summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-01-16 13:07:35 +0100
committerVolker Lendecke <vl@samba.org>2011-01-17 08:03:42 +0100
commit8ac68fc3cbff6acb9b780f01a61c2457555fd579 (patch)
tree6d1928b5386c89b4baea2ff6984345f85d908a4a /source3
parentcb412d22eba8cdb81878628aa4bce3ca4591770f (diff)
downloadsamba-8ac68fc3cbff6acb9b780f01a61c2457555fd579.tar.gz
samba-8ac68fc3cbff6acb9b780f01a61c2457555fd579.tar.bz2
samba-8ac68fc3cbff6acb9b780f01a61c2457555fd579.zip
s3: Convert cli_api to cli_trans
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/clirap.c59
1 files changed, 48 insertions, 11 deletions
diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c
index 0955d1e3bb..8541af4c7d 100644
--- a/source3/libsmb/clirap.c
+++ b/source3/libsmb/clirap.c
@@ -35,17 +35,54 @@ bool cli_api(struct cli_state *cli,
char **rparam, unsigned int *rprcnt,
char **rdata, unsigned int *rdrcnt)
{
- cli_send_trans(cli,SMBtrans,
- PIPE_LANMAN, /* Name */
- 0,0, /* fid, flags */
- NULL,0,0, /* Setup, length, max */
- param, prcnt, mprcnt, /* Params, length, max */
- data, drcnt, mdrcnt /* Data, length, max */
- );
-
- return (cli_receive_trans(cli,SMBtrans,
- rparam, rprcnt,
- rdata, rdrcnt));
+ NTSTATUS status;
+
+ uint8_t *my_rparam, *my_rdata;
+ uint32_t num_my_rparam, num_my_rdata;
+
+ status = cli_trans(talloc_tos(), cli, SMBtrans,
+ PIPE_LANMAN, 0, /* name, fid */
+ 0, 0, /* function, flags */
+ NULL, 0, 0, /* setup */
+ (uint8_t *)param, prcnt, mprcnt, /* Params, length, max */
+ (uint8_t *)data, drcnt, mdrcnt, /* Data, length, max */
+ NULL, /* recv_flags2 */
+ NULL, 0, NULL, /* rsetup */
+ &my_rparam, 0, &num_my_rparam,
+ &my_rdata, 0, &num_my_rdata);
+ if (!NT_STATUS_IS_OK(status)) {
+ return false;
+ }
+
+ /*
+ * I know this memcpy massively hurts, but there are just tons
+ * of callers of cli_api that eventually need changing to
+ * talloc
+ */
+
+ *rparam = (char *)memdup(my_rparam, num_my_rparam);
+ if (*rparam == NULL) {
+ goto fail;
+ }
+ *rprcnt = num_my_rparam;
+ TALLOC_FREE(my_rparam);
+
+ *rdata = (char *)memdup(my_rdata, num_my_rdata);
+ if (*rdata == NULL) {
+ goto fail;
+ }
+ *rdrcnt = num_my_rdata;
+ TALLOC_FREE(my_rdata);
+
+ return true;
+fail:
+ TALLOC_FREE(my_rdata);
+ TALLOC_FREE(my_rparam);
+ *rparam = NULL;
+ *rprcnt = 0;
+ *rdata = NULL;
+ *rdrcnt = 0;
+ return false;
}
/****************************************************************************