From 1e3490dda918c9fe580c90cef6767c777c87c438 Mon Sep 17 00:00:00 2001 From: Matthew Chapman Date: Wed, 22 Sep 1999 04:32:19 +0000 Subject: Fixed an annoying bug in the LDAP code. Attributes not present in the LDAP database were being initialised using unix_to_nt_time on -1, rather than -1 as an NTTIME (which is very different). Problems solved (hopefully): * "Access Denied" when accessing an NT share in a Samba controlled domain. * "Your password has expired" sometimes when logging in. (This used to be commit 740d8388cb6dfebb26681a45fd1b293383d08a6d) --- source3/passdb/sampassldap.c | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/source3/passdb/sampassldap.c b/source3/passdb/sampassldap.c index e456b6ab43..fd503c3d27 100644 --- a/source3/passdb/sampassldap.c +++ b/source3/passdb/sampassldap.c @@ -83,11 +83,10 @@ static void ldap_read_time(char *attribute, NTTIME *nttime) time_t t; if(ldap_get_attribute(attribute, timestr)) + { t = (time_t)strtol(timestr, NULL, 16); - else - t = (time_t)(-1); - - unix_to_nt_time(nttime, t); + unix_to_nt_time(nttime, t); + } } @@ -116,48 +115,30 @@ static struct sam_passwd *ldapsam_getsam() if(ldap_get_attribute("gidNumber", temp)) sam21->unix_gid = atoi(temp); - else - sam21->unix_gid = (gid_t)(-1); if(ldap_get_attribute("grouprid", temp)) sam21->group_rid = strtol(temp, NULL, 16); - else - sam21->group_rid = 0xFFFFFFFF; if(ldap_get_attribute("cn", full_name)) sam21->full_name = full_name; - else - sam21->full_name = NULL; if(ldap_get_attribute("description", acct_desc)) sam21->acct_desc = acct_desc; - else - sam21->acct_desc = NULL; if(ldap_get_attribute("smbHome", home_dir)) sam21->home_dir = home_dir; - else - sam21->home_dir = NULL; if(ldap_get_attribute("homeDrive", home_drive)) sam21->dir_drive = home_drive; - else - sam21->dir_drive = NULL; if(ldap_get_attribute("script", logon_script)) sam21->logon_script = logon_script; - else - sam21->logon_script = NULL; if(ldap_get_attribute("profile", profile_path)) sam21->profile_path = profile_path; - else - sam21->profile_path = NULL; if(ldap_get_attribute("workstations", workstations)) sam21->workstations = workstations; - else - sam21->workstations = NULL; ldap_read_time("pwdCanChange", &sam21->pass_can_change_time); ldap_read_time("pwdMustChange", &sam21->pass_must_change_time); -- cgit