]> git.sur5r.net Git - openldap/commitdiff
Revert prev commit, use ldap_pvt_ funcs
authorHoward Chu <hyc@openldap.org>
Tue, 18 Aug 2009 08:53:41 +0000 (08:53 +0000)
committerHoward Chu <hyc@openldap.org>
Tue, 18 Aug 2009 08:53:41 +0000 (08:53 +0000)
servers/slapd/proto-slap.h
servers/slapd/syncrepl.c

index e14431cdfc434524232024bd296f6be76c6a5362..e97fc5e2c06c45dfa06c7662a5e35711f73c1686 100644 (file)
@@ -1778,8 +1778,6 @@ LDAP_SLAPD_F (Filter *) str2filter_x LDAP_P(( Operation *op, const char *str ));
  * syncrepl.c
  */
 
-LDAP_SLAPD_F (int) slapd_str2scope LDAP_P(( char *str ));
-LDAP_SLAPD_F (struct berval *) slapd_scope2bv LDAP_P(( int scope ));
 LDAP_SLAPD_F (int)  syncrepl_add_glue LDAP_P(( 
                                        Operation*, Entry* ));
 LDAP_SLAPD_F (void) syncrepl_diff_entry LDAP_P((
index 9b8c546b121f3ed1c48c986a98fd0b95ab8a5326..b95397f4726c330a0f6a8408b0b09b7a4a7317e6 100644 (file)
@@ -3808,21 +3808,6 @@ enum {
        GOT_REQUIRED            = (GOT_RID|GOT_PROVIDER|GOT_SEARCHBASE)
 };
 
-static struct {
-       struct berval key;
-       int val;
-} scopes[] = {
-       { BER_BVC("base"), LDAP_SCOPE_BASE },
-       { BER_BVC("one"), LDAP_SCOPE_ONELEVEL },
-       { BER_BVC("onelevel"), LDAP_SCOPE_ONELEVEL },   /* OpenLDAP extension */
-       { BER_BVC("children"), LDAP_SCOPE_SUBORDINATE },
-       { BER_BVC("subord"), LDAP_SCOPE_SUBORDINATE },
-       { BER_BVC("subordinate"), LDAP_SCOPE_SUBORDINATE },
-       { BER_BVC("sub"), LDAP_SCOPE_SUBTREE },
-       { BER_BVC("subtree"), LDAP_SCOPE_SUBTREE },     /* OpenLDAP extension */
-       { BER_BVNULL, 0 }
-};
-
 static slap_verbmasks datamodes[] = {
        { BER_BVC("default"), SYNCDATA_DEFAULT },
        { BER_BVC("accesslog"), SYNCDATA_ACCESSLOG },
@@ -3830,29 +3815,6 @@ static slap_verbmasks datamodes[] = {
        { BER_BVNULL, 0 }
 };
 
-int
-slapd_str2scope( char *str )
-{
-       int i;
-       for ( i = 0; !BER_BVISNULL(&scopes[i].key); i++ ) {
-               if (!strcasecmp( str, scopes[i].key.bv_val ) ) {
-                       return scopes[i].val;
-               }
-       }
-       return -1;
-}
-
-struct berval *
-slapd_scope2bv( int scope )
-{
-       int i;
-       for (i=0; !BER_BVISNULL(&scopes[i].key);i++) {
-               if ( scope == scopes[i].val )
-                       return &scopes[i].key;
-       }
-       return NULL;
-}
-
 static int
 parse_syncrepl_retry(
        ConfigArgs      *c,
@@ -4063,7 +4025,7 @@ parse_syncrepl_line(
                {
                        int j;
                        val = c->argv[ i ] + STRLENOF( SCOPESTR "=" );
-                       j = slapd_str2scope( val );
+                       j = ldap_pvt_str2scope( val );
                        if ( j < 0 ) {
                                snprintf( c->cr_msg, sizeof( c->cr_msg ),
                                        "Error: parse_syncrepl_line: "
@@ -4475,7 +4437,7 @@ add_syncrepl(
 static void
 syncrepl_unparse( syncinfo_t *si, struct berval *bv )
 {
-       struct berval bc, uri, *bs;
+       struct berval bc, uri, bs;
        char buf[BUFSIZ*2], *ptr;
        ber_len_t len;
        int i;
@@ -4529,11 +4491,10 @@ syncrepl_unparse( syncinfo_t *si, struct berval *bv )
                ptr = lutil_strcopy( ptr, si->si_logbase.bv_val );
                *ptr++ = '"';
        }
-       bs = slapd_scope2bv( si->si_scope );
-       if ( bs ) {
-               if ( WHATSLEFT <= STRLENOF( " " SCOPESTR "=" ) + bs->bv_len ) return;
+       if ( ldap_pvt_scope2bv( si->si_scope, &bs ) == LDAP_SUCCESS ) {
+               if ( WHATSLEFT <= STRLENOF( " " SCOPESTR "=" ) + bs.bv_len ) return;
                ptr = lutil_strcopy( ptr, " " SCOPESTR "=" );
-               ptr = lutil_strcopy( ptr, bs->bv_val );
+               ptr = lutil_strcopy( ptr, bs.bv_val );
        }
        if ( si->si_attrsonly ) {
                if ( WHATSLEFT <= STRLENOF( " " ATTRSONLYSTR "=\"" "\"" ) ) return;