diff options
author | Volker Lendecke <vl@samba.org> | 2011-02-16 16:47:23 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2011-02-19 11:32:49 +0100 |
commit | 943aac2e366b781136cfff467b7ea5631890ebdd (patch) | |
tree | 33952961c71bc64d214127e5a291f59db77edbf0 /source3/passdb/pdb_get_set.c | |
parent | 6f3008e62714d46beed96e0f834340f81fa3c0c0 (diff) | |
download | samba-943aac2e366b781136cfff467b7ea5631890ebdd.tar.gz samba-943aac2e366b781136cfff467b7ea5631890ebdd.tar.bz2 samba-943aac2e366b781136cfff467b7ea5631890ebdd.zip |
s3: Add "len" to pdb_set_hours
Diffstat (limited to 'source3/passdb/pdb_get_set.c')
-rw-r--r-- | source3/passdb/pdb_get_set.c | 11 |
1 files changed, 8 insertions, 3 deletions
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); |