Index: scheduler/conf.c =================================================================== --- scheduler/conf.c (revision 7617) +++ scheduler/conf.c (working copy) @@ -2109,7 +2109,7 @@ * Decode the directive... */ - if (!strcasecmp(line, "Include")) + if (!strcasecmp(line, "Include") && value) { /* * Include filename @@ -2130,72 +2130,39 @@ cupsFileClose(incfile); } } - else if (!strcasecmp(line, " */ - if (value) - { - linenum = read_location(fp, value, linenum); - if (linenum == 0) - return (0); - } - else - { - cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d.", - linenum); - return (0); - } + linenum = read_location(fp, value, linenum); + if (linenum == 0) + return (0); } - else if (!strcasecmp(line, " */ - if (value) - { - linenum = read_policy(fp, value, linenum); - if (linenum == 0) - return (0); - } - else - { - cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d.", linenum); - return (0); - } + linenum = read_policy(fp, value, linenum); + if (linenum == 0) + return (0); } - else if (!strcasecmp(line, "FaxRetryInterval")) + else if (!strcasecmp(line, "FaxRetryInterval") && value) { - if (value) - { - JobRetryInterval = atoi(value); - cupsdLogMessage(CUPSD_LOG_WARN, - "FaxRetryInterval is deprecated; use " - "JobRetryInterval on line %d.", linenum); - } - else - { - cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d.", linenum); - return (0); - } + JobRetryInterval = atoi(value); + cupsdLogMessage(CUPSD_LOG_WARN, + "FaxRetryInterval is deprecated; use " + "JobRetryInterval on line %d.", linenum); } - else if (!strcasecmp(line, "FaxRetryLimit")) + else if (!strcasecmp(line, "FaxRetryLimit") && value) { - if (value) - { - JobRetryLimit = atoi(value); - cupsdLogMessage(CUPSD_LOG_WARN, - "FaxRetryLimit is deprecated; use " - "JobRetryLimit on line %d.", linenum); - } - else - { - cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d.", linenum); - return (0); - } + JobRetryLimit = atoi(value); + cupsdLogMessage(CUPSD_LOG_WARN, + "FaxRetryLimit is deprecated; use " + "JobRetryLimit on line %d.", linenum); } else if (!strcasecmp(line, "Port") || !strcasecmp(line, "Listen") #ifdef HAVE_SSL @@ -2289,7 +2256,7 @@ httpAddrFreeList(addrlist); } - else if (!strcasecmp(line, "BrowseAddress")) + else if (!strcasecmp(line, "BrowseAddress") && value) { /* * Add a browse address to the list... @@ -2370,7 +2337,7 @@ cupsdLogMessage(CUPSD_LOG_ERROR, "Bad BrowseAddress %s at line %d.", value, linenum); } - else if (!strcasecmp(line, "BrowseOrder")) + else if (!strcasecmp(line, "BrowseOrder") && value) { /* * "BrowseOrder Deny,Allow" or "BrowseOrder Allow,Deny"... @@ -2416,8 +2383,8 @@ if (strcasecmp(line, "BrowseRemoteProtocols")) BrowseLocalProtocols = protocols; } - else if (!strcasecmp(line, "BrowseAllow") || - !strcasecmp(line, "BrowseDeny")) + else if ((!strcasecmp(line, "BrowseAllow") || + !strcasecmp(line, "BrowseDeny")) && value) { /* * BrowseAllow [From] host/ip... @@ -2521,7 +2488,7 @@ } } } - else if (!strcasecmp(line, "BrowseRelay")) + else if (!strcasecmp(line, "BrowseRelay") && value) { /* * BrowseRelay [from] source [to] destination @@ -2697,7 +2664,7 @@ value, linenum); } } - else if (!strcasecmp(line, "BrowsePoll")) + else if (!strcasecmp(line, "BrowsePoll") && value) { /* * BrowsePoll address[:port] @@ -2759,7 +2726,7 @@ cupsdLogMessage(CUPSD_LOG_INFO, "Polling %s:%d", pollp->hostname, pollp->port); } - else if (!strcasecmp(line, "DefaultAuthType")) + else if (!strcasecmp(line, "DefaultAuthType") && value) { /* * DefaultAuthType {basic,digest,basicdigest,negotiate} @@ -2808,7 +2775,7 @@ } #endif /* HAVE_SSL */ #ifdef HAVE_GSSAPI - else if (!strcasecmp(line, "Krb5Keytab")) + else if (!strcasecmp(line, "Krb5Keytab") && value) { cupsdSetStringf(&Krb5Keytab, "KRB5_KTNAME=%s", value); putenv(Krb5Keytab); @@ -2820,13 +2787,13 @@ # endif /* HAVE_GSSKRB5_REGISTER_ACCEPTOR_IDENTITY */ } #endif /* HAVE_GSSAPI */ - else if (!strcasecmp(line, "User")) + else if (!strcasecmp(line, "User") && value) { /* * User ID to run as... */ - if (value && isdigit(value[0] & 255)) + if (isdigit(value[0] & 255)) { int uid = atoi(value); @@ -2839,7 +2806,7 @@ else User = atoi(value); } - else if (value) + else { struct passwd *p; /* Password information */ @@ -2862,12 +2829,8 @@ "Unknown User \"%s\" on line %d, ignoring!", value, linenum); } - else - cupsdLogMessage(CUPSD_LOG_ERROR, - "User directive on line %d missing the username!", - linenum); } - else if (!strcasecmp(line, "Group")) + else if (!strcasecmp(line, "Group") && value) { /* * Group ID to run as... @@ -2888,7 +2851,7 @@ value, linenum); } } - else if (!strcasecmp(line, "SystemGroup")) + else if (!strcasecmp(line, "SystemGroup") && value) { /* * SystemGroup (admin) group(s)... @@ -2899,7 +2862,7 @@ "Unknown SystemGroup \"%s\" on line %d, ignoring!", value, linenum); } - else if (!strcasecmp(line, "HostNameLookups")) + else if (!strcasecmp(line, "HostNameLookups") && value) { /* * Do hostname lookups? @@ -2915,7 +2878,7 @@ cupsdLogMessage(CUPSD_LOG_WARN, "Unknown HostNameLookups %s on line %d.", value, linenum); } - else if (!strcasecmp(line, "LogLevel")) + else if (!strcasecmp(line, "LogLevel") && value) { /* * Amount of logging to do... @@ -2945,7 +2908,7 @@ cupsdLogMessage(CUPSD_LOG_WARN, "Unknown LogLevel %s on line %d.", value, linenum); } - else if (!strcasecmp(line, "PrintcapFormat")) + else if (!strcasecmp(line, "PrintcapFormat") && value) { /* * Format of printcap file? @@ -2959,7 +2922,7 @@ cupsdLogMessage(CUPSD_LOG_WARN, "Unknown PrintcapFormat %s on line %d.", value, linenum); } - else if (!strcasecmp(line, "ServerTokens")) + else if (!strcasecmp(line, "ServerTokens") && value) { /* * Set the string used for the Server header... @@ -2989,7 +2952,7 @@ cupsdLogMessage(CUPSD_LOG_WARN, "Unknown ServerTokens %s on line %d.", value, linenum); } - else if (!strcasecmp(line, "PassEnv")) + else if (!strcasecmp(line, "PassEnv") && value) { /* * PassEnv variable [... variable] @@ -3014,7 +2977,7 @@ break; } } - else if (!strcasecmp(line, "SetEnv")) + else if (!strcasecmp(line, "SetEnv") && value) { /* * SetEnv variable value @@ -3054,8 +3017,12 @@ * Unknown directive! Output an error message and continue... */ - cupsdLogMessage(CUPSD_LOG_ERROR, "Unknown directive %s on line %d.", - line, linenum); + if (!value) + cupsdLogMessage(CUPSD_LOG_ERROR, "Missing value for %s on line %d.", + line, linenum); + else + cupsdLogMessage(CUPSD_LOG_ERROR, "Unknown directive %s on line %d.", + line, linenum); continue; } @@ -3119,7 +3086,15 @@ break; case CUPSD_VARTYPE_PATHNAME : - if (value[0] == '/') + if (!value) + { + cupsdLogMessage(CUPSD_LOG_ERROR, + "Missing pathname value for %s on line %d!", + line, linenum); + break; + } + + if (value[0] == '/') strlcpy(temp, value, sizeof(temp)); else snprintf(temp, sizeof(temp), "%s/%s", ServerRoot, value);