diff options
author | Volker Lendecke <vl@samba.org> | 2010-07-26 10:08:38 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2010-07-26 23:01:37 +0200 |
commit | 27fb920ee8caade141cf0fd39e75afac7f4b5d0b (patch) | |
tree | 9c61ab09fa3ba7d4d21195017986ecf470931bba /source3 | |
parent | 7c242cab9533ec240756fe1f18e99aef7d4086c2 (diff) | |
download | samba-27fb920ee8caade141cf0fd39e75afac7f4b5d0b.tar.gz samba-27fb920ee8caade141cf0fd39e75afac7f4b5d0b.tar.bz2 samba-27fb920ee8caade141cf0fd39e75afac7f4b5d0b.zip |
s3: Factor out parse_streams_blob
Diffstat (limited to 'source3')
-rw-r--r-- | source3/libsmb/clirap.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c index b1303f68d5..f94c16d55f 100644 --- a/source3/libsmb/clirap.c +++ b/source3/libsmb/clirap.c @@ -900,6 +900,11 @@ NTSTATUS cli_qpathinfo2(struct cli_state *cli, const char *fname, Get the stream info ****************************************************************************/ +static bool parse_streams_blob(TALLOC_CTX *mem_ctx, const uint8_t *data, + size_t data_len, + unsigned int *pnum_streams, + struct stream_struct **pstreams); + bool cli_qpathinfo_streams(struct cli_state *cli, const char *fname, TALLOC_CTX *mem_ctx, unsigned int *pnum_streams, @@ -911,10 +916,8 @@ bool cli_qpathinfo_streams(struct cli_state *cli, const char *fname, char *param; char *rparam=NULL, *rdata=NULL; char *p; - unsigned int num_streams; - struct stream_struct *streams; - unsigned int ofs; size_t namelen = 2*(strlen(fname)+1); + bool ret; param = SMB_MALLOC_ARRAY(char, 6+namelen+2); if (param == NULL) { @@ -949,6 +952,22 @@ bool cli_qpathinfo_streams(struct cli_state *cli, const char *fname, return false; } + ret = parse_streams_blob(mem_ctx, (uint8_t *)rdata, data_len, + pnum_streams, pstreams); + SAFE_FREE(rdata); + SAFE_FREE(rparam); + return ret; +} + +static bool parse_streams_blob(TALLOC_CTX *mem_ctx, const uint8_t *rdata, + size_t data_len, + unsigned int *pnum_streams, + struct stream_struct **pstreams) +{ + unsigned int num_streams; + struct stream_struct *streams; + unsigned int ofs; + num_streams = 0; streams = NULL; ofs = 0; @@ -1013,17 +1032,12 @@ bool cli_qpathinfo_streams(struct cli_state *cli, const char *fname, ofs += len; } - SAFE_FREE(rdata); - SAFE_FREE(rparam); - *pnum_streams = num_streams; *pstreams = streams; return true; fail: TALLOC_FREE(streams); - SAFE_FREE(rdata); - SAFE_FREE(rparam); return false; } |