From 31160de2b8d9397e158098adfa96aaed691614d7 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Thu, 23 Sep 1999 15:59:20 +0000 Subject: use gecos field to fill the full_name don't overwrite backend values with defaults values. J.F. (This used to be commit a204a9adb84c41658def08cb75670995aec02baa) --- source3/passdb/sampass.c | 34 +++++++++++++++++++++++++++------- source3/passdb/sampassdb.c | 9 +++++++++ 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/source3/passdb/sampass.c b/source3/passdb/sampass.c index 28d28150ec..95e2da5605 100644 --- a/source3/passdb/sampass.c +++ b/source3/passdb/sampass.c @@ -88,6 +88,14 @@ static struct sam_passwd *getsamfile21pwent(void *vp) DEBUG(5,("getsamfile21pwent\n")); + user->full_name = NULL; + user->home_dir = NULL; + user->dir_drive = NULL; + user->logon_script = NULL; + user->profile_path = NULL; + user->acct_desc = NULL; + user->workstations = NULL; + user = pwdb_smb_to_sam(getsmbfilepwent(vp)); if (user == NULL) { @@ -122,13 +130,25 @@ static struct sam_passwd *getsamfile21pwent(void *vp) sam_logon_in_ssb = False; - user->full_name = full_name; - user->home_dir = home_dir; - user->dir_drive = home_drive; - user->logon_script = logon_script; - user->profile_path = profile_path; - user->acct_desc = acct_desc; - user->workstations = workstations; + /* + only overwrite values with defaults IIF specific backend + didn't filled the values + */ + + if (user->full_name == NULL) + user->full_name = full_name; + if (user->home_dir == NULL) + user->home_dir = home_dir; + if (user->dir_drive == NULL) + user->dir_drive = home_drive; + if (user->logon_script == NULL) + user->logon_script = logon_script; + if (user->profile_path == NULL) + user->profile_path = profile_path; + if (user->acct_desc == NULL) + user->acct_desc = acct_desc; + if (user->workstations == NULL) + user->workstations = workstations; user->unknown_str = NULL; /* don't know, yet! */ user->munged_dial = NULL; /* "munged" dial-back telephone number */ diff --git a/source3/passdb/sampassdb.c b/source3/passdb/sampassdb.c index 3f1587e1ac..14d0677ac9 100644 --- a/source3/passdb/sampassdb.c +++ b/source3/passdb/sampassdb.c @@ -576,8 +576,10 @@ struct smb_passwd *pwdb_sam_to_smb(struct sam_passwd *user) struct sam_passwd *pwdb_smb_to_sam(struct smb_passwd *user) { static struct sam_passwd pw_buf; + struct passwd *pass=NULL; static fstring nt_name; static fstring unix_name; + static pstring unix_gecos; if (user == NULL) return NULL; @@ -598,6 +600,13 @@ struct sam_passwd *pwdb_smb_to_sam(struct smb_passwd *user) pw_buf.smb_passwd = user->smb_passwd; pw_buf.smb_nt_passwd = user->smb_nt_passwd; pw_buf.acct_ctrl = user->acct_ctrl; + + pass = hashed_getpwnam(unix_name); + if (pass != NULL) + { + pstrcpy(unix_gecos, pass->pw_gecos); + pw_buf.full_name=unix_gecos; + } if ( user->pass_last_set_time != (time_t)-1 ) { -- cgit