int close_all = 1, /* Close all file descriptors? */
disconnect = 1, /* Disconnect from controlling terminal? */
fg = 0, /* Run in foreground? */
- run_as_child = 0;
+ run_as_child = 0,
/* Running as child process? */
+ print_profile = 0;
+ /* Print the sandbox profile to stdout? */
int fds; /* Number of ready descriptors */
cupsd_client_t *con; /* Current client */
cupsd_job_t *job; /* Current job */
close_all = 0;
break;
+ case 'T' : /* Print security profile */
+ print_profile = 1;
+ fg = 1;
+ disconnect = 0;
+ close_all = 0;
+ break;
+
default : /* Unknown option */
_cupsLangPrintf(stderr, _("cupsd: Unknown option \"%c\" - "
"aborting."), *opt);
printf("\"%s\" is OK.\n", ConfigurationFile);
return (0);
}
+ else if (print_profile)
+ {
+ cups_file_t *fp; /* File pointer */
+ const char *profile = cupsdCreateProfile(42, 0);
+ /* Profile */
+ char line[1024]; /* Line from file */
+
+
+ if ((fp = cupsFileOpen(profile, "r")) == NULL)
+ {
+ printf("Unable to open profile file \"%s\": %s\n", profile ? profile : "(null)", strerror(errno));
+ return (1);
+ }
+
+ while (cupsFileGets(fp, line, sizeof(line)))
+ puts(line);
+
+ cupsFileClose(fp);
+
+ return (0);
+ }
/*
* Clean out old temp files and printer cache data.
/* Only allow SNMP (UDP) and LPD (TCP) off the machine... */
cupsFilePuts(fp, ")\n");
cupsFilePuts(fp, "(allow network-outbound\n"
- " (remote udp \"*:161\")"
+ " (remote udp \"*:161\")\n"
" (remote tcp \"*:515\"))\n");
cupsFilePuts(fp, "(allow network-inbound\n"
" (local udp \"localhost:*\"))\n");