Changeset 360
- Timestamp:
- 01/04/00 13:28:03 (13 years ago)
- Location:
- common/trunk
- Files:
-
- 34 modified
-
COPYRIGHT (modified) (1 diff)
-
MODS (modified) (1 diff)
-
configure (modified) (19 diffs)
-
configure.in (modified) (2 diffs)
-
src/Makefile.in (modified) (1 diff)
-
src/acconfig.h (modified) (1 diff)
-
src/base64.c (modified) (1 diff)
-
src/base64.h (modified) (1 diff)
-
src/config.h.in (modified) (2 diffs)
-
src/config_unix.h (modified) (2 diffs)
-
src/config_win32.h (modified) (1 diff)
-
src/debug.c (modified) (1 diff)
-
src/debug.h (modified) (1 diff)
-
src/hmac.c (modified) (1 diff)
-
src/hmac.h (modified) (1 diff)
-
src/mbus.c (modified) (3 diffs)
-
src/mbus.h (modified) (1 diff)
-
src/mbus_config.c (modified) (1 diff)
-
src/mbus_config.h (modified) (1 diff)
-
src/memory.c (modified) (1 diff)
-
src/memory.h (modified) (1 diff)
-
src/net_udp.c (modified) (8 diffs)
-
src/net_udp.h (modified) (1 diff)
-
src/rtp.c (modified) (10 diffs)
-
src/rtp.h (modified) (1 diff)
-
src/util.c (modified) (1 diff)
-
src/util.h (modified) (1 diff)
-
tests/test.c (modified) (2 diffs)
-
tests/test_base64.c (modified) (2 diffs)
-
tests/test_base64.h (modified) (1 diff)
-
tests/test_des.c (modified) (5 diffs)
-
tests/test_des.h (modified) (1 diff)
-
tests/test_md5.c (modified) (2 diffs)
-
tests/test_md5.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
common/trunk/COPYRIGHT
r16 r360 1 Copyright (C) 1995- 1999University College London1 Copyright (C) 1995-2000 University College London 2 2 All rights reserved. 3 3 -
common/trunk/MODS
r358 r360 194 194 - Changed library name to uclmmbase to be consistent with other libs. 195 195 - Add RTP_OPT_FILTER_MY_PACKETS 196 - Cleanup test routines 197 - Fix various potential buffer overflow problems 198 - Update copyright notices to welcome in the new millennium 199 - Previous versions of udp_send() would sometimes return -1 on error, 200 and would sometimes abort(). We now always return -1 and never abort. 201 196 202 197 203 Still to do... -
common/trunk/configure
r357 r360 1726 1726 if test "$GCC" = yes 1727 1727 then 1728 CFLAGS="$CFLAGS -W -Wall -W bad-function-cast -Wmissing-prototypes -Werror"1728 CFLAGS="$CFLAGS -W -Wall -Wwrite-strings -Wbad-function-cast -Wmissing-prototypes -Wcast-qual -Wcast-align -Wstrict-prototypes -Wmissing-declarations -Werror" 1729 1729 if test -f .devel 1730 1730 then … … 1765 1765 # If more files than mbus.c use vsnprintf, split it out into 1766 1766 # vsnprintf.c and add it to AC_REPLACE_FUNCS 1767 echo $ac_n "checking for vsnprintf""... $ac_c" 1>&6 1768 echo "configure:1769: checking for vsnprintf" >&5 1769 if eval "test \"`echo '$''{'ac_cv_func_vsnprintf'+set}'`\" = set"; then 1770 echo $ac_n "(cached) $ac_c" 1>&6 1771 else 1772 cat > conftest.$ac_ext <<EOF 1773 #line 1774 "configure" 1774 #include "confdefs.h" 1775 /* System header to define __stub macros and hopefully few prototypes, 1776 which can conflict with char vsnprintf(); below. */ 1777 #include <assert.h> 1778 /* Override any gcc2 internal prototype to avoid an error. */ 1779 /* We use char because int might match the return type of a gcc2 1780 builtin and then its argument prototype would still apply. */ 1781 char vsnprintf(); 1782 1783 int main() { 1784 1785 /* The GNU C library defines this for functions which it implements 1786 to always fail with ENOSYS. Some functions are actually named 1787 something starting with __ and the normal name is an alias. */ 1788 #if defined (__stub_vsnprintf) || defined (__stub___vsnprintf) 1789 choke me 1790 #else 1791 vsnprintf(); 1792 #endif 1793 1794 ; return 0; } 1795 EOF 1796 if { (eval echo configure:1797: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then 1797 rm -rf conftest* 1798 eval "ac_cv_func_vsnprintf=yes" 1799 else 1800 echo "configure: failed program was:" >&5 1801 cat conftest.$ac_ext >&5 1802 rm -rf conftest* 1803 eval "ac_cv_func_vsnprintf=no" 1804 fi 1805 rm -f conftest* 1806 fi 1807 1808 if eval "test \"`echo '$ac_cv_func_'vsnprintf`\" = yes"; then 1809 echo "$ac_t""yes" 1>&6 1810 : 1811 else 1812 echo "$ac_t""no" 1>&6 1813 cat >> confdefs.h <<\EOF 1814 #define NEED_VSNPRINTF 1 1815 EOF 1816 1817 fi 1818 1819 1820 # If inet_aton is actually needed somewhere, split it out into 1821 # inet_aton.c and add it to AC_REPLACE_FUNCS 1822 1823 for ac_func in inet_pton inet_ntop 1767 for ac_func in vsnprintf 1824 1768 do 1825 1769 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 1826 echo "configure:1 827: checking for $ac_func" >&51770 echo "configure:1771: checking for $ac_func" >&5 1827 1771 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then 1828 1772 echo $ac_n "(cached) $ac_c" 1>&6 1829 1773 else 1830 1774 cat > conftest.$ac_ext <<EOF 1831 #line 1 832"configure"1775 #line 1776 "configure" 1832 1776 #include "confdefs.h" 1833 1777 /* System header to define __stub macros and hopefully few prototypes, … … 1852 1796 ; return 0; } 1853 1797 EOF 1854 if { (eval echo configure:1 855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then1798 if { (eval echo configure:1799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then 1855 1799 rm -rf conftest* 1856 1800 eval "ac_cv_func_$ac_func=yes" … … 1873 1817 else 1874 1818 echo "$ac_t""no" 1>&6 1819 fi 1820 done 1821 1822 1823 # If inet_aton is actually needed somewhere, split it out into 1824 # inet_aton.c and add it to AC_REPLACE_FUNCS 1825 1826 for ac_func in inet_pton inet_ntop 1827 do 1828 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 1829 echo "configure:1830: checking for $ac_func" >&5 1830 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then 1831 echo $ac_n "(cached) $ac_c" 1>&6 1832 else 1833 cat > conftest.$ac_ext <<EOF 1834 #line 1835 "configure" 1835 #include "confdefs.h" 1836 /* System header to define __stub macros and hopefully few prototypes, 1837 which can conflict with char $ac_func(); below. */ 1838 #include <assert.h> 1839 /* Override any gcc2 internal prototype to avoid an error. */ 1840 /* We use char because int might match the return type of a gcc2 1841 builtin and then its argument prototype would still apply. */ 1842 char $ac_func(); 1843 1844 int main() { 1845 1846 /* The GNU C library defines this for functions which it implements 1847 to always fail with ENOSYS. Some functions are actually named 1848 something starting with __ and the normal name is an alias. */ 1849 #if defined (__stub_$ac_func) || defined (__stub___$ac_func) 1850 choke me 1851 #else 1852 $ac_func(); 1853 #endif 1854 1855 ; return 0; } 1856 EOF 1857 if { (eval echo configure:1858: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then 1858 rm -rf conftest* 1859 eval "ac_cv_func_$ac_func=yes" 1860 else 1861 echo "configure: failed program was:" >&5 1862 cat conftest.$ac_ext >&5 1863 rm -rf conftest* 1864 eval "ac_cv_func_$ac_func=no" 1865 fi 1866 rm -f conftest* 1867 fi 1868 1869 if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then 1870 echo "$ac_t""yes" 1>&6 1871 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` 1872 cat >> confdefs.h <<EOF 1873 #define $ac_tr_func 1 1874 EOF 1875 1876 else 1877 echo "$ac_t""no" 1>&6 1875 1878 LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}" 1876 1879 fi … … 1881 1884 1882 1885 echo $ac_n "checking for library containing socket""... $ac_c" 1>&6 1883 echo "configure:188 4: checking for library containing socket" >&51886 echo "configure:1887: checking for library containing socket" >&5 1884 1887 if eval "test \"`echo '$''{'ac_cv_search_socket'+set}'`\" = set"; then 1885 1888 echo $ac_n "(cached) $ac_c" 1>&6 … … 1888 1891 ac_cv_search_socket="no" 1889 1892 cat > conftest.$ac_ext <<EOF 1890 #line 189 1"configure"1893 #line 1894 "configure" 1891 1894 #include "confdefs.h" 1892 1895 /* Override any gcc2 internal prototype to avoid an error. */ … … 1899 1902 ; return 0; } 1900 1903 EOF 1901 if { (eval echo configure:190 2: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then1904 if { (eval echo configure:1905: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then 1902 1905 rm -rf conftest* 1903 1906 ac_cv_search_socket="none required" … … 1910 1913 LIBS="-l$i $ac_func_search_save_LIBS" 1911 1914 cat > conftest.$ac_ext <<EOF 1912 #line 191 3"configure"1915 #line 1916 "configure" 1913 1916 #include "confdefs.h" 1914 1917 /* Override any gcc2 internal prototype to avoid an error. */ … … 1921 1924 ; return 0; } 1922 1925 EOF 1923 if { (eval echo configure:192 4: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then1926 if { (eval echo configure:1927: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then 1924 1927 rm -rf conftest* 1925 1928 ac_cv_search_socket="-l$i" … … 1943 1946 1944 1947 echo $ac_n "checking for library containing inet_addr""... $ac_c" 1>&6 1945 echo "configure:194 6: checking for library containing inet_addr" >&51948 echo "configure:1949: checking for library containing inet_addr" >&5 1946 1949 if eval "test \"`echo '$''{'ac_cv_search_inet_addr'+set}'`\" = set"; then 1947 1950 echo $ac_n "(cached) $ac_c" 1>&6 … … 1950 1953 ac_cv_search_inet_addr="no" 1951 1954 cat > conftest.$ac_ext <<EOF 1952 #line 195 3"configure"1955 #line 1956 "configure" 1953 1956 #include "confdefs.h" 1954 1957 /* Override any gcc2 internal prototype to avoid an error. */ … … 1961 1964 ; return 0; } 1962 1965 EOF 1963 if { (eval echo configure:196 4: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then1966 if { (eval echo configure:1967: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then 1964 1967 rm -rf conftest* 1965 1968 ac_cv_search_inet_addr="none required" … … 1972 1975 LIBS="-l$i $ac_func_search_save_LIBS" 1973 1976 cat > conftest.$ac_ext <<EOF 1974 #line 197 5"configure"1977 #line 1978 "configure" 1975 1978 #include "confdefs.h" 1976 1979 /* Override any gcc2 internal prototype to avoid an error. */ … … 1983 1986 ; return 0; } 1984 1987 EOF 1985 if { (eval echo configure:198 6: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then1988 if { (eval echo configure:1989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then 1986 1989 rm -rf conftest* 1987 1990 ac_cv_search_inet_addr="-l$i" … … 2099 2102 2100 2103 echo $ac_n "checking for getipnodebyname in <netdb.h>""... $ac_c" 1>&6 2101 echo "configure:210 2: checking for getipnodebyname in <netdb.h>" >&52104 echo "configure:2105: checking for getipnodebyname in <netdb.h>" >&5 2102 2105 if eval "test \"`echo '$''{'ucl_cv_getipnodebyname_in_netdb_h'+set}'`\" = set"; then 2103 2106 echo $ac_n "(cached) $ac_c" 1>&6 2104 2107 else 2105 2108 cat > conftest.$ac_ext <<EOF 2106 #line 21 07"configure"2109 #line 2110 "configure" 2107 2110 #include "confdefs.h" 2108 2111 #include <netdb.h> … … 2133 2136 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` 2134 2137 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 2135 echo "configure:213 6: checking for $ac_hdr" >&52138 echo "configure:2139: checking for $ac_hdr" >&5 2136 2139 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then 2137 2140 echo $ac_n "(cached) $ac_c" 1>&6 2138 2141 else 2139 2142 cat > conftest.$ac_ext <<EOF 2140 #line 214 1"configure"2143 #line 2144 "configure" 2141 2144 #include "confdefs.h" 2142 2145 #include <$ac_hdr> 2143 2146 EOF 2144 2147 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" 2145 { (eval echo configure:214 6: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }2148 { (eval echo configure:2149: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } 2146 2149 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` 2147 2150 if test -z "$ac_err"; then … … 2171 2174 2172 2175 echo $ac_n "checking for struct addrinfo in <netdb.h>""... $ac_c" 1>&6 2173 echo "configure:217 4: checking for struct addrinfo in <netdb.h>" >&52176 echo "configure:2177: checking for struct addrinfo in <netdb.h>" >&5 2174 2177 if eval "test \"`echo '$''{'ucl_cv_st_addrinfo_in_netdb_h'+set}'`\" = set"; then 2175 2178 echo $ac_n "(cached) $ac_c" 1>&6 2176 2179 else 2177 2180 cat > conftest.$ac_ext <<EOF 2178 #line 21 79"configure"2181 #line 2182 "configure" 2179 2182 #include "confdefs.h" 2180 2183 #include <netdb.h> … … 2202 2205 2203 2206 echo $ac_n "checking for sin6_len in struct sockaddr_in6""... $ac_c" 1>&6 2204 echo "configure:220 5: checking for sin6_len in struct sockaddr_in6" >&52207 echo "configure:2208: checking for sin6_len in struct sockaddr_in6" >&5 2205 2208 if eval "test \"`echo '$''{'ucl_cv_sin6_len'+set}'`\" = set"; then 2206 2209 echo $ac_n "(cached) $ac_c" 1>&6 2207 2210 else 2208 2211 cat > conftest.$ac_ext <<EOF 2209 #line 221 0"configure"2212 #line 2213 "configure" 2210 2213 #include "confdefs.h" 2211 2214 … … 2223 2226 ; return 0; } 2224 2227 EOF 2225 if { (eval echo configure:222 6: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then2228 if { (eval echo configure:2229: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then 2226 2229 rm -rf conftest* 2227 2230 ucl_cv_sin6_len=yes -
common/trunk/configure.in
r357 r360 100 100 if test "$GCC" = yes 101 101 then 102 CFLAGS="$CFLAGS -W -Wall -W bad-function-cast -Wmissing-prototypes -Werror"102 CFLAGS="$CFLAGS -W -Wall -Wwrite-strings -Wbad-function-cast -Wmissing-prototypes -Wcast-qual -Wcast-align -Wstrict-prototypes -Wmissing-declarations -Werror" 103 103 if test -f .devel 104 104 then … … 112 112 # If more files than mbus.c use vsnprintf, split it out into 113 113 # vsnprintf.c and add it to AC_REPLACE_FUNCS 114 AC_CHECK_FUNC (vsnprintf,,AC_DEFINE(NEED_VSNPRINTF))114 AC_CHECK_FUNCS(vsnprintf) 115 115 116 116 # If inet_aton is actually needed somewhere, split it out into -
common/trunk/src/Makefile.in
r359 r360 31 31 32 32 version.h: VERSION 33 sed -e 's/.*/#define CCL_VERSION " CCL v& $(HOST)"/' VERSION > version.h33 sed -e 's/.*/#define CCL_VERSION "v&"/' VERSION > version.h 34 34 35 35 .c.o: -
common/trunk/src/acconfig.h
r351 r360 17 17 18 18 /* 19 * Define this if your C library doesn't havevsnprintf.19 * Define this if your C library has vsnprintf. 20 20 */ 21 #undef NEED_VSNPRINTF21 #undef HAVE_VSNPRINTF 22 22 23 23 -
common/trunk/src/base64.c
r178 r360 6 6 * from version 2.7 of the Bellcore metamail package. 7 7 * 8 * Copyright (c) 1998 University College London8 * Copyright (c) 1998-2000 University College London 9 9 * All rights reserved. 10 10 * -
common/trunk/src/base64.h
r14 r360 3 3 * AUTHORS: Colin Perkins 4 4 * 5 * Copyright (c) 1998 University College London5 * Copyright (c) 1998-2000 University College London 6 6 * All rights reserved. 7 7 * -
common/trunk/src/config.h.in
r351 r360 37 37 38 38 /* 39 * Define this if your C library doesn't have vsnprintf.40 */41 #undef NEED_VSNPRINTF42 43 /*44 39 * If you don't have these types in <inttypes.h>, #define these to be 45 40 * the types you do have. … … 78 73 #undef HAVE_INET_PTON 79 74 75 /* Define if you have the vsnprintf function. */ 76 #undef HAVE_VSNPRINTF 77 80 78 /* Define if you have the <inttypes.h> header file. */ 81 79 #undef HAVE_INTTYPES_H -
common/trunk/src/config_unix.h
r357 r360 7 7 * $Date$ 8 8 * 9 * Copyright (c) 1995- 98University College London9 * Copyright (c) 1995-2000 University College London 10 10 * All rights reserved. 11 11 * … … 74 74 #include <netdb.h> 75 75 #include <arpa/inet.h> 76 extern int h_errno;77 76 78 77 #ifdef HAVE_STDINT_H -
common/trunk/src/config_win32.h
r342 r360 7 7 * $Date$ 8 8 * 9 * Copyright (c) 1995- 98University College London9 * Copyright (c) 1995-2000 University College London 10 10 * All rights reserved. 11 11 * -
common/trunk/src/debug.c
r332 r360 11 11 * $Date$ 12 12 * 13 * Copyright (c) 1995- 97University College London13 * Copyright (c) 1995-2000 University College London 14 14 * All rights reserved. 15 15 * -
common/trunk/src/debug.h
r334 r360 7 7 * $Date$ 8 8 * 9 * Copyright (c) 1995- 97University College London9 * Copyright (c) 1995-2000 University College London 10 10 * All rights reserved. 11 11 * -
common/trunk/src/hmac.c
r11 r360 5 5 * HMAC message authentication (RFC2104) 6 6 * 7 * Copyright (c) 1998 University College London7 * Copyright (c) 1998-2000 University College London 8 8 * All rights reserved. 9 9 * -
common/trunk/src/hmac.h
r11 r360 5 5 * HMAC message authentication (RFC2104) 6 6 * 7 * Copyright (c) 1998 University College London7 * Copyright (c) 1998-2000 University College London 8 8 * All rights reserved. 9 9 * -
common/trunk/src/mbus.c
r352 r360 5 5 * Markus Germeier 6 6 * 7 * Copyright (c) 1997- 99University College London7 * Copyright (c) 1997-2000 University College London 8 8 * All rights reserved. 9 9 * … … 54 54 #define MBUS_MAX_QLEN 50 /* Number of messages we can queue with mbus_qmsg() */ 55 55 56 #if def NEED_VSNPRINTF57 static int vsnprintf(char *s, int buf_size, const char *format, va_list ap)56 #ifndef HAVE_VSNPRINTF 57 int vsnprintf(char *s, size_t buf_size, const char *format, va_list ap) 58 58 { 59 59 /* Quick hack replacement for vsnprintf... note that this */ … … 149 149 /* iff the addresses are identical (except, possibly, for order */ 150 150 /* of the elements. */ 151 char *y = NULL, c='\0'; 151 char *y = NULL; 152 char c='\0'; 152 153 char *a_orig, *b_orig; 153 154 -
common/trunk/src/mbus.h
r294 r360 3 3 * AUTHORS: Colin Perkins 4 4 * 5 * Copyright (c) 1997 ,1998University College London5 * Copyright (c) 1997-2000 University College London 6 6 * All rights reserved. 7 7 * -
common/trunk/src/mbus_config.c
r350 r360 5 5 * Markus Germeier 6 6 * 7 * Copyright (c) 1999 University College London7 * Copyright (c) 1999-2000 University College London 8 8 * All rights reserved. 9 9 * -
common/trunk/src/mbus_config.h
r348 r360 3 3 * AUTHORS: Colin Perkins 4 4 * 5 * Copyright (c) 1999 University College London5 * Copyright (c) 1999-2000 University College London 6 6 * All rights reserved. 7 7 * -
common/trunk/src/memory.c
r260 r360 7 7 * $Date$ 8 8 * 9 * Copyright (c) 1995- 98University College London9 * Copyright (c) 1995-2000 University College London 10 10 * All rights reserved. 11 11 * -
common/trunk/src/memory.h
r205 r360 7 7 * $Date$ 8 8 * 9 * Copyright (c) 1995- 98University College London9 * Copyright (c) 1995-2000 University College London 10 10 * All rights reserved. 11 11 * -
common/trunk/src/net_udp.c
r351 r360 4 4 * MODIFIED: Orion Hodson & Piers O'Hanlon 5 5 * 6 * Copyright (c) 1998- 99University College London6 * Copyright (c) 1998-2000 University College London 7 7 * All rights reserved. 8 8 * … … 273 273 { 274 274 struct sockaddr_in s_in; 275 int ret;276 275 277 276 assert(s != NULL); … … 283 282 s_in.sin_addr.s_addr = s->addr4.s_addr; 284 283 s_in.sin_port = htons(s->tx_port); 285 if ((ret = sendto(s->fd, buffer, buflen, 0, (struct sockaddr *) &s_in, sizeof(s_in))) < 0) { 286 if (errno != ECONNREFUSED) { 287 socket_error("sendto"); 288 } 289 } 290 return ret; 284 return sendto(s->fd, buffer, buflen, 0, (struct sockaddr *) &s_in, sizeof(s_in)); 291 285 } 292 286 … … 305 299 assert(hent->h_addrtype == AF_INET); 306 300 memcpy(&iaddr.s_addr, hent->h_addr, sizeof(iaddr.s_addr)); 307 str cpy(hname, inet_ntoa(iaddr));301 strncpy(hname, inet_ntoa(iaddr), MAXHOSTNAMELEN); 308 302 return hname; 309 303 } … … 428 422 #ifdef HAVE_IPv6 429 423 struct sockaddr_in6 s_in; 430 int ret;431 424 432 425 assert(s != NULL); … … 442 435 s_in.sin6_len = sizeof(s_in); 443 436 #endif 444 if ((ret = sendto(s->fd, buffer, buflen, 0, (struct sockaddr *) &s_in, sizeof(s_in))) < 0) { 445 socket_error("udp_send6"); 446 } 447 return ret; 437 return sendto(s->fd, buffer, buflen, 0, (struct sockaddr *) &s_in, sizeof(s_in)); 448 438 #else 449 439 UNUSED(s); … … 595 585 /* we receive, this function becomes protocol independent. */ 596 586 int len; 597 587 598 588 assert(buffer != NULL); 599 589 assert(buflen > 0); 600 590 601 591 len = recvfrom(s->fd, buffer, buflen, 0, 0, 0); 602 592 if (len > 0) { … … 645 635 return NULL; 646 636 } 637 -
common/trunk/src/net_udp.h
r314 r360 3 3 * AUTHORS: Colin Perkins 4 4 * 5 * Copyright (c) 1998- 99University College London5 * Copyright (c) 1998-2000 University College London 6 6 * All rights reserved. 7 7 * -
common/trunk/src/rtp.c
r359 r360 15 15 * $Date$ 16 16 * 17 * Copyright (c) 1998- 99University College London17 * Copyright (c) 1998-2000 University College London 18 18 * All rights reserved. 19 19 * … … 774 774 } 775 775 776 #define MAXCNAMELEN 255 777 776 778 static char *get_cname(socket_udp *s) 777 779 { … … 784 786 #endif 785 787 786 cname = (char *) xmalloc(MAX HOSTNAMELEN + 10);788 cname = (char *) xmalloc(MAXCNAMELEN + 1); 787 789 cname[0] = '\0'; 788 790 … … 795 797 #endif 796 798 if (uname != NULL) { 797 s printf(cname, "%s@", uname);799 snprintf(cname, MAXCNAMELEN, "%s@", uname); 798 800 } 799 801 800 802 /* Now the hostname. Must be dotted-quad IP address. */ 801 803 hname = udp_host_addr(s); 802 str cpy(cname + strlen(cname), hname);804 strncpy(cname + strlen(cname), hname, MAXCNAMELEN - strlen(cname)); 803 805 xfree(hname); 804 806 return cname; … … 1877 1879 } 1878 1880 1879 static int add_sdes_item(uint8_t *buf, int type, const char *val)1881 static int add_sdes_item(uint8_t *buf, int buflen, int type, const char *val) 1880 1882 { 1881 1883 /* Fill out an SDES item. It is assumed that the item is a NULL */ … … 1891 1893 namelen = strlen(val); 1892 1894 shdr->length = namelen; 1893 str cpy(shdr->data, val);1895 strncpy(shdr->data, val, buflen - 2); /* The "-2" accounts for the other shdr fields */ 1894 1896 return namelen + 2; 1895 1897 } … … 1928 1930 item = rtp_get_sdes(session, ssrc, RTCP_SDES_CNAME); 1929 1931 if ((item != NULL) && ((strlen(item) + (size_t) 2) <= remaining_len)) { 1930 packet += add_sdes_item(packet, RTCP_SDES_CNAME, item);1932 packet += add_sdes_item(packet, remaining_len, RTCP_SDES_CNAME, item); 1931 1933 } 1932 1934 … … 1934 1936 item = rtp_get_sdes(session, ssrc, RTCP_SDES_NOTE); 1935 1937 if ((item != NULL) && ((strlen(item) + (size_t) 2) <= remaining_len)) { 1936 packet += add_sdes_item(packet, RTCP_SDES_NOTE, item);1938 packet += add_sdes_item(packet, remaining_len, RTCP_SDES_NOTE, item); 1937 1939 } 1938 1940 … … 1947 1949 case 0: item = rtp_get_sdes(session, ssrc, RTCP_SDES_TOOL); 1948 1950 if ((item != NULL) && ((strlen(item) + (size_t) 2) <= remaining_len)) { 1949 packet += add_sdes_item(packet, RTCP_SDES_TOOL, item);1951 packet += add_sdes_item(packet, remaining_len, RTCP_SDES_TOOL, item); 1950 1952 break; 1951 1953 } 1952 1954 case 1: item = rtp_get_sdes(session, ssrc, RTCP_SDES_EMAIL); 1953 1955 if ((item != NULL) && ((strlen(item) + (size_t) 2) <= remaining_len)) { 1954 packet += add_sdes_item(packet, RTCP_SDES_EMAIL, item);1956 packet += add_sdes_item(packet, remaining_len, RTCP_SDES_EMAIL, item); 1955 1957 break; 1956 1958 } 1957 1959 case 2: item = rtp_get_sdes(session, ssrc, RTCP_SDES_PHONE); 1958 1960 if ((item != NULL) && ((strlen(item) + (size_t) 2) <= remaining_len)) { 1959 packet += add_sdes_item(packet, RTCP_SDES_PHONE, item);1961 packet += add_sdes_item(packet, remaining_len, RTCP_SDES_PHONE, item); 1960 1962 break; 1961 1963 } 1962 1964 case 3: item = rtp_get_sdes(session, ssrc, RTCP_SDES_LOC); 1963 1965 if ((item != NULL) && ((strlen(item) + (size_t) 2) <= remaining_len)) { 1964 packet += add_sdes_item(packet, RTCP_SDES_LOC, item);1966 packet += add_sdes_item(packet, remaining_len, RTCP_SDES_LOC, item); 1965 1967 break; 1966 1968 } … … 1970 1972 item = rtp_get_sdes(session, ssrc, RTCP_SDES_NAME); 1971 1973 if (item != NULL) { 1972 packet += add_sdes_item(packet, RTCP_SDES_NAME, item);1974 packet += add_sdes_item(packet, remaining_len, RTCP_SDES_NAME, item); 1973 1975 } 1974 1976 } -
common/trunk/src/rtp.h
r358 r360 6 6 * $Date$ 7 7 * 8 * Copyright (c) 1998- 99University College London8 * Copyright (c) 1998-2000 University College London 9 9 * All rights reserved. 10 10 * -
common/trunk/src/util.c
r186 r360 7 7 * $Date$ 8 8 * 9 * Copyright (c) 1995- 97University College London9 * Copyright (c) 1995-2000 University College London 10 10 * All rights reserved. 11 11 * -
common/trunk/src/util.h
r205 r360 7 7 * $Date$ 8 8 * 9 * Copyright (c) 1995- 98University College London9 * Copyright (c) 1995-2000 University College London 10 10 * All rights reserved. 11 11 * -
common/trunk/tests/test.c
r178 r360 3 3 * AUTHORS: Colin Perkins 4 4 * 5 * Copyright (c) 1999 University College London5 * Copyright (c) 1999-2000 University College London 6 6 * All rights reserved. 7 7 * … … 42 42 #include "test_md5.h" 43 43 44 int main( )44 int main(int argc, char *argv[]) 45 45 { 46 printf("Test suite for %s\n", CCL_VERSION); 46 UNUSED(argc); 47 UNUSED(argv); 48 printf("Testing common multimedia library %s\n", CCL_VERSION); 47 49 test_base64(); 48 50 test_des(); -
common/trunk/tests/test_base64.c
r178 r360 3 3 * AUTHORS: Colin Perkins 4 4 * 5 * Copyright (c) 1999 University College London5 * Copyright (c) 1999-2000 University College London 6 6 * All rights reserved. 7 7 * … … 52 52 } 53 53 54 printf(" base64 encode:"); fflush(stdout);54 printf("Base64 encode... "); fflush(stdout); 55 55 i = base64encode(input, strlen(input), output, 100); 56 56 if ((i != 16) || (strncmp(output, "SGVsbG8sIHdvcmxk", i) != 0)) { 57 printf("failed\n"); 58 } else { 59 printf("success\n"); 57 printf("fail\n"); 58 abort(); 60 59 } 60 printf("pass\n"); 61 61 62 printf(" base64 decode:"); fflush(stdout);62 printf("Base64 decode... "); fflush(stdout); 63 63 i = base64decode(output, i, decode, 100); 64 64 if ((i != 12) || (strncmp(decode, "Hello, world", i) != 0)) { 65 printf("failed\n"); 66 } else { 67 printf("success\n"); 65 printf("fail\n"); 66 abort(); 68 67 } 68 printf("pass\n"); 69 69 } 70 70 -
common/trunk/tests/test_base64.h
r178 r360 3 3 * AUTHORS: Colin Perkins 4 4 * 5 * Copyright (c) 1999 University College London5 * Copyright (c) 1999-2000 University College London 6 6 * All rights reserved. 7 7 * -
common/trunk/tests/test_des.c
r162 r360 9 9 * All rights reserved. 10 10 * 11 * Copyright (c) 1999 University College London11 * Copyright (c) 1999-2000 University College London 12 12 * All rights reserved. 13 13 * … … 217 217 unsigned char cbc_buffer[32], cbc_iv_buf[8]; 218 218 219 printf("DES ECB......... "); fflush(stdout); 219 220 for (i = 0; i < NUM_TESTS; i++) { 220 printf(" DES ECB %2d: ", i); fflush(stdout);221 221 for (j = 0; j < 8; j++) { 222 222 key[j] = key_data[i][j]; … … 227 227 qfDES_ECB_d(key, buffer, 8); 228 228 if (memcmp(buffer, plain, 8) != 0) { 229 printf(" decrypt failed\n");229 printf("fail\n"); 230 230 abort(); 231 231 } … … 233 233 qfDES_ECB_e(key, buffer, 8); 234 234 if (memcmp(buffer, crypt, 8) != 0) { 235 printf(" encrypt failed\n");235 printf("fail\n"); 236 236 abort(); 237 237 } 238 238 qfDES_ECB_d(key, buffer, 8); 239 239 if (memcmp(buffer, plain, 8) != 0) { 240 printf(" decrypt failed\n");240 printf("fail\n"); 241 241 abort(); 242 242 } 243 printf("success\n");244 243 } 245 246 printf(" DES CBC: "); fflush(stdout); 244 printf("pass\n"); 245 246 printf("DES CBC......... "); fflush(stdout); 247 247 memcpy(cbc_buffer, cbc_data, 32); 248 248 memcpy(cbc_iv_buf, cbc_iv, 8); 249 249 qfDES_CBC_e(cbc_key, cbc_buffer, 32, cbc_iv_buf); 250 250 if (memcmp(cbc_buffer, cbc_ok, 32) != 0) { 251 printf(" encrypt failed\n");251 printf("fail\n"); 252 252 abort(); 253 253 } … … 255 255 qfDES_CBC_d(cbc_key, cbc_buffer, 32, cbc_iv_buf); 256 256 if (memcmp(cbc_buffer, cbc_data, 32) != 0) { 257 printf(" decrypt failed\n");257 printf("fail\n"); 258 258 abort(); 259 259 } 260 printf(" success\n");260 printf("pass\n"); 261 261 } 262 262 263 264 /*****************************************************************************/265 #ifdef NDEF266 267 main()268 {269 int i,j;270 des_cblock in,out,outin;271 des_key_schedule ks;272 unsigned char cbc_in[40],cbc_out[40];273 unsigned long cs;274 unsigned char qret[4][4];275 unsigned long lqret[4];276 char *str;277 278 printf("Doing cbc\n");279 if ((j=key_sched((C_Block *)cbc_key,ks)) != 0)280 printf("Key error %2d:%d\n",i+1,j);281 bzero(cbc_out,40);282 bzero(cbc_in,40);283 des_cbc_encrypt((C_Block *)cbc_data,(C_Block *)cbc_out,284 (long)strlen(cbc_data),ks,(C_Block *)cbc_iv,DES_ENCRYPT);285 if (bcmp(cbc_out,cbc_ok,32) != 0)286 printf("cbc_encrypt encrypt error\n");287 des_cbc_encrypt((C_Block *)cbc_out,(C_Block *)cbc_in,288 (long)strlen(cbc_data),ks,(C_Block *)cbc_iv,DES_DECRYPT);289 if (bcmp(cbc_in,cbc_data,32) != 0)290 printf("cbc_encrypt decrypt error\n");291 292 printf("Doing pcbc\n");293 if ((j=key_sched((C_Block *)cbc_key,ks)) != 0)294 printf("Key error %2d:%d\n",i+1,j);295 bzero(cbc_out,40);296 bzero(cbc_in,40);297 des_pcbc_encrypt((C_Block *)cbc_data,(C_Block *)cbc_out,298 (long)strlen(cbc_data),ks,(C_Block *)cbc_iv,DES_ENCRYPT);299 if (bcmp(cbc_out,pcbc_ok,32) != 0)300 printf("pcbc_encrypt encrypt error\n");301 des_pcbc_encrypt((C_Block *)cbc_out,(C_Block *)cbc_in,302 (long)strlen(cbc_data),ks,(C_Block *)cbc_iv,DES_DECRYPT);303 if (bcmp(cbc_in,cbc_data,32) != 0)304 printf("pcbc_encrypt decrypt error\n");305 306 printf("Doing cfb\n");307 key_sched((C_Block *)cfb_key,ks);308 bcopy(cfb_iv,cfb_tmp,sizeof(cfb_iv));309 des_cfb_encrypt(cfb_plain,cfb_buf1,8,(long)sizeof(cfb_plain),ks,310 (C_Block *)cfb_tmp,DES_ENCRYPT);311 if (bcmp(cfb_cipher,cfb_buf1,sizeof(cfb_buf1)) != 0)312 printf("cfb_encrypt encrypt error\n");313 bcopy(cfb_iv,cfb_tmp,sizeof(cfb_iv));314 des_cfb_encrypt(cfb_buf1,cfb_buf2,8,(long)sizeof(cfb_buf1),ks,315 (C_Block *)cfb_tmp,DES_DECRYPT);316 if (bcmp(cfb_plain,cfb_buf2,sizeof(cfb_buf2)) != 0)317 printf("cfb_encrypt decrypt error\n");318 319 bcopy(cfb_iv,cfb_tmp,sizeof(cfb_iv));320 for (i=0; i<sizeof(cfb_plain); i++)321 des_cfb_encrypt(&(cfb_plain[i]),&(cfb_buf1[i]),322 8,(long)1,ks,(C_Block *)cfb_tmp,DES_ENCRYPT);323 if (bcmp(cfb_cipher,cfb_buf1,sizeof(cfb_buf1)) != 0)324 printf("cfb_encrypt small encrypt error\n");325 326 bcopy(cfb_iv,cfb_tmp,sizeof(cfb_iv));327 for (i=0; i<sizeof(cfb_plain); i++)328 des_cfb_encrypt(&(cfb_buf1[i]),&(cfb_buf2[i]),329 8,(long)1,ks,(C_Block *)cfb_tmp,DES_DECRYPT);330 if (bcmp(cfb_plain,cfb_buf2,sizeof(cfb_buf2)) != 0)331 printf("cfb_encrypt small decrypt error\n");332 333 printf("Doing ofb\n");334 key_sched((C_Block *)ofb_key,ks);335 bcopy(ofb_iv,ofb_tmp,sizeof(ofb_iv));336 des_ofb_encrypt(ofb_plain,ofb_buf1,64,(long)sizeof(cfb_plain)/8,ks,337 (C_Block *)ofb_tmp);338 if (bcmp(ofb_cipher,ofb_buf1,sizeof(ofb_buf1)) != 0)339 printf("ofb_encrypt encrypt error\n");340 bcopy(ofb_iv,ofb_tmp,sizeof(ofb_iv));341 des_ofb_encrypt(ofb_buf1,ofb_buf2,64,(long)sizeof(ofb_buf1)/8,ks,342 (C_Block *)ofb_tmp);343 if (bcmp(ofb_plain,ofb_buf2,sizeof(ofb_buf2)) != 0)344 printf("ofb_encrypt decrypt error\n");345 346 printf("Doing cbc_cksum\n");347 des_cbc_cksum((C_Block *)cbc_data,(C_Block *)cbc_out,348 (long)strlen(cbc_data),ks,(C_Block *)cbc_iv);349 if (bcmp(cbc_out,cksum_ok,8) != 0)350 printf("cbc_cksum error\n");351 352 printf("Doing quad_cksum\n");353 cs=quad_cksum((C_Block *)cbc_data,(C_Block *)qret,354 (long)strlen(cbc_data),2,(C_Block *)cbc_iv);355 for (i=0; i<4; i++)356 {357 lqret[i]=0;358 bcopy(&(qret[i][0]),&(lqret[i]),4);359 }360 { /* Big-endian fix */361 static unsigned long l=1;362 static unsigned char *c=(unsigned char *)&l;363 unsigned long ll;364 365 if (!c[0])366 {367 ll=lqret[0]^lqret[3];368 lqret[0]^=ll;369 lqret[3]^=ll;370 ll=lqret[1]^lqret[2];371 lqret[1]^=ll;372 lqret[2]^=ll;373 }374 }375 if (cs != 0x70d7a63a)376 printf("quad_cksum error, ret %08x should be 70d7a63a\n",cs);377 if (lqret[0] != 0x327eba8d)378 printf("quad_cksum error, out[0] %08x is not %08x\n",379 lqret[0],0x327eba8d);380 if (lqret[1] != 0x201a49cc)381 printf("quad_cksum error, out[1] %08x is not %08x\n",382 lqret[1],0x201a49cc);383 if (lqret[2] != 0x70d7a63a)384 printf("quad_cksum error, out[2] %08x is not %08x\n",385 lqret[2],0x70d7a63a);386 if (lqret[3] != 0x501c2c26)387 printf("quad_cksum error, out[3] %08x is not %08x\n",388 lqret[3],0x501c2c26);389 390 printf("input word alignment test");391 for (i=0; i<4; i++)392 {393 printf(" %d",i);394 des_cbc_encrypt((C_Block *)&(cbc_out[i]),(C_Block *)cbc_in,395 (long)strlen(cbc_data),ks,(C_Block *)cbc_iv,396 DES_ENCRYPT);397 }398 printf("\noutput word alignment test");399 for (i=0; i<4; i++)400 {401 printf(" %d",i);402 des_cbc_encrypt((C_Block *)cbc_out,(C_Block *)&(cbc_in[i]),403 (long)strlen(cbc_data),ks,(C_Block *)cbc_iv,404 DES_ENCRYPT);405 }406 printf("\n");407 printf("fast crypt test ");408 str=crypt("testing","ef");409 if (strcmp("efGnQx2725bI2",str) != 0)410 printf("fast crypt error, %x should be efGnQx2725bI2\n",str);411 str=crypt("bca76;23","yA");412 if (strcmp("yA1Rp/1hZXIJk",str) != 0)413 printf("fast crypt error, %x should be yA1Rp/1hZXIJk\n",str);414 printf("\n");415 exit(0);416 }417 418 #endif419 -
common/trunk/tests/test_des.h
r114 r360 3 3 * AUTHORS: Colin Perkins 4 4 * 5 * Copyright (c) 1999 University College London5 * Copyright (c) 1999-2000 University College London 6 6 * All rights reserved. 7 7 * -
common/trunk/tests/test_md5.c
r300 r360 3 3 * AUTHORS: Colin Perkins 4 4 * 5 * Copyright (c) 1999 University College London5 * Copyright (c) 1999-2000 University College London 6 6 * All rights reserved. 7 7 * … … 67 67 int i, l; 68 68 69 printf(" md5:"); fflush(stdout);70 for (i = 0; i < 10000 0; i++) {69 printf("MD5............. "); fflush(stdout); 70 for (i = 0; i < 10000; i++) { 71 71 l = lrand48() % 1024; 72 72 if (do_test(l) == FALSE) { 73 printf("fail ed with len=%d\n", l);74 return;73 printf("fail\n"); 74 abort(); 75 75 } 76 76 } 77 printf(" success\n");77 printf("pass\n"); 78 78 } 79 79 -
common/trunk/tests/test_md5.h
r93 r360 3 3 * AUTHORS: Colin Perkins 4 4 * 5 * Copyright (c) 1999 University College London5 * Copyright (c) 1999-2000 University College London 6 6 * All rights reserved. 7 7 *
