lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1169 - nss-pam-ldapd/common

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

nss-pam-ldapd commit: r1169 - nss-pam-ldapd/common



Author: arthur
Date: Sat Aug 14 15:16:11 2010
New Revision: 1169
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?view=rev&revision=1169

Log:
also don't expand variables in rest of ${var:+rest} expressions if var is not 
set or empty

Modified:
   nss-pam-ldapd/common/expr.c

Modified: nss-pam-ldapd/common/expr.c
==============================================================================
--- nss-pam-ldapd/common/expr.c Sat Aug 14 15:00:13 2010        (r1168)
+++ nss-pam-ldapd/common/expr.c Sat Aug 14 15:16:11 2010        (r1169)
@@ -124,10 +124,19 @@
     {
       /* if variable is set, substitute remainer */
       (*ptr)+=2;
-      if 
(parse_expression(str,ptr,'}',buffer,buflen,expander,expander_arg)==NULL)
-        return NULL;
-      if ((varvalue==NULL)||(*varvalue=='\0'))
+      if ((varvalue!=NULL)&&(*varvalue!='\0'))
+      {
+        /* value is set, evaluate rest of expression */
+        if 
(parse_expression(str,ptr,'}',buffer,buflen,expander,expander_arg)==NULL)
+          return NULL;
+      }
+      else
+      {
+        /* value is not set, skip rest of expression and blank */
+        if 
(parse_expression(str,ptr,'}',buffer,buflen,empty_expander,NULL)==NULL)
+          return NULL;
         buffer[0]='\0';
+      }
     }
     else
       return 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