summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1998-05-25 13:39:08 +0000
committerLuke Leighton <lkcl@samba.org>1998-05-25 13:39:08 +0000
commit863c787b020eaf2dc648f51087f5ce3d2c82ab2c (patch)
tree45b60bf41d0e66146a88490c943dba32b5015edd
parentef46e64510c8625f0c7c0fdfa2ccde79218d079b (diff)
downloadsamba-863c787b020eaf2dc648f51087f5ce3d2c82ab2c.tar.gz
samba-863c787b020eaf2dc648f51087f5ce3d2c82ab2c.tar.bz2
samba-863c787b020eaf2dc648f51087f5ce3d2c82ab2c.zip
added set logon, logoff, kickoff etc time functions.
(This used to be commit dab9728a4376cc52d6e53b09b5f42d08712330d6)
-rw-r--r--source3/include/proto.h5
-rw-r--r--source3/passdb/nispass.c10
-rw-r--r--source3/passdb/passdb.c40
3 files changed, 47 insertions, 8 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 9af21c5637..48cda04561 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1593,6 +1593,11 @@ struct sam_disp_info *pdb_sam_to_dispinfo(struct sam_passwd *user);
struct smb_passwd *pdb_sam_to_smb(struct sam_passwd *user);
struct sam_passwd *pdb_smb_to_sam(struct smb_passwd *user);
time_t pdb_get_last_set_time(char *p);
+void pdb_set_logon_time(char *p, int max_len, time_t t);
+void pdb_set_logoff_time(char *p, int max_len, time_t t);
+void pdb_set_kickoff_time(char *p, int max_len, time_t t);
+void pdb_set_can_change_time(char *p, int max_len, time_t t);
+void pdb_set_must_change_time(char *p, int max_len, time_t t);
void pdb_set_last_set_time(char *p, int max_len, time_t t);
char *pdb_encode_acct_ctrl(uint16 acct_ctrl);
uint16 pdb_decode_acct_ctrl(char *p);
diff --git a/source3/passdb/nispass.c b/source3/passdb/nispass.c
index a61d38c1ec..7ef7ec3093 100644
--- a/source3/passdb/nispass.c
+++ b/source3/passdb/nispass.c
@@ -239,14 +239,14 @@ static BOOL add_nisp21pwd_entry(struct sam_passwd *newpwd)
fstring logon_t;
fstring logoff_t;
- fstring kick_t;
+ fstring kickoff_t;
fstring pwdlset_t;
fstring pwdlchg_t;
fstring pwdmchg_t;
bzero(logon_t , sizeof(logon_t ));
bzero(logoff_t , sizeof(logoff_t ));
- bzero(kick_t , sizeof(kick_t ));
+ bzero(kickoff_t, sizeof(kickoff_t));
bzero(pwdlset_t, sizeof(pwdlset_t));
bzero(pwdlchg_t, sizeof(pwdlchg_t));
bzero(pwdmchg_t, sizeof(pwdmchg_t));
@@ -313,16 +313,12 @@ static BOOL add_nisp21pwd_entry(struct sam_passwd *newpwd)
pdb_sethexpwd(smb_passwd , newpwd->smb_passwd , newpwd->acct_ctrl);
pdb_sethexpwd(smb_nt_passwd, newpwd->smb_nt_passwd, newpwd->acct_ctrl);
-#if 0
pdb_set_logon_time (logon_t , sizeof(logon_t ), newpwd->logon_time );
pdb_set_logoff_time (logoff_t , sizeof(logoff_t ), newpwd->logoff_time );
pdb_set_kickoff_time (kickoff_t, sizeof(kickoff_t), newpwd->kickoff_time );
-#endif
pdb_set_last_set_time (pwdlset_t, sizeof(pwdlset_t), newpwd->pass_last_set_time );
-#if 0
pdb_set_can_change_time (pwdlchg_t, sizeof(pwdlchg_t), newpwd->pass_can_change_time );
pdb_set_must_change_time(pwdmchg_t, sizeof(pwdmchg_t), newpwd->pass_must_change_time);
-#endif
slprintf(uid, sizeof(uid), "%u", newpwd->smb_userid);
slprintf(user_rid, sizeof(user_rid), "0x%x", newpwd->user_rid);
@@ -341,7 +337,7 @@ static BOOL add_nisp21pwd_entry(struct sam_passwd *newpwd)
set_single_attribute(&new_obj, NPF_NTPWD , smb_nt_passwd , strlen(smb_nt_passwd) , EN_CRYPT);
set_single_attribute(&new_obj, NPF_LOGON_T , logon_t , strlen(logon_t) , 0);
set_single_attribute(&new_obj, NPF_LOGOFF_T , logoff_t , strlen(logoff_t) , 0);
- set_single_attribute(&new_obj, NPF_KICK_T , kick_t , strlen(kick_t) , 0);
+ set_single_attribute(&new_obj, NPF_KICK_T , kickoff_t , strlen(kickoff_t) , 0);
set_single_attribute(&new_obj, NPF_PWDLSET_T , pwdlset_t , strlen(pwdlset_t) , 0);
set_single_attribute(&new_obj, NPF_PWDLCHG_T , pwdlchg_t , strlen(pwdlchg_t) , 0);
set_single_attribute(&new_obj, NPF_PWDMCHG_T , pwdmchg_t , strlen(pwdmchg_t) , 0);
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index 47811a3938..fa4a39e836 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -635,16 +635,54 @@ time_t pdb_get_last_set_time(char *p)
/*******************************************************************
sets password-database-format time in a string.
********************************************************************/
-
static void set_time_in_string(char *p, int max_len, char *type, time_t t)
{
slprintf(p, max_len, ":%s-%08X:", type, (uint32)t);
}
/*******************************************************************
+ sets logon time
+ ********************************************************************/
+void pdb_set_logon_time(char *p, int max_len, time_t t)
+{
+ set_time_in_string(p, max_len, "LNT", t);
+}
+
+/*******************************************************************
+ sets logoff time
+ ********************************************************************/
+void pdb_set_logoff_time(char *p, int max_len, time_t t)
+{
+ set_time_in_string(p, max_len, "LOT", t);
+}
+
+/*******************************************************************
+ sets kickoff time
+ ********************************************************************/
+void pdb_set_kickoff_time(char *p, int max_len, time_t t)
+{
+ set_time_in_string(p, max_len, "KOT", t);
+}
+
+/*******************************************************************
+ sets password can change time
+ ********************************************************************/
+void pdb_set_can_change_time(char *p, int max_len, time_t t)
+{
+ set_time_in_string(p, max_len, "CCT", t);
+}
+
+/*******************************************************************
sets password last set time
********************************************************************/
+void pdb_set_must_change_time(char *p, int max_len, time_t t)
+{
+ set_time_in_string(p, max_len, "MCT", t);
+}
+/*******************************************************************
+ sets password last set time
+ ********************************************************************/
void pdb_set_last_set_time(char *p, int max_len, time_t t)
{
set_time_in_string(p, max_len, "LCT", t);