if ( ACL_IS_LEVEL( mask ) ) {
if ( ACL_LVL_IS_NONE(mask) ) {
- ptr = slap_strcopy( ptr, "none" );
+ ptr = lutil_strcopy( ptr, "none" );
} else if ( ACL_LVL_IS_AUTH(mask) ) {
- ptr = slap_strcopy( ptr, "auth" );
+ ptr = lutil_strcopy( ptr, "auth" );
} else if ( ACL_LVL_IS_COMPARE(mask) ) {
- ptr = slap_strcopy( ptr, "compare" );
+ ptr = lutil_strcopy( ptr, "compare" );
} else if ( ACL_LVL_IS_SEARCH(mask) ) {
- ptr = slap_strcopy( ptr, "search" );
+ ptr = lutil_strcopy( ptr, "search" );
} else if ( ACL_LVL_IS_READ(mask) ) {
- ptr = slap_strcopy( ptr, "read" );
+ ptr = lutil_strcopy( ptr, "read" );
} else if ( ACL_LVL_IS_WRITE(mask) ) {
- ptr = slap_strcopy( ptr, "write" );
+ ptr = lutil_strcopy( ptr, "write" );
} else {
- ptr = slap_strcopy( ptr, "unknown" );
+ ptr = lutil_strcopy( ptr, "unknown" );
}
*ptr++ = '(';
ptr = e->e_name.bv_val;
nptr = e->e_nname.bv_val;
for (n = o; n && n->i_parent; n=n->i_parent) {
- ptr = slap_strcopy(ptr, n->i_rdn->rdn.bv_val);
+ ptr = lutil_strcopy(ptr, n->i_rdn->rdn.bv_val);
*ptr++ = ',';
- nptr = slap_strcopy(nptr, n->i_rdn->nrdn.bv_val);
+ nptr = lutil_strcopy(nptr, n->i_rdn->nrdn.bv_val);
*nptr++ = ',';
}
ldap_pvt_thread_rdwr_runlock(&bdb->bi_tree_rdwr);
res = ch_calloc( sizeof( char ), strlen( s ) + 4 + 4*i + 1 );
- ptr = slap_strcopy( res, "(.*)" );
+ ptr = lutil_strcopy( res, "(.*)" );
for ( i = 0, p = s;
( r = strchr( p, ',' ) ) != NULL;
p = r + 1 , i++ ) {
- ptr = slap_strncopy( ptr, p, r - p + 1 );
- ptr = slap_strcopy( ptr, "[ ]?" );
+ ptr = lutil_strncopy( ptr, p, r - p + 1 );
+ ptr = lutil_strcopy( ptr, "[ ]?" );
if ( r[ 1 ] == ' ' ) {
r++;
}
}
- slap_strcopy( ptr, p );
+ lutil_strcopy( ptr, p );
return res;
}
goto cleanup;
}
- ptr = slap_strcopy(filter, "(&(objectclass=");
- ptr = slap_strcopy(ptr, group_oc_name.bv_val);
- ptr = slap_strcopy(ptr, ")(");
- ptr = slap_strcopy(ptr, group_at_name.bv_val);
- ptr = slap_strcopy(ptr, "=");
- ptr = slap_strcopy(ptr, mop_ndn.bv_val);
+ ptr = lutil_strcopy(filter, "(&(objectclass=");
+ ptr = lutil_strcopy(ptr, group_oc_name.bv_val);
+ ptr = lutil_strcopy(ptr, ")(");
+ ptr = lutil_strcopy(ptr, group_at_name.bv_val);
+ ptr = lutil_strcopy(ptr, "=");
+ ptr = lutil_strcopy(ptr, mop_ndn.bv_val);
strcpy(ptr, "))");
gattr[0] = "objectclass";
goto cleanup;
}
- ptr = slap_strcopy( filter, "(&(objectclass=" );
- ptr = slap_strcopy( ptr , group_oc_name.bv_val );
- ptr = slap_strcopy( ptr , ")(" );
- ptr = slap_strcopy( ptr , group_at_name.bv_val );
- ptr = slap_strcopy( ptr , "=" );
- ptr = slap_strcopy( ptr , mop_ndn.bv_val );
+ ptr = lutil_strcopy( filter, "(&(objectclass=" );
+ ptr = lutil_strcopy( ptr , group_oc_name.bv_val );
+ ptr = lutil_strcopy( ptr , ")(" );
+ ptr = lutil_strcopy( ptr , group_at_name.bv_val );
+ ptr = lutil_strcopy( ptr , "=" );
+ ptr = lutil_strcopy( ptr , mop_ndn.bv_val );
strcpy( ptr , "))" );
gattr[ 0 ] = "objectclass";
avastr = ch_malloc( ava->aa_desc->ad_cname.bv_len + 1 +
ava->aa_value.bv_len + 1 );
- slap_strcopy( slap_strcopy( slap_strcopy( avastr,
+ lutil_strcopy( lutil_strcopy( lutil_strcopy( avastr,
ava->aa_desc->ad_cname.bv_val ), "=" ),
ava->aa_value.bv_val );
return 0;
}
-
-/* strcopy is like strcpy except it returns a pointer to the trailing NUL of
- * the result string. This allows fast construction of catenated strings
- * without the overhead of strlen/strcat.
- */
-char *
-slap_strcopy(
- char *a,
- const char *b
-)
-{
- if (!a || !b)
- return a;
-
- while ((*a++ = *b++)) ;
- return a-1;
-}
-
-/* strncopy is like strcpy except it returns a pointer to the trailing NUL of
- * the result string. This allows fast construction of catenated strings
- * without the overhead of strlen/strcat.
- */
-char *
-slap_strncopy(
- char *a,
- const char *b,
- size_t n
-)
-{
- if (!a || !b || n == 0)
- return a;
-
- while ((*a++ = *b++) && n-- > 0) ;
- return a-1;
-}
slapd_srvurls[i] = (char *) realloc( slapd_srvurls[i],
strlen( host ) +
sizeof( LDAP_SRVTYPE_PREFIX ) );
- strcpy( slap_strcopy(slapd_srvurls[i],
+ strcpy( lutil_strcopy(slapd_srvurls[i],
LDAP_SRVTYPE_PREFIX ), host );
ch_free( host );
slapd_srvurls[i] = (char *) realloc( slapd_srvurls[i],
strlen( host ) +
sizeof( LDAPS_SRVTYPE_PREFIX ) );
- strcpy( slap_strcopy(slapd_srvurls[i],
+ strcpy( lutil_strcopy(slapd_srvurls[i],
LDAPS_SRVTYPE_PREFIX ), host );
ch_free( host );
new_dn->bv_len = parent_dn->bv_len + newrdn->bv_len + 1;
new_dn->bv_val = (char *) ch_malloc( new_dn->bv_len + 1 );
- ptr = slap_strcopy( new_dn->bv_val, newrdn->bv_val );
+ ptr = lutil_strcopy( new_dn->bv_val, newrdn->bv_val );
*ptr++ = ',';
strcpy( ptr, parent_dn->bv_val );
}
char buf[MAXPATHLEN];
/* open the lock file */
- strcpy(slap_strcopy( buf, fname ), ".lock" );
+ strcpy(lutil_strcopy( buf, fname ), ".lock" );
if ( (*lfp = fopen( buf, "w" )) == NULL ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, ERR,
LDAP_SLAPD_F (int) charray_strcmp LDAP_P(( const char **a1, const char **a2 ));
LDAP_SLAPD_F (int) charray_strcasecmp LDAP_P(( const char **a1, const char **a2 ));
-LDAP_SLAPD_F (char *) slap_strcopy LDAP_P((
- char *dst, const char *src ));
-LDAP_SLAPD_F (char *) slap_strncopy LDAP_P((
- char *dst, const char *src, size_t n ));
-
/*
* controls.c
*/
/* Build the new dn */
c1 = dn->bv_val;
dn->bv_val = ch_malloc( len+1 );
- p = slap_strcopy( dn->bv_val, "uid=" );
- p = slap_strncopy( p, c1, dn->bv_len );
+ p = lutil_strcopy( dn->bv_val, "uid=" );
+ p = lutil_strncopy( p, c1, dn->bv_len );
if( realm ) {
int rlen = dn->bv_len - ( realm - c1 );
- p = slap_strcopy( p, ",cn=" );
- p = slap_strncopy( p, realm, rlen );
+ p = lutil_strcopy( p, ",cn=" );
+ p = lutil_strncopy( p, realm, rlen );
realm[-1] = '@';
} else if( user_realm && *user_realm ) {
- p = slap_strcopy( p, ",cn=" );
- p = slap_strcopy( p, user_realm );
+ p = lutil_strcopy( p, ",cn=" );
+ p = lutil_strcopy( p, user_realm );
}
if( conn->c_sasl_bind_mech.bv_len ) {
- p = slap_strcopy( p, ",cn=" );
- p = slap_strcopy( p, conn->c_sasl_bind_mech.bv_val );
+ p = lutil_strcopy( p, ",cn=" );
+ p = lutil_strcopy( p, conn->c_sasl_bind_mech.bv_val );
}
- p = slap_strcopy( p, ",cn=auth" );
+ p = lutil_strcopy( p, ",cn=auth" );
dn->bv_len = p - dn->bv_val;
#ifdef NEW_LOGGING