From: Howard Chu Date: Mon, 20 Apr 2009 00:31:33 +0000 (+0000) Subject: Add ATDESC config arg type for AttributeDescriptions X-Git-Tag: ACLCHECK_0~613 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=615082b0d09ce906359e682cad7e59e348253275;p=openldap Add ATDESC config arg type for AttributeDescriptions --- diff --git a/servers/slapd/config.c b/servers/slapd/config.c index a343eae174..c9763bf8be 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -216,6 +216,16 @@ int config_check_vals(ConfigTable *Conf, ConfigArgs *c, int check_only ) { ch_free( c->value_ndn.bv_val ); ch_free( c->value_dn.bv_val ); } + } else if(arg_type == ARG_ATDESC) { + const char *text = NULL; + c->value_ad = NULL; + rc = slap_str2ad( c->argv[1], &c->value_ad, &text ); + if ( rc != LDAP_SUCCESS ) { + snprintf( c->cr_msg, sizeof( c->cr_msg ), "<%s> invalid AttributeDescription %d (%s)", + c->argv[0], rc, text ); + Debug(LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE, "%s: %s\n" , c->log, c->cr_msg, 0); + return(ARG_BAD_CONF); + } } else { /* all numeric */ int j; iarg = 0; larg = 0; barg = 0; @@ -366,6 +376,9 @@ int config_set_vals(ConfigTable *Conf, ConfigArgs *c) { case ARG_BERVAL: *(struct berval *)ptr = c->value_bv; break; + case ARG_ATDESC: + *(AttributeDescription **)ptr = c->value_ad; + break; } return(0); } @@ -443,6 +456,8 @@ config_get_vals(ConfigTable *cf, ConfigArgs *c) break; case ARG_BERVAL: ber_dupbv( &c->value_bv, (struct berval *)ptr ); break; + case ARG_ATDESC: + c->value_ad = *(AttributeDescription **)ptr; break; } } if ( cf->arg_type & ARGS_TYPES) { @@ -469,6 +484,13 @@ config_get_vals(ConfigTable *cf, ConfigArgs *c) return 1; } break; + case ARG_ATDESC: + if ( c->value_ad ) { + bv = c->value_ad->ad_cname; + } else { + return 1; + } + break; default: bv.bv_val = NULL; break; diff --git a/servers/slapd/config.h b/servers/slapd/config.h index 4dc902dac9..b076a42e6c 100644 --- a/servers/slapd/config.h +++ b/servers/slapd/config.h @@ -58,6 +58,7 @@ typedef enum { #define ARG_BERVAL 0x00006000 #define ARG_DN 0x00007000 #define ARG_UINT 0x00008000 +#define ARG_ATDESC 0x00009000 #define ARGS_SYNTAX 0xffff0000 #define ARG_IGNORED 0x00080000 @@ -140,6 +141,7 @@ typedef struct config_args_s { struct berval vdn_dn; struct berval vdn_ndn; } v_dn; + AttributeDescription *v_ad; } values; /* return values for emit mode */ BerVarray rvalue_vals; @@ -170,6 +172,7 @@ typedef struct config_args_s { #define value_bv values.v_bv #define value_dn values.v_dn.vdn_dn #define value_ndn values.v_dn.vdn_ndn +#define value_ad values.v_ad int config_fp_parse_line(ConfigArgs *c);