comparison src/lib-storage/index/shared/shared-storage.c @ 8956:9619fbd698d5 HEAD

shared mailboxes: Don't assert-crash if trying to look up "" user's mailboxes.
author Timo Sirainen <tss@iki.fi>
date Thu, 16 Apr 2009 19:48:10 -0400
parents 3a30d73fc463
children 0dcb7e34a216
comparison
equal deleted inserted replaced
8955:8de5b2a19a08 8956:9619fbd698d5
188 "Invalid namespace prefix %s vs %s", 188 "Invalid namespace prefix %s vs %s",
189 storage->ns_prefix_pattern, *_name); 189 storage->ns_prefix_pattern, *_name);
190 return -1; 190 return -1;
191 } 191 }
192 } 192 }
193
193 /* successfully matched the name. */ 194 /* successfully matched the name. */
194 if (userdomain == NULL) { 195 if (userdomain == NULL) {
195 i_assert(username != NULL); 196 i_assert(username != NULL);
196 userdomain = domain == NULL ? username : 197 userdomain = domain == NULL ? username :
197 t_strconcat(username, "@", domain, NULL); 198 t_strconcat(username, "@", domain, NULL);
202 else { 203 else {
203 username = t_strdup_until(userdomain, domain); 204 username = t_strdup_until(userdomain, domain);
204 domain++; 205 domain++;
205 } 206 }
206 } 207 }
208 if (*userdomain == '\0') {
209 mail_storage_set_error(_storage, MAIL_ERROR_PARAMS,
210 "Empty username doesn't exist");
211 return -1;
212 }
207 213
208 /* expand the namespace prefix and see if it already exists. 214 /* expand the namespace prefix and see if it already exists.
209 this should normally happen only when the mailbox is being opened */ 215 this should normally happen only when the mailbox is being opened */
210 tab = t_malloc(sizeof(static_tab)); 216 tab = t_malloc(sizeof(static_tab));
211 memcpy(tab, static_tab, sizeof(static_tab)); 217 memcpy(tab, static_tab, sizeof(static_tab));