Commit 8282a0f6 8282a0f66a27de33971a2b5c42470548090bf4dc by Sergey Poznyakoff

imap4d: forbid to treat namespace root as a mailbox

* imap4d/namespace.c (namespace_get_name): Return NULL if name
is the same as the returned prefix
1 parent aa0a6207
...@@ -352,6 +352,11 @@ namespace_get_name (char const *name, mu_record_t *rec, int *mode) ...@@ -352,6 +352,11 @@ namespace_get_name (char const *name, mu_record_t *rec, int *mode)
352 { 352 {
353 struct namespace_prefix const *pfx; 353 struct namespace_prefix const *pfx;
354 char *path = namespace_translate_name (name, &pfx); 354 char *path = namespace_translate_name (name, &pfx);
355 if (strcmp (name, pfx->prefix) == 0)
356 {
357 free (path);
358 return NULL;
359 }
355 if (rec) 360 if (rec)
356 *rec = pfx->record; 361 *rec = pfx->record;
357 if (mode) 362 if (mode)
......