log_warn("Continuing with default config settings");
}
apply_settings(daemon, cfg, cmdline_verbose, debug_mode);
+ config_lookup_uid(cfg);
/* prepare */
if(!daemon_open_shared_ports(daemon))
- patch for remote control over local sockets, from Dag-Erling
Smorgrav, Ilya Bakulin. Use control-interface: /path/sock and
control-use-cert: no.
+ - Fixup that patch and uid lookup (only for daemon).
5 January 2015: Wouter
- getauxval test for ppc64 linux compatibility.
return 0;
}
-#ifdef HAVE_GETPWNAM
- /* translate username into uid and gid */
- if(cfg->username && cfg->username[0]) {
- 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;
- }
-#endif
return 1;
}
log_set_time_asc(config->log_time_ascii);
}
+void config_lookup_uid(struct config_file* cfg)
+{
+#ifdef HAVE_GETPWNAM
+ /* translate username into uid and gid */
+ if(cfg->username && cfg->username[0]) {
+ 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;
+ }
+#endif
+}
+
/**
* Calculate string length of full pathname in original filesys
* @param fname: the path name to convert.
*/
void config_apply(struct config_file* config);
+/**
+ * Find username, sets uid and gid.
+ * @param config: the config structure.
+ */
+void config_lookup_uid(struct config_file* config);
+
/**
* Set the given keyword to the given value.
* @param config: where to store config