konfd.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707
  1. /*
  2. * konfd.c
  3. *
  4. * The konfd daemon to store user configuration commands.
  5. *
  6. */
  7. #ifdef HAVE_CONFIG_H
  8. #include "config.h"
  9. #endif /* HAVE_CONFIG_H */
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12. #include <unistd.h>
  13. #include <sys/types.h>
  14. #include <sys/stat.h>
  15. #include <fcntl.h>
  16. #include <sys/wait.h>
  17. #include <errno.h>
  18. #include <assert.h>
  19. #include <sys/socket.h>
  20. #include <sys/un.h>
  21. #include <string.h>
  22. #include <sys/select.h>
  23. #include <signal.h>
  24. #include <syslog.h>
  25. #ifdef HAVE_GETOPT_H
  26. #include <getopt.h>
  27. #endif
  28. #ifdef HAVE_PWD_H
  29. #include <pwd.h>
  30. #endif
  31. #ifdef HAVE_GRP_H
  32. #include <grp.h>
  33. #endif
  34. #include "clish/internal.h"
  35. #include "konf/tree.h"
  36. #include "konf/query.h"
  37. #include "konf/buf.h"
  38. #include "lub/argv.h"
  39. #include "lub/string.h"
  40. #include "lub/log.h"
  41. #ifndef VERSION
  42. #define VERSION 1.2.2
  43. #endif
  44. #define QUOTE(t) #t
  45. #define version(v) printf("%s\n", v)
  46. #define KONFD_PIDFILE "/var/run/konfd.pid"
  47. /* UNIX socket path */
  48. /* Don't use UNIX_PATH_MAX due to portability issues */
  49. #define USOCK_PATH_MAX sizeof(((struct sockaddr_un *)0)->sun_path)
  50. /* OpenBSD has no MSG_NOSIGNAL flag */
  51. #ifndef MSG_NOSIGNAL
  52. #define MSG_NOSIGNAL 0
  53. #endif
  54. /* Global signal vars */
  55. static volatile int sigterm = 0;
  56. static void sighandler(int signo);
  57. static void help(int status, const char *argv0);
  58. static char * process_query(int sock, konf_tree_t * conf, char *str);
  59. int answer_send(int sock, char *command);
  60. static int dump_running_config(int sock, konf_tree_t *conf, konf_query_t *query);
  61. int daemonize(int nochdir, int noclose);
  62. struct options *opts_init(void);
  63. void opts_free(struct options *opts);
  64. static int opts_parse(int argc, char *argv[], struct options *opts);
  65. /* Command line options */
  66. struct options {
  67. char *socket_path;
  68. char *pidfile;
  69. char *chroot;
  70. int debug; /* Don't daemonize in debug mode */
  71. uid_t uid;
  72. gid_t gid;
  73. int log_facility;
  74. };
  75. /*--------------------------------------------------------- */
  76. int main(int argc, char **argv)
  77. {
  78. int retval = -1;
  79. unsigned i;
  80. char *str;
  81. konf_tree_t *conf;
  82. lub_bintree_t bufs;
  83. konf_buf_t *tbuf;
  84. struct options *opts = NULL;
  85. int pidfd = -1;
  86. /* Network vars */
  87. int sock = -1;
  88. struct sockaddr_un laddr;
  89. struct sockaddr_un raddr;
  90. fd_set active_fd_set, read_fd_set;
  91. const int reuseaddr = 1;
  92. /* Signal vars */
  93. struct sigaction sig_act, sigpipe_act;
  94. sigset_t sig_set, sigpipe_set;
  95. /* Parse command line options */
  96. opts = opts_init();
  97. if (opts_parse(argc, argv, opts))
  98. goto err;
  99. /* Initialize syslog */
  100. openlog(argv[0], LOG_CONS, opts->log_facility);
  101. syslog(LOG_ERR, "Start daemon.\n");
  102. /* Fork the daemon */
  103. if (!opts->debug) {
  104. /* Daemonize */
  105. if (daemonize(0, 0) < 0) {
  106. syslog(LOG_ERR, "Can't daemonize\n");
  107. goto err;
  108. }
  109. /* Write pidfile */
  110. if ((pidfd = open(opts->pidfile,
  111. O_WRONLY | O_CREAT | O_EXCL | O_TRUNC,
  112. S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) < 0) {
  113. syslog(LOG_WARNING, "Can't open pidfile %s: %s",
  114. opts->pidfile, strerror(errno));
  115. } else {
  116. char str[20];
  117. snprintf(str, sizeof(str), "%u\n", getpid());
  118. if (write(pidfd, str, strlen(str)) < 0)
  119. syslog(LOG_WARNING, "Can't write to %s: %s",
  120. opts->pidfile, strerror(errno));
  121. close(pidfd);
  122. }
  123. }
  124. /* Create listen socket */
  125. if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
  126. syslog(LOG_ERR, "Can't create listen socket: %s\n",
  127. strerror(errno));
  128. goto err;
  129. }
  130. if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
  131. &reuseaddr, sizeof(reuseaddr))) {
  132. syslog(LOG_ERR, "Can't set socket options: %s\n", strerror(errno));
  133. goto err;
  134. }
  135. laddr.sun_family = AF_UNIX;
  136. strncpy(laddr.sun_path, opts->socket_path, USOCK_PATH_MAX);
  137. laddr.sun_path[USOCK_PATH_MAX - 1] = '\0';
  138. if (bind(sock, (struct sockaddr *)&laddr, sizeof(laddr))) {
  139. syslog(LOG_ERR, "Can't bind socket: %s\n",
  140. strerror(errno));
  141. goto err;
  142. }
  143. if (chown(opts->socket_path, opts->uid, opts->gid)) {
  144. syslog(LOG_ERR, "Can't chown UNIX socket: %s\n",
  145. strerror(errno));
  146. goto err;
  147. }
  148. listen(sock, 5);
  149. /* Change GID */
  150. if (opts->gid != getgid()) {
  151. if (setgid(opts->gid)) {
  152. syslog(LOG_ERR, "Can't set GID to %u: %s",
  153. opts->gid, strerror(errno));
  154. goto err;
  155. }
  156. }
  157. #ifdef HAVE_CHROOT
  158. /* Chroot */
  159. if (opts->chroot) {
  160. if (chroot(opts->chroot) < 0) {
  161. syslog(LOG_ERR, "Can't chroot to %s: %s",
  162. opts->chroot, strerror(errno));
  163. goto err;
  164. }
  165. }
  166. #endif
  167. /* Change UID */
  168. if (opts->uid != getuid()) {
  169. if (setuid(opts->uid)) {
  170. syslog(LOG_ERR, "Can't set UID to %u: %s",
  171. opts->uid, strerror(errno));
  172. goto err;
  173. }
  174. }
  175. /* Create configuration tree */
  176. conf = konf_tree_new("", 0);
  177. /* Initialize the tree of buffers */
  178. lub_bintree_init(&bufs,
  179. konf_buf_bt_offset(),
  180. konf_buf_bt_compare, konf_buf_bt_getkey);
  181. /* Set signal handler */
  182. sigemptyset(&sig_set);
  183. sigaddset(&sig_set, SIGTERM);
  184. sigaddset(&sig_set, SIGINT);
  185. sigaddset(&sig_set, SIGQUIT);
  186. sig_act.sa_flags = 0;
  187. sig_act.sa_mask = sig_set;
  188. sig_act.sa_handler = &sighandler;
  189. sigaction(SIGTERM, &sig_act, NULL);
  190. sigaction(SIGINT, &sig_act, NULL);
  191. sigaction(SIGQUIT, &sig_act, NULL);
  192. /* Ignore SIGPIPE */
  193. sigemptyset(&sigpipe_set);
  194. sigaddset(&sigpipe_set, SIGPIPE);
  195. sigpipe_act.sa_flags = 0;
  196. sigpipe_act.sa_mask = sigpipe_set;
  197. sigpipe_act.sa_handler = SIG_IGN;
  198. sigaction(SIGPIPE, &sigpipe_act, NULL);
  199. /* Initialize the set of active sockets. */
  200. FD_ZERO(&active_fd_set);
  201. FD_SET(sock, &active_fd_set);
  202. /* Main loop */
  203. while (!sigterm) {
  204. int num;
  205. /* Block until input arrives on one or more active sockets. */
  206. read_fd_set = active_fd_set;
  207. num = select(FD_SETSIZE, &read_fd_set, NULL, NULL, NULL);
  208. if (num < 0) {
  209. if (EINTR == errno)
  210. continue;
  211. break;
  212. }
  213. if (0 == num)
  214. continue;
  215. /* Service all the sockets with input pending. */
  216. for (i = 0; i < FD_SETSIZE; ++i) {
  217. if (!FD_ISSET(i, &read_fd_set))
  218. continue;
  219. if (i == sock) {
  220. /* Connection request on listen socket. */
  221. int new;
  222. socklen_t size = sizeof(raddr);
  223. new = accept(sock,
  224. (struct sockaddr *)&raddr, &size);
  225. if (new < 0) {
  226. fprintf(stderr, "accept");
  227. continue;
  228. }
  229. #ifdef DEBUG
  230. fprintf(stderr, "Connection established %u\n", new);
  231. #endif
  232. konf_buftree_remove(&bufs, new);
  233. tbuf = konf_buf_new(new);
  234. /* insert it into the binary tree for this conf */
  235. lub_bintree_insert(&bufs, tbuf);
  236. FD_SET(new, &active_fd_set);
  237. } else {
  238. int nbytes;
  239. /* Data arriving on an already-connected socket. */
  240. if ((nbytes = konf_buftree_read(&bufs, i)) <= 0) {
  241. close(i);
  242. FD_CLR(i, &active_fd_set);
  243. konf_buftree_remove(&bufs, i);
  244. continue;
  245. }
  246. while ((str = konf_buftree_parse(&bufs, i))) {
  247. char *answer;
  248. if (!(answer = process_query(i, conf, str)))
  249. answer = strdup("-e");
  250. free(str);
  251. answer_send(i, answer);
  252. free(answer);
  253. }
  254. }
  255. }
  256. }
  257. /* Free resources */
  258. konf_tree_delete(conf);
  259. /* delete each buf */
  260. while ((tbuf = lub_bintree_findfirst(&bufs))) {
  261. /* remove the buf from the tree */
  262. lub_bintree_remove(&bufs, tbuf);
  263. /* release the instance */
  264. konf_buf_delete(tbuf);
  265. }
  266. retval = 0;
  267. err:
  268. /* Close listen socket */
  269. if (sock >= 0) {
  270. close(sock);
  271. unlink(opts->socket_path);
  272. }
  273. /* Remove pidfile */
  274. if (pidfd >= 0) {
  275. if (unlink(opts->pidfile) < 0) {
  276. syslog(LOG_ERR, "Can't remove pid-file %s: %s\n",
  277. opts->pidfile, strerror(errno));
  278. }
  279. }
  280. /* Free command line options */
  281. opts_free(opts);
  282. syslog(LOG_ERR, "Stop daemon.\n");
  283. return retval;
  284. }
  285. /*--------------------------------------------------------- */
  286. static char * process_query(int sock, konf_tree_t * conf, char *str)
  287. {
  288. unsigned i;
  289. int res;
  290. konf_tree_t *iconf;
  291. konf_tree_t *tmpconf;
  292. konf_query_t *query;
  293. char *retval = NULL;
  294. konf_query_op_t ret = KONF_QUERY_OP_ERROR;
  295. #ifdef DEBUG
  296. fprintf(stderr, "----------------------\n");
  297. fprintf(stderr, "REQUEST: %s\n", str);
  298. #endif
  299. /* Parse query */
  300. query = konf_query_new();
  301. res = konf_query_parse_str(query, str);
  302. if (res < 0) {
  303. konf_query_free(query);
  304. return NULL;
  305. }
  306. #ifdef DEBUG
  307. konf_query_dump(query);
  308. #endif
  309. /* Go through the pwd */
  310. iconf = conf;
  311. for (i = 0; i < konf_query__get_pwdc(query); i++) {
  312. if (!(iconf = konf_tree_find_conf(iconf,
  313. konf_query__get_pwd(query, i), 0, 0))) {
  314. iconf = NULL;
  315. break;
  316. }
  317. }
  318. if (!iconf) {
  319. fprintf(stderr, "Unknown path\n");
  320. konf_query_free(query);
  321. return NULL;
  322. }
  323. switch (konf_query__get_op(query)) {
  324. case KONF_QUERY_OP_SET:
  325. if (konf_query__get_unique(query)) {
  326. int exist = 0;
  327. exist = konf_tree_del_pattern(iconf,
  328. konf_query__get_line(query),
  329. konf_query__get_unique(query),
  330. konf_query__get_pattern(query),
  331. konf_query__get_priority(query),
  332. konf_query__get_seq(query),
  333. konf_query__get_seq_num(query));
  334. if (exist < 0)
  335. break;
  336. if (exist > 0) {
  337. ret = KONF_QUERY_OP_OK;
  338. break;
  339. }
  340. }
  341. tmpconf = konf_tree_new_conf(iconf,
  342. konf_query__get_line(query), konf_query__get_priority(query),
  343. konf_query__get_seq(query), konf_query__get_seq_num(query));
  344. if (!tmpconf)
  345. break;
  346. konf_tree__set_splitter(tmpconf, konf_query__get_splitter(query));
  347. konf_tree__set_depth(tmpconf, konf_query__get_pwdc(query));
  348. ret = KONF_QUERY_OP_OK;
  349. break;
  350. case KONF_QUERY_OP_UNSET:
  351. if (konf_tree_del_pattern(iconf,
  352. NULL,
  353. BOOL_TRUE,
  354. konf_query__get_pattern(query),
  355. konf_query__get_priority(query),
  356. konf_query__get_seq(query),
  357. konf_query__get_seq_num(query)) < 0)
  358. break;
  359. ret = KONF_QUERY_OP_OK;
  360. break;
  361. case KONF_QUERY_OP_DUMP:
  362. if (dump_running_config(sock, iconf, query))
  363. break;
  364. ret = KONF_QUERY_OP_OK;
  365. break;
  366. default:
  367. break;
  368. }
  369. #ifdef DEBUG
  370. /* Print whole tree */
  371. konf_tree_fprintf(conf, stderr, NULL, -1, -1, BOOL_TRUE, 0);
  372. #endif
  373. /* Free resources */
  374. konf_query_free(query);
  375. switch (ret) {
  376. case KONF_QUERY_OP_OK:
  377. lub_string_cat(&retval, "-o");
  378. break;
  379. case KONF_QUERY_OP_ERROR:
  380. lub_string_cat(&retval, "-e");
  381. break;
  382. default:
  383. lub_string_cat(&retval, "-e");
  384. break;
  385. };
  386. #ifdef DEBUG
  387. fprintf(stderr, "ANSWER: %s\n", retval);
  388. #endif
  389. return retval;
  390. }
  391. /*--------------------------------------------------------- */
  392. /*
  393. * Signal handler for temination signals (like SIGTERM, SIGINT, ...)
  394. */
  395. static void sighandler(int signo)
  396. {
  397. sigterm = 1;
  398. }
  399. /*--------------------------------------------------------- */
  400. int answer_send(int sock, char *command)
  401. {
  402. return send(sock, command, strlen(command) + 1, MSG_NOSIGNAL);
  403. }
  404. /*--------------------------------------------------------- */
  405. static int dump_running_config(int sock, konf_tree_t *conf, konf_query_t *query)
  406. {
  407. FILE *fd;
  408. char *filename;
  409. int dupsock = -1;
  410. if ((filename = konf_query__get_path(query))) {
  411. if (!(fd = fopen(filename, "w")))
  412. return -1;
  413. } else {
  414. if ((dupsock = dup(sock)) < 0)
  415. return -1;
  416. fd = fdopen(dupsock, "w");
  417. }
  418. if (!filename) {
  419. fprintf(fd, "-t\n");
  420. #ifdef DEBUG
  421. fprintf(stderr, "ANSWER: -t\n");
  422. #endif
  423. }
  424. konf_tree_fprintf(conf,
  425. fd,
  426. konf_query__get_pattern(query),
  427. konf_query__get_pwdc(query) - 1,
  428. konf_query__get_depth(query),
  429. konf_query__get_seq(query),
  430. 0);
  431. if (!filename) {
  432. fprintf(fd, "\n");
  433. #ifdef DEBUG
  434. fprintf(stderr, "SEND DATA: \n");
  435. #endif
  436. }
  437. fclose(fd);
  438. return 0;
  439. }
  440. /*--------------------------------------------------------- */
  441. /* Implement own simple daemon() to don't use Non-POSIX */
  442. int daemonize(int nochdir, int noclose)
  443. {
  444. int fd;
  445. int pid;
  446. pid = fork();
  447. if (-1 == pid)
  448. return -1;
  449. if (pid > 0)
  450. _exit(0); /* Exit parent */
  451. if (setsid() == -1)
  452. return -1;
  453. if (!nochdir) {
  454. if (chdir("/"))
  455. return -1;
  456. }
  457. if (!noclose) {
  458. fd = open("/dev/null", O_RDWR, 0);
  459. if (fd < 0)
  460. return -1;
  461. dup2(fd, STDIN_FILENO);
  462. dup2(fd, STDOUT_FILENO);
  463. dup2(fd, STDERR_FILENO);
  464. if (fd > 2)
  465. close(fd);
  466. }
  467. return 0;
  468. }
  469. /*--------------------------------------------------------- */
  470. /* Initialize option structure by defaults */
  471. struct options *opts_init(void)
  472. {
  473. struct options *opts = NULL;
  474. opts = malloc(sizeof(*opts));
  475. assert(opts);
  476. opts->debug = 0; /* daemonize by default */
  477. opts->socket_path = strdup(KONFD_SOCKET_PATH);
  478. opts->pidfile = strdup(KONFD_PIDFILE);
  479. opts->chroot = NULL;
  480. opts->uid = getuid();
  481. opts->gid = getgid();
  482. opts->log_facility = LOG_DAEMON;
  483. return opts;
  484. }
  485. /*--------------------------------------------------------- */
  486. /* Free option structure */
  487. void opts_free(struct options *opts)
  488. {
  489. if (opts->socket_path)
  490. free(opts->socket_path);
  491. if (opts->pidfile)
  492. free(opts->pidfile);
  493. if (opts->chroot)
  494. free(opts->chroot);
  495. free(opts);
  496. }
  497. /*--------------------------------------------------------- */
  498. /* Parse command line options */
  499. static int opts_parse(int argc, char *argv[], struct options *opts)
  500. {
  501. static const char *shortopts = "hvs:p:u:g:dr:O:";
  502. #ifdef HAVE_GETOPT_H
  503. static const struct option longopts[] = {
  504. {"help", 0, NULL, 'h'},
  505. {"version", 0, NULL, 'v'},
  506. {"socket", 1, NULL, 's'},
  507. {"pid", 1, NULL, 'p'},
  508. {"user", 1, NULL, 'u'},
  509. {"group", 1, NULL, 'g'},
  510. {"debug", 0, NULL, 'd'},
  511. {"chroot", 1, NULL, 'r'},
  512. {"facility", 1, NULL, 'O'},
  513. {NULL, 0, NULL, 0}
  514. };
  515. #endif
  516. optind = 1;
  517. while(1) {
  518. int opt;
  519. #ifdef HAVE_GETOPT_H
  520. opt = getopt_long(argc, argv, shortopts, longopts, NULL);
  521. #else
  522. opt = getopt(argc, argv, shortopts);
  523. #endif
  524. if (-1 == opt)
  525. break;
  526. switch (opt) {
  527. case 's':
  528. if (opts->socket_path)
  529. free(opts->socket_path);
  530. opts->socket_path = strdup(optarg);
  531. break;
  532. case 'p':
  533. if (opts->pidfile)
  534. free(opts->pidfile);
  535. opts->pidfile = strdup(optarg);
  536. break;
  537. case 'r':
  538. #ifdef HAVE_CHROOT
  539. if (opts->chroot)
  540. free(opts->chroot);
  541. opts->chroot = strdup(optarg);
  542. #else
  543. fprintf(stderr, "Error: The --chroot option is not supported.\n");
  544. return -1;
  545. #endif
  546. break;
  547. case 'd':
  548. opts->debug = 1;
  549. break;
  550. case 'u': {
  551. #ifdef HAVE_PWD_H
  552. struct passwd *pwd = getpwnam(optarg);
  553. if (!pwd) {
  554. fprintf(stderr, "Error: Can't identify user \"%s\"\n",
  555. optarg);
  556. return -1;
  557. }
  558. opts->uid = pwd->pw_uid;
  559. #else
  560. fprintf(stderr, "The --user option is not supported.\n");
  561. return -1;
  562. #endif
  563. break;
  564. }
  565. case 'g': {
  566. #ifdef HAVE_GRP_H
  567. struct group *grp = getgrnam(optarg);
  568. if (!grp) {
  569. fprintf(stderr, "Can't identify group \"%s\"\n",
  570. optarg);
  571. return -1;
  572. }
  573. opts->gid = grp->gr_gid;
  574. #else
  575. fprintf(stderr, "The --group option is not supported.\n");
  576. return -1;
  577. #endif
  578. break;
  579. }
  580. case 'O':
  581. if (lub_log_facility(optarg, &(opts->log_facility))) {
  582. fprintf(stderr, "Error: Illegal syslog facility %s.\n", optarg);
  583. help(-1, argv[0]);
  584. exit(-1);
  585. }
  586. break;
  587. case 'h':
  588. help(0, argv[0]);
  589. exit(0);
  590. break;
  591. case 'v':
  592. version(VERSION);
  593. exit(0);
  594. break;
  595. default:
  596. help(-1, argv[0]);
  597. exit(-1);
  598. break;
  599. }
  600. }
  601. return 0;
  602. }
  603. /*--------------------------------------------------------- */
  604. /* Print help message */
  605. static void help(int status, const char *argv0)
  606. {
  607. const char *name = NULL;
  608. if (!argv0)
  609. return;
  610. /* Find the basename */
  611. name = strrchr(argv0, '/');
  612. if (name)
  613. name++;
  614. else
  615. name = argv0;
  616. if (status != 0) {
  617. fprintf(stderr, "Try `%s -h' for more information.\n",
  618. name);
  619. } else {
  620. printf("Usage: %s [options]\n", name);
  621. printf("Daemon to store user configuration (i.e. commands). "
  622. "The part of the klish project.\n");
  623. printf("Options:\n");
  624. printf("\t-v, --version\tPrint version.\n");
  625. printf("\t-h, --help\tPrint this help.\n");
  626. printf("\t-d, --debug\tDebug mode. Don't daemonize.\n");
  627. printf("\t-s <path>, --socket=<path>\tSpecify the UNIX socket "
  628. "filesystem path to listen on.\n");
  629. printf("\t-p <path>, --pid=<path>\tFile to save daemon's PID to.\n");
  630. printf("\t-r <path>, --chroot=<path>\tDirectory to chroot.\n");
  631. printf("\t-u <user>, --user=<user>\tExecute process as"
  632. " specified user.\n");
  633. printf("\t-g <group>, --group=<group>\tExecute process as"
  634. " specified group.\n");
  635. printf("\t-O, --facility\tSyslog facility. Default is DAEMON.\n");
  636. }
  637. }