diff options
author | Steve Hill <steve@opendium.com> | 2013-03-20 14:48:14 +0100 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2013-03-24 22:48:12 +0100 |
commit | 08f5301d802bddf754923ffc503366d33fc4b4dd (patch) | |
tree | 45e72c3b86a453272cd71ec6ef8d1d759bbd1dc0 | |
parent | edd119c3a0d532fc5f87ccf89585370cb2fa3fed (diff) |
Implement a mkfilter_group_bymemberdn() function
This was part of a bigger change to implement nested groups, however most of
the other parts were re-implemented differently.
For the original changes, see:
http://lists.arthurdejong.org/nss-pam-ldapd-users/2013/msg00034.html
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | nslcd/group.c | 15 |
2 files changed, 16 insertions, 0 deletions
@@ -120,3 +120,4 @@ Matthew L. Dailey <matthew.l.dailey@dartmouth.edu> Chris Hiestand <chiestand@salk.edu> Jon Severinsson <jon@severinsson.net> Thorsten Glaser <t.glaser@tarent.de> +Steve Hill <steve@opendium.com> diff --git a/nslcd/group.c b/nslcd/group.c index 868110c..af7a23a 100644 --- a/nslcd/group.c +++ b/nslcd/group.c @@ -6,6 +6,7 @@ Copyright (C) 1997-2006 Luke Howard Copyright (C) 2006 West Consulting Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Arthur de Jong + Copyright (C) 2013 Steve Hill This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -135,6 +136,20 @@ static int mkfilter_group_bymember(MYLDAP_SESSION *session, attmap_group_member, safedn); } +static int mkfilter_group_bymemberdn(MYLDAP_SESSION *session, + const char *dn, + char *buffer, size_t buflen) +{ + char safedn[300]; + /* escape DN */ + if (myldap_escape(dn, safedn, sizeof(safedn))) + return -1; + return mysnprintf(buffer, buflen, + "(&%s(%s=%s))", + group_filter, + attmap_group_member, safedn); +} + void group_init(void) { int i; |