diff options
-rw-r--r-- | source/include/proto.h | 4 | ||||
-rw-r--r-- | source/passdb/ldap.c | 17 | ||||
-rw-r--r-- | source/passdb/passdb.c | 6 | ||||
-rw-r--r-- | source/passdb/smbpass.c | 12 |
4 files changed, 14 insertions, 25 deletions
diff --git a/source/include/proto.h b/source/include/proto.h index e4cefae1931..4ef785357c0 100644 --- a/source/include/proto.h +++ b/source/include/proto.h @@ -1590,6 +1590,10 @@ struct smb_passwd *getsampwnam(char *name); struct sam_passwd *getsam21pwnam(char *name); struct smb_passwd *getsampwuid(uid_t smb_userid); struct sam_passwd *getsam21pwrid(uint32 rid); +void pdb_init_smb(struct smb_passwd *user); +void pdb_init_sam(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_last_set_time(char *p, int max_len, time_t t); char *pdb_encode_acct_ctrl(uint16 acct_ctrl); diff --git a/source/passdb/ldap.c b/source/passdb/ldap.c index 9693ab1e731..6d4d2f8dcfb 100644 --- a/source/passdb/ldap.c +++ b/source/passdb/ldap.c @@ -24,8 +24,8 @@ #include "includes.h" -#include <ldap.h> #include <lber.h> +#include <ldap.h> #define ADD_USER 1 #define MODIFY_USER 2 @@ -223,11 +223,7 @@ static void ldap_get_smb_passwd(LDAP *ldap_struct,LDAPMessage *entry, static unsigned char smblmpwd[16]; static unsigned char smbntpwd[16]; - user->smb_name = NULL; - user->smb_passwd = NULL; - user->smb_nt_passwd = NULL; - user->smb_userid = 0; - user->pass_last_set_time = (time_t)-1; + pdb_init_smb(user); bzero(smblmpwd, sizeof(smblmpwd)); bzero(smbntpwd, sizeof(smbntpwd)); @@ -292,16 +288,11 @@ static void ldap_get_sam_passwd(LDAP *ldap_struct, LDAPMessage *entry, static pstring temp; static struct smb_passwd pw_buf; + pdb_init_sam(user); + ldap_get_smb_passwd(ldap_struct, entry, &pw_buf); - 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 = pw_buf.pass_last_set_time; - user->pass_can_change_time = (time_t)-1; - user->pass_must_change_time = (time_t)-1; get_single_attribute(ldap_struct, entry, "logonTime", temp); user->pass_last_set_time = (time_t)strtol(temp, NULL, 16); diff --git a/source/passdb/passdb.c b/source/passdb/passdb.c index 82ee94a1513..b43333f3893 100644 --- a/source/passdb/passdb.c +++ b/source/passdb/passdb.c @@ -495,7 +495,7 @@ struct sam_passwd *getsam21pwrid(uint32 rid) /************************************************************* initialises a struct smb_passwd. **************************************************************/ -void pdb_init_sam(struct smb_passwd *user) +void pdb_init_smb(struct smb_passwd *user) { if (user == NULL) return; @@ -528,7 +528,7 @@ struct smb_passwd *pdb_sam_to_smb(struct sam_passwd *user) if (user == NULL) return NULL; - pdb_init_sam(&pw_buf); + pdb_init_smb(&pw_buf); pw_buf.smb_userid = user->smb_userid; pw_buf.smb_name = user->smb_name; @@ -549,7 +549,7 @@ struct sam_passwd *pdb_smb_to_sam(struct smb_passwd *user) if (user == NULL) return NULL; - pdb_init_smb(&pw_buf); + pdb_init_sam(&pw_buf); pw_buf.smb_userid = user->smb_userid; pw_buf.smb_name = user->smb_name; diff --git a/source/passdb/smbpass.c b/source/passdb/smbpass.c index f2f0b27153d..c9d0ec8d444 100644 --- a/source/passdb/smbpass.c +++ b/source/passdb/smbpass.c @@ -111,7 +111,7 @@ struct sam_passwd *getsmb21pwent(void *vp) pwfile = getpwnam(pw_buf->smb_name); if (pwfile == NULL) return NULL; - bzero(&user, sizeof(user)); + pdb_init_sam(&user); pstrcpy(samlogon_user, pw_buf->smb_name); @@ -154,13 +154,6 @@ struct sam_passwd *getsmb21pwent(void *vp) pstrcpy(workstations , ""); } - user.logon_time = (time_t)-1; - user.logoff_time = (time_t)-1; - user.kickoff_time = (time_t)-1; - user.pass_last_set_time = pw_buf->pass_last_set_time; - user.pass_can_change_time = (time_t)-1; - user.pass_must_change_time = (time_t)-1; - user.smb_name = pw_buf->smb_name; user.full_name = full_name; user.home_dir = home_dir; @@ -213,8 +206,9 @@ struct smb_passwd *getsmbpwent(void *vp) return NULL; } + pdb_init_smb(&pw_buf); + pw_buf.acct_ctrl = ACB_NORMAL; - pw_buf.pass_last_set_time = (time_t)-1; /* * Scan the file, a line at a time and check if the name matches. |