openbsd-ports/net/netatalk/patches/patch-libnbp-nbputilc

93 lines
2.1 KiB
Plaintext

--- libatalk/nbp/nbp_util.c.orig Wed Oct 8 07:21:38 1997
+++ libatalk/nbp/nbp_util.c Wed Nov 10 14:33:14 1999
@@ -10,7 +10,7 @@
#include <sys/time.h>
#include <sys/syslog.h>
#include <netdb.h>
-#include <strings.h>
+#include <string.h>
#include <netatalk/endian.h>
#include <netatalk/at.h>
@@ -21,8 +21,10 @@
char nbp_send[ 1024 ];
char nbp_recv[ 1024 ];
-u_char nbp_port = 0;
+u_int8_t nbp_port = 0;
+extern int strndiacasecmp();
+int
nbp_parse( data, nn, len )
char *data;
struct nbpnve *nn;
@@ -30,7 +32,7 @@
{
struct nbptuple nt;
- bcopy( data, &nt, SZ_NBPTUPLE);
+ memcpy( &nt, data, SZ_NBPTUPLE);
data += SZ_NBPTUPLE;
len -= SZ_NBPTUPLE;
if ( len < 0 ) {
@@ -53,7 +55,7 @@
if ( nn->nn_objlen > NBPSTRLEN ) {
return( -1 );
}
- bcopy( data, nn->nn_obj, nn->nn_objlen );
+ memcpy( nn->nn_obj, data, nn->nn_objlen );
data += nn->nn_objlen;
nn->nn_typelen = *data++;
@@ -64,7 +66,7 @@
if ( nn->nn_typelen > NBPSTRLEN ) {
return( 1 );
}
- bcopy( data, nn->nn_type, nn->nn_typelen );
+ memcpy( nn->nn_type, data, nn->nn_typelen );
data += nn->nn_typelen;
nn->nn_zonelen = *data++;
@@ -75,7 +77,7 @@
if ( nn->nn_zonelen > NBPSTRLEN ) {
return( 1 );
}
- bcopy( data, nn->nn_zone, nn->nn_zonelen );
+ memcpy( nn->nn_zone, data, nn->nn_zonelen );
return( len );
}
@@ -84,6 +86,7 @@
#define NBPM_TYPE (1<<2)
#define NBPM_ZONE (1<<3)
+int
nbp_match( n1, n2, flags )
struct nbpnve *n1, *n2;
int flags;
@@ -125,6 +128,7 @@
return( 1 );
}
+int
nbp_name( name, objp, typep, zonep )
char *name, **objp, **typep, **zonep;
{
@@ -135,13 +139,13 @@
if ( strlen( name ) + 1 > sizeof( buf )) {
return( -1 );
}
- strcpy( buf, name );
+ (void)strlcpy( buf, name, sizeof ( buf ) );
- if (( p = rindex( buf, '@' )) != NULL ) {
+ if (( p = strrchr( buf, '@' )) != NULL ) {
*p++ = '\0';
*zonep = p;
}
- if (( p = rindex( buf, ':' )) != NULL ) {
+ if (( p = strrchr( buf, ':' )) != NULL ) {
*p++ = '\0';
*typep = p;
}