s3:smbd: Make sure we do not export "/" (root) as home dir
[samba.git] / source3 / smbd / password.c
index f472bda2c70e03eddbafc22e8259198194bcdc0c..0576d2563ebaf3199acce8d5b2178f950f10156e 100644 (file)
@@ -129,6 +129,13 @@ int register_homes_share(const char *username)
                return -1;
        }
 
+       if (strequal(pwd->pw_dir, "/")) {
+               DBG_NOTICE("Invalid home directory defined for user '%s'\n",
+                          username);
+               TALLOC_FREE(pwd);
+               return -1;
+       }
+
        DEBUG(3, ("Adding homes service for user '%s' using home directory: "
                  "'%s'\n", username, pwd->pw_dir));