diff options
author | Sumit Bose <sbose@redhat.com> | 2011-04-11 21:49:03 +0200 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2011-04-11 16:08:44 -0400 |
commit | 280ed6f992a3a3e661e618c77b64aff35a356c7e (patch) | |
tree | d77985c1fd16ae5acd598046a9957b92fdff4d86 /src/providers/ldap/sdap.c | |
parent | fc5fc2c1a28664b727ace6c18eb4fbeb9ce15ab0 (diff) | |
download | sssd-280ed6f992a3a3e661e618c77b64aff35a356c7e.tar.gz sssd-280ed6f992a3a3e661e618c77b64aff35a356c7e.tar.bz2 sssd-280ed6f992a3a3e661e618c77b64aff35a356c7e.zip |
Initialise srv_opts even if rootDSE is missing
Diffstat (limited to 'src/providers/ldap/sdap.c')
-rw-r--r-- | src/providers/ldap/sdap.c | 78 |
1 files changed, 40 insertions, 38 deletions
diff --git a/src/providers/ldap/sdap.c b/src/providers/ldap/sdap.c index 5e4e56d1..7734904e 100644 --- a/src/providers/ldap/sdap.c +++ b/src/providers/ldap/sdap.c @@ -605,46 +605,48 @@ int sdap_get_server_opts_from_rootdse(TALLOC_CTX *memctx, last_usn_name = opts->gen_map[SDAP_AT_LAST_USN].name; entry_usn_name = opts->gen_map[SDAP_AT_ENTRY_USN].name; - if (last_usn_name) { - ret = sysdb_attrs_get_string(rootdse, - last_usn_name, &last_usn_value); - if (ret != EOK) { - switch (ret) { - case ENOENT: - DEBUG(1, ("%s configured but not found in rootdse!\n", - opts->gen_map[SDAP_AT_LAST_USN].opt_name)); - break; - case ERANGE: - DEBUG(1, ("Multiple values of %s found in rootdse!\n", - opts->gen_map[SDAP_AT_LAST_USN].opt_name)); - break; - default: - DEBUG(1, ("Unkown error (%d) checking rootdse!\n", ret)); - } - } else { - if (!entry_usn_name) { - DEBUG(1, ("%s found in rootdse but %s is not set!\n", - last_usn_name, - opts->gen_map[SDAP_AT_ENTRY_USN].opt_name)); + if (rootdse) { + if (last_usn_name) { + ret = sysdb_attrs_get_string(rootdse, + last_usn_name, &last_usn_value); + if (ret != EOK) { + switch (ret) { + case ENOENT: + DEBUG(1, ("%s configured but not found in rootdse!\n", + opts->gen_map[SDAP_AT_LAST_USN].opt_name)); + break; + case ERANGE: + DEBUG(1, ("Multiple values of %s found in rootdse!\n", + opts->gen_map[SDAP_AT_LAST_USN].opt_name)); + break; + default: + DEBUG(1, ("Unkown error (%d) checking rootdse!\n", ret)); + } } else { - so->supports_usn = true; + if (!entry_usn_name) { + DEBUG(1, ("%s found in rootdse but %s is not set!\n", + last_usn_name, + opts->gen_map[SDAP_AT_ENTRY_USN].opt_name)); + } else { + so->supports_usn = true; + } } - } - } else { - /* no usn option configure, let's try to autodetect. */ - for (i = 0; usn_attrs[i].last_name; i++) { - ret = sysdb_attrs_get_string(rootdse, - usn_attrs[i].last_name, - &last_usn_value); - if (ret == EOK) { - /* Fixate discovered configuration */ - opts->gen_map[SDAP_AT_LAST_USN].name = - talloc_strdup(opts->gen_map, usn_attrs[i].last_name); - opts->gen_map[SDAP_AT_ENTRY_USN].name = - talloc_strdup(opts->gen_map, usn_attrs[i].entry_name); - so->supports_usn = true; - last_usn_name = usn_attrs[i].last_name; - break; + } else { + /* no usn option configure, let's try to autodetect. */ + for (i = 0; usn_attrs[i].last_name; i++) { + ret = sysdb_attrs_get_string(rootdse, + usn_attrs[i].last_name, + &last_usn_value); + if (ret == EOK) { + /* Fixate discovered configuration */ + opts->gen_map[SDAP_AT_LAST_USN].name = + talloc_strdup(opts->gen_map, usn_attrs[i].last_name); + opts->gen_map[SDAP_AT_ENTRY_USN].name = + talloc_strdup(opts->gen_map, usn_attrs[i].entry_name); + so->supports_usn = true; + last_usn_name = usn_attrs[i].last_name; + break; + } } } } |