Commit 6c01b9d8 6c01b9d8055dfdb55a8deab5bc8aefd118a90f1f by Sergey Poznyakoff

Removed unnecessary code: namespace_getfullpath() now translates INBOX to filename.

1 parent bf6389f9
...@@ -73,13 +73,7 @@ imap4d_copy0 (char *arg, int isuid, char *resp, size_t resplen) ...@@ -73,13 +73,7 @@ imap4d_copy0 (char *arg, int isuid, char *resp, size_t resplen)
73 return RESP_BAD; 73 return RESP_BAD;
74 } 74 }
75 75
76 if (strcasecmp (name, "INBOX") == 0 && !mu_virtual_domain) 76 mailbox_name = namespace_getfullpath (name, delim);
77 {
78 struct passwd *pw = mu_getpwuid (getuid());
79 mailbox_name = strdup ((pw) ? pw->pw_name : "");
80 }
81 else
82 mailbox_name = namespace_getfullpath (name, delim);
83 77
84 if (!mailbox_name) 78 if (!mailbox_name)
85 { 79 {
...@@ -117,7 +111,7 @@ imap4d_copy0 (char *arg, int isuid, char *resp, size_t resplen) ...@@ -117,7 +111,7 @@ imap4d_copy0 (char *arg, int isuid, char *resp, size_t resplen)
117 return RESP_OK; 111 return RESP_OK;
118 } 112 }
119 113
120 /* Unless it is certain that the destination mailbix can not be created, 114 /* Unless it is certain that the destination mailbox can not be created,
121 the server MUST send the response code "[TRYCREATE]" as the prefix 115 the server MUST send the response code "[TRYCREATE]" as the prefix
122 of the text of the tagged NO response. This gives a hint to the 116 of the text of the tagged NO response. This gives a hint to the
123 client that it can attempt a CREATE command and retry the copy if 117 client that it can attempt a CREATE command and retry the copy if
......
...@@ -57,25 +57,7 @@ imap4d_select0 (struct imap4d_command *command, char *arg, int flags) ...@@ -57,25 +57,7 @@ imap4d_select0 (struct imap4d_command *command, char *arg, int flags)
57 imap4d_sync (); 57 imap4d_sync ();
58 } 58 }
59 59
60 if (strcasecmp (mailbox_name, "INBOX") == 0 && !mu_virtual_domain) 60 mailbox_name = namespace_getfullpath (mailbox_name, "/");
61 {
62 pw = mu_getpwuid (getuid ());
63 if (pw)
64 {
65 mailbox_name = malloc (strlen (mu_path_maildir) +
66 strlen (pw->pw_name) + 1);
67 if (!mailbox_name)
68 {
69 syslog (LOG_ERR, "Not enough memory");
70 return util_finish (command, RESP_NO, "Not enough memory");
71 }
72 sprintf (mailbox_name, "%s%s", mu_path_maildir, pw->pw_name);
73 }
74 else
75 mailbox_name = strdup ("/dev/null");
76 }
77 else
78 mailbox_name = namespace_getfullpath (mailbox_name, "/");
79 61
80 if (!mailbox_name) 62 if (!mailbox_name)
81 return util_finish (command, RESP_NO, "Couldn't open mailbox"); 63 return util_finish (command, RESP_NO, "Couldn't open mailbox");
......
...@@ -72,22 +72,7 @@ imap4d_status (struct imap4d_command *command, char *arg) ...@@ -72,22 +72,7 @@ imap4d_status (struct imap4d_command *command, char *arg)
72 if (!name || *name == '\0' || !sp || *sp == '\0') 72 if (!name || *name == '\0' || !sp || *sp == '\0')
73 return util_finish (command, RESP_BAD, "Too few args"); 73 return util_finish (command, RESP_BAD, "Too few args");
74 74
75 if (strcasecmp (name, "INBOX") == 0 && !mu_virtual_domain) 75 mailbox_name = namespace_getfullpath (name, delim);
76 {
77 struct passwd *pw = mu_getpwuid (getuid());
78 if (!pw)
79 return util_finish (command, RESP_NO, "Cannot map UID to username");
80 mailbox_name = malloc (strlen (mu_path_maildir) +
81 strlen (pw->pw_name) + 1);
82 if (!mailbox_name)
83 {
84 syslog (LOG_ERR, "Not enough memory");
85 return util_finish (command, RESP_NO, "Not enough memory");
86 }
87 sprintf (mailbox_name, "%s%s", mu_path_maildir, pw->pw_name);
88 }
89 else
90 mailbox_name = namespace_getfullpath (name, delim);
91 76
92 if (!mailbox_name) 77 if (!mailbox_name)
93 return util_finish (command, RESP_NO, "Error opening mailbox"); 78 return util_finish (command, RESP_NO, "Error opening mailbox");
......