From e58682eb077a79b5c54a0cea485b7d134a01f853 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Fri, 9 Jun 2000 14:13:11 +0000 Subject: do some standard_sub_advanced() in api_net_sam_logon on lp_logon_xxx(). and if you have unix realname=yes, you get the gecos name when locking the station. J.F. (This used to be commit b5ad24ae0b15643df5832e2369fb4e43c98a1359) --- source3/include/proto.h | 1 + source3/lib/substitute.c | 2 +- source3/rpc_server/srv_netlog.c | 20 ++++++++++++++++---- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index 8d7630a1be..3887d96589 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -204,6 +204,7 @@ int smbrun(char *cmd,char *outfile,BOOL shared); /*The following definitions come from lib/substitute.c */ void standard_sub_basic(char *str); +void standard_sub_advanced(int snum, char *user, char *connectpath, gid_t gid, char *str); void standard_sub_conn(connection_struct *conn, char *str); void standard_sub_snum(int snum, char *str); void standard_sub_vuser(char *str, user_struct *vuser); diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c index a23f613814..5eb557d03c 100644 --- a/source3/lib/substitute.c +++ b/source3/lib/substitute.c @@ -197,7 +197,7 @@ void standard_sub_basic(char *str) /**************************************************************************** Do some standard substitutions in a string. ****************************************************************************/ -static void standard_sub_advanced(int snum, char *user, char *connectpath, gid_t gid, char *str) +void standard_sub_advanced(int snum, char *user, char *connectpath, gid_t gid, char *str) { char *p, *s, *home; struct passwd *pass; diff --git a/source3/rpc_server/srv_netlog.c b/source3/rpc_server/srv_netlog.c index 7ca03a5e8b..a5aaffc174 100644 --- a/source3/rpc_server/srv_netlog.c +++ b/source3/rpc_server/srv_netlog.c @@ -644,6 +644,7 @@ static BOOL api_net_sam_logon(prs_struct *data, prs_struct *rdata) struct smb_passwd *smb_pass = NULL; UNISTR2 *uni_samlogon_user = NULL; fstring nt_username; + struct passwd *pw; user_struct *vuser = NULL; @@ -708,7 +709,7 @@ static BOOL api_net_sam_logon(prs_struct *data, prs_struct *rdata) /* * Do any case conversions. */ - (void)Get_Pwnam(nt_username, True); + pw=Get_Pwnam(nt_username, True); become_root(True); smb_pass = getsmbpwnam(nt_username); @@ -758,7 +759,8 @@ static BOOL api_net_sam_logon(prs_struct *data, prs_struct *rdata) pstring domain_groups; uint32 r_uid; uint32 r_gid; - + fstring full_name; + /* set up pointer indicating user/password failed to be found */ usr_info.ptr_user_info = 0; @@ -769,17 +771,27 @@ static BOOL api_net_sam_logon(prs_struct *data, prs_struct *rdata) /* possibly a better way would be to do a become_user() call */ sam_logon_in_ssb = True; pstrcpy(samlogon_user, nt_username); - + pstrcpy(logon_script, lp_logon_script()); + standard_sub_advanced(-1, nt_username, "", pw->pw_gid, logon_script); + pstrcpy(profile_path, lp_logon_path()); + standard_sub_advanced(-1, nt_username, "", pw->pw_gid, profile_path); pstrcpy(my_workgroup, lp_workgroup()); pstrcpy(home_drive, lp_logon_drive()); + standard_sub_advanced(-1, nt_username, "", pw->pw_gid, home_drive); + pstrcpy(home_dir, lp_logon_home()); + standard_sub_advanced(-1, nt_username, "", pw->pw_gid, home_dir); pstrcpy(my_name, global_myname); strupper(my_name); + + fstrcpy(full_name, ""); + if (lp_unix_realname()) + fstrcpy(full_name, pw->pw_gecos); /* * This is the point at which we get the group @@ -809,7 +821,7 @@ static BOOL api_net_sam_logon(prs_struct *data, prs_struct *rdata) &dummy_time, /* pass_must_change_time */ nt_username , /* user_name */ - vuser->user.full_name, /* full_name */ + full_name, /* full_name */ logon_script , /* logon_script */ profile_path , /* profile_path */ home_dir , /* home_dir */ -- cgit