diff options
author | Stefan Metzmacher <metze@samba.org> | 2010-04-28 10:43:19 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2010-04-28 15:45:38 +0200 |
commit | 21ec116bbf51b76f17b9e4054969ef315f5e2dd0 (patch) | |
tree | fc2c328bff9018af9e0186424ba64994336c2cd9 /libcli/named_pipe_auth | |
parent | 6129aa0cf5567c793ed65d1402a7e7fd7e5f6a92 (diff) | |
download | samba-21ec116bbf51b76f17b9e4054969ef315f5e2dd0.tar.gz samba-21ec116bbf51b76f17b9e4054969ef315f5e2dd0.tar.bz2 samba-21ec116bbf51b76f17b9e4054969ef315f5e2dd0.zip |
libcli/named_pipe_auth: we need to hide length of the message mode header from the caller
metze
Diffstat (limited to 'libcli/named_pipe_auth')
-rw-r--r-- | libcli/named_pipe_auth/npa_tstream.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libcli/named_pipe_auth/npa_tstream.c b/libcli/named_pipe_auth/npa_tstream.c index 1c9ab8f626..b41fa3eb6d 100644 --- a/libcli/named_pipe_auth/npa_tstream.c +++ b/libcli/named_pipe_auth/npa_tstream.c @@ -743,7 +743,7 @@ static int tstream_npa_readv_next_vector(struct tstream_context *unix_stream, if (left > 0) { /* - * if the message if longer than the buffers the caller + * if the message is longer than the buffers the caller * requested, we need to consume the rest of the message * into the pending buffer, where the next readv can * be served from. @@ -808,6 +808,7 @@ struct tstream_npa_writev_state { size_t count; /* the header for message mode */ + bool hdr_used; uint8_t hdr[2]; int ret; @@ -844,6 +845,7 @@ static struct tevent_req *tstream_npa_writev_send(TALLOC_CTX *mem_ctx, switch (npas->file_type) { case FILE_TYPE_BYTE_MODE_PIPE: + state->hdr_used = false; state->vector = vector; state->count = count; break; @@ -861,6 +863,7 @@ static struct tevent_req *tstream_npa_writev_send(TALLOC_CTX *mem_ctx, new_vector[0].iov_len = sizeof(state->hdr); memcpy(new_vector + 1, vector, sizeof(struct iovec)*count); + state->hdr_used = true; state->vector = new_vector; state->count = count + 1; @@ -911,6 +914,14 @@ static void tstream_npa_writev_handler(struct tevent_req *subreq) return; } + /* + * in message mode we need to hide the length + * of the hdr from the caller + */ + if (state->hdr_used) { + ret -= sizeof(state->hdr); + } + state->ret = ret; tevent_req_done(req); |