diff options
Diffstat (limited to 'source3/lib/substitute.c')
-rw-r--r-- | source3/lib/substitute.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c index 71bd8c777ec..9c70760055b 100644 --- a/source3/lib/substitute.c +++ b/source3/lib/substitute.c @@ -167,6 +167,7 @@ void standard_sub_basic(char *str) { char *p, *s; fstring pidstr; + struct passwd *pass; for (s=str; (p=strchr_m(s, '%'));s=p) { fstring tmp_str; @@ -179,6 +180,13 @@ void standard_sub_basic(char *str) strlower(tmp_str); string_sub(p,"%U",tmp_str,l); break; + case 'G' : + if ((pass = Get_Pwnam(current_user_info.smb_name, False))!=NULL) { + string_sub(p,"%G",gidtoname(pass->pw_gid),l); + } else { + p += 2; + } + break; case 'D' : fstrcpy(tmp_str, current_user_info.domain); strupper(tmp_str); @@ -221,13 +229,6 @@ void standard_sub_advanced(int snum, char *user, char *connectpath, gid_t gid, c int l = sizeof(pstring) - (int)(p-str); switch (*(p+1)) { - case 'G' : - if ((pass = Get_Pwnam(user,False))!=NULL) { - string_sub(p,"%G",gidtoname(pass->pw_gid),l); - } else { - p += 2; - } - break; case 'N' : string_sub(p,"%N", automount_server(user),l); break; case 'H': if ((home = get_user_home_dir(user))) { |