mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-03 21:50:49 -05:00
ITS#6222 need to support unsigned long args too
This commit is contained in:
parent
addb1320a4
commit
46feff08ca
2 changed files with 18 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue