Commit e66f7ed1 e66f7ed1d4b5f6cb696e5b6e02033181d392dc1e by Sergey Poznyakoff

Use mu_getpwuid() instead of getpwuid().

1 parent 24ed1e41
...@@ -27,7 +27,7 @@ imap4d_bye (int reason) ...@@ -27,7 +27,7 @@ imap4d_bye (int reason)
27 int 27 int
28 imap4d_bye0 (int reason, struct imap4d_command *command) 28 imap4d_bye0 (int reason, struct imap4d_command *command)
29 { 29 {
30 struct passwd *pw = getpwuid (getuid ()); 30 struct passwd *pw = mu_getpwuid (getuid ());
31 const char *username; 31 const char *username;
32 int status = EXIT_FAILURE; 32 int status = EXIT_FAILURE;
33 username = (pw) ? pw->pw_name : "Unknown"; 33 username = (pw) ? pw->pw_name : "Unknown";
......
...@@ -75,7 +75,7 @@ imap4d_copy0 (char *arg, int isuid, char *resp, size_t resplen) ...@@ -75,7 +75,7 @@ imap4d_copy0 (char *arg, int isuid, char *resp, size_t resplen)
75 75
76 if (strcasecmp (name, "INBOX") == 0 && !mu_virtual_domain) 76 if (strcasecmp (name, "INBOX") == 0 && !mu_virtual_domain)
77 { 77 {
78 struct passwd *pw = getpwuid (getuid()); 78 struct passwd *pw = mu_getpwuid (getuid());
79 mailbox_name = strdup ((pw) ? pw->pw_name : ""); 79 mailbox_name = strdup ((pw) ? pw->pw_name : "");
80 } 80 }
81 else 81 else
......
...@@ -89,7 +89,7 @@ imap4d_rename (struct imap4d_command *command, char *arg) ...@@ -89,7 +89,7 @@ imap4d_rename (struct imap4d_command *command, char *arg)
89 } 89 }
90 free (name); 90 free (name);
91 free (newname); 91 free (newname);
92 pw = getpwuid (getuid ()); 92 pw = mu_getpwuid (getuid ());
93 if (pw) 93 if (pw)
94 { 94 {
95 mailbox_t inbox = NULL; 95 mailbox_t inbox = NULL;
......
...@@ -59,7 +59,7 @@ imap4d_select0 (struct imap4d_command *command, char *arg, int flags) ...@@ -59,7 +59,7 @@ imap4d_select0 (struct imap4d_command *command, char *arg, int flags)
59 59
60 if (strcasecmp (mailbox_name, "INBOX") == 0 && !mu_virtual_domain) 60 if (strcasecmp (mailbox_name, "INBOX") == 0 && !mu_virtual_domain)
61 { 61 {
62 pw = getpwuid (getuid ()); 62 pw = mu_getpwuid (getuid ());
63 if (pw) 63 if (pw)
64 { 64 {
65 mailbox_name = malloc (strlen (maildir) + strlen (pw->pw_name) + 1); 65 mailbox_name = malloc (strlen (maildir) + strlen (pw->pw_name) + 1);
......
...@@ -47,7 +47,7 @@ imap4d_status (struct imap4d_command *command, char *arg) ...@@ -47,7 +47,7 @@ imap4d_status (struct imap4d_command *command, char *arg)
47 47
48 if (strcasecmp (name, "INBOX") == 0 && !mu_virtual_domain) 48 if (strcasecmp (name, "INBOX") == 0 && !mu_virtual_domain)
49 { 49 {
50 struct passwd *pw = getpwuid (getuid()); 50 struct passwd *pw = mu_getpwuid (getuid());
51 mailbox_name = strdup ((pw) ? pw->pw_name : ""); 51 mailbox_name = strdup ((pw) ? pw->pw_name : "");
52 } 52 }
53 else 53 else
......
...@@ -86,12 +86,12 @@ get_homedir (const char *user) ...@@ -86,12 +86,12 @@ get_homedir (const char *user)
86 homedir = getenv ("HOME"); 86 homedir = getenv ("HOME");
87 if (homedir == NULL) 87 if (homedir == NULL)
88 { 88 {
89 pw = getpwuid (getuid ()); 89 pw = mu_getpwuid (getuid ());
90 if (pw) 90 if (pw)
91 homedir = pw->pw_dir; 91 homedir = pw->pw_dir;
92 } 92 }
93 #else 93 #else
94 pw = getpwuid (getuid ()); 94 pw = mu_getpwuid (getuid ());
95 if (pw) 95 if (pw)
96 homedir = pw->pw_dir; 96 homedir = pw->pw_dir;
97 #endif 97 #endif
...@@ -283,7 +283,7 @@ mailbox_create_default (mailbox_t *pmbox, const char *mail) ...@@ -283,7 +283,7 @@ mailbox_create_default (mailbox_t *pmbox, const char *mail)
283 if (user == NULL) 283 if (user == NULL)
284 { 284 {
285 struct passwd *pw; 285 struct passwd *pw;
286 pw = getpwuid (getuid ()); 286 pw = mu_getpwuid (getuid ());
287 if (pw) 287 if (pw)
288 user = pw->pw_name; 288 user = pw->pw_name;
289 else 289 else
......
...@@ -925,7 +925,7 @@ message_sender (envelope_t envelope, char *buf, size_t len, size_t *pnwrite) ...@@ -925,7 +925,7 @@ message_sender (envelope_t envelope, char *buf, size_t len, size_t *pnwrite)
925 { 925 {
926 struct passwd *pw; 926 struct passwd *pw;
927 const char *sender; 927 const char *sender;
928 pw = getpwuid (getuid ()); 928 pw = mu_getpwuid (getuid ());
929 sender = (pw) ? pw->pw_name : "unknown"; 929 sender = (pw) ? pw->pw_name : "unknown";
930 n = strlen (sender); 930 n = strlen (sender);
931 if (buf && len > 0) 931 if (buf && len > 0)
......
...@@ -621,7 +621,7 @@ get_from (message_t msg, char *localhost, address_t *pmail_from) ...@@ -621,7 +621,7 @@ get_from (message_t msg, char *localhost, address_t *pmail_from)
621 /* If it's not in the header create one form the passwd. */ 621 /* If it's not in the header create one form the passwd. */
622 if (status != 0 || size == 0) 622 if (status != 0 || size == 0)
623 { 623 {
624 struct passwd *pwd = getpwuid (getuid ()); 624 struct passwd *pwd = mu_getpwuid (getuid ());
625 /* Not in the passwd ???? We have a problem. */ 625 /* Not in the passwd ???? We have a problem. */
626 if (pwd == 0 || pwd->pw_name == NULL) 626 if (pwd == 0 || pwd->pw_name == NULL)
627 { 627 {
......
...@@ -397,7 +397,7 @@ get_user (url_t url, const char *filename, char **user) ...@@ -397,7 +397,7 @@ get_user (url_t url, const char *filename, char **user)
397 } 397 }
398 else 398 else
399 { 399 {
400 struct passwd *pw = getpwuid (getuid ()); 400 struct passwd *pw = mu_getpwuid (getuid ());
401 if (pw && pw->pw_name) 401 if (pw && pw->pw_name)
402 { 402 {
403 u = strdup (pw->pw_name); 403 u = strdup (pw->pw_name);
......
...@@ -254,7 +254,7 @@ mu_get_homedir (void) ...@@ -254,7 +254,7 @@ mu_get_homedir (void)
254 { 254 {
255 struct passwd *pwd; 255 struct passwd *pwd;
256 256
257 pwd = getpwuid (getuid ()); 257 pwd = mu_getpwuid (getuid ());
258 if (!pwd) 258 if (!pwd)
259 return NULL; 259 return NULL;
260 homedir = pwd->pw_dir; 260 homedir = pwd->pw_dir;
......