nss-pam-ldapd commit: r1472 - in nss-pam-ldapd-0.7: . common tests
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
nss-pam-ldapd commit: r1472 - in nss-pam-ldapd-0.7: . common tests
- From: Commits of the nss-pam-ldapd project <nss-pam-ldapd-commits [at] lists.arthurdejong.org>
- To: nss-pam-ldapd-commits [at] lists.arthurdejong.org
- Reply-to: nss-pam-ldapd-users [at] lists.arthurdejong.org
- Subject: nss-pam-ldapd commit: r1472 - in nss-pam-ldapd-0.7: . common tests
- Date: Sun, 5 Jun 2011 11:18:10 +0200 (CEST)
Author: arthur
Date: Sun Jun 5 11:18:08 2011
New Revision: 1472
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?view=rev&revision=1472
Log:
handle expressions where the expander function returns NULL (handle it as an
empty string) (r1471 from development)
Modified:
nss-pam-ldapd-0.7/ (props changed)
nss-pam-ldapd-0.7/common/expr.c
nss-pam-ldapd-0.7/tests/test_expr.c
Modified: nss-pam-ldapd-0.7/common/expr.c
==============================================================================
--- nss-pam-ldapd-0.7/common/expr.c Sun Jun 5 11:14:12 2011 (r1471)
+++ nss-pam-ldapd-0.7/common/expr.c Sun Jun 5 11:18:08 2011 (r1472)
@@ -93,6 +93,8 @@
if (parse_name(str,ptr,varname,sizeof(varname))==NULL)
return NULL;
varvalue=expander(varname,expander_arg);
+ if (varvalue==NULL)
+ varvalue="";
if (str[*ptr]=='}')
{
/* simple substitute */
@@ -148,6 +150,8 @@
if (parse_name(str,ptr,varname,sizeof(varname))==NULL)
return NULL;
varvalue=expander(varname,expander_arg);
+ if (varvalue==NULL)
+ varvalue="";
if (strlen(varvalue)>=buflen)
return NULL;
strcpy(buffer,varvalue);
Modified: nss-pam-ldapd-0.7/tests/test_expr.c
==============================================================================
--- nss-pam-ldapd-0.7/tests/test_expr.c Sun Jun 5 11:14:12 2011 (r1471)
+++ nss-pam-ldapd-0.7/tests/test_expr.c Sun Jun 5 11:18:08 2011 (r1472)
@@ -68,6 +68,8 @@
{
if (strcmp(name,"empty")==0)
return "";
+ if (strcmp(name,"null")==0)
+ return NULL;
else
return "foobar";
}
@@ -79,6 +81,8 @@
assertstreq(buffer,"foobar");
assert(expr_parse("$empty",buffer,sizeof(buffer),expanderfn,NULL)!=NULL);
assertstreq(buffer,"");
+
assert(expr_parse("$foo1+$null+$foo2",buffer,sizeof(buffer),expanderfn,NULL)!=NULL);
+ assertstreq(buffer,"foobar++foobar");
assert(expr_parse("${test1}\\$",buffer,sizeof(buffer),expanderfn,NULL)!=NULL);
assertstreq(buffer,"foobar$");
assert(expr_parse("${test1:-default}",buffer,sizeof(buffer),expanderfn,NULL)!=NULL);
--
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits
- nss-pam-ldapd commit: r1472 - in nss-pam-ldapd-0.7: . common tests,
Commits of the nss-pam-ldapd project