Commit 84de61a4 84de61a48d89a05c13e7f5e6056246d08de8112b by Sergey Poznyakoff

Use mu_path_maildir instead of maildir.

1 parent 425d200a
...@@ -585,9 +585,9 @@ mailbox_path (const char *user) ...@@ -585,9 +585,9 @@ mailbox_path (const char *user)
585 585
586 if (!mu_virtual_domain) 586 if (!mu_virtual_domain)
587 { 587 {
588 mailbox_name = calloc (strlen (maildir) + 1 588 mailbox_name = calloc (strlen (mu_path_maildir) + 1 +
589 + strlen (pw->pw_name) + 1, 1); 589 strlen (pw->pw_name) + 1, 1);
590 sprintf (mailbox_name, "%s%s", maildir, pw->pw_name); 590 sprintf (mailbox_name, "%s%s", mu_path_maildir, pw->pw_name);
591 } 591 }
592 else 592 else
593 { 593 {
......
...@@ -28,7 +28,7 @@ collect_open_default () ...@@ -28,7 +28,7 @@ collect_open_default ()
28 28
29 if (!default_mailbox) 29 if (!default_mailbox)
30 { 30 {
31 asprintf (&default_mailbox, "%s%s", maildir, user_name); 31 asprintf (&default_mailbox, "%s%s", mu_path_maildir, user_name);
32 if (!default_mailbox) 32 if (!default_mailbox)
33 { 33 {
34 util_error ("not enough memory"); 34 util_error ("not enough memory");
......
...@@ -62,13 +62,14 @@ imap4d_select0 (struct imap4d_command *command, char *arg, int flags) ...@@ -62,13 +62,14 @@ imap4d_select0 (struct imap4d_command *command, char *arg, int flags)
62 pw = mu_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 (mu_path_maildir) +
66 strlen (pw->pw_name) + 1);
66 if (!mailbox_name) 67 if (!mailbox_name)
67 { 68 {
68 syslog (LOG_ERR, "Not enough memory"); 69 syslog (LOG_ERR, "Not enough memory");
69 return util_finish (command, RESP_NO, "Not enough memory"); 70 return util_finish (command, RESP_NO, "Not enough memory");
70 } 71 }
71 sprintf (mailbox_name, "%s%s", maildir, pw->pw_name); 72 sprintf (mailbox_name, "%s%s", mu_path_maildir, pw->pw_name);
72 } 73 }
73 else 74 else
74 mailbox_name = strdup ("/dev/null"); 75 mailbox_name = strdup ("/dev/null");
......
...@@ -125,7 +125,6 @@ struct argp_child mu_daemon_argp_child[] = ...@@ -125,7 +125,6 @@ struct argp_child mu_daemon_argp_child[] =
125 {NULL, 0, NULL, 0} 125 {NULL, 0, NULL, 0}
126 }; 126 };
127 127
128 char *maildir = MU_PATH_MAILDIR;
129 int log_facility = LOG_FACILITY; 128 int log_facility = LOG_FACILITY;
130 int mu_argp_error_code = 1; 129 int mu_argp_error_code = 1;
131 130
...@@ -198,7 +197,7 @@ mu_common_argp_parser (int key, char *arg, struct argp_state *state) ...@@ -198,7 +197,7 @@ mu_common_argp_parser (int key, char *arg, struct argp_state *state)
198 switch (key) 197 switch (key)
199 { 198 {
200 case 'm': 199 case 'm':
201 maildir = arg; 200 mu_path_maildir = arg;
202 break; 201 break;
203 202
204 case 'L': 203 case 'L':
...@@ -255,13 +254,13 @@ mu_common_argp_parser (int key, char *arg, struct argp_state *state) ...@@ -255,13 +254,13 @@ mu_common_argp_parser (int key, char *arg, struct argp_state *state)
255 254
256 #endif 255 #endif
257 case ARGP_KEY_FINI: 256 case ARGP_KEY_FINI:
258 p = mu_normalize_maildir (maildir); 257 p = mu_normalize_maildir (mu_path_maildir);
259 if (!p) 258 if (!p)
260 { 259 {
261 mu_error ("Badly formed maildir: %s", maildir); 260 mu_error ("Badly formed maildir: %s", mu_path_maildir);
262 exit (mu_argp_error_code); 261 exit (mu_argp_error_code);
263 } 262 }
264 maildir = p; 263 mu_path_maildir = p;
265 break; 264 break;
266 265
267 default: 266 default:
......
...@@ -447,13 +447,13 @@ deliver (FILE *fp, char *name) ...@@ -447,13 +447,13 @@ deliver (FILE *fp, char *name)
447 return; 447 return;
448 } 448 }
449 449
450 path = malloc (strlen (maildir) + strlen (name) + 1); 450 path = malloc (strlen (mu_path_maildir) + strlen (name) + 1);
451 if (!path) 451 if (!path)
452 { 452 {
453 mailer_err ("Out of memory"); 453 mailer_err ("Out of memory");
454 return; 454 return;
455 } 455 }
456 sprintf (path, "%s%s", maildir, name); 456 sprintf (path, "%s%s", mu_path_maildir, name);
457 457
458 if ((status = mailbox_create (&mbox, path)) != 0) 458 if ((status = mailbox_create (&mbox, path)) != 0)
459 { 459 {
......
...@@ -216,9 +216,9 @@ pop3d_apop (const char *arg) ...@@ -216,9 +216,9 @@ pop3d_apop (const char *arg)
216 if (setuid (pw->pw_uid) == -1) 216 if (setuid (pw->pw_uid) == -1)
217 return ERR_BAD_LOGIN; 217 return ERR_BAD_LOGIN;
218 218
219 mailbox_name = calloc (strlen (maildir) + 1 219 mailbox_name = calloc (strlen (mu_path_maildir) + 1
220 + strlen (pw->pw_name) + 1, 1); 220 + strlen (pw->pw_name) + 1, 1);
221 sprintf (mailbox_name, "%s%s", maildir, pw->pw_name); 221 sprintf (mailbox_name, "%s%s", mu_path_maildir, pw->pw_name);
222 222
223 if ((status = mailbox_create (&mbox, mailbox_name)) != 0 223 if ((status = mailbox_create (&mbox, mailbox_name)) != 0
224 || (status = mailbox_open (mbox, MU_STREAM_RDWR)) != 0) 224 || (status = mailbox_open (mbox, MU_STREAM_RDWR)) != 0)
......
...@@ -197,13 +197,14 @@ pop3d_user (const char *arg) ...@@ -197,13 +197,14 @@ pop3d_user (const char *arg)
197 if (pw->pw_uid > 0 && !mu_virtual_domain) 197 if (pw->pw_uid > 0 && !mu_virtual_domain)
198 { 198 {
199 setuid (pw->pw_uid); 199 setuid (pw->pw_uid);
200 mailbox_name = malloc (strlen (maildir) + strlen (pw->pw_name) + 1); 200 mailbox_name = malloc (strlen (mu_path_maildir) +
201 strlen (pw->pw_name) + 1);
201 if (!mailbox_name) 202 if (!mailbox_name)
202 { 203 {
203 syslog (LOG_ERR, "Not enough memory"); 204 syslog (LOG_ERR, "Not enough memory");
204 return ERR_UNKNOWN; 205 return ERR_UNKNOWN;
205 } 206 }
206 sprintf (mailbox_name, "%s%s", maildir, pw->pw_name); 207 sprintf (mailbox_name, "%s%s", mu_path_maildir, pw->pw_name);
207 } 208 }
208 else if (mu_virtual_domain) 209 else if (mu_virtual_domain)
209 { 210 {
......