summaryrefslogtreecommitdiff
path: root/source3/libads
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-02-14 22:55:46 +0000
committerJeremy Allison <jra@samba.org>2003-02-14 22:55:46 +0000
commit8fc1f1aead6db996a6d96efdc5f81779afc9c8d2 (patch)
tree2c6e40b3786b45c5d67814bdf89283afab6d58dc /source3/libads
parent89d480a93318d7055a8b710ac5a6437dd7da7575 (diff)
downloadsamba-8fc1f1aead6db996a6d96efdc5f81779afc9c8d2.tar.gz
samba-8fc1f1aead6db996a6d96efdc5f81779afc9c8d2.tar.bz2
samba-8fc1f1aead6db996a6d96efdc5f81779afc9c8d2.zip
Ensure that only parse_prs.c access internal members of the prs_struct.
Needed to move to disk based i/o later. Jeremy. (This used to be commit a823fee5b41a5b6cd4ef05aa1f85f7725bd272a5)
Diffstat (limited to 'source3/libads')
-rw-r--r--source3/libads/ldap.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index 867d124273..47a94f0a08 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -1157,8 +1157,8 @@ static void dump_sd(const char *filed, struct berval **values)
/* prepare data */
prs_init(&ps, values[0]->bv_len, ctx, UNMARSHALL);
- prs_append_data(&ps, values[0]->bv_val, values[0]->bv_len);
- ps.data_offset = 0;
+ prs_copy_data_in(&ps, values[0]->bv_val, values[0]->bv_len);
+ prs_set_offset(&ps,0);
/* parse secdesc */
if (!sec_io_desc("sd", &psd, &ps, 1)) {
@@ -1478,7 +1478,13 @@ ADS_STATUS ads_set_machine_sd(ADS_STRUCT *ads, const char *hostname, char *dn)
if (!(mods = ads_init_mods(ctx))) return ADS_ERROR(LDAP_NO_MEMORY);
bval.bv_len = sd_size;
- bval.bv_val = prs_data_p(&ps_wire);
+ bval.bv_val = talloc(ctx, sd_size);
+ if (!bval.bv_val) {
+ ret = ADS_ERROR(LDAP_NO_MEMORY);
+ goto ads_set_sd_error;
+ }
+ prs_copy_all_data_out((char *)&bval.bv_val, &ps_wire);
+
ads_mod_ber(ctx, &mods, attrs[0], &bval);
ret = ads_gen_mod(ads, dn, mods);
@@ -1726,8 +1732,8 @@ BOOL ads_pull_sd(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
if (values[0]) {
prs_init(&ps, values[0]->bv_len, mem_ctx, UNMARSHALL);
- prs_append_data(&ps, values[0]->bv_val, values[0]->bv_len);
- ps.data_offset = 0;
+ prs_copy_data_in(&ps, values[0]->bv_val, values[0]->bv_len);
+ prs_set_offset(&ps,0);
ret = sec_io_desc("sd", sd, &ps, 1);
}