konfd.c 16 KB

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