summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2011-04-11 21:49:03 +0200
committerStephen Gallagher <sgallagh@redhat.com>2011-04-11 16:08:44 -0400
commit280ed6f992a3a3e661e618c77b64aff35a356c7e (patch)
treed77985c1fd16ae5acd598046a9957b92fdff4d86 /src
parentfc5fc2c1a28664b727ace6c18eb4fbeb9ce15ab0 (diff)
downloadsssd-280ed6f992a3a3e661e618c77b64aff35a356c7e.tar.gz
sssd-280ed6f992a3a3e661e618c77b64aff35a356c7e.tar.bz2
sssd-280ed6f992a3a3e661e618c77b64aff35a356c7e.zip
Initialise srv_opts even if rootDSE is missing
Diffstat (limited to 'src')
-rw-r--r--src/providers/ldap/sdap.c78
-rw-r--r--src/providers/ldap/sdap_async_connection.c17
2 files changed, 49 insertions, 46 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;
+ }
}
}
}
diff --git a/src/providers/ldap/sdap_async_connection.c b/src/providers/ldap/sdap_async_connection.c
index bdd2b0e0..4694acc1 100644
--- a/src/providers/ldap/sdap_async_connection.c
+++ b/src/providers/ldap/sdap_async_connection.c
@@ -1281,14 +1281,15 @@ static void sdap_cli_rootdse_done(struct tevent_req *subreq)
return;
}
- ret = sdap_get_server_opts_from_rootdse(state,
- state->service->uri, rootdse,
- state->opts, &state->srv_opts);
- if (ret) {
- DEBUG(1, ("sdap_get_server_opts_from_rootdse failed.\n"));
- tevent_req_error(req, ret);
- return;
- }
+ }
+
+ ret = sdap_get_server_opts_from_rootdse(state,
+ state->service->uri, rootdse,
+ state->opts, &state->srv_opts);
+ if (ret) {
+ DEBUG(1, ("sdap_get_server_opts_from_rootdse failed.\n"));
+ tevent_req_error(req, ret);
+ return;
}
sasl_mech = dp_opt_get_string(state->opts->basic, SDAP_SASL_MECH);