From 965148c5f266a6b0d26739d02e0c830709785c3b Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 8 May 1998 11:31:55 +0000 Subject: renamed last_change_time to pass_must_change_time. removed "if (bool==True)" and "if (bool==False)" code from ldap.c - a boolean test may not necessarily return exactly True or exactly False: True may be defined to be -1: you never know... (This used to be commit 9bf9752134a92b9a6e8895300d986cfa23547c03) --- source3/passdb/ldap.c | 21 ++++++++++----------- source3/passdb/smbpass.c | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 21 deletions(-) (limited to 'source3/passdb') diff --git a/source3/passdb/ldap.c b/source3/passdb/ldap.c index 1f0c846ad7..e14742a3aa 100644 --- a/source3/passdb/ldap.c +++ b/source3/passdb/ldap.c @@ -261,7 +261,7 @@ static void ldap_get_user(LDAP *ldap_struct,LDAPMessage *entry, if ( (valeur=ldap_get_values(ldap_struct,entry, "pwdLastSet")) != NULL) { - ldap_passwd->last_change_time=(time_t)strtol(valeur[0], NULL, 16); + ldap_passwd->pass_last_set_time=(time_t)strtol(valeur[0], NULL, 16); ldap_value_free(valeur); } } @@ -321,13 +321,15 @@ static struct smb_passwd *get_ldappwd_entry(char *name, int smb_userid) static struct smb_passwd ldap_passwd; + bzero(&ldap_passwd, sizeof(ldap_passwd)); + ldap_passwd.smb_name = NULL; ldap_passwd.smb_passwd = NULL; ldap_passwd.smb_nt_passwd = NULL; - ldap_passwd.smb_userid = -1; - ldap_passwd.acct_ctrl = ACB_DISABLED; - ldap_passwd.last_change_time = 0; + ldap_passwd.smb_userid = -1; + ldap_passwd.acct_ctrl = ACB_DISABLED; + ldap_passwd.pass_last_set_time = (time_t)-1; ldap_struct=NULL; @@ -374,20 +376,17 @@ static struct smb_passwd *get_ldappwd_entry(char *name, int smb_userid) { DEBUG(0,("get_ldappwd_entry: Found user: %s\n",name)); - if (name[strlen(name)-1]=='$') - machine=True; - else - machine=False; + machine = name[strlen(name)-1] == '$'; } - if (machine==False) + if (!machine) { - if (ldap_check_user(ldap_struct, entry)==True) + if (ldap_check_user(ldap_struct, entry)) ldap_get_user(ldap_struct, entry, &ldap_passwd); } else { - if (ldap_check_machine(ldap_struct, entry)==True) + if (ldap_check_machine(ldap_struct, entry)) ldap_get_machine(ldap_struct, entry, &ldap_passwd); } diff --git a/source3/passdb/smbpass.c b/source3/passdb/smbpass.c index 0e50776dfa..b35e7013f2 100644 --- a/source3/passdb/smbpass.c +++ b/source3/passdb/smbpass.c @@ -190,7 +190,7 @@ struct smb_passwd *getsmbpwent(void *vp) } pw_buf.acct_ctrl = ACB_NORMAL; - pw_buf.last_change_time = (time_t)-1; + pw_buf.pass_last_set_time = (time_t)-1; /* * Scan the file, a line at a time and check if the name matches. @@ -431,7 +431,7 @@ struct smb_passwd *getsmbpwent(void *vp) * read into a time_t as the seconds since * 1970 that the password was last changed. */ - pw_buf.last_change_time = (time_t)strtol(p, NULL, 16); + pw_buf.pass_last_set_time = (time_t)strtol(p, NULL, 16); } } } @@ -730,7 +730,7 @@ BOOL mod_smbpwd_entry(struct smb_passwd* pwd, BOOL override) int lockfd; char *pfile = lp_smb_passwd_file(); BOOL found_entry = False; - BOOL got_last_change_time = False; + BOOL got_pass_last_set_time = False; long pwd_seekpos = 0; @@ -959,7 +959,7 @@ BOOL mod_smbpwd_entry(struct smb_passwd* pwd, BOOL override) * read into a time_t as the seconds since * 1970 that the password was last changed. */ - got_last_change_time = True; + got_pass_last_set_time = True; } /* i == 8 */ } /* *p && StrnCaseCmp() */ } /* p == ':' */ @@ -1029,11 +1029,11 @@ BOOL mod_smbpwd_entry(struct smb_passwd* pwd, BOOL override) /* Add on the account info bits and the time of last password change. */ - pwd->last_change_time = time(NULL); + pwd->pass_last_set_time = time(NULL); - if(got_last_change_time) { + if(got_pass_last_set_time) { sprintf(&ascii_p16[strlen(ascii_p16)], ":[%s]:TLC-%08X:", - encode_bits, (uint32)pwd->last_change_time ); + encode_bits, (uint32)pwd->pass_last_set_time ); wr_len = strlen(ascii_p16); } @@ -1154,7 +1154,7 @@ BOOL machine_password_delete( char *domain, char *name ) The user of this function must have locked the machine password file. ************************************************************************/ -BOOL get_machine_account_password( unsigned char *ret_pwd, time_t *last_change_time) +BOOL get_machine_account_password( unsigned char *ret_pwd, time_t *pass_last_set_time) { char linebuf[256]; char *p; @@ -1162,7 +1162,7 @@ BOOL get_machine_account_password( unsigned char *ret_pwd, time_t *last_change_t linebuf[0] = '\0'; - *last_change_time = (time_t)0; + *pass_last_set_time = (time_t)0; memset(ret_pwd, '\0', 16); if(fseek( mach_passwd_fp, 0L, SEEK_SET) == -1) { @@ -1225,7 +1225,7 @@ BOOL get_machine_account_password( unsigned char *ret_pwd, time_t *last_change_t * 1970 that the password was last changed. */ - *last_change_time = (time_t)strtol(p, NULL, 16); + *pass_last_set_time = (time_t)strtol(p, NULL, 16); return True; } -- cgit