From: Howard Chu Date: Sat, 25 Jul 2009 06:47:00 +0000 (+0000) Subject: ITS#6222 need to support unsigned long args too X-Git-Tag: ACLCHECK_0~400 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=46feff08ca45fefe1c621d6f32225961a2b9c690;p=openldap ITS#6222 need to support unsigned long args too --- diff --git a/servers/slapd/config.c b/servers/slapd/config.c index f89acce44c..dc9a274870 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -128,6 +128,7 @@ int config_check_vals(ConfigTable *Conf, ConfigArgs *c, int check_only ) { int rc, arg_user, arg_type, arg_syn, iarg; unsigned uiarg; long larg; + unsigned long ularg; ber_len_t barg; if(Conf->arg_type == ARG_IGNORED) { @@ -260,6 +261,16 @@ int config_check_vals(ConfigTable *Conf, ConfigArgs *c, int check_only ) { return(ARG_BAD_CONF); } break; + case ARG_ULONG: + if ( lutil_atoulx( &ularg, c->argv[1], 0 ) != 0 ) { + snprintf( c->cr_msg, sizeof( c->cr_msg ), + "<%s> unable to parse \"%s\" as unsigned long", + c->argv[0], c->argv[1] ); + Debug(LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE, "%s: %s\n", + c->log, c->cr_msg, 0); + return(ARG_BAD_CONF); + } + break; case ARG_BER_LEN_T: { unsigned long l; if ( lutil_atoulx( &l, c->argv[1], 0 ) != 0 ) { @@ -308,6 +319,7 @@ int config_check_vals(ConfigTable *Conf, ConfigArgs *c, int check_only ) { case ARG_INT: c->value_int = iarg; break; case ARG_UINT: c->value_uint = uiarg; break; case ARG_LONG: c->value_long = larg; break; + case ARG_ULONG: c->value_ulong = ularg; break; case ARG_BER_LEN_T: c->value_ber_t = barg; break; } } @@ -359,6 +371,7 @@ int config_set_vals(ConfigTable *Conf, ConfigArgs *c) { case ARG_INT: *(int*)ptr = c->value_int; break; case ARG_UINT: *(unsigned*)ptr = c->value_uint; break; case ARG_LONG: *(long*)ptr = c->value_long; break; + case ARG_ULONG: *(unsigned long*)ptr = c->value_ulong; break; case ARG_BER_LEN_T: *(ber_len_t*)ptr = c->value_ber_t; break; case ARG_STRING: { char *cc = *(char**)ptr; @@ -449,6 +462,7 @@ config_get_vals(ConfigTable *cf, ConfigArgs *c) case ARG_INT: c->value_int = *(int *)ptr; break; case ARG_UINT: c->value_uint = *(unsigned *)ptr; break; case ARG_LONG: c->value_long = *(long *)ptr; break; + case ARG_ULONG: c->value_ulong = *(unsigned long *)ptr; break; case ARG_BER_LEN_T: c->value_ber_t = *(ber_len_t *)ptr; break; case ARG_STRING: if ( *(char **)ptr ) @@ -467,6 +481,7 @@ config_get_vals(ConfigTable *cf, ConfigArgs *c) case ARG_INT: bv.bv_len = snprintf(bv.bv_val, sizeof( c->log ), "%d", c->value_int); break; case ARG_UINT: bv.bv_len = snprintf(bv.bv_val, sizeof( c->log ), "%u", c->value_uint); break; case ARG_LONG: bv.bv_len = snprintf(bv.bv_val, sizeof( c->log ), "%ld", c->value_long); break; + case ARG_ULONG: bv.bv_len = snprintf(bv.bv_val, sizeof( c->log ), "%lud", c->value_ulong); break; case ARG_BER_LEN_T: bv.bv_len = snprintf(bv.bv_val, sizeof( c->log ), "%ld", c->value_ber_t); break; case ARG_ON_OFF: bv.bv_len = snprintf(bv.bv_val, sizeof( c->log ), "%s", c->value_int ? "TRUE" : "FALSE"); break; diff --git a/servers/slapd/config.h b/servers/slapd/config.h index ca84a3c18c..99eb6b2c8e 100644 --- a/servers/slapd/config.h +++ b/servers/slapd/config.h @@ -59,6 +59,7 @@ typedef enum { #define ARG_DN 0x00007000 #define ARG_UINT 0x00008000 #define ARG_ATDESC 0x00009000 +#define ARG_ULONG 0x0000a000 #define ARGS_SYNTAX 0xffff0000 #define ARG_IGNORED 0x00080000 @@ -134,6 +135,7 @@ typedef struct config_args_s { int v_int; unsigned v_uint; long v_long; + unsigned long v_ulong; ber_len_t v_ber_t; char *v_string; struct berval v_bv; @@ -167,6 +169,7 @@ typedef struct config_args_s { #define value_int values.v_int #define value_uint values.v_uint #define value_long values.v_long +#define value_ulong values.v_ulong #define value_ber_t values.v_ber_t #define value_string values.v_string #define value_bv values.v_bv