]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:param:service - ensure registry shares loaded before home check
authorAndrew Walker <awalker@ixsystems.com>
Wed, 21 Oct 2020 09:38:45 +0000 (05:38 -0400)
committerJeremy Allison <jra@samba.org>
Thu, 22 Oct 2020 00:30:38 +0000 (00:30 +0000)
Registry shares should be loaded and checked prior to checking home
directories. This ensures that an explicitly defined service takes
priority over home directories (same behavior as non-registry shares).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14543

Signed-off-by: Andrew Walker <awalker@ixsystems.com>
Reviewed-by: Jeremy Alison <jra@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Oct 22 00:30:38 UTC 2020 on sn-devel-184

source3/param/service.c

index 09b8228daadbbe7ae4a6dd9b5792e58fc7bb0d6d..add6b40d619cb626ad92ad847770c1b757f569b1 100644 (file)
@@ -129,6 +129,16 @@ int find_service(TALLOC_CTX *ctx, const char *service_in, char **p_service_out)
 
        iService = lp_servicenumber(*p_service_out);
 
+       /*
+        * check for whether the service is a registry share before
+        * handling home directories. This is to ensure that
+        * that in the case service name is identical to a user's
+        * home directory, the explicit service is preferred.
+        */
+       if (iService < 0) {
+               iService = load_registry_service(*p_service_out);
+       }
+
        /* now handle the special case of a home directory */
        if (iService < 0) {
                char *phome_dir = get_user_home_dir(ctx, *p_service_out);
@@ -186,10 +196,6 @@ int find_service(TALLOC_CTX *ctx, const char *service_in, char **p_service_out)
                }
        }
 
-       if (iService < 0) {
-               iService = load_registry_service(*p_service_out);
-       }
-
        /* Is it a usershare service ? */
        if (iService < 0 && *lp_usershare_path(talloc_tos(), lp_sub)) {
                /* Ensure the name is canonicalized. */