mirror of
https://github.com/samba-team/samba.git
synced 2025-01-29 21:47:30 +03:00
added set logon, logoff, kickoff etc time functions.
This commit is contained in:
parent
d553901b9a
commit
dab9728a43
@ -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 smb_passwd *pdb_sam_to_smb(struct sam_passwd *user);
|
||||||
struct sam_passwd *pdb_smb_to_sam(struct smb_passwd *user);
|
struct sam_passwd *pdb_smb_to_sam(struct smb_passwd *user);
|
||||||
time_t pdb_get_last_set_time(char *p);
|
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);
|
void pdb_set_last_set_time(char *p, int max_len, time_t t);
|
||||||
char *pdb_encode_acct_ctrl(uint16 acct_ctrl);
|
char *pdb_encode_acct_ctrl(uint16 acct_ctrl);
|
||||||
uint16 pdb_decode_acct_ctrl(char *p);
|
uint16 pdb_decode_acct_ctrl(char *p);
|
||||||
|
@ -239,14 +239,14 @@ static BOOL add_nisp21pwd_entry(struct sam_passwd *newpwd)
|
|||||||
|
|
||||||
fstring logon_t;
|
fstring logon_t;
|
||||||
fstring logoff_t;
|
fstring logoff_t;
|
||||||
fstring kick_t;
|
fstring kickoff_t;
|
||||||
fstring pwdlset_t;
|
fstring pwdlset_t;
|
||||||
fstring pwdlchg_t;
|
fstring pwdlchg_t;
|
||||||
fstring pwdmchg_t;
|
fstring pwdmchg_t;
|
||||||
|
|
||||||
bzero(logon_t , sizeof(logon_t ));
|
bzero(logon_t , sizeof(logon_t ));
|
||||||
bzero(logoff_t , sizeof(logoff_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(pwdlset_t, sizeof(pwdlset_t));
|
||||||
bzero(pwdlchg_t, sizeof(pwdlchg_t));
|
bzero(pwdlchg_t, sizeof(pwdlchg_t));
|
||||||
bzero(pwdmchg_t, sizeof(pwdmchg_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_passwd , newpwd->smb_passwd , newpwd->acct_ctrl);
|
||||||
pdb_sethexpwd(smb_nt_passwd, newpwd->smb_nt_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_logon_time (logon_t , sizeof(logon_t ), newpwd->logon_time );
|
||||||
pdb_set_logoff_time (logoff_t , sizeof(logoff_t ), newpwd->logoff_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 );
|
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 );
|
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_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);
|
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(uid, sizeof(uid), "%u", newpwd->smb_userid);
|
||||||
slprintf(user_rid, sizeof(user_rid), "0x%x", newpwd->user_rid);
|
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_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_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_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_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_PWDLCHG_T , pwdlchg_t , strlen(pwdlchg_t) , 0);
|
||||||
set_single_attribute(&new_obj, NPF_PWDMCHG_T , pwdmchg_t , strlen(pwdmchg_t) , 0);
|
set_single_attribute(&new_obj, NPF_PWDMCHG_T , pwdmchg_t , strlen(pwdmchg_t) , 0);
|
||||||
|
@ -635,16 +635,54 @@ time_t pdb_get_last_set_time(char *p)
|
|||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
sets password-database-format time in a string.
|
sets password-database-format time in a string.
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
static void set_time_in_string(char *p, int max_len, char *type, time_t t)
|
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);
|
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
|
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)
|
void pdb_set_last_set_time(char *p, int max_len, time_t t)
|
||||||
{
|
{
|
||||||
set_time_in_string(p, max_len, "LCT", t);
|
set_time_in_string(p, max_len, "LCT", t);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user