config_restrict(ConfigArgs *c) {
slap_mask_t restrictops = 0;
int i;
- struct verb_mask_list restrictable_ops[] = {
+ slap_verbmasks restrictable_ops[] = {
{ "bind", SLAP_RESTRICT_OP_BIND },
{ "add", SLAP_RESTRICT_OP_ADD },
{ "modify", SLAP_RESTRICT_OP_MODIFY },
};
if (c->emit) {
- return mask_to_verbs( c, restrictable_ops, c->be->be_restrictops );
+ return mask_to_verbs( restrictable_ops, c->be->be_restrictops,
+ &c->rvalue_vals );
}
- i = verbs_to_mask( c, restrictable_ops, &restrictops );
+ i = verbs_to_mask( c->argc, c->argv, restrictable_ops, &restrictops );
if ( i ) {
Debug(LDAP_DEBUG_ANY, "%s: "
"unknown operation %s in \"restrict <features>\" line\n",
config_allows(ConfigArgs *c) {
slap_mask_t allows = 0;
int i;
- struct verb_mask_list allowable_ops[] = {
+ slap_verbmasks allowable_ops[] = {
{ "bind_v2", SLAP_ALLOW_BIND_V2 },
{ "bind_anon_cred", SLAP_ALLOW_BIND_ANON_CRED },
{ "bind_anon_dn", SLAP_ALLOW_BIND_ANON_DN },
{ NULL, 0 }
};
if (c->emit) {
- return mask_to_verbs( c, allowable_ops, global_allows );
+ return mask_to_verbs( allowable_ops, global_allows, &c->rvalue_vals );
}
- i = verbs_to_mask(c, allowable_ops, &allows);
+ i = verbs_to_mask(c->argc, c->argv, allowable_ops, &allows);
if ( i ) {
Debug(LDAP_DEBUG_ANY, "%s: "
"unknown feature %s in \"allow <features>\" line\n",
config_disallows(ConfigArgs *c) {
slap_mask_t disallows = 0;
int i;
- struct verb_mask_list disallowable_ops[] = {
+ slap_verbmasks disallowable_ops[] = {
{ "bind_anon", SLAP_DISALLOW_BIND_ANON },
{ "bind_simple", SLAP_DISALLOW_BIND_SIMPLE },
{ "bind_krb4", SLAP_DISALLOW_BIND_KRBV4 },
{ NULL, 0 }
};
if (c->emit) {
- return mask_to_verbs( c, disallowable_ops, global_disallows );
+ return mask_to_verbs( disallowable_ops, global_disallows, &c->rvalue_vals );
}
- i = verbs_to_mask(c, disallowable_ops, &disallows);
+ i = verbs_to_mask(c->argc, c->argv, disallowable_ops, &disallows);
if ( i ) {
Debug(LDAP_DEBUG_ANY, "%s: "
"unknown feature %s in \"disallow <features>\" line\n",
config_requires(ConfigArgs *c) {
slap_mask_t requires = 0;
int i;
- struct verb_mask_list requires_ops[] = {
+ slap_verbmasks requires_ops[] = {
{ "bind", SLAP_REQUIRE_BIND },
{ "LDAPv3", SLAP_REQUIRE_LDAP_V3 },
{ "authc", SLAP_REQUIRE_AUTHC },
{ NULL, 0 }
};
if (c->emit) {
- return mask_to_verbs( c, requires_ops, c->be->be_requires );
+ return mask_to_verbs( requires_ops, c->be->be_requires, &c->rvalue_vals );
}
- i = verbs_to_mask(c, requires_ops, &requires);
+ i = verbs_to_mask(c->argc, c->argv, requires_ops, &requires);
if ( i ) {
Debug(LDAP_DEBUG_ANY, "%s: "
"unknown feature %s in \"require <features>\" line\n",
config_loglevel(ConfigArgs *c) {
int i;
char *next;
- struct verb_mask_list loglevel_ops[] = {
+ slap_verbmasks loglevel_ops[] = {
{ "Trace", LDAP_DEBUG_TRACE },
{ "Packets", LDAP_DEBUG_PACKETS },
{ "Args", LDAP_DEBUG_ARGS },
};
if (c->emit) {
- return mask_to_verbs( c, loglevel_ops, ldap_syslog );
+ return mask_to_verbs( loglevel_ops, ldap_syslog, &c->rvalue_vals );
}
ldap_syslog = 0;
return( 1 );
}
} else {
- int j = verb_to_mask(c, loglevel_ops, c->argv[i][0]);
+ int j = verb_to_mask(c->argv[i], loglevel_ops);
if(!loglevel_ops[j].word) {
Debug( LDAP_DEBUG_ANY,
"%s: unknown level \"%s\" "
static int
config_tls_config(ConfigArgs *c) {
int i, flag;
- struct verb_mask_list crlkeys[] = {
+ slap_verbmasks crlkeys[] = {
{ "none", LDAP_OPT_X_TLS_CRL_NONE },
{ "peer", LDAP_OPT_X_TLS_CRL_PEER },
{ "all", LDAP_OPT_X_TLS_CRL_ALL },
{ NULL, 0 }
};
- struct verb_mask_list vfykeys[] = {
+ slap_verbmasks vfykeys[] = {
{ "never", LDAP_OPT_X_TLS_NEVER },
{ "demand", LDAP_OPT_X_TLS_DEMAND },
{ "try", LDAP_OPT_X_TLS_TRY },
/* restrictops, allows, disallows, requires, loglevel */
int
-verb_to_mask(ConfigArgs *c, struct verb_mask_list *v, int word) {
- int j;
- for(j = 0; v[j].word; j++)
- if(!strcasecmp(c->argv[word], v[j].word))
+verb_to_mask(const char *word, slap_verbmasks *v) {
+ int i;
+ for(i = 0; v[i].word; i++)
+ if(!strcasecmp(word, v[i].word))
break;
- return(j);
+ return(i);
}
int
-verbs_to_mask(ConfigArgs *c, struct verb_mask_list *v, slap_mask_t *m) {
+verbs_to_mask(int argc, char *argv[], slap_verbmasks *v, slap_mask_t *m) {
int i, j;
- for(i = 1; i < c->argc; i++) {
- j = verb_to_mask(c, v, i);
+ for(i = 1; i < argc; i++) {
+ j = verb_to_mask(argv[i], v);
if(!v[j].word) return(1);
while (!v[j].mask) j--;
*m |= v[j].mask;
}
int
-mask_to_verbs(ConfigArgs *c, struct verb_mask_list *v, slap_mask_t m) {
+mask_to_verbs(slap_verbmasks *v, slap_mask_t m, BerVarray *bva) {
int i, j;
struct berval bv;
if (!v[i].mask) continue;
if (( m & v[i].mask ) == v[i].mask ) {
ber_str2bv( v[i].word, 0, 0, &bv );
- value_add_one( &c->rvalue_vals, &bv );
+ value_add_one( bva, &bv );
}
}
return 0;
}
-static struct verb_mask_list tlskey[] = {
+static slap_verbmasks tlskey[] = {
{ "no", SB_TLS_OFF },
{ "yes", SB_TLS_ON },
{ "critical", SB_TLS_CRITICAL }
};
-static struct verb_mask_list methkey[] = {
+static slap_verbmasks methkey[] = {
{ "simple", LDAP_AUTH_SIMPLE },
#ifdef HAVE_CYRUS_SASL
{ "sasl", LDAP_AUTH_SASL },
struct berval key;
int off;
int quote;
- struct verb_mask_list *aux;
+ slap_verbmasks *aux;
} cf_aux_table;
static cf_aux_table bindkey[] = {
{ BER_BVNULL, 0, 0, NULL }
};
-int bindconf_parse( char *word, slap_bindconf *bc ) {
+int bindconf_parse( const char *word, slap_bindconf *bc ) {
int i, rc = 0;
char **cptr;
cf_aux_table *tab;