testparm: only check for %u und passwd program when passwd program is given.
authorMichael Adam <obnox@samba.org>
Tue, 18 Mar 2008 14:50:27 +0000 (15:50 +0100)
committerMichael Adam <obnox@samba.org>
Tue, 18 Mar 2008 14:52:45 +0000 (15:52 +0100)
Michael

source/utils/testparm.c

index d409ff992d73b75b84d402dc4519eb26d53372e7..aded4a83c1820f19e89388b3c1146fc1d0aba4b2 100644 (file)
@@ -140,11 +140,16 @@ cannot be executed (error was %s).\n", truncated_prog, strerror(errno) );
                        fprintf(stderr, "ERROR: the 'unix password sync' parameter is set and there is no valid 'passwd chat' \
 parameter.\n");
                        ret = 1;
-               } else 
-               /* check if there's a %u parameter present */
-               if(strstr_m(lp_passwd_program(), "%u") == NULL) {
-                       fprintf(stderr, "ERROR: the 'passwd program' (%s) requires a '%%u' parameter.\n", lp_passwd_program());
-                       ret = 1;
+               }
+
+               if ((lp_passwd_program() != NULL) &&
+                   (strlen(lp_passwd_program()) > 0))
+               {
+                       /* check if there's a %u parameter present */
+                       if(strstr_m(lp_passwd_program(), "%u") == NULL) {
+                               fprintf(stderr, "ERROR: the 'passwd program' (%s) requires a '%%u' parameter.\n", lp_passwd_program());
+                               ret = 1;
+                       }
                }
 
                /*