lists.arthurdejong.org
RSS feed

nss-pam-ldapd branch master updated. 0.9.3-6-g18d05b0

[Date Prev][Date Next] [Thread Prev][Thread Next]

nss-pam-ldapd branch master updated. 0.9.3-6-g18d05b0



This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "nss-pam-ldapd".

The branch, master has been updated
       via  18d05b01dc6a53481b67839ca0332f56bf456f1e (commit)
       via  fbea2a5d693a36a9899d22a20317b4c82253adbe (commit)
      from  2274b41dcb6bbb2557ab0e4358a11f1d54da12d7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://arthurdejong.org/git/nss-pam-ldapd/commit/?id=18d05b01dc6a53481b67839ca0332f56bf456f1e

commit 18d05b01dc6a53481b67839ca0332f56bf456f1e
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Sun May 4 16:03:53 2014 +0200

    Add a test for setting member attribute mapping

diff --git a/.gitignore b/.gitignore
index 294a9f4..63f34cd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -62,6 +62,7 @@ stamp-*
 /tests/temp.cfg
 /tests/test*.log
 /tests/test*.trs
+/tests/test_attmap
 /tests/test_cfg
 /tests/test_clock
 /tests/test_common
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 862b510..cf1009e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -19,8 +19,8 @@
 # 02110-1301 USA
 
 TESTS = test_dict test_set test_tio test_expr test_getpeercred test_cfg \
-        test_myldap.sh test_common test_nsscmds.sh test_pamcmds.sh \
-        test_manpages.sh test_clock test_tio_timeout
+        test_attmap test_myldap.sh test_common test_nsscmds.sh \
+        test_pamcmds.sh test_manpages.sh test_clock test_tio_timeout
 if HAVE_PYTHON
   TESTS += test_pycompile.sh test_pylint.sh
 endif
@@ -32,8 +32,8 @@ AM_TESTS_ENVIRONMENT = PYTHON='@PYTHON@'; export PYTHON; \
                        builddir=$(builddir); export builddir;
 
 check_PROGRAMS = test_dict test_set test_tio test_expr test_getpeercred \
-                 test_cfg test_myldap test_common test_clock test_tio_timeout \
-                 lookup_netgroup lookup_shadow
+                 test_cfg test_attmap test_myldap test_common test_clock \
+                 test_tio_timeout lookup_netgroup lookup_shadow
 
 EXTRA_DIST = README nslcd-test.conf usernames.txt testenv.sh test_myldap.sh \
              test_nsscmds.sh  test_pamcmds.sh test_pamcmds.expect \
@@ -76,6 +76,9 @@ common_nslcd_LDADD = ../nslcd/log.o ../nslcd/common.o 
../nslcd/invalidator.o \
 test_cfg_SOURCES = test_cfg.c common.h
 test_cfg_LDADD = $(common_nslcd_LDADD)
 
+test_attmap_SOURCES = test_attmap.c common.h
+test_attmap_LDADD = ../nslcd/cfg.o $(common_nslcd_LDADD)
+
 test_myldap_SOURCES = test_myldap.c common.h
 test_myldap_LDADD = ../nslcd/cfg.o $(common_nslcd_LDADD)
 
diff --git a/tests/test_attmap.c b/tests/test_attmap.c
new file mode 100644
index 0000000..112d5fa
--- /dev/null
+++ b/tests/test_attmap.c
@@ -0,0 +1,56 @@
+/*
+   test_cfg.c - simple test for the cfg module
+   This file is part of the nss-pam-ldapd library.
+
+   Copyright (C) 2014 Arthur de Jong
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301 USA
+*/
+
+#include "config.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+#include "common.h"
+
+#include "nslcd/attmap.h"
+
+static void test_member_map(void)
+{
+  const char **var;
+  const char *res;
+  var = attmap_get_var(LM_GROUP, "member");
+  assert(var != NULL);
+  /* expected mapping */
+  res = attmap_set_mapping(var, "uniqueMember");
+  assert(res != NULL);
+  assertstreq(res, "uniqueMember");
+  /* no support for expressions */
+  res = attmap_set_mapping(var, "\"$fred\"");
+  assert(res == NULL);
+  /* but support empty string */
+  res = attmap_set_mapping(var, "\"\"");
+  assert(res != NULL);
+  assertstreq(res, "\"\"");
+}
+
+int main(int UNUSED(argc), char UNUSED(*argv[]))
+{
+  test_member_map();
+  return EXIT_SUCCESS;
+}

http://arthurdejong.org/git/nss-pam-ldapd/commit/?id=fbea2a5d693a36a9899d22a20317b4c82253adbe

commit fbea2a5d693a36a9899d22a20317b4c82253adbe
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Sun May 4 13:37:04 2014 +0200

    Fix mapping group member attribute to empty string
    
    This fixes be94912.

diff --git a/nslcd/attmap.c b/nslcd/attmap.c
index 11d730b..d024a59 100644
--- a/nslcd/attmap.c
+++ b/nslcd/attmap.c
@@ -233,7 +233,7 @@ const char *attmap_set_mapping(const char **var, const char 
*value)
         (var != &attmap_shadow_shadowFlag))
       return NULL;
     /* the member attribute may only be set to an empty string */
-    if ((var == attmap_group_member) && (strcmp(value, "\"\"") != 0))
+    if ((var == &attmap_group_member) && (strcmp(value, "\"\"") != 0))
       return NULL;
   }
   /* check if the value will be changed */

-----------------------------------------------------------------------

Summary of changes:
 .gitignore                                  |    1 +
 nslcd/attmap.c                              |    2 +-
 tests/Makefile.am                           |   11 ++++--
 tests/{test_tio_timeout.c => test_attmap.c} |   54 +++++++++++++++------------
 4 files changed, 39 insertions(+), 29 deletions(-)
 copy tests/{test_tio_timeout.c => test_attmap.c} (51%)


hooks/post-receive
-- 
nss-pam-ldapd
-- 
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits/