From 7fdb821ef32459b6cdcdf6f7656d14804d4c94ed Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 31 Dec 2001 00:06:51 +0000 Subject: some merges from 2.2. Still need to merge in changes from pdb_tdb.c but it will take more time as I don't want to loose any fixes that are only in HEAD. (This used to be commit efcde5d9d8ce44c0613764504d797be54ba21473) --- source3/passdb/pdb_nisplus.c | 58 +++++++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 17 deletions(-) (limited to 'source3/passdb/pdb_nisplus.c') diff --git a/source3/passdb/pdb_nisplus.c b/source3/passdb/pdb_nisplus.c index c2505b99f5..c91f7f3421 100644 --- a/source3/passdb/pdb_nisplus.c +++ b/source3/passdb/pdb_nisplus.c @@ -47,6 +47,8 @@ #include extern int DEBUGLEVEL; +extern pstring samlogon_user; +extern BOOL sam_logon_in_ssb; struct nisp_enum_info { @@ -320,36 +322,54 @@ static BOOL make_sam_from_nisp_object(SAM_ACCOUNT *pw_buf, const nis_object *obj /* values, must exist for user */ if( !(pdb_get_acct_ctrl(pw_buf) & ACB_WSTRUST) ) { + /* FIXME!! This doesn't belong here. + Should be set in net_sam_logon() + --jerry */ + pstrcpy(samlogon_user, pdb_get_username(pw_buf)); get_single_attribute(obj, NPF_HOME_DIR, home_dir, sizeof(pstring)); - if( !(home_dir && *home_dir) ) + if( !(home_dir && *home_dir) ) { pstrcpy(home_dir, lp_logon_home()); - pdb_set_homedir(pw_buf, home_dir); + pdb_set_homedir(pw_buf, home_dir, False); + } + else + pdb_set_homedir(pw_buf, home_dir, True); get_single_attribute(obj, NPF_DIR_DRIVE, home_drive, sizeof(pstring)); - if( !(home_drive && *home_drive) ) + if( !(home_drive && *home_drive) ) { pstrcpy(home_drive, lp_logon_drive()); - pdb_set_dir_drive(pw_buf, home_drive); + pdb_set_dir_drive(pw_buf, home_drive, False); + } + else + pdb_set_dir_drive(pw_buf, home_drive, True); get_single_attribute(obj, NPF_LOGON_SCRIPT, logon_script, sizeof(pstring)); - if( !(logon_script && *logon_script) ) - pstrcpy(logon_script, lp_logon_script()); - pdb_set_logon_script(pw_buf, logon_script); + if( !(logon_script && *logon_script) ) { + pstrcpy(logon_script, lp_logon_script(), False); + } + else + pdb_set_logon_script(pw_buf, logon_script, True); - get_single_attribute(obj, NPF_PROFILE_PATH, profile_path, - sizeof(pstring)); - if( !(profile_path && *profile_path) ) + get_single_attribute(obj, NPF_PROFILE_PATH, profile_path, sizeof(pstring)); + if( !(profile_path && *profile_path) ) { pstrcpy(profile_path, lp_logon_path()); - pdb_set_profile_path(pw_buf, profile_path); - } else { + pdb_set_profile_path(pw_buf, profile_path, False); + } + else + pdb_set_profile_path(pw_buf, profile_path, True); + + } + else + { /* lkclXXXX this is OBSERVED behaviour by NT PDCs, enforced here. */ pdb_set_group_rid (pw_buf, DOMAIN_GROUP_RID_USERS); } /* Check the lanman password column. */ ptr = (char *)ENTRY_VAL(obj, NPF_LMPWD); - pdb_set_lanman_passwd(pw_buf, NULL); + if (!pdb_set_lanman_passwd(pw_buf, NULL)) + return False; if (!strncasecmp(ptr, "NO PASSWORD", 11)) { pdb_set_acct_ctrl(pw_buf, pdb_get_acct_ctrl(pw_buf) | ACB_PWNOTREQ); @@ -359,21 +379,25 @@ static BOOL make_sam_from_nisp_object(SAM_ACCOUNT *pw_buf, const nis_object *obj pdb_get_username(pw_buf))); return False; } - pdb_set_lanman_passwd(pw_buf, smbpwd); + if (!pdb_set_lanman_passwd(pw_buf, smbpwd)) + return False; } /* Check the NT password column. */ ptr = ENTRY_VAL(obj, NPF_NTPWD); - pdb_set_nt_passwd(pw_buf, NULL); + if (!pdb_set_nt_passwd(pw_buf, NULL)) + return False; if (!(pdb_get_acct_ctrl(pw_buf) & ACB_PWNOTREQ) && strncasecmp(ptr, "NO PASSWORD", 11)) { if (strlen(ptr) != 32 || !pdb_gethexpwd(ptr, smbntpwd)) { - DEBUG(0, ("malformed NT pwd entry: uid = %d.\n", + DEBUG(0, ("malformed NT pwd entry:\ + uid = %d.\n", pdb_get_uid(pw_buf))); return False; } - pdb_set_nt_passwd(pw_buf, smbntpwd); + if (!pdb_set_nt_passwd(pw_buf, smbntpwd)) + return False; } pdb_set_unknown_3(pw_buf, 0xffffff); /* don't know */ -- cgit