PATCH: deprecated function bcopy

andreas moroder claudiamoroder at st-ulrich.suedtirol.net
Tue Feb 26 07:03:11 GMT 2002


Hello,

bcopy is used in two functions in samba. This functions is deprecated ( man 
bcooy ). Here is my patch to exchange bcopy with memcpy.

hmac_md5_init_rfc2104 seems not to be used in samba. Is it there for future 
use ?

The first patch cleans also up two signed/unsigned assignments.
Bye
Andreas

--- lib/hmacmd5.c	Fri Feb  8 19:05:50 2002
+++ lib/hmacmd5.and	Mon Feb 25 18:24:26 2002
@@ -28,7 +28,7 @@
 /***********************************************************************
  the rfc 2104 version of hmac_md5 initialisation.
 ***********************************************************************/
-void hmac_md5_init_rfc2104(uchar*  key, int key_len, HMACMD5Context *ctx)
+void hmac_md5_init_rfc2104(uchar*  key, unsigned key_len, HMACMD5Context 
*ctx)
 {
         int i;
 
@@ -49,8 +49,8 @@
         /* start out by storing key in pads */
         ZERO_STRUCT(ctx->k_ipad);
         ZERO_STRUCT(ctx->k_opad);
-        bcopy( key, ctx->k_ipad, key_len);
-        bcopy( key, ctx->k_opad, key_len);
+        memcpy( ctx->k_ipad, key, key_len);
+        memcpy( ctx->k_opad, key, key_len);
 
         /* XOR key with ipad and opad values */
         for (i=0; i<64; i++)
@@ -80,8 +80,8 @@
         /* start out by storing key in pads */
         ZERO_STRUCT(ctx->k_ipad);
         ZERO_STRUCT(ctx->k_opad);
-        bcopy( key, ctx->k_ipad, key_len);
-        bcopy( key, ctx->k_opad, key_len);
+        memcpy( ctx->k_ipad, key, key_len);
+        memcpy( ctx->k_opad, key, key_len);
 
         /* XOR key with ipad and opad values */
         for (i=0; i<64; i++)
@@ -97,7 +97,7 @@
 /***********************************************************************
  update hmac_md5 "inner" buffer
 ***********************************************************************/
-void hmac_md5_update(const uchar* text, int text_len, HMACMD5Context *ctx)
+void hmac_md5_update(const uchar* text, unsigned text_len, HMACMD5Context 
*ctx)
 {
         MD5Update(&ctx->ctx, text, text_len); /* then text of datagram */
 }




--- libsmb/libsmbclient.c	Fri Feb  8 19:06:51 2002
+++ libsmb/libsmbclient.and	Tue Feb 26 15:50:53 2002
@@ -1908,7 +1908,7 @@
 
 		/* Hmmm, do I even need to copy it? */
 
-		bcopy(dirent, smbc_local_dirent, dirent->dirlen); /* Copy the dirent */
+		memcpy(smbc_local_dirent, dirent, dirent->dirlen); /* Copy the dirent */
 
 		dirp = (struct smbc_dirent *)smbc_local_dirent;
 
@@ -2000,7 +2000,7 @@
 
 		dirent = dir->dirent;
 
-		bcopy(dirent, ndir, reqd); /* Copy the data in ... */
+		memcpy(ndir, dirent, reqd); /* Copy the data in ... */
     
 		((struct smbc_dirent *)ndir)->comment = 
 			(char *)(&((struct smbc_dirent *)ndir)->name + dirent->namelen + 1);




More information about the samba-technical mailing list