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:
parent
e7e43ba6a1
commit
efbed2ce90
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user