diff options
| author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2015-04-26 11:25:07 +0000 |
|---|---|---|
| committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2015-04-26 11:25:07 +0000 |
| commit | 9145bbd450b41b3d36e63a815d45bf740a3e0230 (patch) | |
| tree | 6307de5b04b7eea58b8169c069c66d2d477930f9 /util | |
| parent | d3348d437fb0408bc24892ebd0b035686c294705 (diff) | |
Notes
Diffstat (limited to 'util')
| -rw-r--r-- | util/config_file.c | 11 | ||||
| -rw-r--r-- | util/config_file.h | 9 | ||||
| -rw-r--r-- | util/iana_ports.inc | 2 |
3 files changed, 15 insertions, 7 deletions
diff --git a/util/config_file.c b/util/config_file.c index f4eaccf1b3db..5c4e897da373 100644 --- a/util/config_file.c +++ b/util/config_file.c @@ -65,6 +65,11 @@ #include <pwd.h> #endif +/** from cfg username, after daemonise setup performed */ +uid_t cfg_uid = (uid_t)-1; +/** from cfg username, after daemonise setup performed */ +gid_t cfg_gid = (gid_t)-1; + /** global config during parsing */ struct config_parser_state* cfg_parser = 0; @@ -136,8 +141,6 @@ config_create(void) goto error_exit; init_outgoing_availports(cfg->outgoing_avail_ports, 65536); if(!(cfg->username = strdup(UB_USERNAME))) goto error_exit; - cfg->uid = (uid_t)-1; - cfg->gid = (gid_t)-1; #ifdef HAVE_CHROOT if(!(cfg->chrootdir = strdup(CHROOT_DIR))) goto error_exit; #endif @@ -1210,8 +1213,8 @@ void config_lookup_uid(struct config_file* cfg) struct passwd *pwd; if((pwd = getpwnam(cfg->username)) == NULL) log_err("user '%s' does not exist.", cfg->username); - cfg->uid = pwd->pw_uid; - cfg->gid = pwd->pw_gid; + cfg_uid = pwd->pw_uid; + cfg_gid = pwd->pw_gid; } #else (void)cfg; diff --git a/util/config_file.h b/util/config_file.h index 7ffc00a02d2e..ca512d720ebd 100644 --- a/util/config_file.h +++ b/util/config_file.h @@ -194,8 +194,6 @@ struct config_file { char* chrootdir; /** username to change to, if not "". */ char* username; - uid_t uid; - gid_t gid; /** working directory */ char* directory; /** filename to log to. */ @@ -345,6 +343,11 @@ struct config_file { int dnstap_log_forwarder_response_messages; }; +/** from cfg username, after daemonise setup performed */ +extern uid_t cfg_uid; +/** from cfg username, after daemonise setup performed */ +extern gid_t cfg_gid; + /** * Stub config options */ @@ -429,7 +432,7 @@ void config_delete(struct config_file* config); void config_apply(struct config_file* config); /** - * Find username, sets uid and gid. + * Find username, sets cfg_uid and cfg_gid. * @param config: the config structure. */ void config_lookup_uid(struct config_file* config); diff --git a/util/iana_ports.inc b/util/iana_ports.inc index 99e5a6543518..ce939d55ce54 100644 --- a/util/iana_ports.inc +++ b/util/iana_ports.inc @@ -4844,6 +4844,8 @@ 8912, 8913, 8954, +8980, +8981, 8989, 8990, 8991, |
