From 8cc09cd0cfb7dfba4a6262bb7839c934102ef3fe Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Fri, 19 Oct 2012 20:34:21 +0000 Subject: allow attribute options in attribute mapping expressions git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1803 ef36b2f9-881f-0410-afb5-c4e39611909c --- common/expr.c | 2 +- tests/test_expr.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/common/expr.c b/common/expr.c index 7fa4f84..33f9820 100644 --- a/common/expr.c +++ b/common/expr.c @@ -51,7 +51,7 @@ MUST_USE static const char *parse_name(const char *str,int *ptr,char *buffer,siz /* look for an alpha+alphanumeric* string */ if (!my_isalpha(str[*ptr])) return NULL; - while (my_isalphanum(str[*ptr])) + while (my_isalphanum(str[*ptr])||(str[*ptr]==';')) { if ((size_t)i>=buflen) return NULL; diff --git a/tests/test_expr.c b/tests/test_expr.c index 1ea4f8d..da8f46a 100644 --- a/tests/test_expr.c +++ b/tests/test_expr.c @@ -126,6 +126,11 @@ static void test_expr_vars(void) assert(set_contains(set,"uidNumber")); assert(set_contains(set,"uid")); set_free(set); + /* a test with attribute options */ + set=set_new(); + assert(expr_vars("\"${homeDirectory;foo:-/home/something}\"",set)!=NULL); + assert(set_contains(set,"homeDirectory;foo")); + set_free(set); } /* the main program... */ -- cgit v1.2.3