diff options
author | Luke Leighton <lkcl@samba.org> | 1998-05-18 14:43:06 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1998-05-18 14:43:06 +0000 |
commit | c7890d44c76d1746f4dfe994b24acc3799075028 (patch) | |
tree | 07c7524ff6121a973098f8893f42e271f2e33c29 | |
parent | 646ab2b0a773592a5973ce78fecfb24b39aa2506 (diff) | |
download | samba-c7890d44c76d1746f4dfe994b24acc3799075028.tar.gz samba-c7890d44c76d1746f4dfe994b24acc3799075028.tar.bz2 samba-c7890d44c76d1746f4dfe994b24acc3799075028.zip |
no include headers in ldap.c.
passdb.c sam_passwd <-> smb_passwd conversion routines
(This used to be commit 8082239c81dfed5e3cc34a4d0a4e7195398ae627)
-rw-r--r-- | source3/passdb/ldap.c | 3 | ||||
-rw-r--r-- | source3/passdb/passdb.c | 69 |
2 files changed, 72 insertions, 0 deletions
diff --git a/source3/passdb/ldap.c b/source3/passdb/ldap.c index af595d0c0a..9693ab1e73 100644 --- a/source3/passdb/ldap.c +++ b/source3/passdb/ldap.c @@ -24,6 +24,9 @@ #include "includes.h" +#include <ldap.h> +#include <lber.h> + #define ADD_USER 1 #define MODIFY_USER 2 diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c index 411b76d006..82ee94a151 100644 --- a/source3/passdb/passdb.c +++ b/source3/passdb/passdb.c @@ -492,6 +492,75 @@ struct sam_passwd *getsam21pwrid(uint32 rid) ********************************************************** **********************************************************/ +/************************************************************* + initialises a struct smb_passwd. + **************************************************************/ +void pdb_init_sam(struct smb_passwd *user) +{ + if (user == NULL) return; + + bzero(user, sizeof(*user)); + user->pass_last_set_time = (time_t)-1; +} + +/************************************************************* + initialises a struct sam_passwd. + **************************************************************/ +void pdb_init_sam(struct sam_passwd *user) +{ + if (user == NULL) return; + + bzero(user, sizeof(*user)); + user->logon_time = (time_t)-1; + user->logoff_time = (time_t)-1; + user->kickoff_time = (time_t)-1; + user->pass_last_set_time = (time_t)-1; + user->pass_can_change_time = (time_t)-1; + user->pass_must_change_time = (time_t)-1; +} + +/************************************************************* + converts a sam_passwd structure to a smb_passwd structure. + **************************************************************/ +struct smb_passwd *pdb_sam_to_smb(struct sam_passwd *user) +{ + static struct smb_passwd pw_buf; + + if (user == NULL) return NULL; + + pdb_init_sam(&pw_buf); + + pw_buf.smb_userid = user->smb_userid; + pw_buf.smb_name = user->smb_name; + pw_buf.smb_passwd = user->smb_passwd; + pw_buf.smb_nt_passwd = user->smb_nt_passwd; + pw_buf.acct_ctrl = user->acct_ctrl; + pw_buf.pass_last_set_time = user->pass_last_set_time; + + return &pw_buf; +} + +/************************************************************* + converts a smb_passwd structure to a sam_passwd structure. + **************************************************************/ +struct sam_passwd *pdb_smb_to_sam(struct smb_passwd *user) +{ + static struct sam_passwd pw_buf; + + if (user == NULL) return NULL; + + pdb_init_smb(&pw_buf); + + pw_buf.smb_userid = user->smb_userid; + pw_buf.smb_name = user->smb_name; + pw_buf.smb_passwd = user->smb_passwd; + pw_buf.smb_nt_passwd = user->smb_nt_passwd; + pw_buf.acct_ctrl = user->acct_ctrl; + pw_buf.pass_last_set_time = user->pass_last_set_time; + + return &pw_buf; +} + /******************************************************************* gets password-database-format time from a string. ********************************************************************/ |