summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2012-03-09 11:49:12 -0500
committerStephen Gallagher <sgallagh@redhat.com>2012-03-09 15:09:14 -0500
commite92121354bcc2b2e85b91f5dfdaafec476d0d617 (patch)
tree032e31f2ef41531b3610fcdc3ce37a5da0126da1
parent7c9d530b83a5b2469533e232ca7d5af508e03901 (diff)
downloadsssd-e92121354bcc2b2e85b91f5dfdaafec476d0d617.tar.gz
sssd-e92121354bcc2b2e85b91f5dfdaafec476d0d617.tar.bz2
sssd-e92121354bcc2b2e85b91f5dfdaafec476d0d617.zip
Handle empty elements in proxy netgroups:
-rw-r--r--src/providers/proxy/proxy_netgroup.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/providers/proxy/proxy_netgroup.c b/src/providers/proxy/proxy_netgroup.c
index 0c8f5c66..afc57ecb 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;