mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
s3: Add "len" to pdb_set_hours
This commit is contained in:
parent
6f3008e627
commit
943aac2e36
@ -3770,7 +3770,8 @@ bool pdb_set_country_code(struct samu *sampass, uint16_t country_code,
|
|||||||
bool pdb_set_code_page(struct samu *sampass, uint16_t code_page,
|
bool pdb_set_code_page(struct samu *sampass, uint16_t code_page,
|
||||||
enum pdb_value_state flag);
|
enum pdb_value_state flag);
|
||||||
bool pdb_set_unknown_6(struct samu *sampass, uint32_t unkn, enum pdb_value_state flag);
|
bool pdb_set_unknown_6(struct samu *sampass, uint32_t unkn, enum pdb_value_state flag);
|
||||||
bool pdb_set_hours(struct samu *sampass, const uint8_t *hours, enum pdb_value_state flag);
|
bool pdb_set_hours(struct samu *sampass, const uint8 *hours, int hours_len,
|
||||||
|
enum pdb_value_state flag);
|
||||||
bool pdb_set_backend_private_data(struct samu *sampass, void *private_data,
|
bool pdb_set_backend_private_data(struct samu *sampass, void *private_data,
|
||||||
void (*free_fn)(void **),
|
void (*free_fn)(void **),
|
||||||
const struct pdb_methods *my_methods,
|
const struct pdb_methods *my_methods,
|
||||||
|
@ -1263,7 +1263,8 @@ static NTSTATUS sam_account_from_object(struct samu *account,
|
|||||||
pdb_sethexhours(oldstr, pdb_get_hours(account));
|
pdb_sethexhours(oldstr, pdb_get_hours(account));
|
||||||
pdb_sethexhours(newstr, logonHours.data);
|
pdb_sethexhours(newstr, logonHours.data);
|
||||||
if (!strequal(oldstr, newstr)) {
|
if (!strequal(oldstr, newstr)) {
|
||||||
pdb_set_hours(account, logonHours.data, PDB_CHANGED);
|
pdb_set_hours(account, logonHours.data,
|
||||||
|
logonHours.length, PDB_CHANGED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +179,8 @@ static NTSTATUS sam_account_from_delta(struct samu *account,
|
|||||||
pdb_sethexhours(oldstr, pdb_get_hours(account));
|
pdb_sethexhours(oldstr, pdb_get_hours(account));
|
||||||
pdb_sethexhours(newstr, r->logon_hours.bits);
|
pdb_sethexhours(newstr, r->logon_hours.bits);
|
||||||
if (!strequal(oldstr, newstr))
|
if (!strequal(oldstr, newstr))
|
||||||
pdb_set_hours(account, r->logon_hours.bits, PDB_CHANGED);
|
pdb_set_hours(account, r->logon_hours.bits,
|
||||||
|
pdb_get_hours_len(account), PDB_CHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pdb_get_bad_password_count(account) != r->bad_password_count)
|
if (pdb_get_bad_password_count(account) != r->bad_password_count)
|
||||||
|
@ -1086,7 +1086,7 @@ static bool init_samu_from_buffer_v0(struct samu *sampass, uint8_t *buf, uint32_
|
|||||||
pdb_set_unknown_6(sampass, unknown_6, PDB_SET);
|
pdb_set_unknown_6(sampass, unknown_6, PDB_SET);
|
||||||
pdb_set_acct_ctrl(sampass, acct_ctrl, PDB_SET);
|
pdb_set_acct_ctrl(sampass, acct_ctrl, PDB_SET);
|
||||||
pdb_set_logon_divs(sampass, logon_divs, PDB_SET);
|
pdb_set_logon_divs(sampass, logon_divs, PDB_SET);
|
||||||
pdb_set_hours(sampass, hours, PDB_SET);
|
pdb_set_hours(sampass, hours, hours_len, PDB_SET);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
||||||
@ -1278,7 +1278,7 @@ static bool init_samu_from_buffer_v1(struct samu *sampass, uint8_t *buf, uint32_
|
|||||||
pdb_set_unknown_6(sampass, unknown_6, PDB_SET);
|
pdb_set_unknown_6(sampass, unknown_6, PDB_SET);
|
||||||
pdb_set_acct_ctrl(sampass, acct_ctrl, PDB_SET);
|
pdb_set_acct_ctrl(sampass, acct_ctrl, PDB_SET);
|
||||||
pdb_set_logon_divs(sampass, logon_divs, PDB_SET);
|
pdb_set_logon_divs(sampass, logon_divs, PDB_SET);
|
||||||
pdb_set_hours(sampass, hours, PDB_SET);
|
pdb_set_hours(sampass, hours, hours_len, PDB_SET);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
||||||
@ -1509,7 +1509,7 @@ static bool init_samu_from_buffer_v2(struct samu *sampass, uint8_t *buf, uint32_
|
|||||||
pdb_set_unknown_6(sampass, unknown_6, PDB_SET);
|
pdb_set_unknown_6(sampass, unknown_6, PDB_SET);
|
||||||
pdb_set_acct_ctrl(sampass, acct_ctrl, PDB_SET);
|
pdb_set_acct_ctrl(sampass, acct_ctrl, PDB_SET);
|
||||||
pdb_set_logon_divs(sampass, logon_divs, PDB_SET);
|
pdb_set_logon_divs(sampass, logon_divs, PDB_SET);
|
||||||
pdb_set_hours(sampass, hours, PDB_SET);
|
pdb_set_hours(sampass, hours, hours_len, PDB_SET);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
||||||
@ -1744,7 +1744,7 @@ static bool init_samu_from_buffer_v3(struct samu *sampass, uint8_t *buf, uint32_
|
|||||||
/* Change from V2 is the uint32_t acct_ctrl */
|
/* Change from V2 is the uint32_t acct_ctrl */
|
||||||
pdb_set_acct_ctrl(sampass, acct_ctrl, PDB_SET);
|
pdb_set_acct_ctrl(sampass, acct_ctrl, PDB_SET);
|
||||||
pdb_set_logon_divs(sampass, logon_divs, PDB_SET);
|
pdb_set_logon_divs(sampass, logon_divs, PDB_SET);
|
||||||
pdb_set_hours(sampass, hours, PDB_SET);
|
pdb_set_hours(sampass, hours, hours_len, PDB_SET);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
||||||
|
@ -918,12 +918,17 @@ bool pdb_set_unknown_6(struct samu *sampass, uint32_t unkn, enum pdb_value_state
|
|||||||
return pdb_set_init_flags(sampass, PDB_UNKNOWN6, flag);
|
return pdb_set_init_flags(sampass, PDB_UNKNOWN6, flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pdb_set_hours(struct samu *sampass, const uint8 *hours, enum pdb_value_state flag)
|
bool pdb_set_hours(struct samu *sampass, const uint8 *hours, int hours_len,
|
||||||
|
enum pdb_value_state flag)
|
||||||
{
|
{
|
||||||
|
if (hours_len > sizeof(sampass->hours)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!hours) {
|
if (!hours) {
|
||||||
memset ((char *)sampass->hours, 0, MAX_HOURS_LEN);
|
memset ((char *)sampass->hours, 0, hours_len);
|
||||||
} else {
|
} else {
|
||||||
memcpy (sampass->hours, hours, MAX_HOURS_LEN);
|
memcpy (sampass->hours, hours, hours_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
return pdb_set_init_flags(sampass, PDB_HOURS, flag);
|
return pdb_set_init_flags(sampass, PDB_HOURS, flag);
|
||||||
|
@ -1027,7 +1027,7 @@ static bool init_sam_from_ldap(struct ldapsam_privates *ldap_state,
|
|||||||
if (temp) {
|
if (temp) {
|
||||||
pdb_gethexhours(temp, hours);
|
pdb_gethexhours(temp, hours);
|
||||||
memset((char *)temp, '\0', strlen(temp) +1);
|
memset((char *)temp, '\0', strlen(temp) +1);
|
||||||
pdb_set_hours(sampass, hours, PDB_SET);
|
pdb_set_hours(sampass, hours, hours_len, PDB_SET);
|
||||||
ZERO_STRUCT(hours);
|
ZERO_STRUCT(hours);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -580,7 +580,9 @@ void copy_id21_to_sam_passwd(const char *log_prefix,
|
|||||||
pdb_sethexhours(oldstr, pdb_get_hours(to));
|
pdb_sethexhours(oldstr, pdb_get_hours(to));
|
||||||
pdb_sethexhours(newstr, from->logon_hours.bits);
|
pdb_sethexhours(newstr, from->logon_hours.bits);
|
||||||
if (!strequal(oldstr, newstr)) {
|
if (!strequal(oldstr, newstr)) {
|
||||||
pdb_set_hours(to, from->logon_hours.bits, PDB_CHANGED);
|
pdb_set_hours(to, from->logon_hours.bits,
|
||||||
|
from->logon_hours.units_per_week/8,
|
||||||
|
PDB_CHANGED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -526,7 +526,7 @@ static int set_user_info(const char *username, const char *fullname,
|
|||||||
hours_len = pdb_get_hours_len(sam_pwent);
|
hours_len = pdb_get_hours_len(sam_pwent);
|
||||||
memset(hours_array, 0xff, hours_len);
|
memset(hours_array, 0xff, hours_len);
|
||||||
|
|
||||||
pdb_set_hours(sam_pwent, hours_array, PDB_CHANGED);
|
pdb_set_hours(sam_pwent, hours_array, hours_len, PDB_CHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pdb_update_autolock_flag(sam_pwent, &updated_autolock)) {
|
if (!pdb_update_autolock_flag(sam_pwent, &updated_autolock)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user