1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s3: Add sync read_smb

This commit is contained in:
Volker Lendecke 2011-05-19 08:36:54 +02:00
parent e7e43ba6a1
commit efbed2ce90
2 changed files with 25 additions and 0 deletions

View File

@ -108,3 +108,27 @@ ssize_t read_smb_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
*pbuf = talloc_move(mem_ctx, &state->buf);
return talloc_get_size(*pbuf);
}
ssize_t read_smb(int fd, TALLOC_CTX *mem_ctx, uint8_t **pbuf, int *perrno)
{
TALLOC_CTX *frame = talloc_stackframe();
struct event_context *ev;
struct tevent_req *req;
ssize_t ret = -1;
ev = event_context_init(frame);
if (ev == NULL) {
goto fail;
}
req = read_smb_send(frame, ev, fd);
if (req == NULL) {
goto fail;
}
if (!tevent_req_poll(req, ev)) {
goto fail;
}
ret = read_smb_recv(req, mem_ctx, pbuf, perrno);
fail:
TALLOC_FREE(frame);
return ret;
}

View File

@ -29,5 +29,6 @@ struct tevent_req *read_smb_send(TALLOC_CTX *mem_ctx,
ssize_t read_smb_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
uint8_t **pbuf, int *perrno);
ssize_t read_smb(int fd, TALLOC_CTX *mem_ctx, uint8_t **pbuf, int *perrno);
#endif