Hi,
the attaches two patches implement DBus methods to retrieve SSSD domains using the system bus as well as two example getters that leverage the infrastructure to Get and GetAll the object properties.
Pavel, I know you have a large patchset in a private tree that implements the other getters and moves the domain methods into a separate file. I'm fine with merging your and mine patches, I just wanted to get the ball rolling on the list. Feel free to reply with your patchset.
On 05/21/2014 11:03 PM, Jakub Hrozek wrote:
Hi,
the attaches two patches implement DBus methods to retrieve SSSD domains using the system bus as well as two example getters that leverage the infrastructure to Get and GetAll the object properties.
Pavel, I know you have a large patchset in a private tree that implements the other getters and moves the domain methods into a separate file. I'm fine with merging your and mine patches, I just wanted to get the ball rolling on the list. Feel free to reply with your patchset.
Hi, see the attachment.
I squash all my patches to these five - mainly discarded the moving the code around.
I kept you as the author for the methods as I made only very minor changes there. However, I took the ownership for the properties since there only very little of your original code remains there - I hope you don't mind.
The next three patches implements the SSSD components interface required for the OpenLMI provider. I'm sending it to this thread since it depends on the domain patches anyway - there is enough dependency fuzz already.
On Thu, May 22, 2014 at 07:57:28PM +0200, Pavel Březina wrote:
I kept you as the author for the methods as I made only very minor changes there. However, I took the ownership for the properties since there only very little of your original code remains there - I hope you don't mind.
Fine by me, but I can't ack the first one myself, do you agree with it? I can review the rest (2-5).
On 05/22/2014 08:39 PM, Jakub Hrozek wrote:
On Thu, May 22, 2014 at 07:57:28PM +0200, Pavel Březina wrote:
I kept you as the author for the methods as I made only very minor changes there. However, I took the ownership for the properties since there only very little of your original code remains there - I hope you don't mind.
Fine by me, but I can't ack the first one myself, do you agree with it? I can review the rest (2-5).
Yes, ack for the first one.
I've been using the code for some time now and it works perfectly.
On Thu, May 22, 2014 at 07:57:28PM +0200, Pavel Březina wrote:
On 05/21/2014 11:03 PM, Jakub Hrozek wrote:
Hi,
the attaches two patches implement DBus methods to retrieve SSSD domains using the system bus as well as two example getters that leverage the infrastructure to Get and GetAll the object properties.
Pavel, I know you have a large patchset in a private tree that implements the other getters and moves the domain methods into a separate file. I'm fine with merging your and mine patches, I just wanted to get the ball rolling on the list. Feel free to reply with your patchset.
Hi, see the attachment.
I squash all my patches to these five - mainly discarded the moving the code around.
I kept you as the author for the methods as I made only very minor changes there. However, I took the ownership for the properties since there only very little of your original code remains there - I hope you don't mind.
The next three patches implements the SSSD components interface required for the OpenLMI provider. I'm sending it to this thread since it depends on the domain patches anyway - there is enough dependency fuzz already.
From 7e55b23741ed749e95e9d33184b0fd702b86bb46 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek jhrozek@redhat.com Date: Tue, 22 Apr 2014 15:38:08 +0200 Subject: [PATCH 1/5] IFP: Add ListDomains and FindDomainByName
This one was acked by Pavel separately.
From d3d93a3d9ae3d2818c6fd3b78662aab27a3ace36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20B=C5=99ezina?= pbrezina@redhat.com Date: Thu, 22 May 2014 19:01:35 +0200 Subject: [PATCH 2/5] IFP: Implement domain getters
See inline for some nitpicks. In general, the code seems to work well. As par of the review exercise, I started writing some unit tests, but I don't want to block your code from master any longer.
src/responder/ifp/ifp_domains.c | 348 ++++++++++++++++++++++++++ src/responder/ifp/ifp_domains.h | 60 +++++ src/responder/ifp/ifp_iface.xml | 19 ++ src/responder/ifp/ifp_iface_generated.c | 415 ++++++++++++++++++++++++++++++++ src/responder/ifp/ifp_iface_generated.h | 39 +++ src/responder/ifp/ifpsrv.c | 19 ++ 6 files changed, 900 insertions(+)
diff --git a/src/responder/ifp/ifp_domains.c b/src/responder/ifp/ifp_domains.c index a06ba471c43ac7111693aa0d22a14cf33d168caa..ad0c4132711d21a009c2abc9e21a417144936bcd 100644 --- a/src/responder/ifp/ifp_domains.c +++ b/src/responder/ifp/ifp_domains.c @@ -20,6 +20,8 @@ */
#include <talloc.h> +#include <tevent.h> +#include <string.h>
#include "db/sysdb.h" #include "util/util.h" @@ -232,3 +234,349 @@ static void ifp_find_domain_by_name_process(struct tevent_req *req) DEBUG(SSSDBG_OP_FAILURE, "Could not finish request!\n"); } }
+static struct sss_domain_info * +get_domain_info_from_req(struct sbus_request *req, void *data)
I would prefer a different name than 'req' for sbus_request. 'req' is used through the code as a tevent_req instance.
+{
- struct ifp_ctx *ctx = NULL;
- struct sss_domain_info *domains = NULL;
- struct sss_domain_info *iter = NULL;
- const char *path = dbus_message_get_path(req->message);
- const char *safe_name = NULL;
- char *name = NULL;
- ctx = talloc_get_type(data, struct ifp_ctx);
- if (ctx == NULL) {
DEBUG(SSSDBG_CRIT_FAILURE, "Invalid pointer!\n");
return NULL;
- }
- safe_name = ifp_path_strip_prefix(path, INFOPIPE_DOMAIN_PATH_PFX "/");
I think raw_name would be a better name. I would use safe_name for something that was unsafe and was escaped to be safe.
- if (safe_name == NULL) {
return NULL;
- }
- name = ifp_bus_path_unescape(NULL, safe_name);
Can you use sbus_req as the parent context here? I know you free the memory in this function, but allocating on the request would be future-proof when we refactor this code..
- if (name == NULL) {
return NULL;
- }
- DEBUG(SSSDBG_TRACE_INTERNAL, "Looking for domain %s\n", name);
- domains = ctx->rctx->domains;
- for (iter = domains; iter != NULL; iter = get_next_domain(iter, true)) {
if (strcasecmp(iter->name, name) == 0) {
break;
}
- }
- talloc_free(name);
- return iter;
+}
+static void get_server_list(struct sbus_request *dbus_req,
void *data,
const char ***_out,
int *_out_len,
bool backup)
+{
- static const char *srv[] = {"_srv_"};
- struct sss_domain_info *dom = NULL;
- struct ifp_ctx *ctx = NULL;
- const char *conf_path = NULL;
- const char *option = NULL;
- const char **out = NULL;
- char **servers = NULL;
- int num_servers;
- errno_t ret;
- int i;
- *_out = NULL;
- *_out_len = 0;
- dom = get_domain_info_from_req(dbus_req, data);
- if (dom == NULL) {
return;
- }
- if (dom->parent != NULL) {
/* subdomains are not present in configuration */
ret = ENOENT;
goto done;
- }
- ctx = talloc_get_type(data, struct ifp_ctx);
- if (ctx == NULL) {
DEBUG(SSSDBG_CRIT_FAILURE, "Invalid ifp context!\n");
ret = ENOMEM;
goto done;
- }
- conf_path = talloc_asprintf(dbus_req, CONFDB_DOMAIN_PATH_TMPL, dom->name);
- if (conf_path == NULL) {
ret = ENOMEM;
goto done;
- }
- /* TODO: replace hardcoded values with option names from the provider */
I don't like this at all, but I can't see another way with the current code. Maybe we should add a new ID target for getting info about domains? I think the performance would be a non-issue since all that would be needed is an sbus round trip to the DP that would just reply right away. But any DP changes should be discussed on the list first -- for now, just please file a ticket.
- if (strcasecmp(dom->provider, "ldap") == 0) {
option = backup == false ? "ldap_uri" : "ldap_backup_uri";
- } else if (strcasecmp(dom->provider, "ipa") == 0) {
option = backup == false ? "ipa_server" : "ipa_backup_server";
- } else if (strcasecmp(dom->provider, "ad") == 0) {
option = backup == false ? "ad_server" : "ad_backup_server";
- } else {
ret = EINVAL;
goto done;
- }
- ret = confdb_get_string_as_list(ctx->rctx->cdb, dbus_req, conf_path,
option, &servers);
- if (ret != EOK) {
goto done;
- }
- for (num_servers = 0; servers[num_servers] != NULL; num_servers++);
- if (num_servers == 0) {
ret = ENOENT;
goto done;
- }
- out = talloc_zero_array(dbus_req, const char*, num_servers);
- if (out == NULL) {
ret = ENOMEM;
goto done;
- }
- for (i = 0; i < num_servers; i++) {
out[i] = talloc_steal(out, servers[i]);
- }
- *_out = out;
- *_out_len = num_servers;
- ret = EOK;
+done:
- if (ret == ENOENT) {
*_out = srv;
*_out_len = 1;
- }
- return;
+}
+void ifp_dom_get_name(struct sbus_request *dbus_req,
void *data,
const char **_out)
+{
- struct sss_domain_info *dom;
- *_out = NULL;
- dom = get_domain_info_from_req(dbus_req, data);
- if (dom == NULL) {
return;
- }
- *_out = dom->name;
+}
A general comment about the string getters -- could we have a macro that would wrap the repeated pattern? Maybe something like (pseudocode):
#define dom_get_str(dbus_req, data, _out, prop) \ struct sss_domain_info *dom; \ dom = get_domain_info_from_req(dbus_req, data); \ *_out = dom ? dom->prop : NULL;
Then you could reduce the getter to a single line: dom_get_str(dbus_req, data, _out, name);
[snip, the other getters generally look good to me]
+void ifp_dom_get_min_id(struct sbus_request *dbus_req,
void *data,
uint32_t *_out)
+{
- struct sss_domain_info *dom;
- *_out = 0;
The min_id default should be 1, I think. That's the default for min_id in confdb anyway. And our responders explicitly filter any request by ID for ID 0.
- dom = get_domain_info_from_req(dbus_req, data);
- if (dom == NULL) {
return;
- }
- *_out = dom->id_min;
+}
+void ifp_dom_get_max_id(struct sbus_request *dbus_req,
void *data,
uint32_t *_out)
+{
- struct sss_domain_info *dom;
- *_out = 0;
Here the default is OK, because 0 means 'unlimited'.
- dom = get_domain_info_from_req(dbus_req, data);
- if (dom == NULL) {
return;
- }
- *_out = dom->id_max;
+}
+void ifp_dom_get_realm(struct sbus_request *dbus_req,
void *data,
const char **_out)
+{
- struct sss_domain_info *dom;
- *_out = NULL;
- dom = get_domain_info_from_req(dbus_req, data);
- if (dom == NULL) {
return;
- }
- *_out = dom->realm;
+}
+void ifp_dom_get_forest(struct sbus_request *dbus_req,
void *data,
const char **_out)
+{
- struct sss_domain_info *dom;
- *_out = NULL;
- dom = get_domain_info_from_req(dbus_req, data);
- if (dom == NULL) {
return;
- }
- *_out = dom->forest;
+}
+void ifp_dom_get_login_format(struct sbus_request *dbus_req,
void *data,
const char **_out)
+{
- struct sss_domain_info *dom;
- *_out = NULL;
- dom = get_domain_info_from_req(dbus_req, data);
- if (dom == NULL) {
return;
- }
- *_out = dom->names->re_pattern;
+}
+void ifp_dom_get_fqdn_format(struct sbus_request *dbus_req,
void *data,
const char **_out)
+{
- struct sss_domain_info *dom;
- *_out = NULL;
- dom = get_domain_info_from_req(dbus_req, data);
- if (dom == NULL) {
return;
- }
- *_out = dom->names->fq_fmt;
+}
+void ifp_dom_get_enumerable(struct sbus_request *dbus_req,
void *data,
bool *_out)
+{
- struct sss_domain_info *dom;
- *_out = false;
- dom = get_domain_info_from_req(dbus_req, data);
- if (dom == NULL) {
return;
- }
- *_out = dom->enumerate;
+}
+void ifp_dom_get_use_fqdn(struct sbus_request *dbus_req,
void *data,
bool *_out)
+{
- struct sss_domain_info *dom;
- *_out = false;
- dom = get_domain_info_from_req(dbus_req, data);
- if (dom == NULL) {
return;
- }
- *_out = dom->fqnames;
+}
+void ifp_dom_get_subdomain(struct sbus_request *dbus_req,
void *data,
bool *_out)
+{
- struct sss_domain_info *dom;
- *_out = NULL;
Why are you setting a bool default to NULL? I guess you wanted to use false here?
- dom = get_domain_info_from_req(dbus_req, data);
- if (dom == NULL) {
return;
- }
- *_out = dom->parent ? true : false;
+}
+void ifp_dom_get_parent_domain(struct sbus_request *dbus_req,
void *data,
const char **_out)
+{
- struct sss_domain_info *dom;
- *_out = NULL;
- dom = get_domain_info_from_req(dbus_req, data);
- if (dom == NULL) {
return;
- }
- if (dom->parent == NULL) {
*_out = "/";
return;
- }
- *_out = ifp_reply_objpath(dbus_req, INFOPIPE_DOMAIN_PATH_PFX,
dom->parent->name);
+}
The rest of the patch looks good to me.
I'll send review of other patches separately so you can work on addressing the issues in parallel.
On 05/26/2014 05:45 PM, Jakub Hrozek wrote:
On Thu, May 22, 2014 at 07:57:28PM +0200, Pavel Březina wrote:
On 05/21/2014 11:03 PM, Jakub Hrozek wrote:
Hi,
the attaches two patches implement DBus methods to retrieve SSSD domains using the system bus as well as two example getters that leverage the infrastructure to Get and GetAll the object properties.
Pavel, I know you have a large patchset in a private tree that implements the other getters and moves the domain methods into a separate file. I'm fine with merging your and mine patches, I just wanted to get the ball rolling on the list. Feel free to reply with your patchset.
Hi, see the attachment.
I squash all my patches to these five - mainly discarded the moving the code around.
I kept you as the author for the methods as I made only very minor changes there. However, I took the ownership for the properties since there only very little of your original code remains there - I hope you don't mind.
The next three patches implements the SSSD components interface required for the OpenLMI provider. I'm sending it to this thread since it depends on the domain patches anyway - there is enough dependency fuzz already.
From 7e55b23741ed749e95e9d33184b0fd702b86bb46 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek jhrozek@redhat.com Date: Tue, 22 Apr 2014 15:38:08 +0200 Subject: [PATCH 1/5] IFP: Add ListDomains and FindDomainByName
This one was acked by Pavel separately.
Hi, thank you for the review. I'm sending new patches.
- /* TODO: replace hardcoded values with option names from the provider */
I don't like this at all, but I can't see another way with the current
Me neither, thus todo.
code. Maybe we should add a new ID target for getting info about domains? I think the performance would be a non-issue since all that would be needed is an sbus round trip to the DP that would just reply right away. But any DP changes should be discussed on the list first -- for now, just please file a ticket.
My first idea was to do it as a part of future failover refactoring (to make the failover context per domain, not per backend). The idea was to provide a dbus interface for a failover that would retrieve a list of current servers, also with their status etc.
- if (strcasecmp(dom->provider, "ldap") == 0) {
option = backup == false ? "ldap_uri" : "ldap_backup_uri";
- } else if (strcasecmp(dom->provider, "ipa") == 0) {
option = backup == false ? "ipa_server" : "ipa_backup_server";
- } else if (strcasecmp(dom->provider, "ad") == 0) {
option = backup == false ? "ad_server" : "ad_backup_server";
- } else {
ret = EINVAL;
goto done;
- }
On Mon, May 26, 2014 at 10:33:22PM +0200, Pavel Březina wrote:
On 05/26/2014 05:45 PM, Jakub Hrozek wrote:
On Thu, May 22, 2014 at 07:57:28PM +0200, Pavel Březina wrote:
On 05/21/2014 11:03 PM, Jakub Hrozek wrote:
Hi,
the attaches two patches implement DBus methods to retrieve SSSD domains using the system bus as well as two example getters that leverage the infrastructure to Get and GetAll the object properties.
Pavel, I know you have a large patchset in a private tree that implements the other getters and moves the domain methods into a separate file. I'm fine with merging your and mine patches, I just wanted to get the ball rolling on the list. Feel free to reply with your patchset.
Hi, see the attachment.
I squash all my patches to these five - mainly discarded the moving the code around.
I kept you as the author for the methods as I made only very minor changes there. However, I took the ownership for the properties since there only very little of your original code remains there - I hope you don't mind.
The next three patches implements the SSSD components interface required for the OpenLMI provider. I'm sending it to this thread since it depends on the domain patches anyway - there is enough dependency fuzz already.
From 7e55b23741ed749e95e9d33184b0fd702b86bb46 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek jhrozek@redhat.com Date: Tue, 22 Apr 2014 15:38:08 +0200 Subject: [PATCH 1/5] IFP: Add ListDomains and FindDomainByName
This one was acked by Pavel separately.
Hi, thank you for the review. I'm sending new patches.
- /* TODO: replace hardcoded values with option names from the provider */
I don't like this at all, but I can't see another way with the current
Me neither, thus todo.
code. Maybe we should add a new ID target for getting info about domains? I think the performance would be a non-issue since all that would be needed is an sbus round trip to the DP that would just reply right away. But any DP changes should be discussed on the list first -- for now, just please file a ticket.
My first idea was to do it as a part of future failover refactoring (to make the failover context per domain, not per backend). The idea was to provide a dbus interface for a failover that would retrieve a list of current servers, also with their status etc.
- if (strcasecmp(dom->provider, "ldap") == 0) {
option = backup == false ? "ldap_uri" : "ldap_backup_uri";
- } else if (strcasecmp(dom->provider, "ipa") == 0) {
option = backup == false ? "ipa_server" : "ipa_backup_server";
- } else if (strcasecmp(dom->provider, "ad") == 0) {
option = backup == false ? "ad_server" : "ad_backup_server";
- } else {
ret = EINVAL;
goto done;
- }
From 10e4b069bec51dab06be674cec4e881adda7bb4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20B=C5=99ezina?= pbrezina@redhat.com Date: Thu, 22 May 2014 19:01:35 +0200 Subject: [PATCH 1/4] IFP: Implement domain getters
src/responder/ifp/ifp_domains.c | 307 +++++++++++++++++++++++ src/responder/ifp/ifp_domains.h | 60 +++++ src/responder/ifp/ifp_iface.xml | 19 ++ src/responder/ifp/ifp_iface_generated.c | 415 ++++++++++++++++++++++++++++++++ src/responder/ifp/ifp_iface_generated.h | 39 +++ src/responder/ifp/ifpsrv.c | 19 ++ 6 files changed, 859 insertions(+)
diff --git a/src/responder/ifp/ifp_domains.c b/src/responder/ifp/ifp_domains.c index a06ba471c43ac7111693aa0d22a14cf33d168caa..5b34f96e9e6c4b45a1d775818fe15b328d335f18 100644 --- a/src/responder/ifp/ifp_domains.c +++ b/src/responder/ifp/ifp_domains.c @@ -20,6 +20,8 @@ */
#include <talloc.h> +#include <tevent.h> +#include <string.h>
#include "db/sysdb.h" #include "util/util.h" @@ -27,6 +29,19 @@ #include "responder/common/responder.h" #include "responder/ifp/ifp_domains.h"
+#define RETURN_DOM_PROP_AS_STRING(dbus_req, pvt_data, out, property) do { \
- struct sss_domain_info *dom; \
When you declare a variable inside a macro, it's better to give it some strange name to minimize shadowing other variables. Something like _pvt_dom maybe.
\
- *(out) = NULL; \
\
- dom = get_domain_info_from_req((dbus_req), (pvt_data)); \
- if (dom == NULL) { \
return; \
- } \
\
- *(out) = dom->realm; \
dom->property :-)
+} while (0)
The rest looks good to me. I'm still reviewing the latest patch, but I can't apply the one you sent previously to the thread, can you rebase (or rather regenerate the code, I think something had change in the last iteration of the GetAll patches that are luckily pushed now).
On Mon, May 26, 2014 at 10:33:22PM +0200, Pavel Březina wrote:
From f9be8417fefd5e336a85fece276e5601b75f3ccf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20B=C5=99ezina?= pbrezina@redhat.com Date: Fri, 2 May 2014 13:08:21 +0200 Subject: [PATCH 4/4] IFP: Implement SSSD components
Some general comments while you're rebasing the patch..
+int ifp_find_backend_by_name(struct sbus_request *req,
void *data,
const char *arg_name)
+{
- struct ifp_ctx *ctx = NULL;
- DBusError *error = NULL;
- const char *result = NULL;
- ctx = talloc_get_type(data, struct ifp_ctx);
- if (ctx == NULL) {
DEBUG(SSSDBG_CRIT_FAILURE, "Invalid ifp context!\n");
error = sbus_error_new(req, DBUS_ERROR_FAILED, "Invalid ifp context!");
return sbus_request_fail_and_finish(req, error);
- }
- if (backend_exists(ctx->rctx->cdb, arg_name)) {
result = ifp_reply_objpath(req, PATH_BACKENDS, arg_name);
if (result == NULL) {
error = sbus_error_new(req, DBUS_ERROR_NO_MEMORY,
"%s", strerror(ENOMEM));
return sbus_request_fail_and_finish(req, error);
We now have two ways to handle ENOMEM in IFP. The one above, and the one is that I used previously as suggested by Stef: if (ptr == NULL) { return sbus_request_finish(dbus_req, NULL); }
It's simpler because if the system is really OOM, you won't be able to construct the error and in most cases even send the reply back..
(In general we have different opinion on handling OOM with Stef, but this seemed like a common ground)
I would prefer if the responder codebase used one way to handle ENOMEM consistently.
}
- } else {
error = sbus_error_new(req, DBUS_ERROR_FAILED,
"Backend \"%s\" does not exist", arg_name);
return sbus_request_fail_and_finish(req, error);
- }
- return infopipe_iface_FindBackendByName_finish(req, result);
+}
+#ifndef HAVE_CONFIG_LIB +int ifp_component_enable(struct sbus_request *req, void *data)
I wonder if it would be safer to have the #ifndef inside the function to only keep one declaration of each function instead of two?
Maybe: int ifp_component_enable(struct sbus_request *req, void *data) { #ifdef HAVE_CONFIG_LIB /* Do stuff */ retun infopipe_component_Enable_finish(); #else return sbus_request_fail_and_finish(req, sbus_error_new(req, DBUS_ERROR_NOT_SUPPORTED, NULL)); #endif }
+{
- return sbus_request_fail_and_finish(req,
sbus_error_new(req, DBUS_ERROR_NOT_SUPPORTED, NULL));
+} +#else +int ifp_component_enable(struct sbus_request *req, void *data)
It would be nice to use dbus_req, not req as the variable name. I know that's how codegen currently generates the code and I have a TODO item to change the name there as well. Everytime I see a variable names 'req' I think of it as a tevent_req..
We can rename the variable post-beta, if that's too much work, I don't want to delay the patches any longer, but maybe it's just one click with your mighty IDE?
+{
- struct ifp_ctx *ctx = NULL;
- DBusError *error = NULL;
- const char *path = dbus_message_get_path(req->message);
- char *name = NULL;
- enum component_type type;
- struct sss_config_ctx *config_ctx = NULL;
- errno_t ret;
- ctx = talloc_get_type(data, struct ifp_ctx);
- if (ctx == NULL) {
DEBUG(SSSDBG_CRIT_FAILURE, "Invalid ifp context!\n");
error = sbus_error_new(req, DBUS_ERROR_FAILED, "Invalid ifp context!");
goto done;
- }
- ret = check_and_get_component_from_path(req, ctx->rctx->cdb,
path, &type, &name);
- if (ret != EOK) {
error = sbus_error_new(req, DBUS_ERROR_FAILED, "%s", strerror(ret));
goto done;
- }
- config_ctx = sss_config_open(NULL, NULL, CONFDB_DEFAULT_CONFIG_FILE);
Can you use req/dbus_req here as the talloc context?
- if (config_ctx == NULL) {
error = sbus_error_new(req, DBUS_ERROR_NO_MEMORY,
"%s", strerror(ENOMEM));
goto done;
- }
- switch (type) {
- case COMPONENT_MONITOR:
error = sbus_error_new(req, DBUS_ERROR_NOT_SUPPORTED, NULL);
goto done;
break;
- case COMPONENT_RESPONDER:
ret = sss_config_service_enable(config_ctx, name);
break;
- case COMPONENT_BACKEND:
ret = sss_config_domain_enable(config_ctx, name);
break;
- }
- if (ret != EOK) {
error = sbus_error_new(req, DBUS_ERROR_FAILED, "%s", strerror(ret));
goto done;
- }
- ret = sss_config_save(config_ctx);
- if (ret != EOK) {
error = sbus_error_new(req, DBUS_ERROR_FAILED, "%s", strerror(ret));
goto done;
- }
+done:
- sss_config_close(&config_ctx);
- if (error != NULL) {
return sbus_request_fail_and_finish(req, error);
- }
- return infopipe_component_Enable_finish(req);
+} +#endif
In general the patches look good to me.
On Thu, May 22, 2014 at 07:57:28PM +0200, Pavel Březina wrote:
On 05/21/2014 11:03 PM, Jakub Hrozek wrote:
Hi,
the attaches two patches implement DBus methods to retrieve SSSD domains using the system bus as well as two example getters that leverage the infrastructure to Get and GetAll the object properties.
Pavel, I know you have a large patchset in a private tree that implements the other getters and moves the domain methods into a separate file. I'm fine with merging your and mine patches, I just wanted to get the ball rolling on the list. Feel free to reply with your patchset.
Hi, see the attachment.
I squash all my patches to these five - mainly discarded the moving the code around.
I kept you as the author for the methods as I made only very minor changes there. However, I took the ownership for the properties since there only very little of your original code remains there - I hope you don't mind.
The next three patches implements the SSSD components interface required for the OpenLMI provider. I'm sending it to this thread since it depends on the domain patches anyway - there is enough dependency fuzz already.
From 0f1e1adba39f203ad6405531a21d28d5c9bfa9ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20B=C5=99ezina?= pbrezina@redhat.com Date: Mon, 5 May 2014 13:28:34 +0200 Subject: [PATCH 3/5] confdb: add confdb_list_all_domain_names()
ACK.
See attached unit test I used for testing.
On 05/26/2014 07:05 PM, Jakub Hrozek wrote:
On Thu, May 22, 2014 at 07:57:28PM +0200, Pavel Březina wrote:
On 05/21/2014 11:03 PM, Jakub Hrozek wrote:
Hi,
the attaches two patches implement DBus methods to retrieve SSSD domains using the system bus as well as two example getters that leverage the infrastructure to Get and GetAll the object properties.
Pavel, I know you have a large patchset in a private tree that implements the other getters and moves the domain methods into a separate file. I'm fine with merging your and mine patches, I just wanted to get the ball rolling on the list. Feel free to reply with your patchset.
Hi, see the attachment.
I squash all my patches to these five - mainly discarded the moving the code around.
I kept you as the author for the methods as I made only very minor changes there. However, I took the ownership for the properties since there only very little of your original code remains there - I hope you don't mind.
The next three patches implements the SSSD components interface required for the OpenLMI provider. I'm sending it to this thread since it depends on the domain patches anyway - there is enough dependency fuzz already.
From 0f1e1adba39f203ad6405531a21d28d5c9bfa9ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20B=C5=99ezina?= pbrezina@redhat.com Date: Mon, 5 May 2014 13:28:34 +0200 Subject: [PATCH 3/5] confdb: add confdb_list_all_domain_names()
ACK.
See attached unit test I used for testing.
Hi, the tests looks good, however there are three tests in one test. It should be split.
On Mon, May 26, 2014 at 10:36:35PM +0200, Pavel Březina wrote:
On 05/26/2014 07:05 PM, Jakub Hrozek wrote:
On Thu, May 22, 2014 at 07:57:28PM +0200, Pavel Březina wrote:
On 05/21/2014 11:03 PM, Jakub Hrozek wrote:
Hi,
the attaches two patches implement DBus methods to retrieve SSSD domains using the system bus as well as two example getters that leverage the infrastructure to Get and GetAll the object properties.
Pavel, I know you have a large patchset in a private tree that implements the other getters and moves the domain methods into a separate file. I'm fine with merging your and mine patches, I just wanted to get the ball rolling on the list. Feel free to reply with your patchset.
Hi, see the attachment.
I squash all my patches to these five - mainly discarded the moving the code around.
I kept you as the author for the methods as I made only very minor changes there. However, I took the ownership for the properties since there only very little of your original code remains there - I hope you don't mind.
The next three patches implements the SSSD components interface required for the OpenLMI provider. I'm sending it to this thread since it depends on the domain patches anyway - there is enough dependency fuzz already.
From 0f1e1adba39f203ad6405531a21d28d5c9bfa9ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20B=C5=99ezina?= pbrezina@redhat.com Date: Mon, 5 May 2014 13:28:34 +0200 Subject: [PATCH 3/5] confdb: add confdb_list_all_domain_names()
ACK.
See attached unit test I used for testing.
Hi, the tests looks good, however there are three tests in one test. It should be split.
OK, done, hopefully there is not too much duplication.
On Tue, May 27, 2014 at 02:43:25PM +0200, Jakub Hrozek wrote:
From 0f1e1adba39f203ad6405531a21d28d5c9bfa9ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20B=C5=99ezina?= pbrezina@redhat.com Date: Mon, 5 May 2014 13:28:34 +0200 Subject: [PATCH 3/5] confdb: add confdb_list_all_domain_names()
ACK.
See attached unit test I used for testing.
Hi, the tests looks good, however there are three tests in one test. It should be split.
OK, done, hopefully there is not too much duplication.
Sorry, I sent a wrong patch earlier.
On Thu, May 22, 2014 at 07:57:28PM +0200, Pavel Březina wrote:
On 05/21/2014 11:03 PM, Jakub Hrozek wrote:
Hi,
the attaches two patches implement DBus methods to retrieve SSSD domains using the system bus as well as two example getters that leverage the infrastructure to Get and GetAll the object properties.
Pavel, I know you have a large patchset in a private tree that implements the other getters and moves the domain methods into a separate file. I'm fine with merging your and mine patches, I just wanted to get the ball rolling on the list. Feel free to reply with your patchset.
Hi, see the attachment.
I squash all my patches to these five - mainly discarded the moving the code around.
I kept you as the author for the methods as I made only very minor changes there. However, I took the ownership for the properties since there only very little of your original code remains there - I hope you don't mind.
The next three patches implements the SSSD components interface required for the OpenLMI provider. I'm sending it to this thread since it depends on the domain patches anyway - there is enough dependency fuzz already.
From a1a69124369eb50d37bc151802125b909fe7d1ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20B=C5=99ezina?= pbrezina@redhat.com Date: Tue, 6 May 2014 10:54:47 +0200 Subject: [PATCH 4/5] utils: add get_known_services()
src/monitor/monitor.c | 3 +-- src/util/util.c | 8 ++++++++ src/util/util.h | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c index a164ede8a46f5b383c56a23ada693ba6d2ca2210..5e6eb37fdbf30c4079b309d98a1b05fdffdf65c7 100644 --- a/src/monitor/monitor.c +++ b/src/monitor/monitor.c @@ -888,8 +888,7 @@ done:
static char *check_services(char **services) {
- const char *known_services[] = { "nss", "pam", "sudo", "autofs", "ssh",
"pac", "ifp", NULL };
- const char * const *known_services = get_known_services(); int i; int ii;
diff --git a/src/util/util.c b/src/util/util.c index fc37aad229813f328c9af007a005569bb02c5091..ad93ca1a0715e3a5f5c6c7371eb142718c38afa3 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -806,3 +806,11 @@ bool check_ipv6_addr(struct in6_addr *addr, uint8_t flags)
return true;
}
+const char * const * get_known_services(void) +{
- static const char *svc[] = {"nss", "pam", "sudo", "autofs",
"ssh", "pac", "ifp", NULL };
- return svc;
+} diff --git a/src/util/util.h b/src/util/util.h index 54c6c6c78b87398da66e276d67a04f4558cec790..de7f9e553ef8f91df88fe7a71284538358e8798d 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -377,6 +377,8 @@ errno_t check_and_open_readonly(const char *filename, int *fd, bool check_ipv4_addr(struct in_addr *addr, uint8_t check); bool check_ipv6_addr(struct in6_addr *addr, uint8_t check);
+const char * const * get_known_services(void);
int split_on_separator(TALLOC_CTX *mem_ctx, const char *str, const char sep, bool trim, bool skip_empty, char ***_list, int *size); -- 1.7.11.7
ACK, see attached patch for what I tested with.
On 05/26/2014 07:14 PM, Jakub Hrozek wrote:
On Thu, May 22, 2014 at 07:57:28PM +0200, Pavel Březina wrote:
On 05/21/2014 11:03 PM, Jakub Hrozek wrote:
Hi,
the attaches two patches implement DBus methods to retrieve SSSD domains using the system bus as well as two example getters that leverage the infrastructure to Get and GetAll the object properties.
Pavel, I know you have a large patchset in a private tree that implements the other getters and moves the domain methods into a separate file. I'm fine with merging your and mine patches, I just wanted to get the ball rolling on the list. Feel free to reply with your patchset.
Hi, see the attachment.
I squash all my patches to these five - mainly discarded the moving the code around.
I kept you as the author for the methods as I made only very minor changes there. However, I took the ownership for the properties since there only very little of your original code remains there - I hope you don't mind.
The next three patches implements the SSSD components interface required for the OpenLMI provider. I'm sending it to this thread since it depends on the domain patches anyway - there is enough dependency fuzz already.
From a1a69124369eb50d37bc151802125b909fe7d1ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20B=C5=99ezina?= pbrezina@redhat.com Date: Tue, 6 May 2014 10:54:47 +0200 Subject: [PATCH 4/5] utils: add get_known_services()
src/monitor/monitor.c | 3 +-- src/util/util.c | 8 ++++++++ src/util/util.h | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c index a164ede8a46f5b383c56a23ada693ba6d2ca2210..5e6eb37fdbf30c4079b309d98a1b05fdffdf65c7 100644 --- a/src/monitor/monitor.c +++ b/src/monitor/monitor.c @@ -888,8 +888,7 @@ done:
static char *check_services(char **services) {
- const char *known_services[] = { "nss", "pam", "sudo", "autofs", "ssh",
"pac", "ifp", NULL };
- const char * const *known_services = get_known_services(); int i; int ii;
diff --git a/src/util/util.c b/src/util/util.c index fc37aad229813f328c9af007a005569bb02c5091..ad93ca1a0715e3a5f5c6c7371eb142718c38afa3 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -806,3 +806,11 @@ bool check_ipv6_addr(struct in6_addr *addr, uint8_t flags)
return true;
}
+const char * const * get_known_services(void) +{
- static const char *svc[] = {"nss", "pam", "sudo", "autofs",
"ssh", "pac", "ifp", NULL };
- return svc;
+} diff --git a/src/util/util.h b/src/util/util.h index 54c6c6c78b87398da66e276d67a04f4558cec790..de7f9e553ef8f91df88fe7a71284538358e8798d 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -377,6 +377,8 @@ errno_t check_and_open_readonly(const char *filename, int *fd, bool check_ipv4_addr(struct in_addr *addr, uint8_t check); bool check_ipv6_addr(struct in6_addr *addr, uint8_t check);
+const char * const * get_known_services(void);
- int split_on_separator(TALLOC_CTX *mem_ctx, const char *str, const char sep, bool trim, bool skip_empty, char ***_list, int *size);
-- 1.7.11.7
ACK, see attached patch for what I tested with.
Ack. Thank you for the test.
Hi, I'm starting a new thread branch, since the review mails got kind of separated and it starts to be confusing.
I'm sending new patch set including also Jakub's tests, all issues should be fixed.
Ack to all Jakub's patches.
On Tue, May 27, 2014 at 10:28:42PM +0200, Pavel Březina wrote:
Hi, I'm starting a new thread branch, since the review mails got kind of separated and it starts to be confusing.
I'm sending new patch set including also Jakub's tests, all issues should be fixed.
Ack to all Jakub's patches.
Squash in the following patch to the ifp_domains code and I'll ack :-)
On 05/28/2014 10:48 AM, Jakub Hrozek wrote:
On Tue, May 27, 2014 at 10:28:42PM +0200, Pavel Březina wrote:
Hi, I'm starting a new thread branch, since the review mails got kind of separated and it starts to be confusing.
I'm sending new patch set including also Jakub's tests, all issues should be fixed.
Ack to all Jakub's patches.
Squash in the following patch to the ifp_domains code and I'll ack :-)
Thanks. New patches are attached.
On Wed, May 28, 2014 at 11:05:38AM +0200, Pavel Březina wrote:
On 05/28/2014 10:48 AM, Jakub Hrozek wrote:
On Tue, May 27, 2014 at 10:28:42PM +0200, Pavel Březina wrote:
Hi, I'm starting a new thread branch, since the review mails got kind of separated and it starts to be confusing.
I'm sending new patch set including also Jakub's tests, all issues should be fixed.
Ack to all Jakub's patches.
Squash in the following patch to the ifp_domains code and I'll ack :-)
Thanks. New patches are attached.
These work fine.
ACK
On Wed, May 28, 2014 at 11:37:50AM +0200, Jakub Hrozek wrote:
On Wed, May 28, 2014 at 11:05:38AM +0200, Pavel Březina wrote:
On 05/28/2014 10:48 AM, Jakub Hrozek wrote:
On Tue, May 27, 2014 at 10:28:42PM +0200, Pavel Březina wrote:
Hi, I'm starting a new thread branch, since the review mails got kind of separated and it starts to be confusing.
I'm sending new patch set including also Jakub's tests, all issues should be fixed.
Ack to all Jakub's patches.
Squash in the following patch to the ifp_domains code and I'll ack :-)
Thanks. New patches are attached.
These work fine.
ACK
..or not. Lukas found out that there are Coverity warnings. The attached patches fix them.
On (28/05/14 14:15), Jakub Hrozek wrote:
On Wed, May 28, 2014 at 11:37:50AM +0200, Jakub Hrozek wrote:
On Wed, May 28, 2014 at 11:05:38AM +0200, Pavel Březina wrote:
On 05/28/2014 10:48 AM, Jakub Hrozek wrote:
On Tue, May 27, 2014 at 10:28:42PM +0200, Pavel Březina wrote:
Hi, I'm starting a new thread branch, since the review mails got kind of separated and it starts to be confusing.
I'm sending new patch set including also Jakub's tests, all issues should be fixed.
Ack to all Jakub's patches.
Squash in the following patch to the ifp_domains code and I'll ack :-)
Thanks. New patches are attached.
These work fine.
ACK
..or not. Lukas found out that there are Coverity warnings. The attached patches fix them.
problem are fixed.
From 9e8f12c809823f4b7399734005ede6d4547d0510 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek jhrozek@redhat.com Date: Wed, 28 May 2014 13:14:20 +0200 Subject: [PATCH] fixup for components
ACK
From 313623150e661105388af95c906488866236b97a Mon Sep 17 00:00:00 2001 From: Jakub Hrozek jhrozek@redhat.com Date: Wed, 28 May 2014 14:11:54 +0200 Subject: [PATCH] Return dbus error if set
ACK
I also tested dbus methods and they work like a charm :-) ListComponents(out ao components); ListResponders(out ao responders); ListBackends(out ao backends); FindMonitor(out o monitor); FindResponderByName(in s name, out o responder); FindBackendByName(in s name, out o backend); FindDomainByName(in s name, out o domain); ListDomains(out ao domain);
LS
On Wed, May 28, 2014 at 03:12:12PM +0200, Lukas Slebodnik wrote:
These work fine.
ACK
..or not. Lukas found out that there are Coverity warnings. The attached patches fix them.
problem are fixed.
From 9e8f12c809823f4b7399734005ede6d4547d0510 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek jhrozek@redhat.com Date: Wed, 28 May 2014 13:14:20 +0200 Subject: [PATCH] fixup for components
ACK
From 313623150e661105388af95c906488866236b97a Mon Sep 17 00:00:00 2001 From: Jakub Hrozek jhrozek@redhat.com Date: Wed, 28 May 2014 14:11:54 +0200 Subject: [PATCH] Return dbus error if set
ACK
Thanks, I squashed them into the components patch and pushed the whole lot to master: 5246ab9134aa2c8b977b3b1f7b0929cfbbaf951f c61aa53b0d4631630e6757c62193a10b50c8c2e0 8a1fd0633e85221da1fb63451516a70d66c0af31 ebd2db737485d334cd54316e05f848f3ccfd2fee d81f46fb294a6f6f64d3237ab0e0ab01f2c5ea20 d387c4608dbd3ca056e18e85313ef51aac146fd2 590582be38cdbfde387fcc57df92903d48c5a083
On (28/05/14 11:05), Pavel Březina wrote:
On 05/28/2014 10:48 AM, Jakub Hrozek wrote:
On Tue, May 27, 2014 at 10:28:42PM +0200, Pavel Březina wrote:
Hi, I'm starting a new thread branch, since the review mails got kind of separated and it starts to be confusing.
I'm sending new patch set including also Jakub's tests, all issues should be fixed.
Ack to all Jakub's patches.
Squash in the following patch to the ifp_domains code and I'll ack :-)
Thanks. New patches are attached.
There is a warning: src/responder/ifp/ifp_components.c:443:61: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security] error = sbus_error_new(dbus_req, DBUS_ERROR_FAILED, strerror(EINVAL)); ^~~~~~~~~~~~~~~~ 1 error generated.
And warnings from static analysers Error: CLANG_WARNING: [#def2] sssd-1.11.90/src/responder/ifp/ifp_components.c:497:9: warning: Value stored to 'error' is never read # error = sbus_error_new(dbus_req, DBUS_ERROR_NOT_SUPPORTED, NULL); # ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: CLANG_WARNING: [#def4] sssd-1.11.90/src/responder/ifp/ifp_components.c:566:9: warning: Value stored to 'error' is never read # error = sbus_error_new(dbus_req, DBUS_ERROR_NOT_SUPPORTED, NULL); # ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LS
sssd-devel@lists.fedorahosted.org