]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Fix mail_user_home_mkdir() crash when user has no home directory
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 9 May 2019 16:27:18 +0000 (19:27 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Tue, 25 Jun 2019 11:58:15 +0000 (14:58 +0300)
This is used only by dsync when creating lock file. It wouldn't work
without a home directory anyway.

src/lib-storage/mail-user.c

index fadc221211afd5ca3bc0685f62b1bd6d726ad1d3..42ec840b1721a344f10dd3c91c5a803888cd5ab5 100644 (file)
@@ -750,8 +750,10 @@ int mail_user_home_mkdir(struct mail_user *user)
        const char *home;
        int ret;
 
-       if (mail_user_get_home(user, &home) < 0)
-               return -1;
+       if ((ret = mail_user_get_home(user, &home)) <= 0) {
+               /* If user has no home directory, just return success. */
+               return ret;
+       }
 
        /* Try to create the home directory by creating the root directory for
           a namespace that exists under the home. This way we end up in the