diff options
author | Andrew Tridgell <tridge@samba.org> | 2008-05-22 22:46:29 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2008-05-22 22:46:29 +1000 |
commit | d5def936fe67c1cde2c4ed00834c4ce325dfcb55 (patch) | |
tree | 81aa9c5d08d6da0e877fea4bbd03cd341eba82c6 /source4/libcli/raw/raweas.c | |
parent | a6e5c70da75e62c84eff0911c279c6a9b0b00b45 (diff) | |
download | samba-d5def936fe67c1cde2c4ed00834c4ce325dfcb55.tar.gz samba-d5def936fe67c1cde2c4ed00834c4ce325dfcb55.tar.xz samba-d5def936fe67c1cde2c4ed00834c4ce325dfcb55.zip |
pass in the required alignment to the EA construction routines
(This used to be commit af31030e0b78b6b220740529901ec8d2d9f5a3fe)
Diffstat (limited to 'source4/libcli/raw/raweas.c')
-rw-r--r-- | source4/libcli/raw/raweas.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source4/libcli/raw/raweas.c b/source4/libcli/raw/raweas.c index 8ea8e621c9..07b517ade3 100644 --- a/source4/libcli/raw/raweas.c +++ b/source4/libcli/raw/raweas.c @@ -54,13 +54,13 @@ static uint_t ea_name_list_size(uint_t num_names, struct ea_name *eas) This assumes the names are strict ascii, which should be a reasonable assumption */ -size_t ea_list_size_chained(uint_t num_eas, struct ea_struct *eas) +size_t ea_list_size_chained(uint_t num_eas, struct ea_struct *eas, unsigned alignment) { uint_t total = 0; int i; for (i=0;i<num_eas;i++) { uint_t len = 8 + strlen(eas[i].name.s)+1 + eas[i].value.length; - len = (len + 3) & ~3; + len = (len + (alignment-1)) & ~(alignment-1); total += len; } return total; @@ -96,14 +96,15 @@ void ea_put_list(uint8_t *data, uint_t num_eas, struct ea_struct *eas) put a chained ea_list into a pre-allocated buffer - buffer must be at least of size ea_list_size() */ -void ea_put_list_chained(uint8_t *data, uint_t num_eas, struct ea_struct *eas) +void ea_put_list_chained(uint8_t *data, uint_t num_eas, struct ea_struct *eas, + unsigned alignment) { int i; for (i=0;i<num_eas;i++) { uint_t nlen = strlen(eas[i].name.s); uint32_t len = 8+nlen+1+eas[i].value.length; - uint_t pad = ((len + 3) & ~3) - len; + uint_t pad = ((len + (alignment-1)) & ~(alignment-1)) - len; if (i == num_eas-1) { SIVAL(data, 0, 0); } else { |