/*
* Scheduler control program for CUPS.
*
- * Copyright 2007-2012 by Apple Inc.
- * Copyright 2006-2007 by Easy Software Products.
+ * Copyright © 2007-2019 by Apple Inc.
+ * Copyright © 2006-2007 by Easy Software Products.
*
- * Licensed under Apache License v2.0. See the file "LICENSE" for more information.
+ * Licensed under Apache License v2.0. See the file "LICENSE" for more
+ * information.
*/
/*
main(int argc, /* I - Number of command-line args */
char *argv[]) /* I - Command-line arguments */
{
- int i, /* Looping var */
+ int i, j, /* Looping vars */
num_settings; /* Number of settings */
- cups_option_t *settings; /* Settings */
+ cups_option_t *settings, /* Settings */
+ *setting; /* Current setting */
const char *opt; /* Current option character */
http_t *http; /* Connection to server */
+ static const char * const disallowed[] =
+ { /* List of disallowed directives for cupsd.conf */
+ "AccessLog",
+ "CacheDir",
+ "ConfigFilePerm",
+ "DataDir",
+ "DocumentRoot",
+ "ErrorLog",
+ "FatalErrors",
+ "FileDevice",
+ "FontPath",
+ "Group",
+ "Listen",
+ "LogFilePerm",
+ "LPDConfigFile",
+ "PageLog",
+ "PassEnv",
+ "Port",
+ "Printcap",
+ "PrintcapFormat",
+ "RemoteRoot",
+ "RequestRoot",
+ "ServerBin",
+ "ServerCertificate",
+ "ServerKey",
+ "ServerKeychain",
+ "ServerRoot",
+ "SetEnv",
+ "SMBConfigFile",
+ "StateDir",
+ "SystemGroup",
+ "SystemGroupAuthKey",
+ "TempDir",
+ "User"
+ };
/*
for (i = 1; i < argc; i ++)
{
- if (argv[i][0] == '-')
+ if (!strcmp(argv[i], "--help"))
+ usage(NULL);
+ else if (argv[i][0] == '-')
{
if (argv[i][1] == '-')
{
usage(argv[i]);
}
- if (cupsGetOption("Listen", num_settings, settings) ||
- cupsGetOption("Port", num_settings, settings))
+ for (i = num_settings, setting = settings; i > 0; i --, setting ++)
{
- _cupsLangPuts(stderr, _("cupsctl: Cannot set Listen or Port directly."));
- return (1);
+ for (j = 0; j < (int)(sizeof(disallowed) / sizeof(disallowed[0])); j ++)
+ {
+ if (!_cups_strcasecmp(setting->name, disallowed[j]))
+ {
+ _cupsLangPrintf(stderr, _("cupsctl: Cannot set %s directly."), disallowed[j]);
+ return (1);
+ }
+ }
}
/*
_cupsLangPrintf(stderr, _("cupsctl: Unknown option \"-%c\""), *opt);
}
- _cupsLangPuts(stdout, _("Usage: cupsctl [options] [param=value ... "
- "paramN=valueN]"));
- _cupsLangPuts(stdout, "");
+ _cupsLangPuts(stdout, _("Usage: cupsctl [options] [param=value ... paramN=valueN]"));
_cupsLangPuts(stdout, _("Options:"));
- _cupsLangPuts(stdout, "");
- _cupsLangPuts(stdout, _(" -E Encrypt the connection."));
- _cupsLangPuts(stdout, _(" -U username Specify username."));
- _cupsLangPuts(stdout, _(" -h server[:port] Specify server "
- "address."));
- _cupsLangPuts(stdout, "");
- _cupsLangPuts(stdout, _(" --[no-]debug-logging Turn debug logging "
- "on/off."));
- _cupsLangPuts(stdout, _(" --[no-]remote-admin Turn remote "
- "administration on/off."));
- _cupsLangPuts(stdout, _(" --[no-]remote-any Allow/prevent access "
- "from the Internet."));
- _cupsLangPuts(stdout, _(" --[no-]share-printers Turn printer sharing "
- "on/off."));
- _cupsLangPuts(stdout, _(" --[no-]user-cancel-any Allow/prevent users to "
- "cancel any job."));
+ _cupsLangPuts(stdout, _("-E Encrypt the connection to the server"));
+ _cupsLangPuts(stdout, _("-h server[:port] Connect to the named server and port"));
+ _cupsLangPuts(stdout, _("-U username Specify username to use for authentication"));
+ _cupsLangPuts(stdout, _("--[no-]debug-logging Turn debug logging on/off"));
+ _cupsLangPuts(stdout, _("--[no-]remote-admin Turn remote administration on/off"));
+ _cupsLangPuts(stdout, _("--[no-]remote-any Allow/prevent access from the Internet"));
+ _cupsLangPuts(stdout, _("--[no-]share-printers Turn printer sharing on/off"));
+ _cupsLangPuts(stdout, _("--[no-]user-cancel-any Allow/prevent users to cancel any job"));
exit(1);
}