On Tue, Apr 05, 2016 at 02:54:10PM -0400, Simo Sorce wrote:
On Tue, 2016-04-05 at 12:57 -0400, Simo Sorce wrote:
> Thanks, IIRC the int-instead of enum use is intentional, I will look
> at the others.
The last coverity/clang thing is a false positive, but I initialized
reply to NULL anyway, I expect now it will start complaining of possible
NULL dereference :-)
Attached find patches that fixes all other issues (hopefully), one of
them simply dropped an entire function as it turned out I wasn't using
it.
Simo.
--
Simo Sorce * Red Hat, Inc * New York
From 4610b546cb37a150ebaee12559c19a17e422708c Mon Sep 17 00:00:00
2001
From: Simo Sorce <simo(a)redhat.com>
Date: Thu, 7 Jan 2016 10:17:38 -0500
Subject: [PATCH 05/15] Responders: Add support for socket activation
ACK (visual at this point) with a question - do we want to check
that the fd we received is a UNIX socket using sd_is_socket_unix()?
The sd_listen_fds() manpage recommends that.
From 3755b157de1309f554a380e58c42c38dcd9cc5aa Mon Sep 17 00:00:00
2001
From: Simo Sorce <simo(a)redhat.com>
Date: Wed, 20 Jan 2016 10:33:39 -0500
Subject: [PATCH 06/15] ConfDB: Add helper function to get "subsections"
The secrets database will have "subsections", ie sections that are in the
"secrets" namespace and look like this: [secrets/<path>]
This function allows to source any section under secrets/ or under any
arbitrary sub-path.
Related:
https://fedorahosted.org/sssd/ticket/2913
---
src/confdb/confdb.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++
src/confdb/confdb.h | 26 +++++++++++++++
2 files changed, 118 insertions(+)
diff --git a/src/confdb/confdb.c b/src/confdb/confdb.c
index d409344890c869aa3e7b2dbb49c0f51cd3a20adc..03adbe593b42f556b560df77d410f80460200a67
100644
--- a/src/confdb/confdb.c
+++ b/src/confdb/confdb.c
@@ -1531,3 +1531,95 @@ done:
talloc_free(tmp_ctx);
return ret;
}
+
+int confdb_get_sub_sections(TALLOC_CTX *mem_ctx,
+ struct confdb_ctx *cdb,
+ const char *section,
+ char ***sections,
+ int *num_sections)
+{
+ TALLOC_CTX *tmp_ctx = NULL;
+ char *secdn;
+ struct ldb_dn *base = NULL;
+ struct ldb_result *res = NULL;
+ static const char *attrs[] = {"cn", NULL};
+ char **names;
+ int base_comp_num;
+ int num;
+ int i;
Can you use size_t here so that clang doesn't complain about "comparison
of integers of different signs: 'int' and 'unsigned int'" in the for
loop below?
+ int ret;
+
+ tmp_ctx = talloc_new(mem_ctx);
+ if (tmp_ctx == NULL) {
+ return ENOMEM;
+ }
+
+ ret = parse_section(tmp_ctx, section, &secdn, NULL);
+ if (ret != EOK) {
+ goto done;
+ }
+
+ base = ldb_dn_new(tmp_ctx, cdb->ldb, secdn);
+ if (base == NULL) {
+ ret = ENOMEM;
+ goto done;
+ }
+
+ base_comp_num = ldb_dn_get_comp_num(base);
+
+ ret = ldb_search(cdb->ldb, tmp_ctx, &res, base, LDB_SCOPE_SUBTREE,
+ attrs, NULL);
+ if (ret != LDB_SUCCESS) {
+ ret = EIO;
+ goto done;
+ }
+
+ names = talloc_zero_array(tmp_ctx, char *, res->count + 1);
+ if (names == NULL) {
+ ret = ENOMEM;
+ goto done;
+ }
+
+ for (num = 0, i = 0; i < res->count; i++) {
+ const struct ldb_val *val;
+ char *name;
+ int n;
+ int j;
Every time I see variables declared in a scope in C except loop control
variables I think "This should be a static function of its own" :-)
+
+ n = ldb_dn_get_comp_num(res->msgs[i]->dn);
+ if (n == base_comp_num) continue;
+
+ name = NULL;
+ for (j = n - base_comp_num - 1; j >= 0; j--) {
+ val = ldb_dn_get_component_val(res->msgs[i]->dn, j);
+ if (name == NULL) {
+ name = talloc_strndup(names,
+ (const char *)val->data, val->length);
+ } else {
+ name = talloc_asprintf(names, "%s/%.*s", name,
+ (int)val->length,
+ (const char *)val->data);
+ }
+ if (name == NULL) {
+ ret = ENOMEM;
+ goto done;
+ }
+ }
+
+ names[num] = name;
+ if (names[num] == NULL) {
+ ret = ENOMEM;
+ goto done;
+ }
+
+ num++;
+ }
From 082d09cac5919d651accda2d4163deb022fcb7f6 Mon Sep 17 00:00:00
2001
From: Simo Sorce <simo(a)redhat.com>
Date: Fri, 8 Jan 2016 10:56:17 -0500
Subject: [PATCH 07/15] Secrets: Add autoconf macros to build with secrets
Prepares autoconf for the new Secrets Provider
ACK
From aa6203a0a6cb1f3ac60428887e77fe176489c3e0 Mon Sep 17 00:00:00
2001
From: Christian Heimes <cheimes(a)redhat.com>
Date: Fri, 8 Jan 2016 13:26:22 +0100
Subject: [PATCH 08/15] Secrets: m4 macros for jansson and http-parser
Prepares autoconf for the new Secrets Provider dependencies
Related:
https://fedorahosted.org/sssd/ticket/2913
[...]
+PKG_CHECK_MODULES([HTTP_PARSER], [http_parser],
[found_http_parser=yes], [found_http_parser=no])
There is no pkgconfig for http-parser-devel, so it seems to be this line
is redundant.
Otherwise ACK.