From: Andrew Walker Date: Wed, 21 Oct 2020 09:38:45 +0000 (-0400) Subject: s3:param:service - ensure registry shares loaded before home check X-Git-Tag: talloc-2.3.2~199 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b52c2db264a92ea77bcb7e45e016ea03f699393;p=thirdparty%2Fsamba.git s3:param:service - ensure registry shares loaded before home check 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 Reviewed-by: Jeremy Alison Reviewed-by: Gary Lockyer Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Thu Oct 22 00:30:38 UTC 2020 on sn-devel-184 --- diff --git a/source3/param/service.c b/source3/param/service.c index 09b8228daad..add6b40d619 100644 --- a/source3/param/service.c +++ b/source3/param/service.c @@ -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. */