diff options
-rw-r--r-- | source3/lib/substitute.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c index ca2ac7981f..937f02c499 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( |