Revert prev commit, use ldap_pvt_ funcs

This commit is contained in:
Howard Chu 2009-08-18 08:53:41 +00:00
parent 87321c3fae
commit f0a0e9fa32
2 changed files with 5 additions and 46 deletions

View 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((

View 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;