mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-30 03:29:35 -05:00
Bugfix: Move handling of boolean options in front of invalue==NULL error check
This commit is contained in:
parent
26f257f40d
commit
083455be6b
1 changed files with 23 additions and 21 deletions
|
|
@ -239,17 +239,35 @@ ldap_set_option(
|
|||
openldap_ldap_initialize();
|
||||
}
|
||||
|
||||
if(invalue == NULL) {
|
||||
/* no place to set from */
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(ld == NULL) {
|
||||
lo = &openldap_ldap_global_options;
|
||||
} else {
|
||||
lo = &ld->ld_options;
|
||||
}
|
||||
|
||||
switch(option) {
|
||||
case LDAP_OPT_REFERRALS:
|
||||
if(invalue == LDAP_OPT_ON) {
|
||||
LDAP_BOOL_SET(lo, LDAP_BOOL_REFERRALS);
|
||||
} else {
|
||||
LDAP_BOOL_CLR(lo, LDAP_BOOL_REFERRALS);
|
||||
}
|
||||
return 0;
|
||||
|
||||
case LDAP_OPT_RESTART:
|
||||
if(invalue == LDAP_OPT_ON) {
|
||||
LDAP_BOOL_SET(lo, LDAP_BOOL_RESTART);
|
||||
} else {
|
||||
LDAP_BOOL_CLR(lo, LDAP_BOOL_RESTART);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(invalue == NULL) {
|
||||
/* no place to set from */
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch(option) {
|
||||
case LDAP_OPT_API_INFO:
|
||||
case LDAP_OPT_DESC:
|
||||
|
|
@ -268,22 +286,6 @@ ldap_set_option(
|
|||
lo->ldo_timelimit = * (int *) invalue;
|
||||
return 0;
|
||||
|
||||
case LDAP_OPT_REFERRALS:
|
||||
if(invalue == LDAP_OPT_ON) {
|
||||
LDAP_BOOL_SET(lo, LDAP_BOOL_REFERRALS);
|
||||
} else {
|
||||
LDAP_BOOL_CLR(lo, LDAP_BOOL_REFERRALS);
|
||||
}
|
||||
return 0;
|
||||
|
||||
case LDAP_OPT_RESTART:
|
||||
if(invalue == LDAP_OPT_ON) {
|
||||
LDAP_BOOL_SET(lo, LDAP_BOOL_RESTART);
|
||||
} else {
|
||||
LDAP_BOOL_CLR(lo, LDAP_BOOL_RESTART);
|
||||
}
|
||||
return 0;
|
||||
|
||||
case LDAP_OPT_PROTOCOL_VERSION: {
|
||||
int vers = * (int *) invalue;
|
||||
if (vers < LDAP_VERSION_MIN || vers > LDAP_VERSION_MAX) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue