From bc1619137d200d0ef50851d6f9f4261e0abe330c Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Fri, 9 Mar 2012 11:49:12 -0500 Subject: [PATCH 2/2] Handle empty elements in proxy netgroups: --- src/providers/proxy/proxy_netgroup.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/providers/proxy/proxy_netgroup.c b/src/providers/proxy/proxy_netgroup.c index 0c8f5c66087f68fff30ba07eff4013b591a36106..afc57ecbe2eac1a765124d898cb77485fbd9c629 100644 --- a/src/providers/proxy/proxy_netgroup.c +++ b/src/providers/proxy/proxy_netgroup.c @@ -28,6 +28,8 @@ #define BUFLEN 1024 +#define get_triple_el(s) ((s) ? (s) : "") + static errno_t make_netgroup_attr(struct __netgrent netgrent, struct sysdb_attrs *attrs) { @@ -42,9 +44,10 @@ static errno_t make_netgroup_attr(struct __netgrent netgrent, return ret; } } else if (netgrent.type == triple_val) { - dummy = talloc_asprintf(attrs, "(%s,%s,%s)", netgrent.val.triple.host, - netgrent.val.triple.user, - netgrent.val.triple.domain); + dummy = talloc_asprintf(attrs, "(%s,%s,%s)", + get_triple_el(netgrent.val.triple.host), + get_triple_el(netgrent.val.triple.user), + get_triple_el(netgrent.val.triple.domain)); if (dummy == NULL) { DEBUG(1, ("talloc_asprintf failed.\n")); return ENOMEM; -- 1.7.7.6