/*1* Configuration file definitions for the CUPS scheduler.2*3* Copyright © 2021-2022 by OpenPrinting.4* Copyright © 2007-2018 by Apple Inc.5* Copyright © 1997-2007 by Easy Software Products, all rights reserved.6*7* Licensed under Apache License v2.0. See the file "LICENSE" for more8* information.9*/101112/*13* Log levels...14*/1516typedef enum17{18CUPSD_LOG_PPD = -5, /* Used internally for PPD keywords */19CUPSD_LOG_ATTR, /* Used internally for attributes */20CUPSD_LOG_STATE, /* Used internally for printer-state-reasons */21CUPSD_LOG_JOBSTATE, /* Used internally for job-state-reasons */22CUPSD_LOG_PAGE, /* Used internally for page logging */23CUPSD_LOG_NONE,24CUPSD_LOG_EMERG, /* Emergency issues */25CUPSD_LOG_ALERT, /* Something bad happened that needs attention */26CUPSD_LOG_CRIT, /* Critical error but server continues */27CUPSD_LOG_ERROR, /* Error condition */28CUPSD_LOG_WARN, /* Warning */29CUPSD_LOG_NOTICE, /* Normal condition that needs logging */30CUPSD_LOG_INFO, /* General information */31CUPSD_LOG_DEBUG, /* General debugging */32CUPSD_LOG_DEBUG2 /* Detailed debugging */33} cupsd_loglevel_t;3435typedef enum36{37CUPSD_ACCESSLOG_NONE, /* Log no requests */38CUPSD_ACCESSLOG_CONFIG, /* Log config requests */39CUPSD_ACCESSLOG_ACTIONS, /* Log config, print, and job management requests */40CUPSD_ACCESSLOG_ALL /* Log everything */41} cupsd_accesslog_t;4243typedef enum44{45CUPSD_TIME_STANDARD, /* "Standard" Apache/CLF format */46CUPSD_TIME_USECS /* Standard format with microseconds */47} cupsd_time_t;4849typedef enum50{51CUPSD_SANDBOXING_OFF, /* No sandboxing */52CUPSD_SANDBOXING_RELAXED, /* Relaxed sandboxing */53CUPSD_SANDBOXING_STRICT /* Strict sandboxing */54} cupsd_sandboxing_t;555657/*58* FatalErrors flags...59*/6061#define CUPSD_FATAL_NONE 0 /* No errors are fatal */62#define CUPSD_FATAL_BROWSE 1 /* Browse bind errors are fatal */63#define CUPSD_FATAL_CONFIG 2 /* Config file syntax errors are fatal */64#define CUPSD_FATAL_LISTEN 4 /* Listen/Port bind errors are fatal */65#define CUPSD_FATAL_LOG 8 /* Log file errors are fatal */66#define CUPSD_FATAL_PERMISSIONS 16 /* File permission errors are fatal */67#define CUPSD_FATAL_ALL ~0 /* All errors are fatal */686970/*71* Printcap formats...72*/7374#define PRINTCAP_BSD 0 /* Berkeley LPD format */75#define PRINTCAP_SOLARIS 1 /* Solaris lpsched format */76#define PRINTCAP_PLIST 2 /* macOS plist format */777879/*80* ServerAlias data...81*/8283typedef struct84{85size_t namelen; /* Length of alias name */86char name[1]; /* Alias name */87} cupsd_alias_t;888990/*91* Globals...92*/9394VAR char *ConfigurationFile VALUE(NULL),95/* cupsd.conf file to use */96*CupsFilesFile VALUE(NULL),97/* cups-files.conf file to use */98*ServerName VALUE(NULL),99/* FQDN for server */100*ServerAdmin VALUE(NULL),101/* Administrator's email */102*ServerRoot VALUE(NULL),103/* Root directory for scheduler */104*ServerBin VALUE(NULL),105/* Root directory for binaries */106*StateDir VALUE(NULL),107/* Root directory for state data */108*RequestRoot VALUE(NULL),109/* Directory for request files */110*DocumentRoot VALUE(NULL);111/* Root directory for documents */112VAR cups_array_t *ServerAlias VALUE(NULL);113/* Alias names for server */114VAR int ServerNameIsIP VALUE(0);115/* Is the ServerName an IP address? */116VAR int NumSystemGroups VALUE(0);117/* Number of system group names */118VAR char *SystemGroups[MAX_SYSTEM_GROUPS]119VALUE({0});120/* System group names */121VAR gid_t SystemGroupIDs[MAX_SYSTEM_GROUPS]122VALUE({0});123/* System group IDs */124VAR char *AccessLog VALUE(NULL),125/* Access log filename */126*ErrorLog VALUE(NULL),127/* Error log filename */128*PageLog VALUE(NULL),129/* Page log filename */130*CacheDir VALUE(NULL),131/* Cache file directory */132*DataDir VALUE(NULL),133/* Data file directory */134*DefaultLanguage VALUE(NULL),135/* Default language encoding */136*DefaultLocale VALUE(NULL),137/* Default locale */138*DefaultPaperSize VALUE(NULL),139/* Default paper size */140*ErrorPolicy VALUE(NULL),141/* Default printer-error-policy */142*TempDir VALUE(NULL),143/* Temporary directory */144*Printcap VALUE(NULL),145/* Printcap file */146*RemoteRoot VALUE(NULL),147/* Remote root user */148*Classification VALUE(NULL);149/* Classification of system */150VAR cups_array_t *ReadyPaperSizes VALUE(NULL);151/* List of paper sizes to list as ready */152VAR uid_t User VALUE(1),153/* User ID for server */154RunUser VALUE(0);155/* User to run as, used for files */156VAR gid_t Group VALUE(0);157/* Group ID for server */158VAR cupsd_accesslog_t AccessLogLevel VALUE(CUPSD_ACCESSLOG_ACTIONS);159/* Access log level */160VAR int ClassifyOverride VALUE(0),161/* Allow overrides? */162LogDebugHistory VALUE(200),163/* Amount of automatic debug history */164FatalErrors VALUE(CUPSD_FATAL_CONFIG),165/* Which errors are fatal? */166StrictConformance VALUE(FALSE),167/* Require strict IPP conformance? */168SyncOnClose VALUE(FALSE);169/* Call fsync() when closing files? */170VAR mode_t ConfigFilePerm VALUE(0640U),171/* Permissions for config files */172LogFilePerm VALUE(0644U);173/* Permissions for log files */174VAR gid_t LogFileGroup VALUE(0);175/* Group ID for log files */176VAR cupsd_loglevel_t LogLevel VALUE(CUPSD_LOG_WARN);177/* Error log level */178VAR cupsd_time_t LogTimeFormat VALUE(CUPSD_TIME_STANDARD);179/* Log file time format */180VAR cups_file_t *LogStderr VALUE(NULL);181/* Stderr file, if any */182VAR cupsd_sandboxing_t Sandboxing VALUE(CUPSD_SANDBOXING_STRICT);183/* Sandboxing level */184VAR int UseSandboxing VALUE(1);185/* Use sandboxing for child procs? */186VAR int MaxClients VALUE(100),187/* Maximum number of clients */188MaxClientsPerHost VALUE(0),189/* Maximum number of clients per host */190MaxCopies VALUE(CUPS_DEFAULT_MAX_COPIES),191/* Maximum number of copies per job */192MaxLogSize VALUE(1024 * 1024),193/* Maximum size of log files */194MaxRequestSize VALUE(0),195/* Maximum size of IPP requests */196HostNameLookups VALUE(FALSE),197/* Do we do reverse lookups? */198Timeout VALUE(DEFAULT_TIMEOUT),199/* Timeout during requests */200KeepAlive VALUE(TRUE),201/* Support the Keep-Alive option? */202FileDevice VALUE(FALSE),203/* Allow file: devices? */204FilterLimit VALUE(0),205/* Max filter cost at any time */206FilterLevel VALUE(0),207/* Current filter level */208FilterNice VALUE(0),209/* Nice value for filters */210ReloadTimeout VALUE(DEFAULT_KEEPALIVE),211/* Timeout before reload from SIGHUP */212RootCertDuration VALUE(300),213/* Root certificate update interval */214PrintcapFormat VALUE(PRINTCAP_BSD),215/* Format of printcap file? */216DefaultShared VALUE(TRUE),217/* Share printers by default? */218MultipleOperationTimeout VALUE(DEFAULT_TIMEOUT),219/* multiple-operation-time-out value */220WebInterface VALUE(CUPS_DEFAULT_WEBIF);221/* Enable the web interface? */222VAR cups_file_t *AccessFile VALUE(NULL),223/* Access log file */224*ErrorFile VALUE(NULL),225/* Error log file */226*PageFile VALUE(NULL);227/* Page log file */228VAR char *PageLogFormat VALUE(NULL);229/* Page log format */230VAR mime_t *MimeDatabase VALUE(NULL);231/* MIME type database */232VAR int NumMimeTypes VALUE(0);233/* Number of MIME types */234VAR const char **MimeTypes VALUE(NULL);235/* Array of MIME types */236237#ifdef HAVE_TLS238VAR int CreateSelfSignedCerts VALUE(TRUE);239/* Automatically create self-signed certs? */240VAR char *ServerKeychain VALUE(NULL);241/* Keychain holding cert + key */242#endif /* HAVE_TLS */243244#ifdef HAVE_ONDEMAND245VAR int IdleExitTimeout VALUE(60);246/* Time after which an idle cupsd will exit */247#endif /* HAVE_ONDEMAND */248249#ifdef HAVE_AUTHORIZATION_H250VAR char *SystemGroupAuthKey VALUE(NULL);251/* System group auth key */252#endif /* HAVE_AUTHORIZATION_H */253254#ifdef HAVE_GSSAPI255VAR char *GSSServiceName VALUE(NULL);256/* GSS service name */257VAR int HaveServerCreds VALUE(0);258/* Do we have server credentials? */259VAR gss_cred_id_t ServerCreds; /* Server's GSS credentials */260#endif /* HAVE_GSSAPI */261262263/*264* Prototypes...265*/266267extern void cupsdAddAlias(cups_array_t *aliases, const char *name);268extern int cupsdCheckLogFile(cups_file_t **lf, const char *logname);269extern int cupsdCheckPermissions(const char *filename,270const char *suffix, mode_t mode,271uid_t user, gid_t group, int is_dir,272int create_dir);273extern int cupsdCheckProgram(const char *filename, cupsd_printer_t *p);274extern int cupsdDefaultAuthType(void);275extern void cupsdFreeAliases(cups_array_t *aliases);276extern char *cupsdGetDateTime(struct timeval *t, cupsd_time_t format);277extern int cupsdLogClient(cupsd_client_t *con, int level, const char *message, ...) _CUPS_FORMAT(3, 4);278extern void cupsdLogFCMessage(void *context, _cups_fc_result_t result, const char *message);279#ifdef HAVE_GSSAPI280extern int cupsdLogGSSMessage(int level, OM_uint32 major_status, OM_uint32 minor_status, const char *message, ...) _CUPS_FORMAT(4, 5);281#endif /* HAVE_GSSAPI */282extern int cupsdLogJob(cupsd_job_t *job, int level, const char *message,283...) _CUPS_FORMAT(3, 4);284extern int cupsdLogMessage(int level, const char *message, ...) _CUPS_FORMAT(2, 3);285extern int cupsdLogPage(cupsd_job_t *job, const char *page);286extern int cupsdLogRequest(cupsd_client_t *con, http_status_t code);287extern int cupsdReadConfiguration(void);288extern int cupsdWriteErrorLog(int level, const char *message);289290291