summaryrefslogtreecommitdiffstats
path: root/source3/lib/substitute.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-10-18 18:52:01 +0000
committerJeremy Allison <jra@samba.org>2001-10-18 18:52:01 +0000
commit9a903a08a7c4f8407b4d6d0937f0bfda932d2ce3 (patch)
tree757a419cca194453b96feb39d8c4ee2e12399408 /source3/lib/substitute.c
parent904fca76849c74665d2a7cc6c91ff3f7ed6f6c11 (diff)
downloadsamba-9a903a08a7c4f8407b4d6d0937f0bfda932d2ce3.tar.gz
samba-9a903a08a7c4f8407b4d6d0937f0bfda932d2ce3.tar.xz
samba-9a903a08a7c4f8407b4d6d0937f0bfda932d2ce3.zip
Merge Gerry's %G change from 2.2.2.
Jeremy. (This used to be commit d8262286ddb6105a9d3b0730912447ea2401a3fb)
Diffstat (limited to 'source3/lib/substitute.c')
-rw-r--r--source3/lib/substitute.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c
index 71bd8c777e..9c70760055 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))) {