changeset 776:1c7cb34bec1b

Imported from trunk into 2.0 branch: * src/keytools.c (decode_keychange): Avoid undefined behaviour. (encode_keychange): Ditto. Imported from trunk into the 2.0 branch: * include/config.h: Make random use rand on FreeBSD. * include/system.h: For FreeBSD include param.h so we get the aliases. #Undefine printf so stdio.h will compile. printf is not used anywhere.
author asl
date Tue, 25 Mar 2003 16:57:16 +0000
parents 7b1ce5baf938
children f1579ff5f5e9
files packages/net/snmp/lib/current/ChangeLog packages/net/snmp/lib/current/include/config.h packages/net/snmp/lib/current/include/system.h packages/net/snmp/lib/current/src/keytools.c
diffstat 4 files changed, 33 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/packages/net/snmp/lib/current/ChangeLog
+++ b/packages/net/snmp/lib/current/ChangeLog
@@ -1,3 +1,16 @@
+2003-03-25  Jonathan Larmour  <jifl@eCosCentric.com>
+    
+        Imported from trunk into 2.0 branch:
+	* src/keytools.c (decode_keychange): Avoid undefined behaviour.
+	(encode_keychange): Ditto.
+
+2003-02-25  Andrew Lunn  <andrew.lunn@ascom.ch>
+       
+        Imported from trunk into the 2.0 branch:
+	* include/config.h: Make random use rand on FreeBSD.
+	* include/system.h: For FreeBSD include param.h so we get the aliases.
+	#Undefine printf so stdio.h will compile. printf is not used anywhere.
+
 2003-02-24  Jonathan Larmour  <jifl@eCosCentric.com>
 
 	* cdl/snmplib.cdl: Add doc link.
--- a/packages/net/snmp/lib/current/include/config.h
+++ b/packages/net/snmp/lib/current/include/config.h
@@ -1157,7 +1157,14 @@ CONNECTION WITH THE USE OR PERFORMANCE O
 #define srandom(s) srand48(s)
 #else
 #ifdef HAVE_RAND
+#ifdef __ECOS
+#include <pkgconf/system.h>
+#ifndef CYGPKG_NET_FREEBSD_STACK
+
 #define random rand
+
+#endif //CYGPKG_NET_FREEBSD_STACK
+#endif // __ECOS
 #define srandom(s) srand(s)
 #endif
 #endif
@@ -1221,7 +1228,7 @@ CONNECTION WITH THE USE OR PERFORMANCE O
 #define HAVE_SYS_FILE_H                         0
 #define HAVE_KSTAT_H                            0
 #define HAVE_SYS_UN_H                           0
-#define SOCK_MAXADDRLEN                         0
+#define SOCK_MAXADDRLEN                         255
 #define HAVE_SYS_STREAM_H                       0
 #define HAVE_INET_MIB2_H                        0
 #define HAVE_GETPID                             0
--- a/packages/net/snmp/lib/current/include/system.h
+++ b/packages/net/snmp/lib/current/include/system.h
@@ -189,6 +189,14 @@ char *strdup (const char *);
 int setenv (const char *, const char *, int);
 #endif
 
+#ifdef __ECOS
+#include <pkgconf/system.h>
+#ifdef CYGPKG_NET_FREEBSD_STACK
+#include <sys/param.h>
+#undef printf
+#endif //CYGPKG_NET_FREEBSD_STACK
+#endif // __ECOS
+
 #if TIME_WITH_SYS_TIME	
 #	ifdef WIN32
 #		include <sys/timeb.h>
--- a/packages/net/snmp/lib/current/src/keytools.c
+++ b/packages/net/snmp/lib/current/src/keytools.c
@@ -507,7 +507,8 @@ encode_keychange(	oid	*hashtype,	u_int  
             kcstring += properlength;
             nbytes    = 0;
             while ((int)(nbytes++) < properlength) {
-            	*kcstring++ = *kcstring ^ *newkey++;
+                u_char kcs = *kcstring;
+            	*kcstring++ = kcs ^ *newkey++;
             }
         }
 
@@ -624,7 +625,8 @@ decode_keychange(	oid	*hashtype,	u_int  
             bufp   = kcstring+properlength;
             nbytes = 0;
             while ((int)(nbytes++) < properlength) {
-                    *newkey++ = *newkey ^ *bufp++;
+                    u_char nk = *newkey;
+                    *newkey++ = nk ^ *bufp++;
             }
         }