From: Jong Hyuk Choi Date: Fri, 2 May 2003 18:00:33 +0000 (+0000) Subject: strdup cleanup X-Git-Tag: OPENLDAP_REL_ENG_2_2_0ALPHA~175 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9543844d39253311ac978ec2cd90f71a8ca94fc1;p=openldap strdup cleanup --- diff --git a/servers/slapd/config.c b/servers/slapd/config.c index 4e64131fd2..0a0def3979 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -2752,7 +2752,7 @@ parse_syncrepl_line( } else if ( !strncasecmp( cargv[ i ], MASTERSTR, sizeof( MASTERSTR ) - 1 )) { val = cargv[ i ] + sizeof( MASTERSTR ); - si->masteruri = strdup( val ); + si->masteruri = ch_strdup( val ); if (( hp = strchr( val, ':' )) != NULL ) { if ( *( hp + 1 ) == '/' ) { if ( *( hp + 2 ) == '/' ) { @@ -2772,7 +2772,7 @@ parse_syncrepl_line( if ( si->masterport <= 0 ) { si->masterport = 0; } - si->mastername = strdup( val ); + si->mastername = ch_strdup( val ); si->master_bv = (BerVarray) ch_calloc( 2, sizeof (struct berval )); ber_str2bv( si->masteruri, strlen(si->masteruri), 0, &si->master_bv[0] ); @@ -2791,7 +2791,7 @@ parse_syncrepl_line( char *str; struct berval updatedn = {0, NULL}; val = cargv[ i ] + sizeof( UPDATEDNSTR ); - str = strdup( val ); + str = ch_strdup( val ); ber_str2bv( str, strlen(str), 1, &updatedn ); dnNormalize( 0, NULL, NULL, &updatedn, &si->updatedn, NULL ); ch_free( str ); @@ -2800,7 +2800,7 @@ parse_syncrepl_line( } else if ( !strncasecmp( cargv[ i ], BINDDNSTR, sizeof( BINDDNSTR ) - 1 ) ) { val = cargv[ i ] + sizeof( BINDDNSTR ); - si->binddn = strdup( val ); + si->binddn = ch_strdup( val ); gots |= GOT_DN; } else if ( !strncasecmp( cargv[ i ], BINDMETHSTR, sizeof( BINDMETHSTR ) - 1 ) ) { @@ -2833,49 +2833,49 @@ parse_syncrepl_line( SASLMECHSTR, sizeof( SASLMECHSTR ) - 1 ) ) { val = cargv[ i ] + sizeof( SASLMECHSTR ); gots |= GOT_MECH; - si->saslmech = strdup( val ); + si->saslmech = ch_strdup( val ); } else if ( !strncasecmp( cargv[ i ], CREDSTR, sizeof( CREDSTR ) - 1 ) ) { val = cargv[ i ] + sizeof( CREDSTR ); - si->passwd = strdup( val ); + si->passwd = ch_strdup( val ); } else if ( !strncasecmp( cargv[ i ], SECPROPSSTR, sizeof( SECPROPSSTR ) - 1 ) ) { val = cargv[ i ] + sizeof( SECPROPSSTR ); - si->secprops = strdup( val ); + si->secprops = ch_strdup( val ); } else if ( !strncasecmp( cargv[ i ], REALMSTR, sizeof( REALMSTR ) - 1 ) ) { val = cargv[ i ] + sizeof( REALMSTR ); - si->realm = strdup( val ); + si->realm = ch_strdup( val ); } else if ( !strncasecmp( cargv[ i ], AUTHCSTR, sizeof( AUTHCSTR ) - 1 ) ) { val = cargv[ i ] + sizeof( AUTHCSTR ); - si->authcId = strdup( val ); + si->authcId = ch_strdup( val ); } else if ( !strncasecmp( cargv[ i ], OLDAUTHCSTR, sizeof( OLDAUTHCSTR ) - 1 ) ) { /* Old authcID is provided for some backwards compatibility */ val = cargv[ i ] + sizeof( OLDAUTHCSTR ); - si->authcId = strdup( val ); + si->authcId = ch_strdup( val ); } else if ( !strncasecmp( cargv[ i ], AUTHZSTR, sizeof( AUTHZSTR ) - 1 ) ) { val = cargv[ i ] + sizeof( AUTHZSTR ); - si->authzId = strdup( val ); + si->authzId = ch_strdup( val ); } else if ( !strncasecmp( cargv[ i ], SRVTABSTR, sizeof( SRVTABSTR ) - 1 ) ) { val = cargv[ i ] + sizeof( SRVTABSTR ); if ( si->srvtab != NULL ) { free( si->srvtab ); } - si->srvtab = strdup( val ); + si->srvtab = ch_strdup( val ); } else if ( !strncasecmp( cargv[ i ], FILTERSTR, sizeof( FILTERSTR ) - 1 ) ) { val = cargv[ i ] + sizeof( FILTERSTR ); gots |= GOT_FILTER; - si->filterstr = strdup( val ); + si->filterstr = ch_strdup( val ); } else if ( !strncasecmp( cargv[ i ], SEARCHBASESTR, sizeof( SEARCHBASESTR ) - 1 ) ) { val = cargv[ i ] + sizeof( SEARCHBASESTR ); gots |= GOT_SEARCHBASE; - si->base = strdup( val ); + si->base = ch_strdup( val ); } else if ( !strncasecmp( cargv[ i ], SCOPESTR, sizeof( SCOPESTR ) - 1 ) ) { val = cargv[ i ] + sizeof( SCOPESTR ); @@ -2912,7 +2912,7 @@ parse_syncrepl_line( return -1; } si->attrs = tmp; - si->attrs[ nr_attr - 1 ] = strdup( val ); + si->attrs[ nr_attr - 1 ] = ch_strdup( val ); } } if ( *val != '\0' ) { @@ -2927,7 +2927,7 @@ parse_syncrepl_line( return -1; } si->attrs = tmp; - si->attrs[ nr_attr - 1 ] = strdup( val ); + si->attrs[ nr_attr - 1 ] = ch_strdup( val ); } nr_attr++; tmp = (char **) ch_realloc( si->attrs, nr_attr * sizeof( char * )); diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 6ea651384b..b7cdfa1101 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -459,8 +459,7 @@ do_syncrepl( #endif } si->attrs = tmp; - si->attrs[ n++ ] = ( char * ) strndup( descs[i]->ad_cname.bv_val, - descs[i]->ad_cname.bv_len ); + si->attrs[ n++ ] = ch_strdup ( descs[i]->ad_cname.bv_val ); si->attrs[ n ] = NULL; } @@ -724,7 +723,7 @@ syncrepl_message_to_entry( { if ( tmp.sml_type.bv_val == NULL ) break; - mod = (Modifications *) ch_malloc( sizeof(Modifications) ); + mod = (Modifications *) ch_malloc( sizeof( Modifications )); mod->sml_op = LDAP_MOD_REPLACE; mod->sml_next = NULL; @@ -907,7 +906,7 @@ syncrepl_entry( } #if 0 /* FIXME : UUID search required first */ - filterstr = (char *) ch_malloc( strlen("entryUUID=") + syncUUID->bv_len + 1 ); + filterstr = (char *) sl_malloc( strlen("entryUUID=") + syncUUID->bv_len + 1, op->o_tmpmemctx ); strcpy( filterstr, "entryUUID=" ); strcat( filterstr, syncUUID->bv_val ); #endif