Use AC_MEMCPY instead of memcpy

Use sizeof instead of strlen
This commit is contained in:
Kurt Zeilenga 2002-01-02 16:58:37 +00:00
parent f418f6247f
commit 38d800637f

View File

@ -220,8 +220,9 @@ ldap_back_db_config(
} else if ( strcasecmp( argv[1], "attribute" ) == 0 ) { } else if ( strcasecmp( argv[1], "attribute" ) == 0 ) {
map = &li->at_map; map = &li->at_map;
} else { } else {
fprintf( stderr, fprintf( stderr, "%s: line %d: syntax is "
"%s: line %d: syntax is \"map {objectclass | attribute} {<source> | *} [<dest> | *]\"\n", "\"map {objectclass | attribute} {<source> | *} "
"[<dest> | *]\"\n",
fname, lineno ); fname, lineno );
return( 1 ); return( 1 );
} }
@ -257,7 +258,8 @@ ldap_back_db_config(
fname, lineno ); fname, lineno );
} }
mapping = (struct ldapmapping *)ch_calloc( 2, sizeof(struct ldapmapping) ); mapping = (struct ldapmapping *)ch_calloc( 2,
sizeof(struct ldapmapping) );
if ( mapping == NULL ) { if ( mapping == NULL ) {
fprintf( stderr, fprintf( stderr,
"%s: line %d: out of memory\n", "%s: line %d: out of memory\n",
@ -274,8 +276,8 @@ ldap_back_db_config(
mapping[1].dst = mapping->dst; mapping[1].dst = mapping->dst;
} }
if ( avl_find( map->map, (caddr_t)mapping, mapping_cmp ) != NULL if ( avl_find( map->map, (caddr_t)mapping, mapping_cmp ) != NULL ||
|| avl_find( map->remap, (caddr_t)&mapping[1], mapping_cmp ) != NULL) avl_find( map->remap, (caddr_t)&mapping[1], mapping_cmp ) != NULL)
{ {
fprintf( stderr, fprintf( stderr,
"%s: line %d: duplicate mapping found (ignored)\n", "%s: line %d: duplicate mapping found (ignored)\n",
@ -290,8 +292,8 @@ ldap_back_db_config(
/* anything else */ /* anything else */
} else { } else {
fprintf( stderr, fprintf( stderr, "%s: line %d: unknown directive \"%s\" "
"%s: line %d: unknown directive \"%s\" in ldap database definition (ignored)\n", "in ldap database definition (ignored)\n",
fname, lineno, argv[0] ); fname, lineno, argv[0] );
} }
return 0; return 0;
@ -378,7 +380,7 @@ ldap_back_map_filter(
in_quote = !in_quote; in_quote = !in_quote;
if (q != NULL) { if (q != NULL) {
plen = p - q; plen = p - q;
memcpy(s, q, plen); AC_MEMCPY(s, q, plen);
s += plen; s += plen;
q = NULL; q = NULL;
} }
@ -421,7 +423,7 @@ ldap_back_map_filter(
} }
s += (long)nf; s += (long)nf;
} }
memcpy(s, m.bv_val, plen); AC_MEMCPY(s, m.bv_val, plen);
s += plen; s += plen;
*p = c; *p = c;
q = NULL; q = NULL;
@ -501,12 +503,12 @@ suffix_massage_patternize( const char *s, int normalize )
{ {
char *res; char *res;
res = ch_calloc( sizeof( char ), strlen( s ) + 3 ); res = ch_calloc( sizeof( char ), strlen( s ) + sizeof("%1") );
sprintf( res, "%%1%s", s ); sprintf( res, "%%1%s", s );
if ( normalize ) { if ( normalize ) {
char *out = dn_normalize( res + 2 ); char *out = dn_normalize( res + (sizeof("%1")-1) );
if ( out != res + 2 ) { if ( out != res + 2 ) {
strcpy( res + 2, out ); strcpy( res + 2, out );
free( out ); free( out );
@ -599,4 +601,3 @@ suffix_massage_config(
return 0; return 0;
} }
#endif /* ENABLE_REWRITE */ #endif /* ENABLE_REWRITE */