+ /* If the config file contains a line "port portname", the daemon
+ * will listen on the named port rather than SERVICE_NAME "sms_update"
+ */
+ if ((p = config_lookup("port")) == NULL)
+ p = SERVICE_NAME;
+ conn = create_forking_server(p, 0);
+
+ /* If the config file contains a line "user username", the
+ * daemon will run with that user's UID.
+ */
+ if (p = config_lookup("user")) {
+ struct passwd *pw;
+ pw = getpwnam(p);
+ if (pw == 0) {
+ com_err(whoami, errno, "Unable to find user %s\n", p);
+ exit(1);
+ }
+ uid = pw->pw_uid;
+ }
+
+ /* If the config file contains a line "chroot /dir/name", the
+ * daemon will run chrooted to that directory.
+ */
+ if (p = config_lookup("chroot")) {
+ if (chroot(p) < 0) {
+ com_err(whoami, errno, "unable to chroot to %s", p);
+ exit(1);
+ }
+ }
+