1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

Merge Gerry's %G change from 2.2.2.

Jeremy.
(This used to be commit d8262286dd)
This commit is contained in:
Jeremy Allison 2001-10-18 18:52:01 +00:00
parent 904fca7684
commit 9a903a08a7

View File

@ -167,6 +167,7 @@ void standard_sub_basic(char *str)
{ {
char *p, *s; char *p, *s;
fstring pidstr; fstring pidstr;
struct passwd *pass;
for (s=str; (p=strchr_m(s, '%'));s=p) { for (s=str; (p=strchr_m(s, '%'));s=p) {
fstring tmp_str; fstring tmp_str;
@ -179,6 +180,13 @@ void standard_sub_basic(char *str)
strlower(tmp_str); strlower(tmp_str);
string_sub(p,"%U",tmp_str,l); string_sub(p,"%U",tmp_str,l);
break; 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' : case 'D' :
fstrcpy(tmp_str, current_user_info.domain); fstrcpy(tmp_str, current_user_info.domain);
strupper(tmp_str); 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); int l = sizeof(pstring) - (int)(p-str);
switch (*(p+1)) { 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 'N' : string_sub(p,"%N", automount_server(user),l); break;
case 'H': case 'H':
if ((home = get_user_home_dir(user))) { if ((home = get_user_home_dir(user))) {