Skip to content
Snippets Groups Projects
Commit e58d90ca authored by Stephan Bosch's avatar Stephan Bosch
Browse files

Changed acquisition of usernames in sieve command line tools.

parent bdc8a61f
No related branches found
No related tags found
No related merge requests found
......@@ -75,14 +75,25 @@ void sieve_tool_deinit(void)
const char *sieve_tool_get_user(void)
{
uid_t process_euid = geteuid();
struct passwd *pw = getpwuid(process_euid);
if (pw != NULL) {
return t_strdup(pw->pw_name);
}
i_fatal("couldn't lookup our username (uid=%s)", dec2str(process_euid));
return NULL;
const char *user;
uid_t process_euid;
struct passwd *pw;
user = getenv("USER");
if ( user == NULL || *user == '\0' ) {
process_euid = geteuid();
if ((pw = getpwuid(process_euid)) != NULL) {
user = t_strdup(pw->pw_name);
}
}
if ( user == NULL || *user == '\0' ) {
i_fatal("couldn't lookup our username (uid=%s)", dec2str(process_euid));
}
return user;
}
void sieve_tool_get_envelope_data
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.