summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-02-16 16:47:23 +0100
committerVolker Lendecke <vl@samba.org>2011-02-19 11:32:49 +0100
commit943aac2e366b781136cfff467b7ea5631890ebdd (patch)
tree33952961c71bc64d214127e5a291f59db77edbf0 /source3
parent6f3008e62714d46beed96e0f834340f81fa3c0c0 (diff)
downloadsamba-943aac2e366b781136cfff467b7ea5631890ebdd.tar.gz
samba-943aac2e366b781136cfff467b7ea5631890ebdd.tar.bz2
samba-943aac2e366b781136cfff467b7ea5631890ebdd.zip
s3: Add "len" to pdb_set_hours
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h3
-rw-r--r--source3/libnet/libnet_dssync_passdb.c3
-rw-r--r--source3/libnet/libnet_samsync_passdb.c3
-rw-r--r--source3/passdb/passdb.c8
-rw-r--r--source3/passdb/pdb_get_set.c11
-rw-r--r--source3/passdb/pdb_ldap.c2
-rw-r--r--source3/rpc_server/samr/srv_samr_util.c4
-rw-r--r--source3/utils/pdbedit.c2
8 files changed, 23 insertions, 13 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 0885053098..a2cc222e0f 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -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,
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,
void (*free_fn)(void **),
const struct pdb_methods *my_methods,
diff --git a/source3/libnet/libnet_dssync_passdb.c b/source3/libnet/libnet_dssync_passdb.c
index 4b66c39bb3..df99e40ebb 100644
--- a/source3/libnet/libnet_dssync_passdb.c
+++ b/source3/libnet/libnet_dssync_passdb.c
@@ -1263,7 +1263,8 @@ static NTSTATUS sam_account_from_object(struct samu *account,
pdb_sethexhours(oldstr, pdb_get_hours(account));
pdb_sethexhours(newstr, logonHours.data);
if (!strequal(oldstr, newstr)) {
- pdb_set_hours(account, logonHours.data, PDB_CHANGED);
+ pdb_set_hours(account, logonHours.data,
+ logonHours.length, PDB_CHANGED);
}
}
diff --git a/source3/libnet/libnet_samsync_passdb.c b/source3/libnet/libnet_samsync_passdb.c
index 9d72194c03..cfcdb7cec2 100644
--- a/source3/libnet/libnet_samsync_passdb.c
+++ b/source3/libnet/libnet_samsync_passdb.c
@@ -179,7 +179,8 @@ static NTSTATUS sam_account_from_delta(struct samu *account,
pdb_sethexhours(oldstr, pdb_get_hours(account));
pdb_sethexhours(newstr, r->logon_hours.bits);
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)
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index dafe55eef7..fdc4bdc486 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -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_acct_ctrl(sampass, acct_ctrl, 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:
@@ -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_acct_ctrl(sampass, acct_ctrl, 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:
@@ -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_acct_ctrl(sampass, acct_ctrl, 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:
@@ -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 */
pdb_set_acct_ctrl(sampass, acct_ctrl, 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:
diff --git a/source3/passdb/pdb_get_set.c b/source3/passdb/pdb_get_set.c
index 07a63e24e6..e572c3d94f 100644
--- a/source3/passdb/pdb_get_set.c
+++ b/source3/passdb/pdb_get_set.c
@@ -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);
}
-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) {
- memset ((char *)sampass->hours, 0, MAX_HOURS_LEN);
+ memset ((char *)sampass->hours, 0, hours_len);
} else {
- memcpy (sampass->hours, hours, MAX_HOURS_LEN);
+ memcpy (sampass->hours, hours, hours_len);
}
return pdb_set_init_flags(sampass, PDB_HOURS, flag);
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index a884b305ed..573c50520e 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -1027,7 +1027,7 @@ static bool init_sam_from_ldap(struct ldapsam_privates *ldap_state,
if (temp) {
pdb_gethexhours(temp, hours);
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);
}
diff --git a/source3/rpc_server/samr/srv_samr_util.c b/source3/rpc_server/samr/srv_samr_util.c
index 0bab1271f2..8dfeae15e8 100644
--- a/source3/rpc_server/samr/srv_samr_util.c
+++ b/source3/rpc_server/samr/srv_samr_util.c
@@ -580,7 +580,9 @@ void copy_id21_to_sam_passwd(const char *log_prefix,
pdb_sethexhours(oldstr, pdb_get_hours(to));
pdb_sethexhours(newstr, from->logon_hours.bits);
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);
}
}
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index 400805375e..ec324cd5e8 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -526,7 +526,7 @@ static int set_user_info(const char *username, const char *fullname,
hours_len = pdb_get_hours_len(sam_pwent);
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)) {