summaryrefslogtreecommitdiff
path: root/source3/passdb
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/passdb
parent6f3008e62714d46beed96e0f834340f81fa3c0c0 (diff)
downloadsamba-943aac2e366b781136cfff467b7ea5631890ebdd.tar.gz
samba-943aac2e366b781136cfff467b7ea5631890ebdd.tar.bz2
samba-943aac2e366b781136cfff467b7ea5631890ebdd.zip
s3: Add "len" to pdb_set_hours
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/passdb.c8
-rw-r--r--source3/passdb/pdb_get_set.c11
-rw-r--r--source3/passdb/pdb_ldap.c2
3 files changed, 13 insertions, 8 deletions
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);
}