From 755b185fe97ee595e17f045bbf9e278c3115a52d Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 27 Nov 2013 17:21:01 +0100 Subject: [PATCH] s3-lib: Fix %G subtituion for domain users in smbd. BUG: https://bugzilla.samba.org/show_bug.cgi?id=10286 Signed-off-by: Andreas Schneider --- source3/lib/substitute.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c index ca2ac79..937f02c 100644 --- a/source3/lib/substitute.c +++ b/source3/lib/substitute.c @@ -499,10 +499,20 @@ char *talloc_sub_basic(TALLOC_CTX *mem_ctx, break; case 'G' : { struct passwd *pass; - r = talloc_strdup(tmp_ctx, smb_name); + + if (domain_name != NULL && domain_name[0] != '\0') { + r = talloc_asprintf(tmp_ctx, + "%s%c%s", + domain_name, + *lp_winbind_separator(), + smb_name); + } else { + r = talloc_strdup(tmp_ctx, smb_name); + } if (r == NULL) { goto error; } + pass = Get_Pwnam_alloc(tmp_ctx, r); if (pass != NULL) { a_string = realloc_string_sub( -- 1.8.4.3