From b54509045d7186fc0526d91bcf429659cba8be1d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 6 May 1998 18:14:02 +0000 Subject: loadparm.c: Added #ifdef USE_LDAP around ldap code. server.c: Moved %U, %G and %N into standard_sub() from standard_sub_basic() as only smbd knows about usernames. Also fixes problem with calling standard_sub_basic() from loadparm.c. smbpass.c: Partial tidyup of machine_password_lock() code - not finished yet. util.c: Moved %U, %G and %N into standard_sub() from standard_sub_basic() as only smbd knows about usernames. Also fixes problem with calling standard_sub_basic() from loadparm.c. lib/rpc/server/srv_ldap_helpers.c: Added #ifdef USE_LDAP around ldap code. lib/rpc/server/srv_samr.c: Added #ifdef USE_LDAP around ldap code. Jeremy. (This used to be commit 446b98ca071170fc950bad86ad96b58308a5b75c) --- source3/smbd/server.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 29ee8c9fc5..6f5527714d 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -4340,10 +4340,14 @@ do some standard substitutions in a string ****************************************************************************/ void standard_sub(int cnum,char *str,uint16 vuid) { - user_struct *vuser = get_valid_user_struct(vuid); - if (VALID_CNUM(cnum)) { char *p, *s, *home; + struct passwd *pass; + char *username = sesssetup_user; + user_struct *vuser = get_valid_user_struct(vuid); + + if(vuser != NULL) + pstrcpy( sesssetup_user, vuser->requested_name); for ( s=str ; (p=strchr(s, '%')) != NULL ; s=p ) { switch (*(p+1)) { @@ -4355,24 +4359,29 @@ void standard_sub(int cnum,char *str,uint16 vuid) case 'P' : string_sub(p,"%P",Connections[cnum].connectpath); break; case 'S' : string_sub(p,"%S",lp_servicename(Connections[cnum].service)); break; case 'g' : string_sub(p,"%g",gidtoname(Connections[cnum].gid)); break; + case 'G' : + { + if ((pass = Get_Pwnam(sesssetup_user,False))!=NULL) + string_sub(p,"%G",gidtoname(pass->pw_gid)); + else + p += 2; + break; + } case 'u' : string_sub(p,"%u",Connections[cnum].user); break; + case 'U' : string_sub(p,"%U", username); break; /* * Patch from jkf@soton.ac.uk - * Left the %N (NIS server name) in standard_sub_basic as it - * is a feature for logon servers, hence uses the username. * The %p (NIS server path) code is here as it is used * instead of the default "path =" string in [homes] and so * needs the service name, not the username. */ + case 'N' : string_sub(p,"%N", automount_server(username)); break; case 'p' : string_sub(p,"%p",automount_path(lp_servicename(Connections[cnum].service))); break; case '\0' : p++; break; /* don't run off the end of the string */ default : p+=2; break; } } } - if(vuser != NULL) - pstrcpy( sesssetup_user, vuser->requested_name); - standard_sub_basic(str); } -- cgit