diff options
author | Jonathan Matthew <jmatthew@cvs.openbsd.org> | 2012-03-15 03:44:47 +0000 |
---|---|---|
committer | Jonathan Matthew <jmatthew@cvs.openbsd.org> | 2012-03-15 03:44:47 +0000 |
commit | e943017c7566d05a5d92993e2dd45656d0a3ab95 (patch) | |
tree | 7f1ed955f5596a2a5c95e89071b286873abdbaf3 | |
parent | 5d338038c0232f354369623be9116a9352c581fd (diff) |
Accept empty/nonexistant ldap attributes when we want a list. This allows
empty groups to show up, which is helpful if they're used as primary
groups.
ok dlg@
-rw-r--r-- | usr.sbin/ypldap/aldap.c | 6 | ||||
-rw-r--r-- | usr.sbin/ypldap/ldapclient.c | 11 |
2 files changed, 7 insertions, 10 deletions
diff --git a/usr.sbin/ypldap/aldap.c b/usr.sbin/ypldap/aldap.c index d99b2a53527..4dabe48dc4e 100644 --- a/usr.sbin/ypldap/aldap.c +++ b/usr.sbin/ypldap/aldap.c @@ -1,5 +1,5 @@ -/* $Id: aldap.c,v 1.28 2011/08/28 16:37:28 aschrijver Exp $ */ -/* $OpenBSD: aldap.c,v 1.28 2011/08/28 16:37:28 aschrijver Exp $ */ +/* $Id: aldap.c,v 1.29 2012/03/15 03:44:46 jmatthew Exp $ */ +/* $OpenBSD: aldap.c,v 1.29 2012/03/15 03:44:46 jmatthew Exp $ */ /* * Copyright (c) 2008 Alexander Schrijver <aschrijver@openbsd.org> @@ -400,7 +400,7 @@ aldap_match_attr(struct aldap_message *msg, char *inkey, char ***outvalues) char **ret; if (msg->body.search.attrs == NULL) - return (-1); + goto fail; LDAP_DEBUG("attr", msg->body.search.attrs); diff --git a/usr.sbin/ypldap/ldapclient.c b/usr.sbin/ypldap/ldapclient.c index 6814e375b73..b24066a668e 100644 --- a/usr.sbin/ypldap/ldapclient.c +++ b/usr.sbin/ypldap/ldapclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldapclient.c,v 1.23 2011/08/28 16:37:28 aschrijver Exp $ */ +/* $OpenBSD: ldapclient.c,v 1.24 2012/03/15 03:44:46 jmatthew Exp $ */ /* * Copyright (c) 2008 Alexander Schrijver <aschrijver@openbsd.org> @@ -461,12 +461,9 @@ client_build_req(struct idm *idm, struct idm_req *ir, struct aldap_message *m, GID_MAX, NULL); } } else if (idm->idm_list & F_LIST(i)) { - if (aldap_match_attr(m, idm->idm_attrs[i], &ldap_attrs) == -1) - return (-1); - if (ldap_attrs[0] == NULL) - return (-1); - for (k = 0; k >= 0 && ldap_attrs[k] != NULL; k++) { - /* XXX: Fail when attributes have ilegal characters e.g. ',' */ + aldap_match_attr(m, idm->idm_attrs[i], &ldap_attrs); + for (k = 0; k >= 0 && ldap_attrs && ldap_attrs[k] != NULL; k++) { + /* XXX: Fail when attributes have illegal characters e.g. ',' */ if (strlcat(ir->ir_line, ldap_attrs[k], sizeof(ir->ir_line)) >= sizeof(ir->ir_line)) continue; |