On Fri, Aug 12, 2016 at 11:40:24AM +0200, Pavel Březina wrote:
I'm sorry, I sent wrong patches. How about now?
Now I have last two comments before I ack :) both are in the largest patch,
the other can be considered acked.
From de872fd874b8395f526743f1836dea335726b3ff Mon Sep 17 00:00:00
2001
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina(a)redhat.com>
Date: Mon, 27 Jun 2016 13:56:13 +0200
Subject: [PATCH 6/7] ssctl: print active server and server list
[...]
@@ -50,17 +232,102 @@ errno_t dp_failover_list_services(struct
sbus_request *sbus_req,
return ENOMEM;
}
- num_services = 0;
- DLIST_FOR_EACH(svc, be_ctx->be_fo->svcs) {
- services[num_services] = talloc_strdup(services, svc->name);
- if (services[num_services] == NULL) {
- DEBUG(SSSDBG_CRIT_FAILURE, "talloc_strdup() failed\n");
- talloc_free(services);
- return ENOMEM;
- }
- num_services++;
+ /* Fill the list. */
+ if ((ad_found && ipa_found) || (!ad_found && !ipa_found)) {
+ /* If AD and IPA was found it is some complicated configuration,
+ * we return everything. Otherwise it's LDAP. */
+ ret = dp_failover_list_services_ldap(be_ctx, services, &num_services);
+ } else if (ad_found) {
+ ret = dp_failover_list_services_ad(be_ctx, domain,
+ services, &num_services);
+ } else if (ipa_found) {
+ ret = dp_failover_list_services_ipa(be_ctx, domain,
+ services, &num_services);
+ }
If no branch of the above match, ret is undefined (thanks, Coverity)
+
+ if (ret != EOK) {
+ DEBUG(SSSDBG_CRIT_FAILURE, "Unable to create service list [%d]:
%s\n",
+ ret, sss_strerror(ret));
+ talloc_free(services);
+ return ret;
}
iface_dp_failover_ListServices_finish(sbus_req, services, num_services);
return EOK;
}
[...]
@@ -137,9 +286,9 @@ errno_t sssctl_domain_status(struct sss_cmdline
*cmdline,
{"online", 'o', POPT_ARG_NONE , &opts.online, 0,
_("Show online status"), NULL },
/*
{"last-requests", 'l', POPT_ARG_NONE, &opts.last, 0,
_("Show last requests that went to data provider"), NULL },
+ */
{"active-server", 'a', POPT_ARG_NONE, &opts.active, 0,
_("Show information about active server"), NULL },
{"servers", 'r', POPT_ARG_NONE, &opts.servers, 0,
_("Show list of discovered servers"), NULL },
- */
I don't like the commented variable member, can we remove it?
> {"start", 's', POPT_ARG_NONE, &opts.force_start, 0,
_("Start SSSD if it is not running"), NULL },
> POPT_TABLEEND
> };