]> git.sur5r.net Git - openldap/commitdiff
Moved slap_strcopy, slap_strncopy to lutil_strcopy, lutil_strncopy
authorHoward Chu <hyc@openldap.org>
Sat, 27 Jul 2002 00:24:02 +0000 (00:24 +0000)
committerHoward Chu <hyc@openldap.org>
Sat, 27 Jul 2002 00:24:02 +0000 (00:24 +0000)
12 files changed:
servers/slapd/aclparse.c
servers/slapd/back-bdb/dn2id.c
servers/slapd/back-ldap/config.c
servers/slapd/back-ldap/group.c
servers/slapd/back-meta/group.c
servers/slapd/back-perl/compare.c
servers/slapd/charray.c
servers/slapd/daemon.c
servers/slapd/dn.c
servers/slapd/lock.c
servers/slapd/proto-slap.h
servers/slapd/sasl.c

index 4af093f1a01d5838fb25ee7acfe882c9c5b38339..51f0a0c1c3578712fda496e2b608caba4f4ad506 100644 (file)
@@ -1106,24 +1106,24 @@ accessmask2str( slap_mask_t mask, char *buf )
 
        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++ = '(';
index 9f4c5a5c0fba44a4be3973835c42f308aa86b133..4e8d02cd60aab4b6439f1344fdb8379d78de9ad8 100644 (file)
@@ -793,9 +793,9 @@ int bdb_fix_dn(
        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);
index a8e82ad0eacd6c612c246ca2760630c0d1bce8c8..f0ea612e8137575f1134c18bca2b534c610b0224 100644 (file)
@@ -325,18 +325,18 @@ suffix_massage_regexize( const char *s )
 
        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;
 }
index 374ffc2959ac4f1a8dfd95c775120549cebe4b7e..16a2c5046ec62d5d3819425b46823ccdeb4bd961 100644 (file)
@@ -176,12 +176,12 @@ ldap_back_group(
                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";
index 14d624aa30b31097a33cb3d2b48eb77714caf4dc..67886898a3236262b2767914b2d6d7407327fc51 100644 (file)
@@ -250,12 +250,12 @@ meta_back_group(
                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";
index cf167b3b31273130fbcee2e01acb0002128f5e99..41e2299103709266ddc44eca00a565a057f901fd 100644 (file)
@@ -48,7 +48,7 @@ perl_back_compare(
        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 );
 
index e8c3dbc048d1f74a11d5f6de7b8334c8bfceef64..46bff0714af508f3ff9819c9bafd00528180d9b8 100644 (file)
@@ -211,38 +211,3 @@ charray_strcasecmp( const char **a1, const char **a2 )
 
        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;
-}
index 4c297f52d193ee8bb54c131fc0bf7af22d609226..c732e1afa68c268f3d15aece89b7307a449d21db 100644 (file)
@@ -107,7 +107,7 @@ void slapd_slp_init( const char* urls ) {
                                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 );
@@ -119,7 +119,7 @@ void slapd_slp_init( const char* urls ) {
                                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 );
index 346817765b670f6c33620a06337d7579ec0852ad..23aa4e78399eac50b14aee2a5505ef497439b452 100644 (file)
@@ -799,7 +799,7 @@ build_new_dn( struct berval * new_dn,
        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 );
 }
index 29d89ad270a056f00712b86a89141770030626d0..13fe405b14e1583526f4263c620a1748f4549bf6 100644 (file)
@@ -27,7 +27,7 @@ lock_fopen( const char *fname, const char *type, FILE **lfp )
        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, 
index 3e75823e0d78d97a1c7cde13915ba00da26370ce..6503d5322ec7ef841df00492d0daa4b5311a8f1f 100644 (file)
@@ -267,11 +267,6 @@ LDAP_SLAPD_F (char **) str2charray LDAP_P(( const char *str, const char *brkstr
 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
  */
index 59c6047614202f34d56bfd5c7edb2e3eec26a0af..b9b23458d250445ea3c280dfdf0ae12436872f63 100644 (file)
@@ -400,24 +400,24 @@ int slap_sasl_getdn( Connection *conn, char *id, int len,
                /* 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