summaryrefslogtreecommitdiff
path: root/source3/rpc_parse/parse_prs.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpc_parse/parse_prs.c')
-rw-r--r--source3/rpc_parse/parse_prs.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c
index 6f6117a9e2..63f9527dec 100644
--- a/source3/rpc_parse/parse_prs.c
+++ b/source3/rpc_parse/parse_prs.c
@@ -116,6 +116,25 @@ BOOL prs_init(prs_struct *ps, uint32 size, TALLOC_CTX *ctx, BOOL io)
}
/*******************************************************************
+ read from a socket into memory.
+ ********************************************************************/
+BOOL prs_read(prs_struct *ps, int fd, size_t len, int timeout)
+{
+ BOOL ok;
+ size_t prev_size = ps->buffer_size;
+ if (!prs_grow(ps, len))
+ return False;
+
+ if (timeout > 0) {
+ ok = (read_with_timeout(fd, &ps->data_p[prev_size],
+ len, len,timeout) == len);
+ } else {
+ ok = (read_data(fd, &ps->data_p[prev_size], len) == len);
+ }
+ return ok;
+}
+
+/*******************************************************************
Delete the memory in a parse structure - if we own it.
********************************************************************/