pdb_ldap kickoffTime default

metzemix at gmx.de metzemix at gmx.de
Mon Mar 25 02:24:13 GMT 2002


I have tested samba-3.0-alpha17, I used the pdb_ldap SAM backend.

When I tried to connect to a samba share. I got an error:
in the log something like this 

account for user test has expired!

kickoffTime has unix timestamp 1001!!

But there no entries for
logonTime,logoffTime,kickoffTime,pwdMustChange,pwdCanChange in my ldap entry for user test. when I add the attribute
kickoffTime=0.

Then I got :
account for user test password must change or something like this.

I add pwdMustChange=0.

and I have no problems!!!:-)
the value 1001 for kickoffTime is the value of the primaryGroupID attribute,
I tested it for a view users...

I wrote a patch to set the defaults timestamps when there are no attributes
in the ldap entry.

logonTime=0
pwdCanChange=0 
pwdMustChange=get_time_t_max();
logoffTime=get_time_t_max();
kickoffTime=get_time_t_max();


---------------------------------------------------------------------------
diff -Nur HEAD HEAD-fix
--- HEAD/source/pdb_ldap.c      Mon Mar 25 09:58:31 2002
+++ HEAD-fix/source/pdb_ldap.c  Mon Mar 25 10:28:44 2002
@@ -569,26 +569,31 @@
                logon_time = (time_t) atol(temp);
                pdb_set_logon_time(sampass, logon_time, True);
        }
-
+       else pdb_set_logon_time(sampass, 0, False);
+
        if (!get_single_attribute(ldap_struct, entry, "logoffTime", temp)) {
                logoff_time = (time_t) atol(temp);
                pdb_set_logoff_time(sampass, logoff_time, True);
        }
+       else pdb_set_logoff_time(sampass, get_time_t_max(), False);

        if (!get_single_attribute(ldap_struct, entry, "kickoffTime", temp))
{
                kickoff_time = (time_t) atol(temp);
                pdb_set_kickoff_time(sampass, kickoff_time, True);
        }
+       else pdb_set_kickoff_time(sampass, get_time_t_max(), False);

        if (!get_single_attribute(ldap_struct, entry, "pwdCanChange", temp))
{
                pass_can_change_time = (time_t) atol(temp);
                pdb_set_pass_can_change_time(sampass, pass_can_change_time,
True);
        }
+       else pdb_set_pass_cn_change_time(sampass, 0, False);

        if (!get_single_attribute(ldap_struct, entry, "pwdMustChange",
temp)) {
                pass_must_change_time = (time_t) atol(temp);
                pdb_set_pass_must_change_time(sampass,
pass_must_change_time, True);
        }
+       else pdb_set_pass_must_change_time(sampass, get_time_t_max(),
False);

        /* recommend that 'gecos' and 'displayName' should refer to the same
         * attribute OID.  userFullName depreciated, only used by Samba
--------------------------------------------------------



metze


-- 
Stefan (metze) Metzmacher
metze at metzemix.de

GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net
-------------- next part --------------
diff -Nur HEAD HEAD-fix
--- HEAD/source/pdb_ldap.c      Mon Mar 25 09:58:31 2002
+++ HEAD-fix/source/pdb_ldap.c  Mon Mar 25 10:28:44 2002
@@ -569,26 +569,31 @@
                logon_time = (time_t) atol(temp);
                pdb_set_logon_time(sampass, logon_time, True);
        }
-
+       else pdb_set_logon_time(sampass, 0, False);
+
        if (!get_single_attribute(ldap_struct, entry, "logoffTime", temp)) {
                logoff_time = (time_t) atol(temp);
                pdb_set_logoff_time(sampass, logoff_time, True);
        }
+       else pdb_set_logoff_time(sampass, get_time_t_max(), False);

        if (!get_single_attribute(ldap_struct, entry, "kickoffTime", temp)) {
                kickoff_time = (time_t) atol(temp);
                pdb_set_kickoff_time(sampass, kickoff_time, True);
        }
+       else pdb_set_kickoff_time(sampass, get_time_t_max(), False);

        if (!get_single_attribute(ldap_struct, entry, "pwdCanChange", temp)) {
                pass_can_change_time = (time_t) atol(temp);
                pdb_set_pass_can_change_time(sampass, pass_can_change_time, True);
        }
+       else pdb_set_pass_cn_change_time(sampass, 0, False);

        if (!get_single_attribute(ldap_struct, entry, "pwdMustChange", temp)) {
                pass_must_change_time = (time_t) atol(temp);
                pdb_set_pass_must_change_time(sampass, pass_must_change_time, True);
        }
+       else pdb_set_pass_must_change_time(sampass, get_time_t_max(), False);

        /* recommend that 'gecos' and 'displayName' should refer to the same
         * attribute OID.  userFullName depreciated, only used by Samba


More information about the samba-technical mailing list