summaryrefslogtreecommitdiffstats
path: root/source3/rpc_parse
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-03-27 11:15:59 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:18:56 -0500
commita806037b8713cdf0ae32f7091f53819393132a0b (patch)
tree07f44ea36f16a70e51125d29072f93799069a7e1 /source3/rpc_parse
parent4b0c9a0084f539e344e743bb1f30d1565d2cca1d (diff)
downloadsamba-a806037b8713cdf0ae32f7091f53819393132a0b.tar.gz
samba-a806037b8713cdf0ae32f7091f53819393132a0b.tar.xz
samba-a806037b8713cdf0ae32f7091f53819393132a0b.zip
r21987: split tdb_prs_*() functions in version which take a keystr and a TDB_DATA key
metze (This used to be commit 724c6fa337bb535e1b97d0452c2489f58339a3bf)
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r--source3/rpc_parse/parse_prs.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c
index 54bbe3adf6c..ca46807932d 100644
--- a/source3/rpc_parse/parse_prs.c
+++ b/source3/rpc_parse/parse_prs.c
@@ -1454,22 +1454,24 @@ BOOL prs_uint32_post(const char *name, prs_struct *ps, int depth, uint32 *data32
}
/* useful function to store a structure in rpc wire format */
-int tdb_prs_store(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps)
+int tdb_prs_store(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps)
{
- TDB_DATA kbuf, dbuf;
- kbuf.dptr = keystr;
- kbuf.dsize = strlen(keystr)+1;
+ TDB_DATA dbuf;
dbuf.dptr = ps->data_p;
dbuf.dsize = prs_offset(ps);
return tdb_trans_store(tdb, kbuf, dbuf, TDB_REPLACE);
}
+int tdb_prs_store_bystring(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps)
+{
+ TDB_DATA kbuf = string_term_tdb_data(keystr);
+ return tdb_prs_store(tdb, kbuf, ps);
+}
+
/* useful function to fetch a structure into rpc wire format */
-int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps, TALLOC_CTX *mem_ctx)
+int tdb_prs_fetch(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps, TALLOC_CTX *mem_ctx)
{
- TDB_DATA kbuf, dbuf;
- kbuf.dptr = keystr;
- kbuf.dsize = strlen(keystr)+1;
+ TDB_DATA dbuf;
prs_init(ps, 0, mem_ctx, UNMARSHALL);
@@ -1482,6 +1484,12 @@ int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps, TALLOC_CTX *me
return 0;
}
+int tdb_prs_fetch_bystring(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps, TALLOC_CTX *mem_ctx)
+{
+ TDB_DATA kbuf = string_term_tdb_data(keystr);
+ return tdb_prs_fetch(tdb, kbuf, ps, mem_ctx);
+}
+
/*******************************************************************
hash a stream.
********************************************************************/