uchar *pwhistory;
uint32_t pwHistLen;
uint32_t current_history_len;
+ const uint8_t *current_history;
if (!plaintext)
return False;
* the pw_history was first loaded into the struct samu struct
* and now.... JRA.
*/
- pwhistory = (uchar *)pdb_get_pw_history(sampass, ¤t_history_len);
-
- if ((current_history_len != 0) && (pwhistory == NULL)) {
+ current_history = pdb_get_pw_history(sampass, ¤t_history_len);
+ if ((current_history_len != 0) && (current_history == NULL)) {
DEBUG(1, ("pdb_set_plaintext_passwd: pwhistory == NULL!\n"));
return false;
}
- if (current_history_len < pwHistLen) {
- /*
- * Ensure we have space for the needed history. This
- * also takes care of an account which did not have
- * any history at all so far, i.e. pwhistory==NULL
- */
- uchar *new_history = talloc_zero_array(
+ /*
+ * Ensure we have space for the needed history. This
+ * also takes care of an account which did not have
+ * any history at all so far, i.e. pwhistory==NULL
+ */
+ pwhistory = talloc_zero_array(
sampass, uchar,
pwHistLen*PW_HISTORY_ENTRY_LEN);
-
- if (!new_history) {
- return False;
- }
-
- memcpy(new_history, pwhistory,
- current_history_len*PW_HISTORY_ENTRY_LEN);
-
- pwhistory = new_history;
+ if (!pwhistory) {
+ return false;
}
+ memcpy(pwhistory, current_history,
+ current_history_len*PW_HISTORY_ENTRY_LEN);
+
/*
* Make room for the new password in the history list.
*/