]>
Commit | Line | Data |
---|---|---|
1d13e637 AF |
1 | commit 1d5f14acc3bacb96f7b8b300b3aeccd793552122 |
2 | Author: Andreas Schneider <asn@samba.org> | |
3 | AuthorDate: Wed Nov 27 17:21:01 2013 +0100 | |
4 | Commit: Andreas Schneider <asn@samba.org> | |
5 | CommitDate: Wed Feb 5 11:44:51 2014 +0100 | |
6 | ||
7 | s3-lib: Fix %G substitution for domain users in smbd | |
8 | ||
9 | BUG: https://bugzilla.samba.org/show_bug.cgi?id=10286 | |
10 | Signed-off-by: Andreas Schneider <asn@samba.org> | |
11 | Reviewed-by: Christian Ambach <ambi@samba.org> | |
12 | ||
13 | Autobuild-User(master): Christian Ambach <ambi@samba.org> | |
14 | Autobuild-Date(master): Tue Dec 10 16:39:43 CET 2013 on sn-devel-104 | |
15 | ||
16 | (cherry picked from commit 8eef4ab79ec5fb7e96ad2f2ad6c9bf30db13a50d) | |
17 | --- | |
18 | source3/lib/substitute.c | 12 +++++++++++- | |
19 | 1 file changed, 11 insertions(+), 1 deletion(-) | |
20 | ||
21 | diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c | |
22 | index 10beed7..5f72a5d 100644 | |
23 | --- a/source3/lib/substitute.c | |
24 | +++ b/source3/lib/substitute.c | |
25 | @@ -605,10 +605,20 @@ static char *alloc_sub_basic(const char *smb_name, const char *domain_name, | |
26 | break; | |
27 | case 'G' : { | |
28 | struct passwd *pass; | |
29 | - r = talloc_strdup(tmp_ctx, smb_name); | |
30 | + | |
31 | + if (domain_name != NULL && domain_name[0] != '\0') { | |
32 | + r = talloc_asprintf(tmp_ctx, | |
33 | + "%s%c%s", | |
34 | + domain_name, | |
35 | + *lp_winbind_separator(), | |
36 | + smb_name); | |
37 | + } else { | |
38 | + r = talloc_strdup(tmp_ctx, smb_name); | |
39 | + } | |
40 | if (r == NULL) { | |
41 | goto error; | |
42 | } | |
43 | + | |
44 | pass = Get_Pwnam_alloc(tmp_ctx, r); | |
45 | if (pass != NULL) { | |
46 | a_string = realloc_string_sub( |