diff options
author | Stefan Metzmacher <metze@samba.org> | 2004-08-04 13:23:35 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:57:47 -0500 |
commit | c5fbb6f23c2d399c7510bc552cdb1a27b1ef66a8 (patch) | |
tree | 6fccf75601681c68afca5dd9c6b840de44f7f31c /source4/libcli/raw | |
parent | a0cb701b6fac6e75da691e239cd0407b9269533a (diff) | |
download | samba-c5fbb6f23c2d399c7510bc552cdb1a27b1ef66a8.tar.gz samba-c5fbb6f23c2d399c7510bc552cdb1a27b1ef66a8.tar.bz2 samba-c5fbb6f23c2d399c7510bc552cdb1a27b1ef66a8.zip |
r1654: rename cli_ -> smbcli_
rename CLI_ -> SMBCLI_
metze
(This used to be commit 8441750fd9427dd6fe477f27e603821b4026f038)
Diffstat (limited to 'source4/libcli/raw')
-rw-r--r-- | source4/libcli/raw/clioplock.c | 12 | ||||
-rw-r--r-- | source4/libcli/raw/clisession.c | 140 | ||||
-rw-r--r-- | source4/libcli/raw/clisocket.c | 34 | ||||
-rw-r--r-- | source4/libcli/raw/clitransport.c | 124 | ||||
-rw-r--r-- | source4/libcli/raw/clitree.c | 100 | ||||
-rw-r--r-- | source4/libcli/raw/rawacl.c | 12 | ||||
-rw-r--r-- | source4/libcli/raw/rawdate.c | 12 | ||||
-rw-r--r-- | source4/libcli/raw/rawfile.c | 224 | ||||
-rw-r--r-- | source4/libcli/raw/rawfileinfo.c | 118 | ||||
-rw-r--r-- | source4/libcli/raw/rawfsinfo.c | 42 | ||||
-rw-r--r-- | source4/libcli/raw/rawioctl.c | 46 | ||||
-rw-r--r-- | source4/libcli/raw/rawnegotiate.c | 48 | ||||
-rw-r--r-- | source4/libcli/raw/rawnotify.c | 16 | ||||
-rw-r--r-- | source4/libcli/raw/rawreadwrite.c | 62 | ||||
-rw-r--r-- | source4/libcli/raw/rawrequest.c | 144 | ||||
-rw-r--r-- | source4/libcli/raw/rawsearch.c | 138 | ||||
-rw-r--r-- | source4/libcli/raw/rawsetfileinfo.c | 68 | ||||
-rw-r--r-- | source4/libcli/raw/rawtrans.c | 110 | ||||
-rw-r--r-- | source4/libcli/raw/smb_signing.c | 62 |
19 files changed, 756 insertions, 756 deletions
diff --git a/source4/libcli/raw/clioplock.c b/source4/libcli/raw/clioplock.c index 29e44fc940..6ae21a08f4 100644 --- a/source4/libcli/raw/clioplock.c +++ b/source4/libcli/raw/clioplock.c @@ -23,12 +23,12 @@ /**************************************************************************** send an ack for an oplock break request ****************************************************************************/ -BOOL cli_oplock_ack(struct cli_tree *tree, uint16_t fnum, uint16_t ack_level) +BOOL smbcli_oplock_ack(struct smbcli_tree *tree, uint16_t fnum, uint16_t ack_level) { BOOL ret; - struct cli_request *req; + struct smbcli_request *req; - req = cli_request_setup(tree, SMBlockingX, 8, 0); + req = smbcli_request_setup(tree, SMBlockingX, 8, 0); SSVAL(req->out.vwv,VWV(0),0xFF); SSVAL(req->out.vwv,VWV(1),0); @@ -43,7 +43,7 @@ BOOL cli_oplock_ack(struct cli_tree *tree, uint16_t fnum, uint16_t ack_level) subsystem not to allocate an id for a reply */ req->one_way_request = 1; - ret = cli_request_send(req); + ret = smbcli_request_send(req); return ret; } @@ -52,8 +52,8 @@ BOOL cli_oplock_ack(struct cli_tree *tree, uint16_t fnum, uint16_t ack_level) /**************************************************************************** set the oplock handler for a connection ****************************************************************************/ -void cli_oplock_handler(struct cli_transport *transport, - BOOL (*handler)(struct cli_transport *, uint16_t, uint16_t, uint8_t, void *), +void smbcli_oplock_handler(struct smbcli_transport *transport, + BOOL (*handler)(struct smbcli_transport *, uint16_t, uint16_t, uint8_t, void *), void *private) { transport->oplock.handler = handler; diff --git a/source4/libcli/raw/clisession.c b/source4/libcli/raw/clisession.c index d5373bc76f..b32d59f340 100644 --- a/source4/libcli/raw/clisession.c +++ b/source4/libcli/raw/clisession.c @@ -22,17 +22,17 @@ #include "includes.h" #define SETUP_REQUEST_SESSION(cmd, wct, buflen) do { \ - req = cli_request_setup_session(session, cmd, wct, buflen); \ + req = smbcli_request_setup_session(session, cmd, wct, buflen); \ if (!req) return NULL; \ } while (0) /**************************************************************************** Initialize the session context ****************************************************************************/ -struct cli_session *cli_session_init(struct cli_transport *transport) +struct smbcli_session *smbcli_session_init(struct smbcli_transport *transport) { - struct cli_session *session; - TALLOC_CTX *mem_ctx = talloc_init("cli_session"); + struct smbcli_session *session; + TALLOC_CTX *mem_ctx = talloc_init("smbcli_session"); if (mem_ctx == NULL) { return NULL; } @@ -55,11 +55,11 @@ struct cli_session *cli_session_init(struct cli_transport *transport) /**************************************************************************** reduce reference_count and destroy is <= 0 ****************************************************************************/ -void cli_session_close(struct cli_session *session) +void smbcli_session_close(struct smbcli_session *session) { session->reference_count--; if (session->reference_count <= 0) { - cli_transport_close(session->transport); + smbcli_transport_close(session->transport); talloc_destroy(session->mem_ctx); } } @@ -67,9 +67,9 @@ void cli_session_close(struct cli_session *session) /**************************************************************************** Perform a session setup (async send) ****************************************************************************/ -struct cli_request *smb_raw_session_setup_send(struct cli_session *session, union smb_sesssetup *parms) +struct smbcli_request *smb_raw_session_setup_send(struct smbcli_session *session, union smb_sesssetup *parms) { - struct cli_request *req; + struct smbcli_request *req; switch (parms->generic.level) { case RAW_SESSSETUP_GENERIC: @@ -85,11 +85,11 @@ struct cli_request *smb_raw_session_setup_send(struct cli_session *session, unio SSVAL(req->out.vwv,VWV(4),parms->old.in.vc_num); SIVAL(req->out.vwv,VWV(5),parms->old.in.sesskey); SSVAL(req->out.vwv,VWV(7),parms->old.in.password.length); - cli_req_append_blob(req, &parms->old.in.password); - cli_req_append_string(req, parms->old.in.user, STR_TERMINATE); - cli_req_append_string(req, parms->old.in.domain, STR_TERMINATE|STR_UPPER); - cli_req_append_string(req, parms->old.in.os, STR_TERMINATE); - cli_req_append_string(req, parms->old.in.lanman, STR_TERMINATE); + smbcli_req_append_blob(req, &parms->old.in.password); + smbcli_req_append_string(req, parms->old.in.user, STR_TERMINATE); + smbcli_req_append_string(req, parms->old.in.domain, STR_TERMINATE|STR_UPPER); + smbcli_req_append_string(req, parms->old.in.os, STR_TERMINATE); + smbcli_req_append_string(req, parms->old.in.lanman, STR_TERMINATE); break; case RAW_SESSSETUP_NT1: @@ -104,12 +104,12 @@ struct cli_request *smb_raw_session_setup_send(struct cli_session *session, unio SSVAL(req->out.vwv, VWV(8), parms->nt1.in.password2.length); SIVAL(req->out.vwv, VWV(9), 0); /* reserved */ SIVAL(req->out.vwv, VWV(11), parms->nt1.in.capabilities); - cli_req_append_blob(req, &parms->nt1.in.password1); - cli_req_append_blob(req, &parms->nt1.in.password2); - cli_req_append_string(req, parms->nt1.in.user, STR_TERMINATE); - cli_req_append_string(req, parms->nt1.in.domain, STR_TERMINATE|STR_UPPER); - cli_req_append_string(req, parms->nt1.in.os, STR_TERMINATE); - cli_req_append_string(req, parms->nt1.in.lanman, STR_TERMINATE); + smbcli_req_append_blob(req, &parms->nt1.in.password1); + smbcli_req_append_blob(req, &parms->nt1.in.password2); + smbcli_req_append_string(req, parms->nt1.in.user, STR_TERMINATE); + smbcli_req_append_string(req, parms->nt1.in.domain, STR_TERMINATE|STR_UPPER); + smbcli_req_append_string(req, parms->nt1.in.os, STR_TERMINATE); + smbcli_req_append_string(req, parms->nt1.in.lanman, STR_TERMINATE); break; case RAW_SESSSETUP_SPNEGO: @@ -123,15 +123,15 @@ struct cli_request *smb_raw_session_setup_send(struct cli_session *session, unio SSVAL(req->out.vwv, VWV(7), parms->spnego.in.secblob.length); SIVAL(req->out.vwv, VWV(8), 0); /* reserved */ SIVAL(req->out.vwv, VWV(10), parms->spnego.in.capabilities); - cli_req_append_blob(req, &parms->spnego.in.secblob); - cli_req_append_string(req, parms->spnego.in.os, STR_TERMINATE); - cli_req_append_string(req, parms->spnego.in.lanman, STR_TERMINATE); - cli_req_append_string(req, parms->spnego.in.domain, STR_TERMINATE); + smbcli_req_append_blob(req, &parms->spnego.in.secblob); + smbcli_req_append_string(req, parms->spnego.in.os, STR_TERMINATE); + smbcli_req_append_string(req, parms->spnego.in.lanman, STR_TERMINATE); + smbcli_req_append_string(req, parms->spnego.in.domain, STR_TERMINATE); break; } - if (!cli_request_send(req)) { - cli_request_destroy(req); + if (!smbcli_request_send(req)) { + smbcli_request_destroy(req); return NULL; } @@ -142,20 +142,20 @@ struct cli_request *smb_raw_session_setup_send(struct cli_session *session, unio /**************************************************************************** Perform a session setup (async recv) ****************************************************************************/ -NTSTATUS smb_raw_session_setup_recv(struct cli_request *req, +NTSTATUS smb_raw_session_setup_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, union smb_sesssetup *parms) { uint16_t len; char *p; - if (!cli_request_receive(req)) { - return cli_request_destroy(req); + if (!smbcli_request_receive(req)) { + return smbcli_request_destroy(req); } if (!NT_STATUS_IS_OK(req->status) && !NT_STATUS_EQUAL(req->status,NT_STATUS_MORE_PROCESSING_REQUIRED)) { - return cli_request_destroy(req); + return smbcli_request_destroy(req); } switch (parms->generic.level) { @@ -164,35 +164,35 @@ NTSTATUS smb_raw_session_setup_recv(struct cli_request *req, return NT_STATUS_INVALID_LEVEL; case RAW_SESSSETUP_OLD: - CLI_CHECK_WCT(req, 3); + SMBCLI_CHECK_WCT(req, 3); ZERO_STRUCT(parms->old.out); parms->old.out.vuid = SVAL(req->in.hdr, HDR_UID); parms->old.out.action = SVAL(req->in.vwv, VWV(2)); p = req->in.data; if (p) { - p += cli_req_pull_string(req, mem_ctx, &parms->old.out.os, p, -1, STR_TERMINATE); - p += cli_req_pull_string(req, mem_ctx, &parms->old.out.lanman, p, -1, STR_TERMINATE); - p += cli_req_pull_string(req, mem_ctx, &parms->old.out.domain, p, -1, STR_TERMINATE); + p += smbcli_req_pull_string(req, mem_ctx, &parms->old.out.os, p, -1, STR_TERMINATE); + p += smbcli_req_pull_string(req, mem_ctx, &parms->old.out.lanman, p, -1, STR_TERMINATE); + p += smbcli_req_pull_string(req, mem_ctx, &parms->old.out.domain, p, -1, STR_TERMINATE); } break; case RAW_SESSSETUP_NT1: - CLI_CHECK_WCT(req, 3); + SMBCLI_CHECK_WCT(req, 3); ZERO_STRUCT(parms->nt1.out); parms->nt1.out.vuid = SVAL(req->in.hdr, HDR_UID); parms->nt1.out.action = SVAL(req->in.vwv, VWV(2)); p = req->in.data; if (p) { - p += cli_req_pull_string(req, mem_ctx, &parms->nt1.out.os, p, -1, STR_TERMINATE); - p += cli_req_pull_string(req, mem_ctx, &parms->nt1.out.lanman, p, -1, STR_TERMINATE); + p += smbcli_req_pull_string(req, mem_ctx, &parms->nt1.out.os, p, -1, STR_TERMINATE); + p += smbcli_req_pull_string(req, mem_ctx, &parms->nt1.out.lanman, p, -1, STR_TERMINATE); if (p < (req->in.data + req->in.data_size)) { - p += cli_req_pull_string(req, mem_ctx, &parms->nt1.out.domain, p, -1, STR_TERMINATE); + p += smbcli_req_pull_string(req, mem_ctx, &parms->nt1.out.domain, p, -1, STR_TERMINATE); } } break; case RAW_SESSSETUP_SPNEGO: - CLI_CHECK_WCT(req, 4); + SMBCLI_CHECK_WCT(req, 4); ZERO_STRUCT(parms->spnego.out); parms->spnego.out.vuid = SVAL(req->in.hdr, HDR_UID); parms->spnego.out.action = SVAL(req->in.vwv, VWV(2)); @@ -202,16 +202,16 @@ NTSTATUS smb_raw_session_setup_recv(struct cli_request *req, break; } - parms->spnego.out.secblob = cli_req_pull_blob(req, mem_ctx, p, len); + parms->spnego.out.secblob = smbcli_req_pull_blob(req, mem_ctx, p, len); p += parms->spnego.out.secblob.length; - p += cli_req_pull_string(req, mem_ctx, &parms->spnego.out.os, p, -1, STR_TERMINATE); - p += cli_req_pull_string(req, mem_ctx, &parms->spnego.out.lanman, p, -1, STR_TERMINATE); - p += cli_req_pull_string(req, mem_ctx, &parms->spnego.out.domain, p, -1, STR_TERMINATE); + p += smbcli_req_pull_string(req, mem_ctx, &parms->spnego.out.os, p, -1, STR_TERMINATE); + p += smbcli_req_pull_string(req, mem_ctx, &parms->spnego.out.lanman, p, -1, STR_TERMINATE); + p += smbcli_req_pull_string(req, mem_ctx, &parms->spnego.out.domain, p, -1, STR_TERMINATE); break; } failed: - return cli_request_destroy(req); + return smbcli_request_destroy(req); } /* @@ -239,7 +239,7 @@ static DATA_BLOB nt_blob(const char *pass, DATA_BLOB challenge) /* store the user session key for a transport */ -void cli_session_set_user_session_key(struct cli_session *session, +void smbcli_session_set_user_session_key(struct smbcli_session *session, const DATA_BLOB *session_key) { session->user_session_key = data_blob_talloc(session->mem_ctx, @@ -250,19 +250,19 @@ void cli_session_set_user_session_key(struct cli_session *session, /* setup signing for a NT1 style session setup */ -static void use_nt1_session_keys(struct cli_session *session, +static void use_nt1_session_keys(struct smbcli_session *session, const char *password, const DATA_BLOB *nt_response) { - struct cli_transport *transport = session->transport; + struct smbcli_transport *transport = session->transport; uint8_t nt_hash[16]; DATA_BLOB session_key = data_blob(NULL, 16); E_md4hash(password, nt_hash); SMBsesskeygen_ntv1(nt_hash, session_key.data); - cli_transport_simple_set_signing(transport, session_key, *nt_response); + smbcli_transport_simple_set_signing(transport, session_key, *nt_response); - cli_session_set_user_session_key(session, &session_key); + smbcli_session_set_user_session_key(session, &session_key); data_blob_free(&session_key); } @@ -270,7 +270,7 @@ static void use_nt1_session_keys(struct cli_session *session, Perform a session setup (sync interface) using generic interface and the old style sesssetup call ****************************************************************************/ -static NTSTATUS smb_raw_session_setup_generic_old(struct cli_session *session, +static NTSTATUS smb_raw_session_setup_generic_old(struct smbcli_session *session, TALLOC_CTX *mem_ctx, union smb_sesssetup *parms) { @@ -319,7 +319,7 @@ static NTSTATUS smb_raw_session_setup_generic_old(struct cli_session *session, Perform a session setup (sync interface) using generic interface and the NT1 style sesssetup call ****************************************************************************/ -static NTSTATUS smb_raw_session_setup_generic_nt1(struct cli_session *session, +static NTSTATUS smb_raw_session_setup_generic_nt1(struct smbcli_session *session, TALLOC_CTX *mem_ctx, union smb_sesssetup *parms) { @@ -375,7 +375,7 @@ static NTSTATUS smb_raw_session_setup_generic_nt1(struct cli_session *session, Perform a session setup (sync interface) using generic interface and the SPNEGO style sesssetup call ****************************************************************************/ -static NTSTATUS smb_raw_session_setup_generic_spnego(struct cli_session *session, +static NTSTATUS smb_raw_session_setup_generic_spnego(struct smbcli_session *session, TALLOC_CTX *mem_ctx, union smb_sesssetup *parms) { @@ -396,7 +396,7 @@ static NTSTATUS smb_raw_session_setup_generic_spnego(struct cli_session *session s2.spnego.in.lanman = "Samba"; s2.spnego.out.vuid = UID_FIELD_INVALID; - cli_temp_set_signing(session->transport); + smbcli_temp_set_signing(session->transport); status = gensec_client_start(&session->gensec); if (!NT_STATUS_IS_OK(status)) { @@ -455,7 +455,7 @@ static NTSTATUS smb_raw_session_setup_generic_spnego(struct cli_session *session session_key_err = gensec_session_key(session->gensec, &session_key); } if (NT_STATUS_IS_OK(session_key_err)) { - cli_transport_simple_set_signing(session->transport, session_key, null_data_blob); + smbcli_transport_simple_set_signing(session->transport, session_key, null_data_blob); } session->vuid = s2.spnego.out.vuid; @@ -479,7 +479,7 @@ done: return session_key_err; } - cli_session_set_user_session_key(session, &session_key); + smbcli_session_set_user_session_key(session, &session_key); parms->generic.out.vuid = s2.spnego.out.vuid; parms->generic.out.os = s2.spnego.out.os; @@ -496,7 +496,7 @@ done: /**************************************************************************** Perform a session setup (sync interface) using generic interface ****************************************************************************/ -static NTSTATUS smb_raw_session_setup_generic(struct cli_session *session, +static NTSTATUS smb_raw_session_setup_generic(struct smbcli_session *session, TALLOC_CTX *mem_ctx, union smb_sesssetup *parms) { @@ -527,10 +527,10 @@ static NTSTATUS smb_raw_session_setup_generic(struct cli_session *session, this interface allows for RAW_SESSSETUP_GENERIC to auto-select session setup variant based on negotiated protocol options ****************************************************************************/ -NTSTATUS smb_raw_session_setup(struct cli_session *session, TALLOC_CTX *mem_ctx, +NTSTATUS smb_raw_session_setup(struct smbcli_session *session, TALLOC_CTX *mem_ctx, union smb_sesssetup *parms) { - struct cli_request *req; + struct smbcli_request *req; if (parms->generic.level == RAW_SESSSETUP_GENERIC) { NTSTATUS ret = smb_raw_session_setup_generic(session, mem_ctx, parms); @@ -555,17 +555,17 @@ NTSTATUS smb_raw_session_setup(struct cli_session *session, TALLOC_CTX *mem_ctx, /**************************************************************************** Send a uloggoff (async send) *****************************************************************************/ -struct cli_request *smb_raw_ulogoff_send(struct cli_session *session) +struct smbcli_request *smb_raw_ulogoff_send(struct smbcli_session *session) { - struct cli_request *req; + struct smbcli_request *req; SETUP_REQUEST_SESSION(SMBulogoffX, 2, 0); SSVAL(req->out.vwv, VWV(0), SMB_CHAIN_NONE); SSVAL(req->out.vwv, VWV(1), 0); - if (!cli_request_send(req)) { - cli_request_destroy(req); + if (!smbcli_request_send(req)) { + smbcli_request_destroy(req); return NULL; } @@ -575,24 +575,24 @@ struct cli_request *smb_raw_ulogoff_send(struct cli_session *session) /**************************************************************************** Send a uloggoff (sync interface) *****************************************************************************/ -NTSTATUS smb_raw_ulogoff(struct cli_session *session) +NTSTATUS smb_raw_ulogoff(struct smbcli_session *session) { - struct cli_request *req = smb_raw_ulogoff_send(session); - return cli_request_simple_recv(req); + struct smbcli_request *req = smb_raw_ulogoff_send(session); + return smbcli_request_simple_recv(req); } /**************************************************************************** Send a SMBexit ****************************************************************************/ -NTSTATUS smb_raw_exit(struct cli_session *session) +NTSTATUS smb_raw_exit(struct smbcli_session *session) { - struct cli_request *req; + struct smbcli_request *req; - req = cli_request_setup_session(session, SMBexit, 0, 0); + req = smbcli_request_setup_session(session, SMBexit, 0, 0); - if (cli_request_send(req)) { - cli_request_receive(req); + if (smbcli_request_send(req)) { + smbcli_request_receive(req); } - return cli_request_destroy(req); + return smbcli_request_destroy(req); } diff --git a/source4/libcli/raw/clisocket.c b/source4/libcli/raw/clisocket.c index eb5d3c0342..78d37b9be1 100644 --- a/source4/libcli/raw/clisocket.c +++ b/source4/libcli/raw/clisocket.c @@ -23,14 +23,14 @@ /* - create a cli_socket context + create a smbcli_socket context */ -struct cli_socket *cli_sock_init(void) +struct smbcli_socket *smbcli_sock_init(void) { - struct cli_socket *sock; + struct smbcli_socket *sock; TALLOC_CTX *mem_ctx; - mem_ctx = talloc_init("cli_socket"); + mem_ctx = talloc_init("smbcli_socket"); if (!mem_ctx) return NULL; sock = talloc_zero(mem_ctx, sizeof(*sock)); @@ -51,10 +51,10 @@ struct cli_socket *cli_sock_init(void) } /* - connect a cli_socket context to an IP/port pair + connect a smbcli_socket context to an IP/port pair if port is 0 then choose 445 then 139 */ -BOOL cli_sock_connect(struct cli_socket *sock, struct in_addr *ip, int port) +BOOL smbcli_sock_connect(struct smbcli_socket *sock, struct in_addr *ip, int port) { if (getenv("LIBSMB_PROG")) { sock->fd = sock_exec(getenv("LIBSMB_PROG")); @@ -62,8 +62,8 @@ BOOL cli_sock_connect(struct cli_socket *sock, struct in_addr *ip, int port) } if (port == 0) { - return cli_sock_connect(sock, ip, 445) || - cli_sock_connect(sock, ip, 139); + return smbcli_sock_connect(sock, ip, 445) || + smbcli_sock_connect(sock, ip, 139); } sock->dest_ip = *ip; @@ -85,7 +85,7 @@ BOOL cli_sock_connect(struct cli_socket *sock, struct in_addr *ip, int port) /**************************************************************************** mark the socket as dead ****************************************************************************/ -void cli_sock_dead(struct cli_socket *sock) +void smbcli_sock_dead(struct smbcli_socket *sock) { if (sock->fd != -1) { close(sock->fd); @@ -96,18 +96,18 @@ void cli_sock_dead(struct cli_socket *sock) /**************************************************************************** reduce socket reference count - if it becomes zero then close ****************************************************************************/ -void cli_sock_close(struct cli_socket *sock) +void smbcli_sock_close(struct smbcli_socket *sock) { sock->reference_count--; if (sock->reference_count <= 0) { - cli_sock_dead(sock); + smbcli_sock_dead(sock); } } /**************************************************************************** Set socket options on a open connection. ****************************************************************************/ -void cli_sock_set_options(struct cli_socket *sock, const char *options) +void smbcli_sock_set_options(struct smbcli_socket *sock, const char *options) { set_socket_options(sock->fd, options); } @@ -115,7 +115,7 @@ void cli_sock_set_options(struct cli_socket *sock, const char *options) /**************************************************************************** Write to socket. Return amount written. ****************************************************************************/ -ssize_t cli_sock_write(struct cli_socket *sock, const char *data, size_t len) +ssize_t smbcli_sock_write(struct smbcli_socket *sock, const char *data, size_t len) { if (sock->fd == -1) { errno = EIO; @@ -129,7 +129,7 @@ ssize_t cli_sock_write(struct cli_socket *sock, const char *data, size_t len) /**************************************************************************** Read from socket. return amount read ****************************************************************************/ -ssize_t cli_sock_read(struct cli_socket *sock, char *data, size_t len) +ssize_t smbcli_sock_read(struct smbcli_socket *sock, char *data, size_t len) { if (sock->fd == -1) { errno = EIO; @@ -142,7 +142,7 @@ ssize_t cli_sock_read(struct cli_socket *sock, char *data, size_t len) /**************************************************************************** resolve a hostname and connect ****************************************************************************/ -BOOL cli_sock_connect_byname(struct cli_socket *sock, const char *host, int port) +BOOL smbcli_sock_connect_byname(struct smbcli_socket *sock, const char *host, int port) { int name_type = 0x20; struct in_addr ip; @@ -155,7 +155,7 @@ BOOL cli_sock_connect_byname(struct cli_socket *sock, const char *host, int port return sock->fd != -1; } - mem_ctx = talloc_init("cli_sock_connect_byname"); + mem_ctx = talloc_init("smbcli_sock_connect_byname"); if (!mem_ctx) return False; name = talloc_strdup(mem_ctx, host); @@ -171,7 +171,7 @@ BOOL cli_sock_connect_byname(struct cli_socket *sock, const char *host, int port return False; } - ret = cli_sock_connect(sock, &ip, port); + ret = smbcli_sock_connect(sock, &ip, port); if (ret) { sock->hostname = talloc_steal(mem_ctx, sock->mem_ctx, name); diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c index 3b3c10ed01..5290dd953d 100644 --- a/source4/libcli/raw/clitransport.c +++ b/source4/libcli/raw/clitransport.c @@ -24,24 +24,24 @@ /* an event has happened on the socket */ -static void cli_transport_event_handler(struct event_context *ev, struct fd_event *fde, +static void smbcli_transport_event_handler(struct event_context *ev, struct fd_event *fde, time_t t, uint16_t flags) { - struct cli_transport *transport = fde->private; + struct smbcli_transport *transport = fde->private; - cli_transport_process(transport); + smbcli_transport_process(transport); } /* create a transport structure based on an established socket */ -struct cli_transport *cli_transport_init(struct cli_socket *sock) +struct smbcli_transport *smbcli_transport_init(struct smbcli_socket *sock) { TALLOC_CTX *mem_ctx; - struct cli_transport *transport; + struct smbcli_transport *transport; struct fd_event fde; - mem_ctx = talloc_init("cli_transport"); + mem_ctx = talloc_init("smbcli_transport"); if (!mem_ctx) return NULL; transport = talloc_zero(mem_ctx, sizeof(*transport)); @@ -59,7 +59,7 @@ struct cli_transport *cli_transport_init(struct cli_socket *sock) transport->options.use_spnego = lp_use_spnego(); transport->negotiate.max_xmit = ~0; - cli_init_signing(transport); + smbcli_init_signing(transport); transport->socket->reference_count++; @@ -67,7 +67,7 @@ struct cli_transport *cli_transport_init(struct cli_socket *sock) fde.fd = sock->fd; fde.flags = EVENT_FD_READ; - fde.handler = cli_transport_event_handler; + fde.handler = smbcli_transport_event_handler; fde.private = transport; fde.ref_count = 1; @@ -80,11 +80,11 @@ struct cli_transport *cli_transport_init(struct cli_socket *sock) decrease reference count on a transport, and destroy if it becomes zero */ -void cli_transport_close(struct cli_transport *transport) +void smbcli_transport_close(struct smbcli_transport *transport) { transport->reference_count--; if (transport->reference_count <= 0) { - cli_sock_close(transport->socket); + smbcli_sock_close(transport->socket); event_remove_fd(transport->event.ctx, transport->event.fde); event_remove_timed(transport->event.ctx, transport->event.te); event_context_destroy(transport->event.ctx); @@ -95,14 +95,14 @@ void cli_transport_close(struct cli_transport *transport) /* mark the transport as dead */ -void cli_transport_dead(struct cli_transport *transport) +void smbcli_transport_dead(struct smbcli_transport *transport) { - cli_sock_dead(transport->socket); + smbcli_sock_dead(transport->socket); /* all pending sends become errors */ while (transport->pending_send) { - struct cli_request *req = transport->pending_send; - req->state = CLI_REQUEST_ERROR; + struct smbcli_request *req = transport->pending_send; + req->state = SMBCLI_REQUEST_ERROR; req->status = NT_STATUS_NET_WRITE_FAULT; DLIST_REMOVE(transport->pending_send, req); if (req->async.fn) { @@ -112,8 +112,8 @@ void cli_transport_dead(struct cli_transport *transport) /* as do all pending receives */ while (transport->pending_recv) { - struct cli_request *req = transport->pending_recv; - req->state = CLI_REQUEST_ERROR; + struct smbcli_request *req = transport->pending_recv; + req->state = SMBCLI_REQUEST_ERROR; req->status = NT_STATUS_NET_WRITE_FAULT; DLIST_REMOVE(transport->pending_recv, req); if (req->async.fn) { @@ -126,7 +126,7 @@ void cli_transport_dead(struct cli_transport *transport) /* enable select for write on a transport */ -static void cli_transport_write_enable(struct cli_transport *transport) +static void smbcli_transport_write_enable(struct smbcli_transport *transport) { transport->event.fde->flags |= EVENT_FD_WRITE; } @@ -134,7 +134,7 @@ static void cli_transport_write_enable(struct cli_transport *transport) /* disable select for write on a transport */ -static void cli_transport_write_disable(struct cli_transport *transport) +static void smbcli_transport_write_disable(struct smbcli_transport *transport) { transport->event.fde->flags &= ~EVENT_FD_WRITE; } @@ -142,13 +142,13 @@ static void cli_transport_write_disable(struct cli_transport *transport) /**************************************************************************** send a session request (if appropriate) ****************************************************************************/ -BOOL cli_transport_connect(struct cli_transport *transport, +BOOL smbcli_transport_connect(struct smbcli_transport *transport, struct nmb_name *calling, struct nmb_name *called) { char *p; int len = NBT_HDR_SIZE; - struct cli_request *req; + struct smbcli_request *req; if (called) { transport->called = *called; @@ -160,7 +160,7 @@ BOOL cli_transport_connect(struct cli_transport *transport, } /* allocate output buffer */ - req = cli_request_setup_nonsmb(transport, NBT_HDR_SIZE + 2*nbt_mangled_name_len()); + req = smbcli_request_setup_nonsmb(transport, NBT_HDR_SIZE + 2*nbt_mangled_name_len()); /* put in the destination name */ p = req->out.buffer + NBT_HDR_SIZE; @@ -175,20 +175,20 @@ BOOL cli_transport_connect(struct cli_transport *transport, _smb_setlen(req->out.buffer,len-4); SCVAL(req->out.buffer,0,0x81); - if (!cli_request_send(req) || - !cli_request_receive(req)) { - cli_request_destroy(req); + if (!smbcli_request_send(req) || + !smbcli_request_receive(req)) { + smbcli_request_destroy(req); return False; } if (CVAL(req->in.buffer,0) != 0x82) { transport->error.etype = ETYPE_NBT; transport->error.e.nbt_error = CVAL(req->in.buffer,4); - cli_request_destroy(req); + smbcli_request_destroy(req); return False; } - cli_request_destroy(req); + smbcli_request_destroy(req); return True; } @@ -196,10 +196,10 @@ BOOL cli_transport_connect(struct cli_transport *transport, /**************************************************************************** get next mid in sequence ****************************************************************************/ -uint16_t cli_transport_next_mid(struct cli_transport *transport) +uint16_t smbcli_transport_next_mid(struct smbcli_transport *transport) { uint16_t mid; - struct cli_request *req; + struct smbcli_request *req; mid = transport->next_mid; @@ -225,7 +225,7 @@ again: static void idle_handler(struct event_context *ev, struct timed_event *te, time_t t) { - struct cli_transport *transport = te->private; + struct smbcli_transport *transport = te->private; te->next_event = t + transport->idle.period; transport->idle.func(transport, transport->idle.private); } @@ -234,8 +234,8 @@ static void idle_handler(struct event_context *ev, setup the idle handler for a transport the period is in seconds */ -void cli_transport_idle_handler(struct cli_transport *transport, - void (*idle_func)(struct cli_transport *, void *), +void smbcli_transport_idle_handler(struct smbcli_transport *transport, + void (*idle_func)(struct smbcli_transport *, void *), uint_t period, void *private) { @@ -257,27 +257,27 @@ void cli_transport_idle_handler(struct cli_transport *transport, /* process some pending sends */ -static void cli_transport_process_send(struct cli_transport *transport) +static void smbcli_transport_process_send(struct smbcli_transport *transport) { while (transport->pending_send) { - struct cli_request *req = transport->pending_send; + struct smbcli_request *req = transport->pending_send; ssize_t ret; - ret = cli_sock_write(transport->socket, req->out.buffer, req->out.size); + ret = smbcli_sock_write(transport->socket, req->out.buffer, req->out.size); if (ret == -1) { if (errno == EAGAIN || errno == EINTR) { return; } - cli_transport_dead(transport); + smbcli_transport_dead(transport); } req->out.buffer += ret; req->out.size -= ret; if (req->out.size == 0) { DLIST_REMOVE(transport->pending_send, req); if (req->one_way_request) { - req->state = CLI_REQUEST_DONE; - cli_request_destroy(req); + req->state = SMBCLI_REQUEST_DONE; + smbcli_request_destroy(req); } else { - req->state = CLI_REQUEST_RECV; + req->state = SMBCLI_REQUEST_RECV; DLIST_ADD(transport->pending_recv, req); } } @@ -285,19 +285,19 @@ static void cli_transport_process_send(struct cli_transport *transport) /* we're out of requests to send, so don't wait for write events any more */ - cli_transport_write_disable(transport); + smbcli_transport_write_disable(transport); } /* we have a full request in our receive buffer - match it to a pending request and process */ -static void cli_transport_finish_recv(struct cli_transport *transport) +static void smbcli_transport_finish_recv(struct smbcli_transport *transport) { uint8_t *buffer, *hdr, *vwv; int len; uint16_t wct, mid = 0; - struct cli_request *req; + struct smbcli_request *req; buffer = transport->recv_buffer.buffer; len = transport->recv_buffer.req_size; @@ -355,14 +355,14 @@ static void cli_transport_finish_recv(struct cli_transport *transport) /* handle non-SMB replies */ if (req->in.size < NBT_HDR_SIZE + MIN_SMB_SIZE) { - req->state = CLI_REQUEST_ERROR; + req->state = SMBCLI_REQUEST_ERROR; goto error; } if (req->in.size < NBT_HDR_SIZE + MIN_SMB_SIZE + VWV(wct)) { DEBUG(2,("bad reply size for mid %d\n", mid)); req->status = NT_STATUS_UNSUCCESSFUL; - req->state = CLI_REQUEST_ERROR; + req->state = SMBCLI_REQUEST_ERROR; goto error; } @@ -394,10 +394,10 @@ static void cli_transport_finish_recv(struct cli_transport *transport) req->status = transport->error.e.nt_status; } - if (!cli_request_check_sign_mac(req)) { + if (!smbcli_request_check_sign_mac(req)) { transport->error.etype = ETYPE_SOCKET; transport->error.e.socket_error = SOCKET_READ_BAD_SIG; - req->state = CLI_REQUEST_ERROR; + req->state = SMBCLI_REQUEST_ERROR; goto error; }; @@ -406,7 +406,7 @@ async: notify that the reply has been received. This might destroy the request so it must happen last */ DLIST_REMOVE(transport->pending_recv, req); - req->state = CLI_REQUEST_DONE; + req->state = SMBCLI_REQUEST_DONE; if (req->async.fn) { req->async.fn(req); } @@ -415,21 +415,21 @@ async: error: if (req) { DLIST_REMOVE(transport->pending_recv, req); - req->state = CLI_REQUEST_ERROR; + req->state = SMBCLI_REQUEST_ERROR; } } /* process some pending receives */ -static void cli_transport_process_recv(struct cli_transport *transport) +static void smbcli_transport_process_recv(struct smbcli_transport *transport) { /* a incoming packet goes through 2 stages - first we read the 4 byte header, which tells us how much more is coming. Then we read the rest */ if (transport->recv_buffer.received < NBT_HDR_SIZE) { ssize_t ret; - ret = cli_sock_read(transport->socket, + ret = smbcli_sock_read(transport->socket, transport->recv_buffer.header + transport->recv_buffer.received, NBT_HDR_SIZE - transport->recv_buffer.received); @@ -437,7 +437,7 @@ static void cli_transport_process_recv(struct cli_transport *transport) if (errno == EINTR || errno == EAGAIN) { return; } - cli_transport_dead(transport); + smbcli_transport_dead(transport); return; } @@ -449,7 +449,7 @@ static void cli_transport_process_recv(struct cli_transport *transport) transport->recv_buffer.buffer = talloc(transport->mem_ctx, NBT_HDR_SIZE+transport->recv_buffer.req_size); if (transport->recv_buffer.buffer == NULL) { - cli_transport_dead(transport); + smbcli_transport_dead(transport); return; } memcpy(transport->recv_buffer.buffer, transport->recv_buffer.header, NBT_HDR_SIZE); @@ -458,7 +458,7 @@ static void cli_transport_process_recv(struct cli_transport *transport) if (transport->recv_buffer.received < transport->recv_buffer.req_size) { ssize_t ret; - ret = cli_sock_read(transport->socket, + ret = smbcli_sock_read(transport->socket, transport->recv_buffer.buffer + transport->recv_buffer.received, transport->recv_buffer.req_size - @@ -467,7 +467,7 @@ static void cli_transport_process_recv(struct cli_transport *transport) if (errno == EINTR || errno == EAGAIN) { return; } - cli_transport_dead(transport); + smbcli_transport_dead(transport); return; } transport->recv_buffer.received += ret; @@ -475,7 +475,7 @@ static void cli_transport_process_recv(struct cli_transport *transport) if (transport->recv_buffer.received != 0 && transport->recv_buffer.received == transport->recv_buffer.req_size) { - cli_transport_finish_recv(transport); + smbcli_transport_finish_recv(transport); } } @@ -483,10 +483,10 @@ static void cli_transport_process_recv(struct cli_transport *transport) process some read/write requests that are pending return False if the socket is dead */ -BOOL cli_transport_process(struct cli_transport *transport) +BOOL smbcli_transport_process(struct smbcli_transport *transport) { - cli_transport_process_send(transport); - cli_transport_process_recv(transport); + smbcli_transport_process_send(transport); + smbcli_transport_process_recv(transport); if (transport->socket->fd == -1) { return False; } @@ -498,19 +498,19 @@ BOOL cli_transport_process(struct cli_transport *transport) /* put a request into the send queue */ -void cli_transport_send(struct cli_request *req) +void smbcli_transport_send(struct smbcli_request *req) { /* check if the transport is dead */ if (req->transport->socket->fd == -1) { - req->state = CLI_REQUEST_ERROR; + req->state = SMBCLI_REQUEST_ERROR; req->status = NT_STATUS_NET_WRITE_FAULT; return; } /* put it on the outgoing socket queue */ - req->state = CLI_REQUEST_SEND; - DLIST_ADD_END(req->transport->pending_send, req, struct cli_request *); + req->state = SMBCLI_REQUEST_SEND; + DLIST_ADD_END(req->transport->pending_send, req, struct smbcli_request *); /* make sure we look for write events */ - cli_transport_write_enable(req->transport); + smbcli_transport_write_enable(req->transport); } diff --git a/source4/libcli/raw/clitree.c b/source4/libcli/raw/clitree.c index a580ded010..b9d572fd56 100644 --- a/source4/libcli/raw/clitree.c +++ b/source4/libcli/raw/clitree.c @@ -22,7 +22,7 @@ #include "includes.h" #define SETUP_REQUEST_TREE(cmd, wct, buflen) do { \ - req = cli_request_setup(tree, cmd, wct, buflen); \ + req = smbcli_request_setup(tree, cmd, wct, buflen); \ if (!req) return NULL; \ } while (0) @@ -30,10 +30,10 @@ /**************************************************************************** Initialize the tree context ****************************************************************************/ -struct cli_tree *cli_tree_init(struct cli_session *session) +struct smbcli_tree *smbcli_tree_init(struct smbcli_session *session) { - struct cli_tree *tree; - TALLOC_CTX *mem_ctx = talloc_init("cli_tree"); + struct smbcli_tree *tree; + TALLOC_CTX *mem_ctx = talloc_init("smbcli_tree"); if (mem_ctx == NULL) { return NULL; } @@ -54,12 +54,12 @@ struct cli_tree *cli_tree_init(struct cli_session *session) /**************************************************************************** reduce reference count on a tree and destroy if <= 0 ****************************************************************************/ -void cli_tree_close(struct cli_tree *tree) +void smbcli_tree_close(struct smbcli_tree *tree) { if (!tree) return; tree->reference_count--; if (tree->reference_count <= 0) { - cli_session_close(tree->session); + smbcli_session_close(tree->session); talloc_destroy(tree->mem_ctx); } } @@ -68,16 +68,16 @@ void cli_tree_close(struct cli_tree *tree) /**************************************************************************** Send a tconX (async send) ****************************************************************************/ -struct cli_request *smb_tree_connect_send(struct cli_tree *tree, union smb_tcon *parms) +struct smbcli_request *smb_tree_connect_send(struct smbcli_tree *tree, union smb_tcon *parms) { - struct cli_request *req; + struct smbcli_request *req; switch (parms->tcon.level) { case RAW_TCON_TCON: SETUP_REQUEST_TREE(SMBtcon, 0, 0); - cli_req_append_ascii4(req, parms->tcon.in.service, STR_ASCII); - cli_req_append_ascii4(req, parms->tcon.in.password,STR_ASCII); - cli_req_append_ascii4(req, parms->tcon.in.dev, STR_ASCII); + smbcli_req_append_ascii4(req, parms->tcon.in.service, STR_ASCII); + smbcli_req_append_ascii4(req, parms->tcon.in.password,STR_ASCII); + smbcli_req_append_ascii4(req, parms->tcon.in.dev, STR_ASCII); break; case RAW_TCON_TCONX: @@ -86,14 +86,14 @@ struct cli_request *smb_tree_connect_send(struct cli_tree *tree, union smb_tcon SSVAL(req->out.vwv, VWV(1), 0); SSVAL(req->out.vwv, VWV(2), parms->tconx.in.flags); SSVAL(req->out.vwv, VWV(3), parms->tconx.in.password.length); - cli_req_append_blob(req, &parms->tconx.in.password); - cli_req_append_string(req, parms->tconx.in.path, STR_TERMINATE | STR_UPPER); - cli_req_append_string(req, parms->tconx.in.device, STR_TERMINATE | STR_ASCII); + smbcli_req_append_blob(req, &parms->tconx.in.password); + smbcli_req_append_string(req, parms->tconx.in.path, STR_TERMINATE | STR_UPPER); + smbcli_req_append_string(req, parms->tconx.in.device, STR_TERMINATE | STR_ASCII); break; } - if (!cli_request_send(req)) { - cli_request_destroy(req); + if (!smbcli_request_send(req)) { + smbcli_request_destroy(req); return NULL; } @@ -103,18 +103,18 @@ struct cli_request *smb_tree_connect_send(struct cli_tree *tree, union smb_tcon /**************************************************************************** Send a tconX (async recv) ****************************************************************************/ -NTSTATUS smb_tree_connect_recv(struct cli_request *req, TALLOC_CTX *mem_ctx, union smb_tcon *parms) +NTSTATUS smb_tree_connect_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, union smb_tcon *parms) { char *p; - if (!cli_request_receive(req) || - cli_request_is_error(req)) { + if (!smbcli_request_receive(req) || + smbcli_request_is_error(req)) { goto failed; } switch (parms->tcon.level) { case RAW_TCON_TCON: - CLI_CHECK_WCT(req, 2); + SMBCLI_CHECK_WCT(req, 2); parms->tcon.out.max_xmit = SVAL(req->in.vwv, VWV(0)); parms->tcon.out.cnum = SVAL(req->in.vwv, VWV(1)); break; @@ -130,23 +130,23 @@ NTSTATUS smb_tree_connect_recv(struct cli_request *req, TALLOC_CTX *mem_ctx, uni p = req->in.data; if (!p) break; - p += cli_req_pull_string(req, mem_ctx, &parms->tconx.out.dev_type, + p += smbcli_req_pull_string(req, mem_ctx, &parms->tconx.out.dev_type, p, -1, STR_ASCII | STR_TERMINATE); - p += cli_req_pull_string(req, mem_ctx, &parms->tconx.out.fs_type, + p += smbcli_req_pull_string(req, mem_ctx, &parms->tconx.out.fs_type, p, -1, STR_TERMINATE); break; } failed: - return cli_request_destroy(req); + return smbcli_request_destroy(req); } /**************************************************************************** Send a tconX (sync interface) ****************************************************************************/ -NTSTATUS smb_tree_connect(struct cli_tree *tree, TALLOC_CTX *mem_ctx, union smb_tcon *parms) +NTSTATUS smb_tree_connect(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_tcon *parms) { - struct cli_request *req = smb_tree_connect_send(tree, parms); + struct smbcli_request *req = smb_tree_connect_send(tree, parms); return smb_tree_connect_recv(req, mem_ctx, parms); } @@ -154,35 +154,35 @@ NTSTATUS smb_tree_connect(struct cli_tree *tree, TALLOC_CTX *mem_ctx, union smb_ /**************************************************************************** Send a tree disconnect. ****************************************************************************/ -NTSTATUS smb_tree_disconnect(struct cli_tree *tree) +NTSTATUS smb_tree_disconnect(struct smbcli_tree *tree) { - struct cli_request *req; + struct smbcli_request *req; if (!tree) return NT_STATUS_OK; - req = cli_request_setup(tree, SMBtdis, 0, 0); + req = smbcli_request_setup(tree, SMBtdis, 0, 0); - if (cli_request_send(req)) { - cli_request_receive(req); + if (smbcli_request_send(req)) { + smbcli_request_receive(req); } - return cli_request_destroy(req); + return smbcli_request_destroy(req); } /* - a convenient function to establish a cli_tree from scratch, using reasonable default + a convenient function to establish a smbcli_tree from scratch, using reasonable default parameters */ -NTSTATUS cli_tree_full_connection(struct cli_tree **ret_tree, +NTSTATUS smbcli_tree_full_connection(struct smbcli_tree **ret_tree, const char *my_name, const char *dest_host, int port, const char *service, const char *service_type, const char *user, const char *domain, const char *password) { - struct cli_socket *sock; - struct cli_transport *transport; - struct cli_session *session; - struct cli_tree *tree; + struct smbcli_socket *sock; + struct smbcli_transport *transport; + struct smbcli_session *session; + struct smbcli_tree *tree; NTSTATUS status; struct nmb_name calling; struct nmb_name called; @@ -193,20 +193,20 @@ NTSTATUS cli_tree_full_connection(struct cli_tree **ret_tree, *ret_tree = NULL; - sock = cli_sock_init(); + sock = smbcli_sock_init(); if (!sock) { return NT_STATUS_NO_MEMORY; } /* open a TCP socket to the server */ - if (!cli_sock_connect_byname(sock, dest_host, port)) { + if (!smbcli_sock_connect_byname(sock, dest_host, port)) { DEBUG(2,("Failed to establish socket connection - %s\n", strerror(errno))); return NT_STATUS_UNSUCCESSFUL; } - transport = cli_transport_init(sock); + transport = smbcli_transport_init(sock); if (!transport) { - cli_sock_close(sock); + smbcli_sock_close(sock); return NT_STATUS_NO_MEMORY; } @@ -214,8 +214,8 @@ NTSTATUS cli_tree_full_connection(struct cli_tree **ret_tree, make_nmb_name(&calling, my_name, 0x0); make_nmb_name(&called, dest_host, 0x20); - if (!cli_transport_connect(transport, &calling, &called)) { - cli_transport_close(transport); + if (!smbcli_transport_connect(transport, &calling, &called)) { + smbcli_transport_close(transport); return NT_STATUS_UNSUCCESSFUL; } @@ -223,13 +223,13 @@ NTSTATUS cli_tree_full_connection(struct cli_tree **ret_tree, /* negotiate protocol options with the server */ status = smb_raw_negotiate(transport); if (!NT_STATUS_IS_OK(status)) { - cli_transport_close(transport); + smbcli_transport_close(transport); return status; } - session = cli_session_init(transport); + session = smbcli_session_init(transport); if (!session) { - cli_transport_close(transport); + smbcli_transport_close(transport); return NT_STATUS_NO_MEMORY; } @@ -255,16 +255,16 @@ NTSTATUS cli_tree_full_connection(struct cli_tree **ret_tree, status = smb_raw_session_setup(session, mem_ctx, &setup); if (!NT_STATUS_IS_OK(status)) { - cli_session_close(session); + smbcli_session_close(session); talloc_destroy(mem_ctx); return status; } session->vuid = setup.generic.out.vuid; - tree = cli_tree_init(session); + tree = smbcli_tree_init(session); if (!tree) { - cli_session_close(session); + smbcli_session_close(session); talloc_destroy(mem_ctx); return NT_STATUS_NO_MEMORY; } @@ -288,7 +288,7 @@ NTSTATUS cli_tree_full_connection(struct cli_tree **ret_tree, SAFE_FREE(in_path); if (!NT_STATUS_IS_OK(status)) { - cli_tree_close(tree); + smbcli_tree_close(tree); talloc_destroy(mem_ctx); return status; } diff --git a/source4/libcli/raw/rawacl.c b/source4/libcli/raw/rawacl.c index ca93591597..77374ae8b9 100644 --- a/source4/libcli/raw/rawacl.c +++ b/source4/libcli/raw/rawacl.c @@ -23,7 +23,7 @@ /**************************************************************************** fetch file ACL (async send) ****************************************************************************/ -struct cli_request *smb_raw_query_secdesc_send(struct cli_tree *tree, +struct smbcli_request *smb_raw_query_secdesc_send(struct smbcli_tree *tree, struct smb_query_secdesc *query) { struct smb_nttrans nt; @@ -52,7 +52,7 @@ struct cli_request *smb_raw_query_secdesc_send(struct cli_tree *tree, /**************************************************************************** fetch file ACL (async recv) ****************************************************************************/ -NTSTATUS smb_raw_query_secdesc_recv(struct cli_request *req, +NTSTATUS smb_raw_query_secdesc_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, struct smb_query_secdesc *query) { @@ -91,11 +91,11 @@ NTSTATUS smb_raw_query_secdesc_recv(struct cli_request *req, /**************************************************************************** fetch file ACL (sync interface) ****************************************************************************/ -NTSTATUS smb_raw_query_secdesc(struct cli_tree *tree, +NTSTATUS smb_raw_query_secdesc(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, struct smb_query_secdesc *query) { - struct cli_request *req = smb_raw_query_secdesc_send(tree, query); + struct smbcli_request *req = smb_raw_query_secdesc_send(tree, query); return smb_raw_query_secdesc_recv(req, mem_ctx, query); } @@ -104,13 +104,13 @@ NTSTATUS smb_raw_query_secdesc(struct cli_tree *tree, /**************************************************************************** set file ACL (async send) ****************************************************************************/ -struct cli_request *smb_raw_set_secdesc_send(struct cli_tree *tree, +struct smbcli_request *smb_raw_set_secdesc_send(struct smbcli_tree *tree, struct smb_set_secdesc *set) { struct smb_nttrans nt; uint8_t params[8]; struct ndr_push *ndr; - struct cli_request *req; + struct smbcli_request *req; NTSTATUS status; nt.in.max_setup = 0; diff --git a/source4/libcli/raw/rawdate.c b/source4/libcli/raw/rawdate.c index 3b731d653b..bfb7465bd5 100644 --- a/source4/libcli/raw/rawdate.c +++ b/source4/libcli/raw/rawdate.c @@ -26,7 +26,7 @@ put a dos date into a buffer (time/date format) This takes GMT time and puts local time for zone_offset in the buffer ********************************************************************/ -void raw_push_dos_date(struct cli_transport *transport, +void raw_push_dos_date(struct smbcli_transport *transport, uint8_t *buf, int offset, time_t unixdate) { push_dos_date(buf, offset, unixdate, transport->negotiate.server_zone); @@ -36,7 +36,7 @@ void raw_push_dos_date(struct cli_transport *transport, put a dos date into a buffer (date/time format) This takes GMT time and puts local time in the buffer ********************************************************************/ -void raw_push_dos_date2(struct cli_transport *transport, +void raw_push_dos_date2(struct smbcli_transport *transport, char *buf, int offset, time_t unixdate) { push_dos_date2(buf, offset, unixdate, transport->negotiate.server_zone); @@ -46,7 +46,7 @@ void raw_push_dos_date2(struct cli_transport *transport, put a dos 32 bit "unix like" date into a buffer. This routine takes GMT and converts it to LOCAL time in zone_offset before putting it ********************************************************************/ -void raw_push_dos_date3(struct cli_transport *transport, +void raw_push_dos_date3(struct smbcli_transport *transport, char *buf, int offset, time_t unixdate) { push_dos_date3(buf, offset, unixdate, transport->negotiate.server_zone); @@ -55,7 +55,7 @@ void raw_push_dos_date3(struct cli_transport *transport, /******************************************************************* convert a dos date ********************************************************************/ -time_t raw_pull_dos_date(struct cli_transport *transport, +time_t raw_pull_dos_date(struct smbcli_transport *transport, const uint8_t *date_ptr) { return pull_dos_date(date_ptr, transport->negotiate.server_zone); @@ -64,7 +64,7 @@ time_t raw_pull_dos_date(struct cli_transport *transport, /******************************************************************* like raw_pull_dos_date() but the words are reversed ********************************************************************/ -time_t raw_pull_dos_date2(struct cli_transport *transport, +time_t raw_pull_dos_date2(struct smbcli_transport *transport, const uint8_t *date_ptr) { return pull_dos_date2(date_ptr, transport->negotiate.server_zone); @@ -74,7 +74,7 @@ time_t raw_pull_dos_date2(struct cli_transport *transport, create a unix GMT date from a dos date in 32 bit "unix like" format these arrive in server zone, with corresponding DST ******************************************************************/ -time_t raw_pull_dos_date3(struct cli_transport *transport, +time_t raw_pull_dos_date3(struct smbcli_transport *transport, const uint8_t *date_ptr) { return pull_dos_date3(date_ptr, transport->negotiate.server_zone); diff --git a/source4/libcli/raw/rawfile.c b/source4/libcli/raw/rawfile.c index 0d00ffcca6..8bd8e5d8af 100644 --- a/source4/libcli/raw/rawfile.c +++ b/source4/libcli/raw/rawfile.c @@ -23,7 +23,7 @@ #include "includes.h" #define SETUP_REQUEST(cmd, wct, buflen) do { \ - req = cli_request_setup(tree, cmd, wct, buflen); \ + req = smbcli_request_setup(tree, cmd, wct, buflen); \ if (!req) return NULL; \ } while (0) @@ -31,17 +31,17 @@ /**************************************************************************** Rename a file - async interface ****************************************************************************/ -struct cli_request *smb_raw_rename_send(struct cli_tree *tree, +struct smbcli_request *smb_raw_rename_send(struct smbcli_tree *tree, union smb_rename *parms) { - struct cli_request *req; + struct smbcli_request *req; switch (parms->generic.level) { case RAW_RENAME_RENAME: SETUP_REQUEST(SMBmv, 1, 0); SSVAL(req->out.vwv, VWV(0), parms->rename.in.attrib); - cli_req_append_ascii4(req, parms->rename.in.pattern1, STR_TERMINATE); - cli_req_append_ascii4(req, parms->rename.in.pattern2, STR_TERMINATE); + smbcli_req_append_ascii4(req, parms->rename.in.pattern1, STR_TERMINATE); + smbcli_req_append_ascii4(req, parms->rename.in.pattern2, STR_TERMINATE); break; case RAW_RENAME_NTRENAME: @@ -49,13 +49,13 @@ struct cli_request *smb_raw_rename_send(struct cli_tree *tree, SSVAL(req->out.vwv, VWV(0), parms->ntrename.in.attrib); SSVAL(req->out.vwv, VWV(1), parms->ntrename.in.flags); SIVAL(req->out.vwv, VWV(2), parms->ntrename.in.cluster_size); - cli_req_append_ascii4(req, parms->ntrename.in.old_name, STR_TERMINATE); - cli_req_append_ascii4(req, parms->ntrename.in.new_name, STR_TERMINATE); + smbcli_req_append_ascii4(req, parms->ntrename.in.old_name, STR_TERMINATE); + smbcli_req_append_ascii4(req, parms->ntrename.in.new_name, STR_TERMINATE); break; } - if (!cli_request_send(req)) { - cli_request_destroy(req); + if (!smbcli_request_send(req)) { + smbcli_request_destroy(req); return NULL; } @@ -65,29 +65,29 @@ struct cli_request *smb_raw_rename_send(struct cli_tree *tree, /**************************************************************************** Rename a file - sync interface ****************************************************************************/ -NTSTATUS smb_raw_rename(struct cli_tree *tree, +NTSTATUS smb_raw_rename(struct smbcli_tree *tree, union smb_rename *parms) { - struct cli_request *req = smb_raw_rename_send(tree, parms); - return cli_request_simple_recv(req); + struct smbcli_request *req = smb_raw_rename_send(tree, parms); + return smbcli_request_simple_recv(req); } /**************************************************************************** Delete a file - async interface ****************************************************************************/ -struct cli_request *smb_raw_unlink_send(struct cli_tree *tree, +struct smbcli_request *smb_raw_unlink_send(struct smbcli_tree *tree, struct smb_unlink *parms) { - struct cli_request *req; + struct smbcli_request *req; SETUP_REQUEST(SMBunlink, 1, 0); SSVAL(req->out.vwv, VWV(0), parms->in.attrib); - cli_req_append_ascii4(req, parms->in.pattern, STR_TERMINATE); + smbcli_req_append_ascii4(req, parms->in.pattern, STR_TERMINATE); - if (!cli_request_send(req)) { - cli_request_destroy(req); + if (!smbcli_request_send(req)) { + smbcli_request_destroy(req); return NULL; } return req; @@ -96,24 +96,24 @@ struct cli_request *smb_raw_unlink_send(struct cli_tree *tree, /* delete a file - sync interface */ -NTSTATUS smb_raw_unlink(struct cli_tree *tree, +NTSTATUS smb_raw_unlink(struct smbcli_tree *tree, struct smb_unlink *parms) { - struct cli_request *req = smb_raw_unlink_send(tree, parms); - return cli_request_simple_recv(req); + struct smbcli_request *req = smb_raw_unlink_send(tree, parms); + return smbcli_request_simple_recv(req); } /**************************************************************************** create a directory using TRANSACT2_MKDIR - async interface ****************************************************************************/ -static struct cli_request *smb_raw_t2mkdir_send(struct cli_tree *tree, +static struct smbcli_request *smb_raw_t2mkdir_send(struct smbcli_tree *tree, union smb_mkdir *parms) { struct smb_trans2 t2; uint16_t setup = TRANSACT2_MKDIR; TALLOC_CTX *mem_ctx; - struct cli_request *req; + struct smbcli_request *req; uint16_t data_total; mem_ctx = talloc_init("t2mkdir"); @@ -132,7 +132,7 @@ static struct cli_request *smb_raw_t2mkdir_send(struct cli_tree *tree, SIVAL(t2.in.params.data, VWV(0), 0); /* reserved */ - cli_blob_append_string(tree->session, mem_ctx, + smbcli_blob_append_string(tree->session, mem_ctx, &t2.in.params, parms->t2mkdir.in.path, 0); ea_put_list(t2.in.data.data, parms->t2mkdir.in.num_eas, parms->t2mkdir.in.eas); @@ -147,10 +147,10 @@ static struct cli_request *smb_raw_t2mkdir_send(struct cli_tree *tree, /**************************************************************************** Create a directory - async interface ****************************************************************************/ -struct cli_request *smb_raw_mkdir_send(struct cli_tree *tree, +struct smbcli_request *smb_raw_mkdir_send(struct smbcli_tree *tree, union smb_mkdir *parms) { - struct cli_request *req; + struct smbcli_request *req; if (parms->generic.level == RAW_MKDIR_T2MKDIR) { return smb_raw_t2mkdir_send(tree, parms); @@ -162,9 +162,9 @@ struct cli_request *smb_raw_mkdir_send(struct cli_tree *tree, SETUP_REQUEST(SMBmkdir, 0, 0); - cli_req_append_ascii4(req, parms->mkdir.in.path, STR_TERMINATE); + smbcli_req_append_ascii4(req, parms->mkdir.in.path, STR_TERMINATE); - if (!cli_request_send(req)) { + if (!smbcli_request_send(req)) { return NULL; } @@ -174,27 +174,27 @@ struct cli_request *smb_raw_mkdir_send(struct cli_tree *tree, /**************************************************************************** Create a directory - sync interface ****************************************************************************/ -NTSTATUS smb_raw_mkdir(struct cli_tree *tree, +NTSTATUS smb_raw_mkdir(struct smbcli_tree *tree, union smb_mkdir *parms) { - struct cli_request *req = smb_raw_mkdir_send(tree, parms); - return cli_request_simple_recv(req); + struct smbcli_request *req = smb_raw_mkdir_send(tree, parms); + return smbcli_request_simple_recv(req); } /**************************************************************************** Remove a directory - async interface ****************************************************************************/ -struct cli_request *smb_raw_rmdir_send(struct cli_tree *tree, +struct smbcli_request *smb_raw_rmdir_send(struct smbcli_tree *tree, struct smb_rmdir *parms) { - struct cli_request *req; + struct smbcli_request *req; SETUP_REQUEST(SMBrmdir, 0, 0); - cli_req_append_ascii4(req, parms->in.path, STR_TERMINATE); + smbcli_req_append_ascii4(req, parms->in.path, STR_TERMINATE); - if (!cli_request_send(req)) { - cli_request_destroy(req); + if (!smbcli_request_send(req)) { + smbcli_request_destroy(req); return NULL; } @@ -204,24 +204,24 @@ struct cli_request *smb_raw_rmdir_send(struct cli_tree *tree, /**************************************************************************** Remove a directory - sync interface ****************************************************************************/ -NTSTATUS smb_raw_rmdir(struct cli_tree *tree, +NTSTATUS smb_raw_rmdir(struct smbcli_tree *tree, struct smb_rmdir *parms) { - struct cli_request *req = smb_raw_rmdir_send(tree, parms); - return cli_request_simple_recv(req); + struct smbcli_request *req = smb_raw_rmdir_send(tree, parms); + return smbcli_request_simple_recv(req); } /**************************************************************************** Open a file using TRANSACT2_OPEN - async send ****************************************************************************/ -static struct cli_request *smb_raw_t2open_send(struct cli_tree *tree, +static struct smbcli_request *smb_raw_t2open_send(struct smbcli_tree *tree, union smb_open *parms) { struct smb_trans2 t2; uint16_t setup = TRANSACT2_OPEN; TALLOC_CTX *mem_ctx = talloc_init("smb_raw_t2open"); - struct cli_request *req; + struct smbcli_request *req; uint16_t list_size; list_size = ea_list_size(parms->t2open.in.num_eas, parms->t2open.in.eas); @@ -248,7 +248,7 @@ static struct cli_request *smb_raw_t2open_send(struct cli_tree *tree, SIVAL(t2.in.params.data, VWV(11), 0); SSVAL(t2.in.params.data, VWV(13), 0); - cli_blob_append_string(tree->session, mem_ctx, + smbcli_blob_append_string(tree->session, mem_ctx, &t2.in.params, parms->t2open.in.fname, STR_TERMINATE); @@ -265,9 +265,9 @@ static struct cli_request *smb_raw_t2open_send(struct cli_tree *tree, /**************************************************************************** Open a file using TRANSACT2_OPEN - async recv ****************************************************************************/ -static NTSTATUS smb_raw_t2open_recv(struct cli_request *req, TALLOC_CTX *mem_ctx, union smb_open *parms) +static NTSTATUS smb_raw_t2open_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, union smb_open *parms) { - struct cli_transport *transport = req?req->transport:NULL; + struct smbcli_transport *transport = req?req->transport:NULL; struct smb_trans2 t2; NTSTATUS status; @@ -294,10 +294,10 @@ static NTSTATUS smb_raw_t2open_recv(struct cli_request *req, TALLOC_CTX *mem_ctx /**************************************************************************** Open a file - async send ****************************************************************************/ -struct cli_request *smb_raw_open_send(struct cli_tree *tree, union smb_open *parms) +struct smbcli_request *smb_raw_open_send(struct smbcli_tree *tree, union smb_open *parms) { int len; - struct cli_request *req = NULL; + struct smbcli_request *req = NULL; switch (parms->open.level) { case RAW_OPEN_T2OPEN: @@ -307,7 +307,7 @@ struct cli_request *smb_raw_open_send(struct cli_tree *tree, union smb_open *par SETUP_REQUEST(SMBopen, 2, 0); SSVAL(req->out.vwv, VWV(0), parms->open.in.flags); SSVAL(req->out.vwv, VWV(1), parms->open.in.search_attrs); - cli_req_append_ascii4(req, parms->open.in.fname, STR_TERMINATE); + smbcli_req_append_ascii4(req, parms->open.in.fname, STR_TERMINATE); break; case RAW_OPEN_OPENX: @@ -324,7 +324,7 @@ struct cli_request *smb_raw_open_send(struct cli_tree *tree, union smb_open *par SIVAL(req->out.vwv, VWV(9), parms->openx.in.size); SIVAL(req->out.vwv, VWV(11),parms->openx.in.timeout); SIVAL(req->out.vwv, VWV(13),0); /* reserved */ - cli_req_append_string(req, parms->openx.in.fname, STR_TERMINATE); + smbcli_req_append_string(req, parms->openx.in.fname, STR_TERMINATE); break; case RAW_OPEN_MKNEW: @@ -332,7 +332,7 @@ struct cli_request *smb_raw_open_send(struct cli_tree *tree, union smb_open *par SSVAL(req->out.vwv, VWV(0), parms->mknew.in.attrib); raw_push_dos_date3(tree->session->transport, req->out.vwv, VWV(1), parms->mknew.in.write_time); - cli_req_append_ascii4(req, parms->mknew.in.fname, STR_TERMINATE); + smbcli_req_append_ascii4(req, parms->mknew.in.fname, STR_TERMINATE); break; case RAW_OPEN_CREATE: @@ -340,7 +340,7 @@ struct cli_request *smb_raw_open_send(struct cli_tree *tree, union smb_open *par SSVAL(req->out.vwv, VWV(0), parms->create.in.attrib); raw_push_dos_date3(tree->session->transport, req->out.vwv, VWV(1), parms->create.in.write_time); - cli_req_append_ascii4(req, parms->create.in.fname, STR_TERMINATE); + smbcli_req_append_ascii4(req, parms->create.in.fname, STR_TERMINATE); break; case RAW_OPEN_CTEMP: @@ -348,7 +348,7 @@ struct cli_request *smb_raw_open_send(struct cli_tree *tree, union smb_open *par SSVAL(req->out.vwv, VWV(0), parms->ctemp.in.attrib); raw_push_dos_date3(tree->session->transport, req->out.vwv, VWV(1), parms->ctemp.in.write_time); - cli_req_append_ascii4(req, parms->ctemp.in.directory, STR_TERMINATE); + smbcli_req_append_ascii4(req, parms->ctemp.in.directory, STR_TERMINATE); break; case RAW_OPEN_SPLOPEN: @@ -373,13 +373,13 @@ struct cli_request *smb_raw_open_send(struct cli_tree *tree, union smb_open *par SIVAL(req->out.vwv, 43, parms->ntcreatex.in.impersonation); SCVAL(req->out.vwv, 47, parms->ntcreatex.in.security_flags); - cli_req_append_string_len(req, parms->ntcreatex.in.fname, STR_TERMINATE, &len); + smbcli_req_append_string_len(req, parms->ntcreatex.in.fname, STR_TERMINATE, &len); SSVAL(req->out.vwv, 5, len); break; } - if (!cli_request_send(req)) { - cli_request_destroy(req); + if (!smbcli_request_send(req)) { + smbcli_request_destroy(req); return NULL; } @@ -389,10 +389,10 @@ struct cli_request *smb_raw_open_send(struct cli_tree *tree, union smb_open *par /**************************************************************************** Open a file - async recv ****************************************************************************/ -NTSTATUS smb_raw_open_recv(struct cli_request *req, TALLOC_CTX *mem_ctx, union smb_open *parms) +NTSTATUS smb_raw_open_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, union smb_open *parms) { - if (!cli_request_receive(req) || - cli_request_is_error(req)) { + if (!smbcli_request_receive(req) || + smbcli_request_is_error(req)) { goto failed; } @@ -401,7 +401,7 @@ NTSTATUS smb_raw_open_recv(struct cli_request *req, TALLOC_CTX *mem_ctx, union s return smb_raw_t2open_recv(req, mem_ctx, parms); case RAW_OPEN_OPEN: - CLI_CHECK_WCT(req, 7); + SMBCLI_CHECK_WCT(req, 7); parms->open.out.fnum = SVAL(req->in.vwv, VWV(0)); parms->open.out.attrib = SVAL(req->in.vwv, VWV(1)); parms->open.out.write_time = raw_pull_dos_date3(req->transport, @@ -411,7 +411,7 @@ NTSTATUS smb_raw_open_recv(struct cli_request *req, TALLOC_CTX *mem_ctx, union s break; case RAW_OPEN_OPENX: - CLI_CHECK_MIN_WCT(req, 15); + SMBCLI_CHECK_MIN_WCT(req, 15); parms->openx.out.fnum = SVAL(req->in.vwv, VWV(2)); parms->openx.out.attrib = SVAL(req->in.vwv, VWV(3)); parms->openx.out.write_time = raw_pull_dos_date3(req->transport, @@ -432,35 +432,35 @@ NTSTATUS smb_raw_open_recv(struct cli_request *req, TALLOC_CTX *mem_ctx, union s break; case RAW_OPEN_MKNEW: - CLI_CHECK_WCT(req, 1); + SMBCLI_CHECK_WCT(req, 1); parms->mknew.out.fnum = SVAL(req->in.vwv, VWV(0)); break; case RAW_OPEN_CREATE: - CLI_CHECK_WCT(req, 1); + SMBCLI_CHECK_WCT(req, 1); parms->create.out.fnum = SVAL(req->in.vwv, VWV(0)); break; case RAW_OPEN_CTEMP: - CLI_CHECK_WCT(req, 1); + SMBCLI_CHECK_WCT(req, 1); parms->ctemp.out.fnum = SVAL(req->in.vwv, VWV(0)); - cli_req_pull_string(req, mem_ctx, &parms->ctemp.out.name, req->in.data, -1, STR_TERMINATE | STR_ASCII); + smbcli_req_pull_string(req, mem_ctx, &parms->ctemp.out.name, req->in.data, -1, STR_TERMINATE | STR_ASCII); break; case RAW_OPEN_SPLOPEN: - CLI_CHECK_WCT(req, 1); + SMBCLI_CHECK_WCT(req, 1); parms->splopen.out.fnum = SVAL(req->in.vwv, VWV(0)); break; case RAW_OPEN_NTCREATEX: - CLI_CHECK_MIN_WCT(req, 34); + SMBCLI_CHECK_MIN_WCT(req, 34); parms->ntcreatex.out.oplock_level = CVAL(req->in.vwv, 4); parms->ntcreatex.out.fnum = SVAL(req->in.vwv, 5); parms->ntcreatex.out.create_action = IVAL(req->in.vwv, 7); - parms->ntcreatex.out.create_time = cli_pull_nttime(req->in.vwv, 11); - parms->ntcreatex.out.access_time = cli_pull_nttime(req->in.vwv, 19); - parms->ntcreatex.out.write_time = cli_pull_nttime(req->in.vwv, 27); - parms->ntcreatex.out.change_time = cli_pull_nttime(req->in.vwv, 35); + parms->ntcreatex.out.create_time = smbcli_pull_nttime(req->in.vwv, 11); + parms->ntcreatex.out.access_time = smbcli_pull_nttime(req->in.vwv, 19); + parms->ntcreatex.out.write_time = smbcli_pull_nttime(req->in.vwv, 27); + parms->ntcreatex.out.change_time = smbcli_pull_nttime(req->in.vwv, 35); parms->ntcreatex.out.attrib = IVAL(req->in.vwv, 43); parms->ntcreatex.out.alloc_size = BVAL(req->in.vwv, 47); parms->ntcreatex.out.size = BVAL(req->in.vwv, 55); @@ -471,16 +471,16 @@ NTSTATUS smb_raw_open_recv(struct cli_request *req, TALLOC_CTX *mem_ctx, union s } failed: - return cli_request_destroy(req); + return smbcli_request_destroy(req); } /**************************************************************************** Open a file - sync interface ****************************************************************************/ -NTSTATUS smb_raw_open(struct cli_tree *tree, TALLOC_CTX *mem_ctx, union smb_open *parms) +NTSTATUS smb_raw_open(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_open *parms) { - struct cli_request *req = smb_raw_open_send(tree, parms); + struct smbcli_request *req = smb_raw_open_send(tree, parms); return smb_raw_open_recv(req, mem_ctx, parms); } @@ -488,9 +488,9 @@ NTSTATUS smb_raw_open(struct cli_tree *tree, TALLOC_CTX *mem_ctx, union smb_open /**************************************************************************** Close a file - async send ****************************************************************************/ -struct cli_request *smb_raw_close_send(struct cli_tree *tree, union smb_close *parms) +struct smbcli_request *smb_raw_close_send(struct smbcli_tree *tree, union smb_close *parms) { - struct cli_request *req; + struct smbcli_request *req; switch (parms->generic.level) { case RAW_CLOSE_GENERIC: @@ -512,8 +512,8 @@ struct cli_request *smb_raw_close_send(struct cli_tree *tree, union smb_close *p if (!req) return NULL; - if (!cli_request_send(req)) { - cli_request_destroy(req); + if (!smbcli_request_send(req)) { + smbcli_request_destroy(req); return NULL; } @@ -524,19 +524,19 @@ struct cli_request *smb_raw_close_send(struct cli_tree *tree, union smb_close *p /**************************************************************************** Close a file - sync interface ****************************************************************************/ -NTSTATUS smb_raw_close(struct cli_tree *tree, union smb_close *parms) +NTSTATUS smb_raw_close(struct smbcli_tree *tree, union smb_close *parms) { - struct cli_request *req = smb_raw_close_send(tree, parms); - return cli_request_simple_recv(req); + struct smbcli_request *req = smb_raw_close_send(tree, parms); + return smbcli_request_simple_recv(req); } /**************************************************************************** Locking calls - async interface ****************************************************************************/ -struct cli_request *smb_raw_lock_send(struct cli_tree *tree, union smb_lock *parms) +struct smbcli_request *smb_raw_lock_send(struct smbcli_tree *tree, union smb_lock *parms) { - struct cli_request *req; + struct smbcli_request *req; switch (parms->generic.level) { case RAW_LOCK_GENERIC: @@ -590,8 +590,8 @@ struct cli_request *smb_raw_lock_send(struct cli_tree *tree, union smb_lock *par } } - if (!cli_request_send(req)) { - cli_request_destroy(req); + if (!smbcli_request_send(req)) { + smbcli_request_destroy(req); return NULL; } @@ -601,26 +601,26 @@ struct cli_request *smb_raw_lock_send(struct cli_tree *tree, union smb_lock *par /**************************************************************************** Locking calls - sync interface ****************************************************************************/ -NTSTATUS smb_raw_lock(struct cli_tree *tree, union smb_lock *parms) +NTSTATUS smb_raw_lock(struct smbcli_tree *tree, union smb_lock *parms) { - struct cli_request *req = smb_raw_lock_send(tree, parms); - return cli_request_simple_recv(req); + struct smbcli_request *req = smb_raw_lock_send(tree, parms); + return smbcli_request_simple_recv(req); } /**************************************************************************** Check for existence of a dir - async send ****************************************************************************/ -struct cli_request *smb_raw_chkpath_send(struct cli_tree *tree, struct smb_chkpath *parms) +struct smbcli_request *smb_raw_chkpath_send(struct smbcli_tree *tree, struct smb_chkpath *parms) { - struct cli_request *req; + struct smbcli_request *req; SETUP_REQUEST(SMBchkpth, 0, 0); - cli_req_append_ascii4(req, parms->in.path, STR_TERMINATE); + smbcli_req_append_ascii4(req, parms->in.path, STR_TERMINATE); - if (!cli_request_send(req)) { - cli_request_destroy(req); + if (!smbcli_request_send(req)) { + smbcli_request_destroy(req); return NULL; } @@ -630,10 +630,10 @@ struct cli_request *smb_raw_chkpath_send(struct cli_tree *tree, struct smb_chkpa /**************************************************************************** Check for existence of a dir - sync interface ****************************************************************************/ -NTSTATUS smb_raw_chkpath(struct cli_tree *tree, struct smb_chkpath *parms) +NTSTATUS smb_raw_chkpath(struct smbcli_tree *tree, struct smb_chkpath *parms) { - struct cli_request *req = smb_raw_chkpath_send(tree, parms); - return cli_request_simple_recv(req); + struct smbcli_request *req = smb_raw_chkpath_send(tree, parms); + return smbcli_request_simple_recv(req); } @@ -643,15 +643,15 @@ NTSTATUS smb_raw_chkpath(struct cli_tree *tree, struct smb_chkpath *parms) flush a file - async send a flush to fnum 0xFFFF will flush all files ****************************************************************************/ -struct cli_request *smb_raw_flush_send(struct cli_tree *tree, struct smb_flush *parms) +struct smbcli_request *smb_raw_flush_send(struct smbcli_tree *tree, struct smb_flush *parms) { - struct cli_request *req; + struct smbcli_request *req; SETUP_REQUEST(SMBflush, 1, 0); SSVAL(req->out.vwv, VWV(0), parms->in.fnum); - if (!cli_request_send(req)) { - cli_request_destroy(req); + if (!smbcli_request_send(req)) { + smbcli_request_destroy(req); return NULL; } @@ -662,20 +662,20 @@ struct cli_request *smb_raw_flush_send(struct cli_tree *tree, struct smb_flush * /**************************************************************************** flush a file - sync interface ****************************************************************************/ -NTSTATUS smb_raw_flush(struct cli_tree *tree, struct smb_flush *parms) +NTSTATUS smb_raw_flush(struct smbcli_tree *tree, struct smb_flush *parms) { - struct cli_request *req = smb_raw_flush_send(tree, parms); - return cli_request_simple_recv(req); + struct smbcli_request *req = smb_raw_flush_send(tree, parms); + return smbcli_request_simple_recv(req); } /**************************************************************************** seek a file - async send ****************************************************************************/ -struct cli_request *smb_raw_seek_send(struct cli_tree *tree, +struct smbcli_request *smb_raw_seek_send(struct smbcli_tree *tree, struct smb_seek *parms) { - struct cli_request *req; + struct smbcli_request *req; SETUP_REQUEST(SMBlseek, 4, 0); @@ -683,8 +683,8 @@ struct cli_request *smb_raw_seek_send(struct cli_tree *tree, SSVAL(req->out.vwv, VWV(1), parms->in.mode); SIVALS(req->out.vwv, VWV(2), parms->in.offset); - if (!cli_request_send(req)) { - cli_request_destroy(req); + if (!smbcli_request_send(req)) { + smbcli_request_destroy(req); return NULL; } return req; @@ -693,27 +693,27 @@ struct cli_request *smb_raw_seek_send(struct cli_tree *tree, /**************************************************************************** seek a file - async receive ****************************************************************************/ -NTSTATUS smb_raw_seek_recv(struct cli_request *req, +NTSTATUS smb_raw_seek_recv(struct smbcli_request *req, struct smb_seek *parms) { - if (!cli_request_receive(req) || - cli_request_is_error(req)) { - return cli_request_destroy(req); + if (!smbcli_request_receive(req) || + smbcli_request_is_error(req)) { + return smbcli_request_destroy(req); } - CLI_CHECK_WCT(req, 2); + SMBCLI_CHECK_WCT(req, 2); parms->out.offset = IVAL(req->in.vwv, VWV(0)); failed: - return cli_request_destroy(req); + return smbcli_request_destroy(req); } /* seek a file - sync interface */ -NTSTATUS smb_raw_seek(struct cli_tree *tree, +NTSTATUS smb_raw_seek(struct smbcli_tree *tree, struct smb_seek *parms) { - struct cli_request *req = smb_raw_seek_send(tree, parms); + struct smbcli_request *req = smb_raw_seek_send(tree, parms); return smb_raw_seek_recv(req, parms); } diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index f27a0d7281..8dc220b0b4 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -36,7 +36,7 @@ /**************************************************************************** Handle qfileinfo/qpathinfo trans2 backend. ****************************************************************************/ -static NTSTATUS smb_raw_info_backend(struct cli_session *session, +static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, TALLOC_CTX *mem_ctx, union smb_fileinfo *parms, DATA_BLOB *blob) @@ -95,10 +95,10 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session, if (blob->length != 36) { FINFO_CHECK_SIZE(40); } - parms->basic_info.out.create_time = cli_pull_nttime(blob->data, 0); - parms->basic_info.out.access_time = cli_pull_nttime(blob->data, 8); - parms->basic_info.out.write_time = cli_pull_nttime(blob->data, 16); - parms->basic_info.out.change_time = cli_pull_nttime(blob->data, 24); + parms->basic_info.out.create_time = smbcli_pull_nttime(blob->data, 0); + parms->basic_info.out.access_time = smbcli_pull_nttime(blob->data, 8); + parms->basic_info.out.write_time = smbcli_pull_nttime(blob->data, 16); + parms->basic_info.out.change_time = smbcli_pull_nttime(blob->data, 24); parms->basic_info.out.attrib = IVAL(blob->data, 32); return NT_STATUS_OK; @@ -121,17 +121,17 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session, case RAW_FILEINFO_NAME_INFO: case RAW_FILEINFO_NAME_INFORMATION: FINFO_CHECK_MIN_SIZE(4); - cli_blob_pull_string(session, mem_ctx, blob, + smbcli_blob_pull_string(session, mem_ctx, blob, &parms->name_info.out.fname, 0, 4, STR_UNICODE); return NT_STATUS_OK; case RAW_FILEINFO_ALL_INFO: case RAW_FILEINFO_ALL_INFORMATION: FINFO_CHECK_MIN_SIZE(72); - parms->all_info.out.create_time = cli_pull_nttime(blob->data, 0); - parms->all_info.out.access_time = cli_pull_nttime(blob->data, 8); - parms->all_info.out.write_time = cli_pull_nttime(blob->data, 16); - parms->all_info.out.change_time = cli_pull_nttime(blob->data, 24); + parms->all_info.out.create_time = smbcli_pull_nttime(blob->data, 0); + parms->all_info.out.access_time = smbcli_pull_nttime(blob->data, 8); + parms->all_info.out.write_time = smbcli_pull_nttime(blob->data, 16); + parms->all_info.out.change_time = smbcli_pull_nttime(blob->data, 24); parms->all_info.out.attrib = IVAL(blob->data, 32); parms->all_info.out.alloc_size = BVAL(blob->data, 40); parms->all_info.out.size = BVAL(blob->data, 48); @@ -139,14 +139,14 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session, parms->all_info.out.delete_pending = CVAL(blob->data, 60); parms->all_info.out.directory = CVAL(blob->data, 61); parms->all_info.out.ea_size = IVAL(blob->data, 64); - cli_blob_pull_string(session, mem_ctx, blob, + smbcli_blob_pull_string(session, mem_ctx, blob, &parms->all_info.out.fname, 68, 72, STR_UNICODE); return NT_STATUS_OK; case RAW_FILEINFO_ALT_NAME_INFO: case RAW_FILEINFO_ALT_NAME_INFORMATION: FINFO_CHECK_MIN_SIZE(4); - cli_blob_pull_string(session, mem_ctx, blob, + smbcli_blob_pull_string(session, mem_ctx, blob, &parms->alt_name_info.out.fname, 0, 4, STR_UNICODE); return NT_STATUS_OK; @@ -166,7 +166,7 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session, } parms->stream_info.out.streams[n].size = BVAL(blob->data, ofs + 8); parms->stream_info.out.streams[n].alloc_size = BVAL(blob->data, ofs + 16); - cli_blob_pull_string(session, mem_ctx, blob, + smbcli_blob_pull_string(session, mem_ctx, blob, &parms->stream_info.out.streams[n].stream_name, ofs+4, ofs+24, STR_UNICODE); parms->stream_info.out.num_streams++; @@ -218,9 +218,9 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session, FINFO_CHECK_SIZE(100); parms->unix_basic_info.out.end_of_file = BVAL(blob->data, 0); parms->unix_basic_info.out.num_bytes = BVAL(blob->data, 8); - parms->unix_basic_info.out.status_change_time = cli_pull_nttime(blob->data, 16); - parms->unix_basic_info.out.access_time = cli_pull_nttime(blob->data, 24); - parms->unix_basic_info.out.change_time = cli_pull_nttime(blob->data, 32); + parms->unix_basic_info.out.status_change_time = smbcli_pull_nttime(blob->data, 16); + parms->unix_basic_info.out.access_time = smbcli_pull_nttime(blob->data, 24); + parms->unix_basic_info.out.change_time = smbcli_pull_nttime(blob->data, 32); parms->unix_basic_info.out.uid = BVAL(blob->data, 40); parms->unix_basic_info.out.gid = BVAL(blob->data, 48); parms->unix_basic_info.out.file_type = IVAL(blob->data, 52); @@ -232,16 +232,16 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session, return NT_STATUS_OK; case RAW_FILEINFO_UNIX_LINK: - cli_blob_pull_string(session, mem_ctx, blob, + smbcli_blob_pull_string(session, mem_ctx, blob, &parms->unix_link_info.out.link_dest, 0, 4, STR_UNICODE); return NT_STATUS_OK; case RAW_FILEINFO_NETWORK_OPEN_INFORMATION: FINFO_CHECK_SIZE(56); - parms->network_open_information.out.create_time = cli_pull_nttime(blob->data, 0); - parms->network_open_information.out.access_time = cli_pull_nttime(blob->data, 8); - parms->network_open_information.out.write_time = cli_pull_nttime(blob->data, 16); - parms->network_open_information.out.change_time = cli_pull_nttime(blob->data, 24); + parms->network_open_information.out.create_time = smbcli_pull_nttime(blob->data, 0); + parms->network_open_information.out.access_time = smbcli_pull_nttime(blob->data, 8); + parms->network_open_information.out.write_time = smbcli_pull_nttime(blob->data, 16); + parms->network_open_information.out.change_time = smbcli_pull_nttime(blob->data, 24); parms->network_open_information.out.alloc_size = BVAL(blob->data, 32); parms->network_open_information.out.size = BVAL(blob->data, 40); parms->network_open_information.out.attrib = IVAL(blob->data, 48); @@ -260,12 +260,12 @@ static NTSTATUS smb_raw_info_backend(struct cli_session *session, /**************************************************************************** Very raw query file info - returns param/data blobs - (async send) ****************************************************************************/ -static struct cli_request *smb_raw_fileinfo_blob_send(struct cli_tree *tree, +static struct smbcli_request *smb_raw_fileinfo_blob_send(struct smbcli_tree *tree, uint16_t fnum, uint16_t info_level) { struct smb_trans2 tp; uint16_t setup = TRANSACT2_QFILEINFO; - struct cli_request *req; + struct smbcli_request *req; TALLOC_CTX *mem_ctx = talloc_init("raw_fileinfo"); tp.in.max_setup = 0; @@ -297,7 +297,7 @@ static struct cli_request *smb_raw_fileinfo_blob_send(struct cli_tree *tree, /**************************************************************************** Very raw query file info - returns param/data blobs - (async recv) ****************************************************************************/ -static NTSTATUS smb_raw_fileinfo_blob_recv(struct cli_request *req, +static NTSTATUS smb_raw_fileinfo_blob_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, DATA_BLOB *blob) { @@ -312,13 +312,13 @@ static NTSTATUS smb_raw_fileinfo_blob_recv(struct cli_request *req, /**************************************************************************** Very raw query path info - returns param/data blobs (async send) ****************************************************************************/ -static struct cli_request *smb_raw_pathinfo_blob_send(struct cli_tree *tree, +static struct smbcli_request *smb_raw_pathinfo_blob_send(struct smbcli_tree *tree, const char *fname, uint16_t info_level) { struct smb_trans2 tp; uint16_t setup = TRANSACT2_QPATHINFO; - struct cli_request *req; + struct smbcli_request *req; TALLOC_CTX *mem_ctx = talloc_init("raw_pathinfo"); tp.in.max_setup = 0; @@ -338,7 +338,7 @@ static struct cli_request *smb_raw_pathinfo_blob_send(struct cli_tree *tree, SSVAL(tp.in.params.data, 0, info_level); SIVAL(tp.in.params.data, 2, 0); - cli_blob_append_string(tree->session, mem_ctx, &tp.in.params, + smbcli_blob_append_string(tree->session, mem_ctx, &tp.in.params, fname, STR_TERMINATE); req = smb_raw_trans2_send(tree, &tp); @@ -351,18 +351,18 @@ static struct cli_request *smb_raw_pathinfo_blob_send(struct cli_tree *tree, /**************************************************************************** send a SMBgetatr (async send) ****************************************************************************/ -static struct cli_request *smb_raw_getattr_send(struct cli_tree *tree, +static struct smbcli_request *smb_raw_getattr_send(struct smbcli_tree *tree, union smb_fileinfo *parms) { - struct cli_request *req; + struct smbcli_request *req; - req = cli_request_setup(tree, SMBgetatr, 0, 0); + req = smbcli_request_setup(tree, SMBgetatr, 0, 0); if (!req) return NULL; - cli_req_append_ascii4(req, parms->getattr.in.fname, STR_TERMINATE); + smbcli_req_append_ascii4(req, parms->getattr.in.fname, STR_TERMINATE); - if (!cli_request_send(req)) { - cli_request_destroy(req); + if (!smbcli_request_send(req)) { + smbcli_request_destroy(req); return NULL; } @@ -372,39 +372,39 @@ static struct cli_request *smb_raw_getattr_send(struct cli_tree *tree, /**************************************************************************** send a SMBgetatr (async recv) ****************************************************************************/ -static NTSTATUS smb_raw_getattr_recv(struct cli_request *req, +static NTSTATUS smb_raw_getattr_recv(struct smbcli_request *req, union smb_fileinfo *parms) { - if (!cli_request_receive(req) || - cli_request_is_error(req)) { - return cli_request_destroy(req); + if (!smbcli_request_receive(req) || + smbcli_request_is_error(req)) { + return smbcli_request_destroy(req); } - CLI_CHECK_WCT(req, 10); + SMBCLI_CHECK_WCT(req, 10); parms->getattr.out.attrib = SVAL(req->in.vwv, VWV(0)); parms->getattr.out.write_time = raw_pull_dos_date3(req->transport, req->in.vwv + VWV(1)); parms->getattr.out.size = IVAL(req->in.vwv, VWV(3)); failed: - return cli_request_destroy(req); + return smbcli_request_destroy(req); } /**************************************************************************** Handle SMBgetattrE (async send) ****************************************************************************/ -static struct cli_request *smb_raw_getattrE_send(struct cli_tree *tree, +static struct smbcli_request *smb_raw_getattrE_send(struct smbcli_tree *tree, union smb_fileinfo *parms) { - struct cli_request *req; + struct smbcli_request *req; - req = cli_request_setup(tree, SMBgetattrE, 1, 0); + req = smbcli_request_setup(tree, SMBgetattrE, 1, 0); if (!req) return NULL; SSVAL(req->out.vwv, VWV(0), parms->getattre.in.fnum); - if (!cli_request_send(req)) { - cli_request_destroy(req); + if (!smbcli_request_send(req)) { + smbcli_request_destroy(req); return NULL; } @@ -414,15 +414,15 @@ static struct cli_request *smb_raw_getattrE_send(struct cli_tree *tree, /**************************************************************************** Handle SMBgetattrE (async send) ****************************************************************************/ -static NTSTATUS smb_raw_getattrE_recv(struct cli_request *req, +static NTSTATUS smb_raw_getattrE_recv(struct smbcli_request *req, union smb_fileinfo *parms) { - if (!cli_request_receive(req) || - cli_request_is_error(req)) { - return cli_request_destroy(req); + if (!smbcli_request_receive(req) || + smbcli_request_is_error(req)) { + return smbcli_request_destroy(req); } - CLI_CHECK_WCT(req, 11); + SMBCLI_CHECK_WCT(req, 11); parms->getattre.out.create_time = raw_pull_dos_date2(req->transport, req->in.vwv + VWV(0)); parms->getattre.out.access_time = raw_pull_dos_date2(req->transport, @@ -434,14 +434,14 @@ static NTSTATUS smb_raw_getattrE_recv(struct cli_request *req, parms->getattre.out.attrib = SVAL(req->in.vwv, VWV(10)); failed: - return cli_request_destroy(req); + return smbcli_request_destroy(req); } /**************************************************************************** Query file info (async send) ****************************************************************************/ -struct cli_request *smb_raw_fileinfo_send(struct cli_tree *tree, +struct smbcli_request *smb_raw_fileinfo_send(struct smbcli_tree *tree, union smb_fileinfo *parms) { /* pass off the non-trans2 level to specialised functions */ @@ -460,13 +460,13 @@ struct cli_request *smb_raw_fileinfo_send(struct cli_tree *tree, /**************************************************************************** Query file info (async recv) ****************************************************************************/ -NTSTATUS smb_raw_fileinfo_recv(struct cli_request *req, +NTSTATUS smb_raw_fileinfo_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, union smb_fileinfo *parms) { DATA_BLOB blob; NTSTATUS status; - struct cli_session *session = req?req->session:NULL; + struct smbcli_session *session = req?req->session:NULL; if (parms->generic.level == RAW_FILEINFO_GETATTRE) { return smb_raw_getattrE_recv(req, parms); @@ -486,18 +486,18 @@ NTSTATUS smb_raw_fileinfo_recv(struct cli_request *req, /**************************************************************************** Query file info (sync interface) ****************************************************************************/ -NTSTATUS smb_raw_fileinfo(struct cli_tree *tree, +NTSTATUS smb_raw_fileinfo(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_fileinfo *parms) { - struct cli_request *req = smb_raw_fileinfo_send(tree, parms); + struct smbcli_request *req = smb_raw_fileinfo_send(tree, parms); return smb_raw_fileinfo_recv(req, mem_ctx, parms); } /**************************************************************************** Query path info (async send) ****************************************************************************/ -struct cli_request *smb_raw_pathinfo_send(struct cli_tree *tree, +struct smbcli_request *smb_raw_pathinfo_send(struct smbcli_tree *tree, union smb_fileinfo *parms) { if (parms->generic.level == RAW_FILEINFO_GETATTR) { @@ -514,7 +514,7 @@ struct cli_request *smb_raw_pathinfo_send(struct cli_tree *tree, /**************************************************************************** Query path info (async recv) ****************************************************************************/ -NTSTATUS smb_raw_pathinfo_recv(struct cli_request *req, +NTSTATUS smb_raw_pathinfo_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, union smb_fileinfo *parms) { @@ -525,10 +525,10 @@ NTSTATUS smb_raw_pathinfo_recv(struct cli_request *req, /**************************************************************************** Query path info (sync interface) ****************************************************************************/ -NTSTATUS smb_raw_pathinfo(struct cli_tree *tree, +NTSTATUS smb_raw_pathinfo(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_fileinfo *parms) { - struct cli_request *req = smb_raw_pathinfo_send(tree, parms); + struct smbcli_request *req = smb_raw_pathinfo_send(tree, parms); return smb_raw_pathinfo_recv(req, mem_ctx, parms); } diff --git a/source4/libcli/raw/rawfsinfo.c b/source4/libcli/raw/rawfsinfo.c index faf375deb0..aefe8e3085 100644 --- a/source4/libcli/raw/rawfsinfo.c +++ b/source4/libcli/raw/rawfsinfo.c @@ -25,15 +25,15 @@ /**************************************************************************** Query FS Info - SMBdskattr call (async send) ****************************************************************************/ -static struct cli_request *smb_raw_dskattr_send(struct cli_tree *tree, +static struct smbcli_request *smb_raw_dskattr_send(struct smbcli_tree *tree, union smb_fsinfo *fsinfo) { - struct cli_request *req; + struct smbcli_request *req; - req = cli_request_setup(tree, SMBdskattr, 0, 0); + req = smbcli_request_setup(tree, SMBdskattr, 0, 0); - if (!cli_request_send(req)) { - cli_request_destroy(req); + if (!smbcli_request_send(req)) { + smbcli_request_destroy(req); return NULL; } @@ -43,29 +43,29 @@ static struct cli_request *smb_raw_dskattr_send(struct cli_tree *tree, /**************************************************************************** Query FS Info - SMBdskattr call (async recv) ****************************************************************************/ -static NTSTATUS smb_raw_dskattr_recv(struct cli_request *req, +static NTSTATUS smb_raw_dskattr_recv(struct smbcli_request *req, union smb_fsinfo *fsinfo) { - if (!cli_request_receive(req) || - cli_request_is_error(req)) { + if (!smbcli_request_receive(req) || + smbcli_request_is_error(req)) { goto failed; } - CLI_CHECK_WCT(req, 5); + SMBCLI_CHECK_WCT(req, 5); fsinfo->dskattr.out.units_total = SVAL(req->in.vwv, VWV(0)); fsinfo->dskattr.out.blocks_per_unit = SVAL(req->in.vwv, VWV(1)); fsinfo->dskattr.out.block_size = SVAL(req->in.vwv, VWV(2)); fsinfo->dskattr.out.units_free = SVAL(req->in.vwv, VWV(3)); failed: - return cli_request_destroy(req); + return smbcli_request_destroy(req); } /**************************************************************************** RAW_QFS_ trans2 interface via blobs (async send) ****************************************************************************/ -static struct cli_request *smb_raw_qfsinfo_send(struct cli_tree *tree, +static struct smbcli_request *smb_raw_qfsinfo_send(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, uint16_t info_level) { @@ -94,7 +94,7 @@ static struct cli_request *smb_raw_qfsinfo_send(struct cli_tree *tree, /**************************************************************************** RAW_QFS_ trans2 interface via blobs (async recv) ****************************************************************************/ -static NTSTATUS smb_raw_qfsinfo_blob_recv(struct cli_request *req, +static NTSTATUS smb_raw_qfsinfo_blob_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, DATA_BLOB *blob) { @@ -129,7 +129,7 @@ static NTSTATUS smb_raw_qfsinfo_blob_recv(struct cli_request *req, /**************************************************************************** Query FSInfo raw interface (async send) ****************************************************************************/ -struct cli_request *smb_raw_fsinfo_send(struct cli_tree *tree, +struct smbcli_request *smb_raw_fsinfo_send(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_fsinfo *fsinfo) { @@ -153,14 +153,14 @@ struct cli_request *smb_raw_fsinfo_send(struct cli_tree *tree, /**************************************************************************** Query FSInfo raw interface (async recv) ****************************************************************************/ -NTSTATUS smb_raw_fsinfo_recv(struct cli_request *req, +NTSTATUS smb_raw_fsinfo_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, union smb_fsinfo *fsinfo) { DATA_BLOB blob; NTSTATUS status; int i; - struct cli_session *session = req?req->session:NULL; + struct smbcli_session *session = req?req->session:NULL; if (fsinfo->generic.level == RAW_QFS_DSKATTR) { return smb_raw_dskattr_recv(req, fsinfo); @@ -190,7 +190,7 @@ NTSTATUS smb_raw_fsinfo_recv(struct cli_request *req, case RAW_QFS_VOLUME: QFS_CHECK_MIN_SIZE(5); fsinfo->volume.out.serial_number = IVAL(blob.data, 0); - cli_blob_pull_string(session, mem_ctx, &blob, + smbcli_blob_pull_string(session, mem_ctx, &blob, &fsinfo->volume.out.volume_name, 4, 5, STR_LEN8BIT | STR_NOALIGN); break; @@ -198,9 +198,9 @@ NTSTATUS smb_raw_fsinfo_recv(struct cli_request *req, case RAW_QFS_VOLUME_INFO: case RAW_QFS_VOLUME_INFORMATION: QFS_CHECK_MIN_SIZE(18); - fsinfo->volume_info.out.create_time = cli_pull_nttime(blob.data, 0); + fsinfo->volume_info.out.create_time = smbcli_pull_nttime(blob.data, 0); fsinfo->volume_info.out.serial_number = IVAL(blob.data, 8); - cli_blob_pull_string(session, mem_ctx, &blob, + smbcli_blob_pull_string(session, mem_ctx, &blob, &fsinfo->volume_info.out.volume_name, 12, 18, STR_UNICODE); break; @@ -226,7 +226,7 @@ NTSTATUS smb_raw_fsinfo_recv(struct cli_request *req, QFS_CHECK_MIN_SIZE(12); fsinfo->attribute_info.out.fs_attr = IVAL(blob.data, 0); fsinfo->attribute_info.out.max_file_component_length = IVAL(blob.data, 4); - cli_blob_pull_string(session, mem_ctx, &blob, + smbcli_blob_pull_string(session, mem_ctx, &blob, &fsinfo->attribute_info.out.fs_type, 8, 12, STR_UNICODE); break; @@ -274,10 +274,10 @@ failed: /**************************************************************************** Query FSInfo raw interface (sync interface) ****************************************************************************/ -NTSTATUS smb_raw_fsinfo(struct cli_tree *tree, +NTSTATUS smb_raw_fsinfo(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_fsinfo *fsinfo) { - struct cli_request *req = smb_raw_fsinfo_send(tree, mem_ctx, fsinfo); + struct smbcli_request *req = smb_raw_fsinfo_send(tree, mem_ctx, fsinfo); return smb_raw_fsinfo_recv(req, mem_ctx, fsinfo); } diff --git a/source4/libcli/raw/rawioctl.c b/source4/libcli/raw/rawioctl.c index 271758c65c..798300451b 100644 --- a/source4/libcli/raw/rawioctl.c +++ b/source4/libcli/raw/rawioctl.c @@ -22,25 +22,25 @@ #include "includes.h" #define SETUP_REQUEST(cmd, wct, buflen) do { \ - req = cli_request_setup(tree, cmd, wct, buflen); \ + req = smbcli_request_setup(tree, cmd, wct, buflen); \ if (!req) return NULL; \ } while (0) /* send a raw smb ioctl - async send */ -static struct cli_request *smb_raw_smbioctl_send(struct cli_tree *tree, +static struct smbcli_request *smb_raw_smbioctl_send(struct smbcli_tree *tree, union smb_ioctl *parms) { - struct cli_request *req; + struct smbcli_request *req; SETUP_REQUEST(SMBioctl, 3, 0); SSVAL(req->out.vwv, VWV(0), parms->ioctl.in.fnum); SIVAL(req->out.vwv, VWV(1), parms->ioctl.in.request); - if (!cli_request_send(req)) { - cli_request_destroy(req); + if (!smbcli_request_send(req)) { + smbcli_request_destroy(req); return NULL; } @@ -50,17 +50,17 @@ static struct cli_request *smb_raw_smbioctl_send(struct cli_tree *tree, /* send a raw smb ioctl - async recv */ -static NTSTATUS smb_raw_smbioctl_recv(struct cli_request *req, +static NTSTATUS smb_raw_smbioctl_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, union smb_ioctl *parms) { - if (!cli_request_receive(req) || - cli_request_is_error(req)) { - return cli_request_destroy(req); + if (!smbcli_request_receive(req) || + smbcli_request_is_error(req)) { + return smbcli_request_destroy(req); } - parms->ioctl.out.blob = cli_req_pull_blob(req, mem_ctx, req->in.data, -1); - return cli_request_destroy(req); + parms->ioctl.out.blob = smbcli_req_pull_blob(req, mem_ctx, req->in.data, -1); + return smbcli_request_destroy(req); } @@ -68,7 +68,7 @@ static NTSTATUS smb_raw_smbioctl_recv(struct cli_request *req, /**************************************************************************** NT ioctl (async send) ****************************************************************************/ -static struct cli_request *smb_raw_ntioctl_send(struct cli_tree *tree, +static struct smbcli_request *smb_raw_ntioctl_send(struct smbcli_tree *tree, union smb_ioctl *parms) { struct smb_nttrans nt; @@ -93,26 +93,26 @@ static struct cli_request *smb_raw_ntioctl_send(struct cli_tree *tree, /**************************************************************************** NT ioctl (async recv) ****************************************************************************/ -static NTSTATUS smb_raw_ntioctl_recv(struct cli_request *req, +static NTSTATUS smb_raw_ntioctl_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, union smb_ioctl *parms) { - if (!cli_request_receive(req) || - cli_request_is_error(req)) { - return cli_request_destroy(req); + if (!smbcli_request_receive(req) || + smbcli_request_is_error(req)) { + return smbcli_request_destroy(req); } - parms->ntioctl.out.blob = cli_req_pull_blob(req, mem_ctx, req->in.data, -1); - return cli_request_destroy(req); + parms->ntioctl.out.blob = smbcli_req_pull_blob(req, mem_ctx, req->in.data, -1); + return smbcli_request_destroy(req); } /* send a raw ioctl - async send */ -struct cli_request *smb_raw_ioctl_send(struct cli_tree *tree, union smb_ioctl *parms) +struct smbcli_request *smb_raw_ioctl_send(struct smbcli_tree *tree, union smb_ioctl *parms) { - struct cli_request *req = NULL; + struct smbcli_request *req = NULL; switch (parms->generic.level) { case RAW_IOCTL_IOCTL: @@ -130,7 +130,7 @@ struct cli_request *smb_raw_ioctl_send(struct cli_tree *tree, union smb_ioctl *p /* recv a raw ioctl - async recv */ -NTSTATUS smb_raw_ioctl_recv(struct cli_request *req, +NTSTATUS smb_raw_ioctl_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, union smb_ioctl *parms) { switch (parms->generic.level) { @@ -146,10 +146,10 @@ NTSTATUS smb_raw_ioctl_recv(struct cli_request *req, /* send a raw ioctl - sync interface */ -NTSTATUS smb_raw_ioctl(struct cli_tree *tree, +NTSTATUS smb_raw_ioctl(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_ioctl *parms) { - struct cli_request *req; + struct smbcli_request *req; req = smb_raw_ioctl_send(tree, parms); return smb_raw_ioctl_recv(req, mem_ctx, parms); } diff --git a/source4/libcli/raw/rawnegotiate.c b/source4/libcli/raw/rawnegotiate.c index 6bf35fb26d..9b00aa6121 100644 --- a/source4/libcli/raw/rawnegotiate.c +++ b/source4/libcli/raw/rawnegotiate.c @@ -41,13 +41,13 @@ static const struct { /**************************************************************************** Send a negprot command. ****************************************************************************/ -struct cli_request *smb_negprot_send(struct cli_transport *transport, int maxprotocol) +struct smbcli_request *smb_negprot_send(struct smbcli_transport *transport, int maxprotocol) { - struct cli_request *req; + struct smbcli_request *req; int i; uint16_t flags2 = 0; - req = cli_request_setup_transport(transport, SMBnegprot, 0, 0); + req = smbcli_request_setup_transport(transport, SMBnegprot, 0, 0); if (!req) { return NULL; } @@ -66,12 +66,12 @@ struct cli_request *smb_negprot_send(struct cli_transport *transport, int maxpro /* setup the protocol strings */ for (i=0; i < ARRAY_SIZE(prots) && prots[i].prot <= maxprotocol; i++) { - cli_req_append_bytes(req, "\2", 1); - cli_req_append_string(req, prots[i].name, STR_TERMINATE | STR_ASCII); + smbcli_req_append_bytes(req, "\2", 1); + smbcli_req_append_string(req, prots[i].name, STR_TERMINATE | STR_ASCII); } - if (!cli_request_send(req)) { - cli_request_destroy(req); + if (!smbcli_request_send(req)) { + smbcli_request_destroy(req); return NULL; } @@ -81,9 +81,9 @@ struct cli_request *smb_negprot_send(struct cli_transport *transport, int maxpro /**************************************************************************** Send a negprot command. ****************************************************************************/ -NTSTATUS smb_raw_negotiate(struct cli_transport *transport) +NTSTATUS smb_raw_negotiate(struct smbcli_transport *transport) { - struct cli_request *req; + struct smbcli_request *req; int protocol; req = smb_negprot_send(transport, PROTOCOL_NT1); @@ -91,18 +91,18 @@ NTSTATUS smb_raw_negotiate(struct cli_transport *transport) return NT_STATUS_UNSUCCESSFUL; } - if (!cli_request_receive(req) || - cli_request_is_error(req)) { - return cli_request_destroy(req); + if (!smbcli_request_receive(req) || + smbcli_request_is_error(req)) { + return smbcli_request_destroy(req); } - CLI_CHECK_MIN_WCT(req, 1); + SMBCLI_CHECK_MIN_WCT(req, 1); protocol = SVALS(req->in.vwv, VWV(0)); if (protocol >= ARRAY_SIZE(prots) || protocol < 0) { req->status = NT_STATUS_UNSUCCESSFUL; - return cli_request_destroy(req); + return smbcli_request_destroy(req); } transport->negotiate.protocol = prots[protocol].prot; @@ -111,7 +111,7 @@ NTSTATUS smb_raw_negotiate(struct cli_transport *transport) NTTIME ntt; /* NT protocol */ - CLI_CHECK_WCT(req, 17); + SMBCLI_CHECK_WCT(req, 17); transport->negotiate.sec_mode = CVAL(req->in.vwv,VWV(1)); transport->negotiate.max_mux = SVAL(req->in.vwv,VWV(1)+1); transport->negotiate.max_xmit = IVAL(req->in.vwv,VWV(3)+1); @@ -119,7 +119,7 @@ NTSTATUS smb_raw_negotiate(struct cli_transport *transport) transport->negotiate.capabilities = IVAL(req->in.vwv,VWV(9)+1); /* this time arrives in real GMT */ - ntt = cli_pull_nttime(req->in.vwv, VWV(11)+1); + ntt = smbcli_pull_nttime(req->in.vwv, VWV(11)+1); transport->negotiate.server_time = nt_time_to_unix(ntt); transport->negotiate.server_zone = SVALS(req->in.vwv,VWV(15)+1) * 60; transport->negotiate.key_len = CVAL(req->in.vwv,VWV(16)+1); @@ -128,14 +128,14 @@ NTSTATUS smb_raw_negotiate(struct cli_transport *transport) if (req->in.data_size < 16) { goto failed; } - transport->negotiate.server_guid = cli_req_pull_blob(req, transport->mem_ctx, req->in.data, 16); - transport->negotiate.secblob = cli_req_pull_blob(req, transport->mem_ctx, req->in.data + 16, req->in.data_size - 16); + transport->negotiate.server_guid = smbcli_req_pull_blob(req, transport->mem_ctx, req->in.data, 16); + transport->negotiate.secblob = smbcli_req_pull_blob(req, transport->mem_ctx, req->in.data + 16, req->in.data_size - 16); } else { if (req->in.data_size < (transport->negotiate.key_len)) { goto failed; } - transport->negotiate.secblob = cli_req_pull_blob(req, transport->mem_ctx, req->in.data, transport->negotiate.key_len); - cli_req_pull_string(req, transport->mem_ctx, &transport->negotiate.server_domain, + transport->negotiate.secblob = smbcli_req_pull_blob(req, transport->mem_ctx, req->in.data, transport->negotiate.key_len); + smbcli_req_pull_string(req, transport->mem_ctx, &transport->negotiate.server_domain, req->in.data+transport->negotiate.key_len, req->in.data_size-transport->negotiate.key_len, STR_UNICODE|STR_NOALIGN); /* here comes the server name */ @@ -146,7 +146,7 @@ NTSTATUS smb_raw_negotiate(struct cli_transport *transport) transport->negotiate.writebraw_supported = True; } } else if (transport->negotiate.protocol >= PROTOCOL_LANMAN1) { - CLI_CHECK_WCT(req, 13); + SMBCLI_CHECK_WCT(req, 13); transport->negotiate.sec_mode = SVAL(req->in.vwv,VWV(1)); transport->negotiate.max_xmit = SVAL(req->in.vwv,VWV(2)); transport->negotiate.sesskey = IVAL(req->in.vwv,VWV(6)); @@ -161,7 +161,7 @@ NTSTATUS smb_raw_negotiate(struct cli_transport *transport) if ((SVAL(req->in.vwv,VWV(5)) & 0x2)) { transport->negotiate.writebraw_supported = 1; } - transport->negotiate.secblob = cli_req_pull_blob(req, transport->mem_ctx, + transport->negotiate.secblob = smbcli_req_pull_blob(req, transport->mem_ctx, req->in.data, req->in.data_size); } else { /* the old core protocol */ @@ -172,10 +172,10 @@ NTSTATUS smb_raw_negotiate(struct cli_transport *transport) } /* a way to force ascii SMB */ - if (getenv("CLI_FORCE_ASCII")) { + if (getenv("SMBCLI_FORCE_ASCII")) { transport->negotiate.capabilities &= ~CAP_UNICODE; } failed: - return cli_request_destroy(req); + return smbcli_request_destroy(req); } diff --git a/source4/libcli/raw/rawnotify.c b/source4/libcli/raw/rawnotify.c index a9215fee10..47553e735e 100644 --- a/source4/libcli/raw/rawnotify.c +++ b/source4/libcli/raw/rawnotify.c @@ -23,7 +23,7 @@ /**************************************************************************** change notify (async send) ****************************************************************************/ -struct cli_request *smb_raw_changenotify_send(struct cli_tree *tree, struct smb_notify *parms) +struct smbcli_request *smb_raw_changenotify_send(struct smbcli_tree *tree, struct smb_notify *parms) { struct smb_nttrans nt; uint16_t setup[4]; @@ -46,13 +46,13 @@ struct cli_request *smb_raw_changenotify_send(struct cli_tree *tree, struct smb_ /**************************************************************************** change notify (async recv) ****************************************************************************/ -NTSTATUS smb_raw_changenotify_recv(struct cli_request *req, +NTSTATUS smb_raw_changenotify_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, struct smb_notify *parms) { struct smb_nttrans nt; NTSTATUS status; uint32_t ofs, i; - struct cli_session *session = req?req->session:NULL; + struct smbcli_session *session = req?req->session:NULL; status = smb_raw_nttrans_recv(req, mem_ctx, &nt); if (!NT_STATUS_IS_OK(status)) { @@ -80,7 +80,7 @@ NTSTATUS smb_raw_changenotify_recv(struct cli_request *req, for (i=ofs=0; i<parms->out.num_changes; i++) { parms->out.changes[i].action = IVAL(nt.out.params.data, ofs+4); - cli_blob_pull_string(session, mem_ctx, &nt.out.params, + smbcli_blob_pull_string(session, mem_ctx, &nt.out.params, &parms->out.changes[i].name, ofs+8, ofs+12, STR_UNICODE); ofs += IVAL(nt.out.params.data, ofs); @@ -95,11 +95,11 @@ NTSTATUS smb_raw_changenotify_recv(struct cli_request *req, used to cancel a pending change notify request note that this request does not expect a response! ****************************************************************************/ -NTSTATUS smb_raw_ntcancel(struct cli_request *oldreq) +NTSTATUS smb_raw_ntcancel(struct smbcli_request *oldreq) { - struct cli_request *req; + struct smbcli_request *req; - req = cli_request_setup_transport(oldreq->transport, SMBntcancel, 0, 0); + req = smbcli_request_setup_transport(oldreq->transport, SMBntcancel, 0, 0); SSVAL(req->out.hdr, HDR_MID, SVAL(oldreq->out.hdr, HDR_MID)); SSVAL(req->out.hdr, HDR_PID, SVAL(oldreq->out.hdr, HDR_PID)); @@ -111,7 +111,7 @@ NTSTATUS smb_raw_ntcancel(struct cli_request *oldreq) req->sign_single_increment = 1; req->one_way_request = 1; - cli_request_send(req); + smbcli_request_send(req); return NT_STATUS_OK; } diff --git a/source4/libcli/raw/rawreadwrite.c b/source4/libcli/raw/rawreadwrite.c index 3e3b29d252..f0a9a063ed 100644 --- a/source4/libcli/raw/rawreadwrite.c +++ b/source4/libcli/raw/rawreadwrite.c @@ -22,7 +22,7 @@ #include "includes.h" #define SETUP_REQUEST(cmd, wct, buflen) do { \ - req = cli_request_setup(tree, cmd, wct, buflen); \ + req = smbcli_request_setup(tree, cmd, wct, buflen); \ if (!req) return NULL; \ } while (0) @@ -30,10 +30,10 @@ /**************************************************************************** low level read operation (async send) ****************************************************************************/ -struct cli_request *smb_raw_read_send(struct cli_tree *tree, union smb_read *parms) +struct smbcli_request *smb_raw_read_send(struct smbcli_tree *tree, union smb_read *parms) { BOOL bigoffset = False; - struct cli_request *req; + struct smbcli_request *req; switch (parms->generic.level) { case RAW_READ_GENERIC: @@ -90,8 +90,8 @@ struct cli_request *smb_raw_read_send(struct cli_tree *tree, union smb_read *par break; } - if (!cli_request_send(req)) { - cli_request_destroy(req); + if (!smbcli_request_send(req)) { + smbcli_request_destroy(req); return NULL; } @@ -107,10 +107,10 @@ struct cli_request *smb_raw_read_send(struct cli_tree *tree, union smb_read *par /**************************************************************************** low level read operation (async recv) ****************************************************************************/ -NTSTATUS smb_raw_read_recv(struct cli_request *req, union smb_read *parms) +NTSTATUS smb_raw_read_recv(struct smbcli_request *req, union smb_read *parms) { - if (!cli_request_receive(req) || - cli_request_is_error(req)) { + if (!smbcli_request_receive(req) || + smbcli_request_is_error(req)) { goto failed; } @@ -130,10 +130,10 @@ NTSTATUS smb_raw_read_recv(struct cli_request *req, union smb_read *parms) break; case RAW_READ_LOCKREAD: - CLI_CHECK_WCT(req, 5); + SMBCLI_CHECK_WCT(req, 5); parms->lockread.out.nread = SVAL(req->in.vwv, VWV(0)); if (parms->lockread.out.nread > parms->lockread.in.count || - !cli_raw_pull_data(req, req->in.data+3, + !smbcli_raw_pull_data(req, req->in.data+3, parms->lockread.out.nread, parms->lockread.out.data)) { req->status = NT_STATUS_BUFFER_TOO_SMALL; } @@ -141,10 +141,10 @@ NTSTATUS smb_raw_read_recv(struct cli_request *req, union smb_read *parms) case RAW_READ_READ: /* there are 4 reserved words in the reply */ - CLI_CHECK_WCT(req, 5); + SMBCLI_CHECK_WCT(req, 5); parms->read.out.nread = SVAL(req->in.vwv, VWV(0)); if (parms->read.out.nread > parms->read.in.count || - !cli_raw_pull_data(req, req->in.data+3, + !smbcli_raw_pull_data(req, req->in.data+3, parms->read.out.nread, parms->read.out.data)) { req->status = NT_STATUS_BUFFER_TOO_SMALL; } @@ -152,12 +152,12 @@ NTSTATUS smb_raw_read_recv(struct cli_request *req, union smb_read *parms) case RAW_READ_READX: /* there are 5 reserved words in the reply */ - CLI_CHECK_WCT(req, 12); + SMBCLI_CHECK_WCT(req, 12); parms->readx.out.remaining = SVAL(req->in.vwv, VWV(2)); parms->readx.out.compaction_mode = SVAL(req->in.vwv, VWV(3)); parms->readx.out.nread = SVAL(req->in.vwv, VWV(5)); if (parms->readx.out.nread > MAX(parms->readx.in.mincnt, parms->readx.in.maxcnt) || - !cli_raw_pull_data(req, req->in.hdr + SVAL(req->in.vwv, VWV(6)), + !smbcli_raw_pull_data(req, req->in.hdr + SVAL(req->in.vwv, VWV(6)), parms->readx.out.nread, parms->readx.out.data)) { req->status = NT_STATUS_BUFFER_TOO_SMALL; @@ -166,15 +166,15 @@ NTSTATUS smb_raw_read_recv(struct cli_request *req, union smb_read *parms) } failed: - return cli_request_destroy(req); + return smbcli_request_destroy(req); } /**************************************************************************** low level read operation (sync interface) ****************************************************************************/ -NTSTATUS smb_raw_read(struct cli_tree *tree, union smb_read *parms) +NTSTATUS smb_raw_read(struct smbcli_tree *tree, union smb_read *parms) { - struct cli_request *req = smb_raw_read_send(tree, parms); + struct smbcli_request *req = smb_raw_read_send(tree, parms); return smb_raw_read_recv(req, parms); } @@ -182,10 +182,10 @@ NTSTATUS smb_raw_read(struct cli_tree *tree, union smb_read *parms) /**************************************************************************** raw write interface (async send) ****************************************************************************/ -struct cli_request *smb_raw_write_send(struct cli_tree *tree, union smb_write *parms) +struct smbcli_request *smb_raw_write_send(struct smbcli_tree *tree, union smb_write *parms) { BOOL bigoffset = False; - struct cli_request *req; + struct smbcli_request *req; switch (parms->generic.level) { case RAW_WRITE_GENERIC: @@ -264,8 +264,8 @@ struct cli_request *smb_raw_write_send(struct cli_tree *tree, union smb_write *p break; } - if (!cli_request_send(req)) { -cli_request_destroy(req); + if (!smbcli_request_send(req)) { +smbcli_request_destroy(req); return NULL; } @@ -276,10 +276,10 @@ cli_request_destroy(req); /**************************************************************************** raw write interface (async recv) ****************************************************************************/ -NTSTATUS smb_raw_write_recv(struct cli_request *req, union smb_write *parms) +NTSTATUS smb_raw_write_recv(struct smbcli_request *req, union smb_write *parms) { - if (!cli_request_receive(req) || - cli_request_is_error(req)) { + if (!smbcli_request_receive(req) || + smbcli_request_is_error(req)) { goto failed; } @@ -287,19 +287,19 @@ NTSTATUS smb_raw_write_recv(struct cli_request *req, union smb_write *parms) case RAW_WRITE_GENERIC: break; case RAW_WRITE_WRITEUNLOCK: - CLI_CHECK_WCT(req, 1); + SMBCLI_CHECK_WCT(req, 1); parms->writeunlock.out.nwritten = SVAL(req->in.vwv, VWV(0)); break; case RAW_WRITE_WRITE: - CLI_CHECK_WCT(req, 1); + SMBCLI_CHECK_WCT(req, 1); parms->write.out.nwritten = SVAL(req->in.vwv, VWV(0)); break; case RAW_WRITE_WRITECLOSE: - CLI_CHECK_WCT(req, 1); + SMBCLI_CHECK_WCT(req, 1); parms->writeclose.out.nwritten = SVAL(req->in.vwv, VWV(0)); break; case RAW_WRITE_WRITEX: - CLI_CHECK_WCT(req, 6); + SMBCLI_CHECK_WCT(req, 6); parms->writex.out.nwritten = SVAL(req->in.vwv, VWV(2)); parms->writex.out.nwritten += (CVAL(req->in.vwv, VWV(4)) << 16); parms->writex.out.remaining = SVAL(req->in.vwv, VWV(3)); @@ -309,14 +309,14 @@ NTSTATUS smb_raw_write_recv(struct cli_request *req, union smb_write *parms) } failed: - return cli_request_destroy(req); + return smbcli_request_destroy(req); } /**************************************************************************** raw write interface (sync interface) ****************************************************************************/ -NTSTATUS smb_raw_write(struct cli_tree *tree, union smb_write *parms) +NTSTATUS smb_raw_write(struct smbcli_tree *tree, union smb_write *parms) { - struct cli_request *req = smb_raw_write_send(tree, parms); + struct smbcli_request *req = smb_raw_write_send(tree, parms); return smb_raw_write_recv(req, parms); } diff --git a/source4/libcli/raw/rawrequest.c b/source4/libcli/raw/rawrequest.c index 38b8f71f57..4143cb12ca 100644 --- a/source4/libcli/raw/rawrequest.c +++ b/source4/libcli/raw/rawrequest.c @@ -20,7 +20,7 @@ */ /* - this file implements functions for manipulating the 'struct cli_request' structure in libsmb + this file implements functions for manipulating the 'struct smbcli_request' structure in libsmb */ #include "includes.h" @@ -32,7 +32,7 @@ #define MAX_BYTES_PER_CHAR 3 /* destroy a request structure and return final status */ -NTSTATUS cli_request_destroy(struct cli_request *req) +NTSTATUS smbcli_request_destroy(struct smbcli_request *req) { NTSTATUS status; @@ -58,28 +58,28 @@ NTSTATUS cli_request_destroy(struct cli_request *req) low-level function to setup a request buffer for a non-SMB packet at the transport level */ -struct cli_request *cli_request_setup_nonsmb(struct cli_transport *transport, uint_t size) +struct smbcli_request *smbcli_request_setup_nonsmb(struct smbcli_transport *transport, uint_t size) { - struct cli_request *req; + struct smbcli_request *req; TALLOC_CTX *mem_ctx; /* each request gets its own talloc context. The request structure itself is also allocated inside this context, so we need to allocate it before we construct the request */ - mem_ctx = talloc_init("cli_request"); + mem_ctx = talloc_init("smbcli_request"); if (!mem_ctx) { return NULL; } - req = talloc(mem_ctx, sizeof(struct cli_request)); + req = talloc(mem_ctx, sizeof(struct smbcli_request)); if (!req) { return NULL; } ZERO_STRUCTP(req); /* setup the request context */ - req->state = CLI_REQUEST_INIT; + req->state = SMBCLI_REQUEST_INIT; req->mem_ctx = mem_ctx; req->transport = transport; req->session = NULL; @@ -103,12 +103,12 @@ struct cli_request *cli_request_setup_nonsmb(struct cli_transport *transport, ui /* setup a SMB packet at transport level */ -struct cli_request *cli_request_setup_transport(struct cli_transport *transport, +struct smbcli_request *smbcli_request_setup_transport(struct smbcli_transport *transport, uint8_t command, uint_t wct, uint_t buflen) { - struct cli_request *req; + struct smbcli_request *req; - req = cli_request_setup_nonsmb(transport, NBT_HDR_SIZE + MIN_SMB_SIZE + wct*2 + buflen); + req = smbcli_request_setup_nonsmb(transport, NBT_HDR_SIZE + MIN_SMB_SIZE + wct*2 + buflen); if (!req) return NULL; @@ -129,7 +129,7 @@ struct cli_request *cli_request_setup_transport(struct cli_transport *transport, SSVAL(req->out.hdr,HDR_FLG2, 0); /* assign a mid */ - req->mid = cli_transport_next_mid(transport); + req->mid = smbcli_transport_next_mid(transport); /* copy the pid, uid and mid to the request */ SSVAL(req->out.hdr, HDR_PID, 0); @@ -146,17 +146,17 @@ struct cli_request *cli_request_setup_transport(struct cli_transport *transport, /* setup a reply in req->out with the given word count and initial data buffer size. the caller will then fill in the command words and - data before calling cli_request_send() to send the reply on its + data before calling smbcli_request_send() to send the reply on its way. This interface is used before a session is setup. */ -struct cli_request *cli_request_setup_session(struct cli_session *session, +struct smbcli_request *smbcli_request_setup_session(struct smbcli_session *session, uint8_t command, uint_t wct, uint_t buflen) { - struct cli_request *req; + struct smbcli_request *req; uint16_t flags2; uint32_t capabilities; - req = cli_request_setup_transport(session->transport, command, wct, buflen); + req = smbcli_request_setup_transport(session->transport, command, wct, buflen); if (!req) return NULL; @@ -189,13 +189,13 @@ struct cli_request *cli_request_setup_session(struct cli_session *session, /* setup a request for tree based commands */ -struct cli_request *cli_request_setup(struct cli_tree *tree, +struct smbcli_request *smbcli_request_setup(struct smbcli_tree *tree, uint8_t command, uint_t wct, uint_t buflen) { - struct cli_request *req; + struct smbcli_request *req; - req = cli_request_setup_session(tree->session, command, wct, buflen); + req = smbcli_request_setup_session(tree->session, command, wct, buflen); if (req) { req->tree = tree; SSVAL(req->out.hdr,HDR_TID,tree->tid); @@ -211,7 +211,7 @@ struct cli_request *cli_request_setup(struct cli_tree *tree, To cope with this req->out.ptr is supplied. This will be updated to point at the same offset into the packet as before this call */ -static void cli_req_grow_allocation(struct cli_request *req, uint_t new_size) +static void smbcli_req_grow_allocation(struct smbcli_request *req, uint_t new_size) { int delta; char *buf2; @@ -252,11 +252,11 @@ static void cli_req_grow_allocation(struct cli_request *req, uint_t new_size) To cope with this req->out.ptr is supplied. This will be updated to point at the same offset into the packet as before this call */ -static void cli_req_grow_data(struct cli_request *req, uint_t new_size) +static void smbcli_req_grow_data(struct smbcli_request *req, uint_t new_size) { int delta; - cli_req_grow_allocation(req, new_size); + smbcli_req_grow_allocation(req, new_size); delta = new_size - req->out.data_size; @@ -271,15 +271,15 @@ static void cli_req_grow_data(struct cli_request *req, uint_t new_size) /* send a message */ -BOOL cli_request_send(struct cli_request *req) +BOOL smbcli_request_send(struct smbcli_request *req) { if (IVAL(req->out.buffer, 0) == 0) { _smb_setlen(req->out.buffer, req->out.size - NBT_HDR_SIZE); } - cli_request_calculate_sign_mac(req); + smbcli_request_calculate_sign_mac(req); - cli_transport_send(req); + smbcli_transport_send(req); return True; } @@ -288,14 +288,14 @@ BOOL cli_request_send(struct cli_request *req) /* receive a response to a packet */ -BOOL cli_request_receive(struct cli_request *req) +BOOL smbcli_request_receive(struct smbcli_request *req) { /* req can be NULL when a send has failed. This eliminates lots of NULL checks in each module */ if (!req) return False; /* keep receiving packets until this one is replied to */ - while (req->state <= CLI_REQUEST_RECV) { + while (req->state <= SMBCLI_REQUEST_RECV) { event_loop_once(req->transport->event.ctx); } @@ -307,12 +307,12 @@ BOOL cli_request_receive(struct cli_request *req) receive another reply to a request - this is used for requests that have multi-part replies (such as SMBtrans2) */ -BOOL cli_request_receive_more(struct cli_request *req) +BOOL smbcli_request_receive_more(struct smbcli_request *req) { - req->state = CLI_REQUEST_RECV; + req->state = SMBCLI_REQUEST_RECV; DLIST_ADD(req->transport->pending_recv, req); - return cli_request_receive(req); + return smbcli_request_receive(req); } @@ -320,7 +320,7 @@ BOOL cli_request_receive_more(struct cli_request *req) handle oplock break requests from the server - return True if the request was an oplock break */ -BOOL handle_oplock_break(struct cli_transport *transport, uint_t len, const char *hdr, const char *vwv) +BOOL handle_oplock_break(struct smbcli_transport *transport, uint_t len, const char *hdr, const char *vwv) { /* we must be very fussy about what we consider an oplock break to avoid matching readbraw replies */ @@ -347,15 +347,15 @@ BOOL handle_oplock_break(struct cli_transport *transport, uint_t len, const char wait for a reply to be received for a packet that just returns an error code and nothing more */ -NTSTATUS cli_request_simple_recv(struct cli_request *req) +NTSTATUS smbcli_request_simple_recv(struct smbcli_request *req) { - cli_request_receive(req); - return cli_request_destroy(req); + smbcli_request_receive(req); + return smbcli_request_destroy(req); } /* Return true if the last packet was in error */ -BOOL cli_request_is_error(struct cli_request *req) +BOOL smbcli_request_is_error(struct smbcli_request *req) { return NT_STATUS_IS_ERR(req->status); } @@ -365,7 +365,7 @@ BOOL cli_request_is_error(struct cli_request *req) return the number of bytes added to the packet */ -size_t cli_req_append_string(struct cli_request *req, const char *str, uint_t flags) +size_t smbcli_req_append_string(struct smbcli_request *req, const char *str, uint_t flags) { size_t len; @@ -376,17 +376,17 @@ size_t cli_req_append_string(struct cli_request *req, const char *str, uint_t fl len = (strlen(str)+2) * MAX_BYTES_PER_CHAR; - cli_req_grow_allocation(req, len + req->out.data_size); + smbcli_req_grow_allocation(req, len + req->out.data_size); len = push_string(NULL, req->out.data + req->out.data_size, str, len, flags); - cli_req_grow_data(req, len + req->out.data_size); + smbcli_req_grow_data(req, len + req->out.data_size); return len; } /* - this is like cli_req_append_string but it also return the + this is like smbcli_req_append_string but it also return the non-terminated string byte length, which can be less than the number of bytes consumed in the packet for 2 reasons: @@ -396,7 +396,7 @@ size_t cli_req_append_string(struct cli_request *req, const char *str, uint_t fl this is used in places where the non-terminated string byte length is placed in the packet as a separate field */ -size_t cli_req_append_string_len(struct cli_request *req, const char *str, uint_t flags, int *len) +size_t smbcli_req_append_string_len(struct smbcli_request *req, const char *str, uint_t flags, int *len) { int diff = 0; size_t ret; @@ -412,7 +412,7 @@ size_t cli_req_append_string_len(struct cli_request *req, const char *str, uint_ } /* do the hard work */ - ret = cli_req_append_string(req, str, flags); + ret = smbcli_req_append_string(req, str, flags); /* see if we need to subtract the termination */ if (flags & STR_TERMINATE) { @@ -437,11 +437,11 @@ size_t cli_req_append_string_len(struct cli_request *req, const char *str, uint_ if dest_len is -1 then no limit applies */ -size_t cli_req_append_ascii4(struct cli_request *req, const char *str, uint_t flags) +size_t smbcli_req_append_ascii4(struct smbcli_request *req, const char *str, uint_t flags) { size_t size; - cli_req_append_bytes(req, (const uint8_t *)"\4", 1); - size = cli_req_append_string(req, str, flags); + smbcli_req_append_bytes(req, (const uint8_t *)"\4", 1); + size = smbcli_req_append_string(req, str, flags); return size + 1; } @@ -452,11 +452,11 @@ size_t cli_req_append_ascii4(struct cli_request *req, const char *str, uint_t fl if dest is NULL, then put the blob at the end of the data portion of the packet */ -size_t cli_req_append_blob(struct cli_request *req, const DATA_BLOB *blob) +size_t smbcli_req_append_blob(struct smbcli_request *req, const DATA_BLOB *blob) { - cli_req_grow_allocation(req, req->out.data_size + blob->length); + smbcli_req_grow_allocation(req, req->out.data_size + blob->length); memcpy(req->out.data + req->out.data_size, blob->data, blob->length); - cli_req_grow_data(req, req->out.data_size + blob->length); + smbcli_req_grow_data(req, req->out.data_size + blob->length); return blob->length; } @@ -464,11 +464,11 @@ size_t cli_req_append_blob(struct cli_request *req, const DATA_BLOB *blob) append raw bytes into the data portion of the request packet return the number of bytes added */ -size_t cli_req_append_bytes(struct cli_request *req, const uint8_t *bytes, size_t byte_len) +size_t smbcli_req_append_bytes(struct smbcli_request *req, const uint8_t *bytes, size_t byte_len) { - cli_req_grow_allocation(req, byte_len + req->out.data_size); + smbcli_req_grow_allocation(req, byte_len + req->out.data_size); memcpy(req->out.data + req->out.data_size, bytes, byte_len); - cli_req_grow_data(req, byte_len + req->out.data_size); + smbcli_req_grow_data(req, byte_len + req->out.data_size); return byte_len; } @@ -476,15 +476,15 @@ size_t cli_req_append_bytes(struct cli_request *req, const uint8_t *bytes, size_ append variable block (type 5 buffer) into the data portion of the request packet return the number of bytes added */ -size_t cli_req_append_var_block(struct cli_request *req, const uint8_t *bytes, uint16_t byte_len) +size_t smbcli_req_append_var_block(struct smbcli_request *req, const uint8_t *bytes, uint16_t byte_len) { - cli_req_grow_allocation(req, byte_len + 3 + req->out.data_size); + smbcli_req_grow_allocation(req, byte_len + 3 + req->out.data_size); SCVAL(req->out.data + req->out.data_size, 0, 5); SSVAL(req->out.data + req->out.data_size, 1, byte_len); /* add field length */ if (byte_len > 0) { memcpy(req->out.data + req->out.data_size + 3, bytes, byte_len); } - cli_req_grow_data(req, byte_len + 3 + req->out.data_size); + smbcli_req_grow_data(req, byte_len + 3 + req->out.data_size); return byte_len + 3; } @@ -502,7 +502,7 @@ size_t cli_req_append_var_block(struct cli_request *req, const uint8_t *bytes, u on failure zero is returned and *dest is set to NULL, otherwise the number of bytes consumed in the packet is returned */ -static size_t cli_req_pull_ucs2(struct cli_request *req, TALLOC_CTX *mem_ctx, +static size_t smbcli_req_pull_ucs2(struct smbcli_request *req, TALLOC_CTX *mem_ctx, char **dest, const char *src, int byte_len, uint_t flags) { int src_len, src_len2, alignment=0; @@ -559,7 +559,7 @@ static size_t cli_req_pull_ucs2(struct cli_request *req, TALLOC_CTX *mem_ctx, on failure zero is returned and *dest is set to NULL, otherwise the number of bytes consumed in the packet is returned */ -size_t cli_req_pull_ascii(struct cli_request *req, TALLOC_CTX *mem_ctx, +size_t smbcli_req_pull_ascii(struct smbcli_request *req, TALLOC_CTX *mem_ctx, char **dest, const char *src, int byte_len, uint_t flags) { int src_len, src_len2; @@ -602,15 +602,15 @@ size_t cli_req_pull_ascii(struct cli_request *req, TALLOC_CTX *mem_ctx, on failure zero is returned and *dest is set to NULL, otherwise the number of bytes consumed in the packet is returned */ -size_t cli_req_pull_string(struct cli_request *req, TALLOC_CTX *mem_ctx, +size_t smbcli_req_pull_string(struct smbcli_request *req, TALLOC_CTX *mem_ctx, char **dest, const char *src, int byte_len, uint_t flags) { if (!(flags & STR_ASCII) && (((flags & STR_UNICODE) || (req->flags2 & FLAGS2_UNICODE_STRINGS)))) { - return cli_req_pull_ucs2(req, mem_ctx, dest, src, byte_len, flags); + return smbcli_req_pull_ucs2(req, mem_ctx, dest, src, byte_len, flags); } - return cli_req_pull_ascii(req, mem_ctx, dest, src, byte_len, flags); + return smbcli_req_pull_ascii(req, mem_ctx, dest, src, byte_len, flags); } @@ -620,7 +620,7 @@ size_t cli_req_pull_string(struct cli_request *req, TALLOC_CTX *mem_ctx, if byte_len is -1 then limit the blob only by packet size */ -DATA_BLOB cli_req_pull_blob(struct cli_request *req, TALLOC_CTX *mem_ctx, const char *src, int byte_len) +DATA_BLOB smbcli_req_pull_blob(struct smbcli_request *req, TALLOC_CTX *mem_ctx, const char *src, int byte_len) { int src_len; @@ -639,7 +639,7 @@ DATA_BLOB cli_req_pull_blob(struct cli_request *req, TALLOC_CTX *mem_ctx, const /* check that a lump of data in a request is within the bounds of the data section of the packet */ -static BOOL cli_req_data_oob(struct cli_request *req, const char *ptr, uint32_t count) +static BOOL smbcli_req_data_oob(struct smbcli_request *req, const char *ptr, uint32_t count) { /* be careful with wraparound! */ if (ptr < req->in.data || @@ -656,11 +656,11 @@ static BOOL cli_req_data_oob(struct cli_request *req, const char *ptr, uint32_t return False if any part is outside the data portion of the packet */ -BOOL cli_raw_pull_data(struct cli_request *req, const char *src, int len, char *dest) +BOOL smbcli_raw_pull_data(struct smbcli_request *req, const char *src, int len, char *dest) { if (len == 0) return True; - if (cli_req_data_oob(req, src, len)) { + if (smbcli_req_data_oob(req, src, len)) { return False; } @@ -672,7 +672,7 @@ BOOL cli_raw_pull_data(struct cli_request *req, const char *src, int len, char * /* put a NTTIME into a packet */ -void cli_push_nttime(void *base, uint16_t offset, NTTIME t) +void smbcli_push_nttime(void *base, uint16_t offset, NTTIME t) { SBVAL(base, offset, t); } @@ -680,7 +680,7 @@ void cli_push_nttime(void *base, uint16_t offset, NTTIME t) /* pull a NTTIME from a packet */ -NTTIME cli_pull_nttime(void *base, uint16_t offset) +NTTIME smbcli_pull_nttime(void *base, uint16_t offset) { NTTIME ret = BVAL(base, offset); return ret; @@ -699,7 +699,7 @@ NTTIME cli_pull_nttime(void *base, uint16_t offset) on failure zero is returned and *dest is set to NULL, otherwise the number of bytes consumed in the blob is returned */ -static size_t cli_blob_pull_ucs2(TALLOC_CTX* mem_ctx, +static size_t smbcli_blob_pull_ucs2(TALLOC_CTX* mem_ctx, DATA_BLOB *blob, const char **dest, const char *src, int byte_len, uint_t flags) { @@ -758,7 +758,7 @@ static size_t cli_blob_pull_ucs2(TALLOC_CTX* mem_ctx, on failure zero is returned and *dest is set to NULL, otherwise the number of bytes consumed in the blob is returned */ -static size_t cli_blob_pull_ascii(TALLOC_CTX *mem_ctx, +static size_t smbcli_blob_pull_ascii(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char **dest, const char *src, int byte_len, uint_t flags) { @@ -804,7 +804,7 @@ static size_t cli_blob_pull_ascii(TALLOC_CTX *mem_ctx, on failure zero is returned and dest->s is set to NULL, otherwise the number of bytes consumed in the blob is returned */ -size_t cli_blob_pull_string(struct cli_session *session, +size_t smbcli_blob_pull_string(struct smbcli_session *session, TALLOC_CTX *mem_ctx, DATA_BLOB *blob, WIRE_STRING *dest, @@ -834,7 +834,7 @@ size_t cli_blob_pull_string(struct cli_session *session, if (flags & STR_LEN_NOTERM) { extra = 2; } - return align + extra + cli_blob_pull_ucs2(mem_ctx, blob, &dest->s, + return align + extra + smbcli_blob_pull_ucs2(mem_ctx, blob, &dest->s, blob->data+str_offset+align, dest->private_length, flags); } @@ -843,7 +843,7 @@ size_t cli_blob_pull_string(struct cli_session *session, extra = 1; } - return extra + cli_blob_pull_ascii(mem_ctx, blob, &dest->s, + return extra + smbcli_blob_pull_ascii(mem_ctx, blob, &dest->s, blob->data+str_offset, dest->private_length, flags); } @@ -859,7 +859,7 @@ size_t cli_blob_pull_string(struct cli_session *session, on failure zero is returned and dest->s is set to NULL, otherwise the number of bytes consumed in the blob is returned */ -size_t cli_blob_pull_unix_string(struct cli_session *session, +size_t smbcli_blob_pull_unix_string(struct smbcli_session *session, TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char **dest, @@ -879,7 +879,7 @@ size_t cli_blob_pull_unix_string(struct cli_session *session, if (flags & STR_LEN_NOTERM) { extra = 2; } - return align + extra + cli_blob_pull_ucs2(mem_ctx, blob, dest, + return align + extra + smbcli_blob_pull_ucs2(mem_ctx, blob, dest, blob->data+str_offset+align, -1, flags); } @@ -888,7 +888,7 @@ size_t cli_blob_pull_unix_string(struct cli_session *session, extra = 1; } - return extra + cli_blob_pull_ascii(mem_ctx, blob, dest, + return extra + smbcli_blob_pull_ascii(mem_ctx, blob, dest, blob->data+str_offset, -1, flags); } @@ -896,7 +896,7 @@ size_t cli_blob_pull_unix_string(struct cli_session *session, /* append a string into a blob */ -size_t cli_blob_append_string(struct cli_session *session, +size_t smbcli_blob_append_string(struct smbcli_session *session, TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char *str, uint_t flags) { diff --git a/source4/libcli/raw/rawsearch.c b/source4/libcli/raw/rawsearch.c index a4ba8e8696..67410283ed 100644 --- a/source4/libcli/raw/rawsearch.c +++ b/source4/libcli/raw/rawsearch.c @@ -23,7 +23,7 @@ /**************************************************************************** Old style search backend - process output. ****************************************************************************/ -static void smb_raw_search_backend(struct cli_request *req, +static void smb_raw_search_backend(struct smbcli_request *req, TALLOC_CTX *mem_ctx, uint16_t count, void *private, @@ -42,12 +42,12 @@ static void smb_raw_search_backend(struct cli_request *req, p = req->in.data + 3; for (i=0; i < count; i++) { - search_data.search.search_id = cli_req_pull_blob(req, mem_ctx, p, 21); + search_data.search.search_id = smbcli_req_pull_blob(req, mem_ctx, p, 21); search_data.search.attrib = CVAL(p, 21); search_data.search.write_time = raw_pull_dos_date(req->transport, p + 22); search_data.search.size = IVAL(p, 26); - cli_req_pull_ascii(req, mem_ctx, &search_data.search.name, p+30, 13, STR_ASCII); + smbcli_req_pull_ascii(req, mem_ctx, &search_data.search.name, p+30, 13, STR_ASCII); if (!callback(private, &search_data)) { break; } @@ -58,27 +58,27 @@ static void smb_raw_search_backend(struct cli_request *req, /**************************************************************************** Old style search first. ****************************************************************************/ -static NTSTATUS smb_raw_search_first_old(struct cli_tree *tree, +static NTSTATUS smb_raw_search_first_old(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_search_first *io, void *private, BOOL (*callback)(void *private, union smb_search_data *file)) { - struct cli_request *req; + struct smbcli_request *req; - req = cli_request_setup(tree, SMBsearch, 2, 0); + req = smbcli_request_setup(tree, SMBsearch, 2, 0); if (!req) { return NT_STATUS_NO_MEMORY; } SSVAL(req->out.vwv, VWV(0), io->search_first.in.max_count); SSVAL(req->out.vwv, VWV(1), io->search_first.in.search_attrib); - cli_req_append_ascii4(req, io->search_first.in.pattern, STR_TERMINATE); - cli_req_append_var_block(req, NULL, 0); + smbcli_req_append_ascii4(req, io->search_first.in.pattern, STR_TERMINATE); + smbcli_req_append_var_block(req, NULL, 0); - if (!cli_request_send(req) || - !cli_request_receive(req)) { - return cli_request_destroy(req); + if (!smbcli_request_send(req) || + !smbcli_request_receive(req)) { + return smbcli_request_destroy(req); } if (NT_STATUS_IS_OK(req->status)) { @@ -86,33 +86,33 @@ static NTSTATUS smb_raw_search_first_old(struct cli_tree *tree, smb_raw_search_backend(req, mem_ctx, io->search_first.out.count, private, callback); } - return cli_request_destroy(req); + return smbcli_request_destroy(req); } /**************************************************************************** Old style search next. ****************************************************************************/ -static NTSTATUS smb_raw_search_next_old(struct cli_tree *tree, +static NTSTATUS smb_raw_search_next_old(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_search_next *io, void *private, BOOL (*callback)(void *private, union smb_search_data *file)) { - struct cli_request *req; + struct smbcli_request *req; - req = cli_request_setup(tree, SMBsearch, 2, 0); + req = smbcli_request_setup(tree, SMBsearch, 2, 0); if (!req) { return NT_STATUS_NO_MEMORY; } SSVAL(req->out.vwv, VWV(0), io->search_next.in.max_count); SSVAL(req->out.vwv, VWV(1), io->search_next.in.search_attrib); - cli_req_append_ascii4(req, "", STR_TERMINATE); - cli_req_append_var_block(req, io->search_next.in.search_id.data, 21); + smbcli_req_append_ascii4(req, "", STR_TERMINATE); + smbcli_req_append_var_block(req, io->search_next.in.search_id.data, 21); - if (!cli_request_send(req) || - !cli_request_receive(req)) { - return cli_request_destroy(req); + if (!smbcli_request_send(req) || + !smbcli_request_receive(req)) { + return smbcli_request_destroy(req); } if (NT_STATUS_IS_OK(req->status)) { @@ -120,13 +120,13 @@ static NTSTATUS smb_raw_search_next_old(struct cli_tree *tree, smb_raw_search_backend(req, mem_ctx, io->search_next.out.count, private, callback); } - return cli_request_destroy(req); + return smbcli_request_destroy(req); } /**************************************************************************** Very raw search first - returns param/data blobs. ****************************************************************************/ -static NTSTATUS smb_raw_search_first_blob(struct cli_tree *tree, +static NTSTATUS smb_raw_search_first_blob(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, /* used to allocate output blobs */ union smb_search_first *io, uint16_t info_level, @@ -157,7 +157,7 @@ static NTSTATUS smb_raw_search_first_blob(struct cli_tree *tree, SSVAL(tp.in.params.data, 6, info_level); SIVAL(tp.in.params.data, 8, io->t2ffirst.in.storage_type); - cli_blob_append_string(tree->session, mem_ctx, &tp.in.params, + smbcli_blob_append_string(tree->session, mem_ctx, &tp.in.params, io->t2ffirst.in.pattern, STR_TERMINATE); status = smb_raw_trans2(tree, mem_ctx, &tp); @@ -178,7 +178,7 @@ static NTSTATUS smb_raw_search_first_blob(struct cli_tree *tree, Very raw search first - returns param/data blobs. Used in CIFS-on-CIFS NTVFS. ****************************************************************************/ -static NTSTATUS smb_raw_search_next_blob(struct cli_tree *tree, +static NTSTATUS smb_raw_search_next_blob(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_search_next *io, uint16_t info_level, @@ -209,7 +209,7 @@ static NTSTATUS smb_raw_search_next_blob(struct cli_tree *tree, SIVAL(tp.in.params.data, 6, io->t2fnext.in.resume_key); SSVAL(tp.in.params.data, 10, io->t2fnext.in.flags); - cli_blob_append_string(tree->session, mem_ctx, &tp.in.params, + smbcli_blob_append_string(tree->session, mem_ctx, &tp.in.params, io->t2fnext.in.last_name, STR_TERMINATE); @@ -233,7 +233,7 @@ static NTSTATUS smb_raw_search_next_blob(struct cli_tree *tree, return 0 for success with end of list return -1 for a parse error */ -static int parse_trans2_search(struct cli_tree *tree, +static int parse_trans2_search(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, enum smb_search_level level, uint16_t flags, @@ -265,7 +265,7 @@ static int parse_trans2_search(struct cli_tree *tree, data->standard.size = IVAL(blob->data, 12); data->standard.alloc_size = IVAL(blob->data, 16); data->standard.attrib = SVAL(blob->data, 20); - len = cli_blob_pull_string(tree->session, mem_ctx, blob, + len = smbcli_blob_pull_string(tree->session, mem_ctx, blob, &data->standard.name, 22, 23, STR_LEN8BIT | STR_TERMINATE | STR_LEN_NOTERM); return len + 23; @@ -288,7 +288,7 @@ static int parse_trans2_search(struct cli_tree *tree, data->ea_size.alloc_size = IVAL(blob->data, 16); data->ea_size.attrib = SVAL(blob->data, 20); data->ea_size.ea_size = IVAL(blob->data, 22); - len = cli_blob_pull_string(tree->session, mem_ctx, blob, + len = smbcli_blob_pull_string(tree->session, mem_ctx, blob, &data->ea_size.name, 26, 27, STR_LEN8BIT | STR_TERMINATE | STR_NOALIGN); return len + 27 + 1; @@ -297,14 +297,14 @@ static int parse_trans2_search(struct cli_tree *tree, if (blob->length < 65) return -1; ofs = IVAL(blob->data, 0); data->directory_info.file_index = IVAL(blob->data, 4); - data->directory_info.create_time = cli_pull_nttime(blob->data, 8); - data->directory_info.access_time = cli_pull_nttime(blob->data, 16); - data->directory_info.write_time = cli_pull_nttime(blob->data, 24); - data->directory_info.change_time = cli_pull_nttime(blob->data, 32); + data->directory_info.create_time = smbcli_pull_nttime(blob->data, 8); + data->directory_info.access_time = smbcli_pull_nttime(blob->data, 16); + data->directory_info.write_time = smbcli_pull_nttime(blob->data, 24); + data->directory_info.change_time = smbcli_pull_nttime(blob->data, 32); data->directory_info.size = BVAL(blob->data, 40); data->directory_info.alloc_size = BVAL(blob->data, 48); data->directory_info.attrib = IVAL(blob->data, 56); - len = cli_blob_pull_string(tree->session, mem_ctx, blob, + len = smbcli_blob_pull_string(tree->session, mem_ctx, blob, &data->directory_info.name, 60, 64, 0); if (ofs != 0 && ofs < 64+len) { @@ -316,15 +316,15 @@ static int parse_trans2_search(struct cli_tree *tree, if (blob->length < 69) return -1; ofs = IVAL(blob->data, 0); data->full_directory_info.file_index = IVAL(blob->data, 4); - data->full_directory_info.create_time = cli_pull_nttime(blob->data, 8); - data->full_directory_info.access_time = cli_pull_nttime(blob->data, 16); - data->full_directory_info.write_time = cli_pull_nttime(blob->data, 24); - data->full_directory_info.change_time = cli_pull_nttime(blob->data, 32); + data->full_directory_info.create_time = smbcli_pull_nttime(blob->data, 8); + data->full_directory_info.access_time = smbcli_pull_nttime(blob->data, 16); + data->full_directory_info.write_time = smbcli_pull_nttime(blob->data, 24); + data->full_directory_info.change_time = smbcli_pull_nttime(blob->data, 32); data->full_directory_info.size = BVAL(blob->data, 40); data->full_directory_info.alloc_size = BVAL(blob->data, 48); data->full_directory_info.attrib = IVAL(blob->data, 56); data->full_directory_info.ea_size = IVAL(blob->data, 64); - len = cli_blob_pull_string(tree->session, mem_ctx, blob, + len = smbcli_blob_pull_string(tree->session, mem_ctx, blob, &data->full_directory_info.name, 60, 68, 0); if (ofs != 0 && ofs < 68+len) { @@ -336,7 +336,7 @@ static int parse_trans2_search(struct cli_tree *tree, if (blob->length < 13) return -1; ofs = IVAL(blob->data, 0); data->name_info.file_index = IVAL(blob->data, 4); - len = cli_blob_pull_string(tree->session, mem_ctx, blob, + len = smbcli_blob_pull_string(tree->session, mem_ctx, blob, &data->name_info.name, 8, 12, 0); if (ofs != 0 && ofs < 12+len) { @@ -349,18 +349,18 @@ static int parse_trans2_search(struct cli_tree *tree, if (blob->length < 95) return -1; ofs = IVAL(blob->data, 0); data->both_directory_info.file_index = IVAL(blob->data, 4); - data->both_directory_info.create_time = cli_pull_nttime(blob->data, 8); - data->both_directory_info.access_time = cli_pull_nttime(blob->data, 16); - data->both_directory_info.write_time = cli_pull_nttime(blob->data, 24); - data->both_directory_info.change_time = cli_pull_nttime(blob->data, 32); + data->both_directory_info.create_time = smbcli_pull_nttime(blob->data, 8); + data->both_directory_info.access_time = smbcli_pull_nttime(blob->data, 16); + data->both_directory_info.write_time = smbcli_pull_nttime(blob->data, 24); + data->both_directory_info.change_time = smbcli_pull_nttime(blob->data, 32); data->both_directory_info.size = BVAL(blob->data, 40); data->both_directory_info.alloc_size = BVAL(blob->data, 48); data->both_directory_info.attrib = IVAL(blob->data, 56); data->both_directory_info.ea_size = IVAL(blob->data, 64); - cli_blob_pull_string(tree->session, mem_ctx, blob, + smbcli_blob_pull_string(tree->session, mem_ctx, blob, &data->both_directory_info.short_name, 68, 70, STR_LEN8BIT | STR_UNICODE); - len = cli_blob_pull_string(tree->session, mem_ctx, blob, + len = smbcli_blob_pull_string(tree->session, mem_ctx, blob, &data->both_directory_info.name, 60, 94, 0); if (ofs != 0 && ofs < 94+len) { @@ -373,16 +373,16 @@ static int parse_trans2_search(struct cli_tree *tree, if (blob->length < 81) return -1; ofs = IVAL(blob->data, 0); data->id_full_directory_info.file_index = IVAL(blob->data, 4); - data->id_full_directory_info.create_time = cli_pull_nttime(blob->data, 8); - data->id_full_directory_info.access_time = cli_pull_nttime(blob->data, 16); - data->id_full_directory_info.write_time = cli_pull_nttime(blob->data, 24); - data->id_full_directory_info.change_time = cli_pull_nttime(blob->data, 32); + data->id_full_directory_info.create_time = smbcli_pull_nttime(blob->data, 8); + data->id_full_directory_info.access_time = smbcli_pull_nttime(blob->data, 16); + data->id_full_directory_info.write_time = smbcli_pull_nttime(blob->data, 24); + data->id_full_directory_info.change_time = smbcli_pull_nttime(blob->data, 32); data->id_full_directory_info.size = BVAL(blob->data, 40); data->id_full_directory_info.alloc_size = BVAL(blob->data, 48); data->id_full_directory_info.attrib = IVAL(blob->data, 56); data->id_full_directory_info.ea_size = IVAL(blob->data, 64); data->id_full_directory_info.file_id = BVAL(blob->data, 72); - len = cli_blob_pull_string(tree->session, mem_ctx, blob, + len = smbcli_blob_pull_string(tree->session, mem_ctx, blob, &data->id_full_directory_info.name, 60, 80, 0); if (ofs != 0 && ofs < 80+len) { @@ -394,19 +394,19 @@ static int parse_trans2_search(struct cli_tree *tree, if (blob->length < 105) return -1; ofs = IVAL(blob->data, 0); data->id_both_directory_info.file_index = IVAL(blob->data, 4); - data->id_both_directory_info.create_time = cli_pull_nttime(blob->data, 8); - data->id_both_directory_info.access_time = cli_pull_nttime(blob->data, 16); - data->id_both_directory_info.write_time = cli_pull_nttime(blob->data, 24); - data->id_both_directory_info.change_time = cli_pull_nttime(blob->data, 32); + data->id_both_directory_info.create_time = smbcli_pull_nttime(blob->data, 8); + data->id_both_directory_info.access_time = smbcli_pull_nttime(blob->data, 16); + data->id_both_directory_info.write_time = smbcli_pull_nttime(blob->data, 24); + data->id_both_directory_info.change_time = smbcli_pull_nttime(blob->data, 32); data->id_both_directory_info.size = BVAL(blob->data, 40); data->id_both_directory_info.alloc_size = BVAL(blob->data, 48); data->id_both_directory_info.attrib = SVAL(blob->data, 56); data->id_both_directory_info.ea_size = IVAL(blob->data, 64); - cli_blob_pull_string(tree->session, mem_ctx, blob, + smbcli_blob_pull_string(tree->session, mem_ctx, blob, &data->id_both_directory_info.short_name, 68, 70, STR_LEN8BIT | STR_UNICODE); data->id_both_directory_info.file_id = BVAL(blob->data, 96); - len = cli_blob_pull_string(tree->session, mem_ctx, blob, + len = smbcli_blob_pull_string(tree->session, mem_ctx, blob, &data->id_both_directory_info.name, 60, 104, 0); if (ofs != 0 && ofs < 104+len) { @@ -420,9 +420,9 @@ static int parse_trans2_search(struct cli_tree *tree, data->unix_info.file_index = IVAL(blob->data, 4); data->unix_info.size = BVAL(blob->data, 8); data->unix_info.alloc_size = BVAL(blob->data, 16); - data->unix_info.status_change_time = cli_pull_nttime(blob->data, 24); - data->unix_info.access_time = cli_pull_nttime(blob->data, 32); - data->unix_info.change_time = cli_pull_nttime(blob->data, 40); + data->unix_info.status_change_time = smbcli_pull_nttime(blob->data, 24); + data->unix_info.access_time = smbcli_pull_nttime(blob->data, 32); + data->unix_info.change_time = smbcli_pull_nttime(blob->data, 40); data->unix_info.uid = IVAL(blob->data, 48); data->unix_info.gid = IVAL(blob->data, 56); data->unix_info.file_type = IVAL(blob->data, 64); @@ -432,7 +432,7 @@ static int parse_trans2_search(struct cli_tree *tree, data->unix_info.permissions = IVAL(blob->data, 92); data->unix_info.nlink = IVAL(blob->data, 100); /* There is no length field for this name but we know it's null terminated. */ - len = cli_blob_pull_unix_string(tree->session, mem_ctx, blob, + len = smbcli_blob_pull_unix_string(tree->session, mem_ctx, blob, &data->unix_info.name, 108, 0); if (ofs != 0 && ofs < 108+len) { return -1; @@ -447,7 +447,7 @@ static int parse_trans2_search(struct cli_tree *tree, /**************************************************************************** Trans2 search backend - process output. ****************************************************************************/ -static NTSTATUS smb_raw_t2search_backend(struct cli_tree *tree, +static NTSTATUS smb_raw_t2search_backend(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, enum smb_search_level level, uint16_t flags, @@ -490,7 +490,7 @@ static NTSTATUS smb_raw_t2search_backend(struct cli_tree *tree, /* Implements trans2findfirst2 and old search */ -NTSTATUS smb_raw_search_first(struct cli_tree *tree, +NTSTATUS smb_raw_search_first(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_search_first *io, void *private, BOOL (*callback)(void *private, union smb_search_data *file)) @@ -534,7 +534,7 @@ NTSTATUS smb_raw_search_first(struct cli_tree *tree, /* Implements trans2findnext2 and old smbsearch */ -NTSTATUS smb_raw_search_next(struct cli_tree *tree, +NTSTATUS smb_raw_search_next(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_search_next *io, void *private, BOOL (*callback)(void *private, union smb_search_data *file)) @@ -578,21 +578,21 @@ NTSTATUS smb_raw_search_next(struct cli_tree *tree, /* Implements trans2findclose2 */ -NTSTATUS smb_raw_search_close(struct cli_tree *tree, +NTSTATUS smb_raw_search_close(struct smbcli_tree *tree, union smb_search_close *io) { - struct cli_request *req; + struct smbcli_request *req; - req = cli_request_setup(tree, SMBfindclose, 1, 0); + req = smbcli_request_setup(tree, SMBfindclose, 1, 0); if (!req) { return NT_STATUS_NO_MEMORY; } SSVAL(req->out.vwv, VWV(0), io->findclose.in.handle); - if (cli_request_send(req)) { - cli_request_receive(req); + if (smbcli_request_send(req)) { + smbcli_request_receive(req); } - return cli_request_destroy(req); + return smbcli_request_destroy(req); } diff --git a/source4/libcli/raw/rawsetfileinfo.c b/source4/libcli/raw/rawsetfileinfo.c index 3dcda401f5..b1667db50f 100644 --- a/source4/libcli/raw/rawsetfileinfo.c +++ b/source4/libcli/raw/rawsetfileinfo.c @@ -24,7 +24,7 @@ /**************************************************************************** Handle setfileinfo/setpathinfo trans2 backend. ****************************************************************************/ -static BOOL smb_raw_setinfo_backend(struct cli_tree *tree, +static BOOL smb_raw_setinfo_backend(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_setfileinfo *parms, DATA_BLOB *blob) @@ -61,10 +61,10 @@ static BOOL smb_raw_setinfo_backend(struct cli_tree *tree, case RAW_SFILEINFO_BASIC_INFO: case RAW_SFILEINFO_BASIC_INFORMATION: NEED_BLOB(40); - cli_push_nttime(blob->data, 0, parms->basic_info.in.create_time); - cli_push_nttime(blob->data, 8, parms->basic_info.in.access_time); - cli_push_nttime(blob->data, 16, parms->basic_info.in.write_time); - cli_push_nttime(blob->data, 24, parms->basic_info.in.change_time); + smbcli_push_nttime(blob->data, 0, parms->basic_info.in.create_time); + smbcli_push_nttime(blob->data, 8, parms->basic_info.in.access_time); + smbcli_push_nttime(blob->data, 16, parms->basic_info.in.write_time); + smbcli_push_nttime(blob->data, 24, parms->basic_info.in.change_time); SIVAL(blob->data, 32, parms->basic_info.in.attrib); SIVAL(blob->data, 36, 0); /* padding */ return True; @@ -73,9 +73,9 @@ static BOOL smb_raw_setinfo_backend(struct cli_tree *tree, NEED_BLOB(92); SBVAL(blob->data, 0, parms->unix_basic.in.end_of_file); SBVAL(blob->data, 8, parms->unix_basic.in.num_bytes); - cli_push_nttime(blob->data, 16, parms->unix_basic.in.status_change_time); - cli_push_nttime(blob->data, 24, parms->unix_basic.in.access_time); - cli_push_nttime(blob->data, 32, parms->unix_basic.in.change_time); + smbcli_push_nttime(blob->data, 16, parms->unix_basic.in.status_change_time); + smbcli_push_nttime(blob->data, 24, parms->unix_basic.in.access_time); + smbcli_push_nttime(blob->data, 32, parms->unix_basic.in.change_time); SBVAL(blob->data, 40, parms->unix_basic.in.uid); SBVAL(blob->data, 48, parms->unix_basic.in.gid); SIVAL(blob->data, 56, parms->unix_basic.in.file_type); @@ -107,7 +107,7 @@ static BOOL smb_raw_setinfo_backend(struct cli_tree *tree, NEED_BLOB(12); SIVAL(blob->data, 0, parms->rename_information.in.overwrite); SIVAL(blob->data, 4, parms->rename_information.in.root_fid); - len = cli_blob_append_string(tree->session, mem_ctx, blob, + len = smbcli_blob_append_string(tree->session, mem_ctx, blob, parms->rename_information.in.new_name, STR_UNICODE|STR_TERMINATE); SIVAL(blob->data, 8, len - 2); @@ -130,7 +130,7 @@ static BOOL smb_raw_setinfo_backend(struct cli_tree *tree, /**************************************************************************** Very raw set file info - takes data blob (async send) ****************************************************************************/ -static struct cli_request *smb_raw_setfileinfo_blob_send(struct cli_tree *tree, +static struct smbcli_request *smb_raw_setfileinfo_blob_send(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, uint16_t fnum, uint16_t info_level, @@ -163,7 +163,7 @@ static struct cli_request *smb_raw_setfileinfo_blob_send(struct cli_tree *tree, /**************************************************************************** Very raw set path info - takes data blob ****************************************************************************/ -static struct cli_request *smb_raw_setpathinfo_blob_send(struct cli_tree *tree, +static struct smbcli_request *smb_raw_setpathinfo_blob_send(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, const char *fname, uint16_t info_level, @@ -186,7 +186,7 @@ static struct cli_request *smb_raw_setpathinfo_blob_send(struct cli_tree *tree, } SSVAL(tp.in.params.data, 0, info_level); SSVAL(tp.in.params.data, 2, 0); - cli_blob_append_string(tree->session, mem_ctx, + smbcli_blob_append_string(tree->session, mem_ctx, &tp.in.params, fname, STR_TERMINATE); @@ -198,23 +198,23 @@ static struct cli_request *smb_raw_setpathinfo_blob_send(struct cli_tree *tree, /**************************************************************************** Handle setattr (async send) ****************************************************************************/ -static struct cli_request *smb_raw_setattr_send(struct cli_tree *tree, +static struct smbcli_request *smb_raw_setattr_send(struct smbcli_tree *tree, union smb_setfileinfo *parms) { - struct cli_request *req; + struct smbcli_request *req; - req = cli_request_setup(tree, SMBsetatr, 8, 0); + req = smbcli_request_setup(tree, SMBsetatr, 8, 0); if (!req) return NULL; SSVAL(req->out.vwv, VWV(0), parms->setattr.in.attrib); raw_push_dos_date3(tree->session->transport, req->out.vwv, VWV(1), parms->setattr.in.write_time); memset(req->out.vwv + VWV(3), 0, 10); /* reserved */ - cli_req_append_ascii4(req, parms->setattr.file.fname, STR_TERMINATE); - cli_req_append_ascii4(req, "", STR_TERMINATE); + smbcli_req_append_ascii4(req, parms->setattr.file.fname, STR_TERMINATE); + smbcli_req_append_ascii4(req, "", STR_TERMINATE); - if (!cli_request_send(req)) { - cli_request_destroy(req); + if (!smbcli_request_send(req)) { + smbcli_request_destroy(req); return NULL; } @@ -224,12 +224,12 @@ static struct cli_request *smb_raw_setattr_send(struct cli_tree *tree, /**************************************************************************** Handle setattrE. (async send) ****************************************************************************/ -static struct cli_request *smb_raw_setattrE_send(struct cli_tree *tree, +static struct smbcli_request *smb_raw_setattrE_send(struct smbcli_tree *tree, union smb_setfileinfo *parms) { - struct cli_request *req; + struct smbcli_request *req; - req = cli_request_setup(tree, SMBsetattrE, 7, 0); + req = smbcli_request_setup(tree, SMBsetattrE, 7, 0); if (!req) return NULL; SSVAL(req->out.vwv, VWV(0), parms->setattre.file.fnum); @@ -240,8 +240,8 @@ static struct cli_request *smb_raw_setattrE_send(struct cli_tree *tree, raw_push_dos_date2(tree->session->transport, req->out.vwv, VWV(5), parms->setattre.in.write_time); - if (!cli_request_send(req)) { - cli_request_destroy(req); + if (!smbcli_request_send(req)) { + smbcli_request_destroy(req); return NULL; } @@ -251,12 +251,12 @@ static struct cli_request *smb_raw_setattrE_send(struct cli_tree *tree, /**************************************************************************** Set file info (async send) ****************************************************************************/ -struct cli_request *smb_raw_setfileinfo_send(struct cli_tree *tree, +struct smbcli_request *smb_raw_setfileinfo_send(struct smbcli_tree *tree, union smb_setfileinfo *parms) { DATA_BLOB blob; TALLOC_CTX *mem_ctx; - struct cli_request *req; + struct smbcli_request *req; if (parms->generic.level == RAW_SFILEINFO_SETATTRE) { return smb_raw_setattrE_send(tree, parms); @@ -287,23 +287,23 @@ struct cli_request *smb_raw_setfileinfo_send(struct cli_tree *tree, /**************************************************************************** Set file info (async send) ****************************************************************************/ -NTSTATUS smb_raw_setfileinfo(struct cli_tree *tree, +NTSTATUS smb_raw_setfileinfo(struct smbcli_tree *tree, union smb_setfileinfo *parms) { - struct cli_request *req = smb_raw_setfileinfo_send(tree, parms); - return cli_request_simple_recv(req); + struct smbcli_request *req = smb_raw_setfileinfo_send(tree, parms); + return smbcli_request_simple_recv(req); } /**************************************************************************** Set path info (async send) ****************************************************************************/ -struct cli_request *smb_raw_setpathinfo_send(struct cli_tree *tree, +struct smbcli_request *smb_raw_setpathinfo_send(struct smbcli_tree *tree, union smb_setfileinfo *parms) { DATA_BLOB blob; TALLOC_CTX *mem_ctx; - struct cli_request *req; + struct smbcli_request *req; if (parms->generic.level == RAW_SFILEINFO_SETATTR) { return smb_raw_setattr_send(tree, parms); @@ -334,9 +334,9 @@ struct cli_request *smb_raw_setpathinfo_send(struct cli_tree *tree, /**************************************************************************** Set path info (sync interface) ****************************************************************************/ -NTSTATUS smb_raw_setpathinfo(struct cli_tree *tree, +NTSTATUS smb_raw_setpathinfo(struct smbcli_tree *tree, union smb_setfileinfo *parms) { - struct cli_request *req = smb_raw_setpathinfo_send(tree, parms); - return cli_request_simple_recv(req); + struct smbcli_request *req = smb_raw_setpathinfo_send(tree, parms); + return smbcli_request_simple_recv(req); } diff --git a/source4/libcli/raw/rawtrans.c b/source4/libcli/raw/rawtrans.c index 5dde753368..0c39abe880 100644 --- a/source4/libcli/raw/rawtrans.c +++ b/source4/libcli/raw/rawtrans.c @@ -25,7 +25,7 @@ /* check out of bounds for incoming data */ -static BOOL raw_trans_oob(struct cli_request *req, +static BOOL raw_trans_oob(struct smbcli_request *req, uint_t offset, uint_t count) { char *ptr; @@ -49,7 +49,7 @@ static BOOL raw_trans_oob(struct cli_request *req, /**************************************************************************** receive a SMB trans or trans2 response allocating the necessary memory ****************************************************************************/ -NTSTATUS smb_raw_trans2_recv(struct cli_request *req, +NTSTATUS smb_raw_trans2_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, struct smb_trans2 *parms) { @@ -63,8 +63,8 @@ NTSTATUS smb_raw_trans2_recv(struct cli_request *req, parms->out.params.length = 0; parms->out.params.data = NULL; - if (!cli_request_receive(req)) { - return cli_request_destroy(req); + if (!smbcli_request_receive(req)) { + return smbcli_request_destroy(req); } /* @@ -73,10 +73,10 @@ NTSTATUS smb_raw_trans2_recv(struct cli_request *req, * be treated as such. */ if (NT_STATUS_IS_ERR(req->status)) { - return cli_request_destroy(req); + return smbcli_request_destroy(req); } - CLI_CHECK_MIN_WCT(req, 10); + SMBCLI_CHECK_MIN_WCT(req, 10); /* parse out the lengths */ total_data = SVAL(req->in.vwv, VWV(1)); @@ -88,7 +88,7 @@ NTSTATUS smb_raw_trans2_recv(struct cli_request *req, if (!tdata) { DEBUG(0,("smb_raw_receive_trans: failed to enlarge data buffer to %d bytes\n", total_data)); req->status = NT_STATUS_NO_MEMORY; - return cli_request_destroy(req); + return smbcli_request_destroy(req); } parms->out.data.data = tdata; } @@ -98,20 +98,20 @@ NTSTATUS smb_raw_trans2_recv(struct cli_request *req, if (!tparam) { DEBUG(0,("smb_raw_receive_trans: failed to enlarge param buffer to %d bytes\n", total_param)); req->status = NT_STATUS_NO_MEMORY; - return cli_request_destroy(req); + return smbcli_request_destroy(req); } parms->out.params.data = tparam; } parms->out.setup_count = SVAL(req->in.vwv, VWV(9)); - CLI_CHECK_WCT(req, 10 + parms->out.setup_count); + SMBCLI_CHECK_WCT(req, 10 + parms->out.setup_count); if (parms->out.setup_count > 0) { int i; parms->out.setup = talloc(mem_ctx, 2 * parms->out.setup_count); if (!parms->out.setup) { req->status = NT_STATUS_NO_MEMORY; - return cli_request_destroy(req); + return smbcli_request_destroy(req); } for (i=0;i<parms->out.setup_count;i++) { parms->out.setup[i] = SVAL(req->in.vwv, VWV(10+i)); @@ -132,7 +132,7 @@ NTSTATUS smb_raw_trans2_recv(struct cli_request *req, /* they must *only* shrink */ DEBUG(1,("smb_raw_receive_trans: data/params expanded!\n")); req->status = NT_STATUS_BUFFER_TOO_SMALL; - return cli_request_destroy(req); + return smbcli_request_destroy(req); } total_data = total_data2; @@ -151,7 +151,7 @@ NTSTATUS smb_raw_trans2_recv(struct cli_request *req, param_count + param_disp > total_param) { DEBUG(1,("smb_raw_receive_trans: Buffer overflow\n")); req->status = NT_STATUS_BUFFER_TOO_SMALL; - return cli_request_destroy(req); + return smbcli_request_destroy(req); } /* check the server isn't being nasty */ @@ -159,7 +159,7 @@ NTSTATUS smb_raw_trans2_recv(struct cli_request *req, raw_trans_oob(req, data_ofs, data_count)) { DEBUG(1,("smb_raw_receive_trans: out of bounds parameters!\n")); req->status = NT_STATUS_BUFFER_TOO_SMALL; - return cli_request_destroy(req); + return smbcli_request_destroy(req); } if (data_count) { @@ -180,17 +180,17 @@ NTSTATUS smb_raw_trans2_recv(struct cli_request *req, if (total_data <= parms->out.data.length && total_param <= parms->out.params.length) break; - if (!cli_request_receive_more(req)) { + if (!smbcli_request_receive_more(req)) { req->status = NT_STATUS_UNSUCCESSFUL; - return cli_request_destroy(req); + return smbcli_request_destroy(req); } } failed: - return cli_request_destroy(req); + return smbcli_request_destroy(req); } -NTSTATUS smb_raw_trans_recv(struct cli_request *req, +NTSTATUS smb_raw_trans_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, struct smb_trans2 *parms) { @@ -201,12 +201,12 @@ NTSTATUS smb_raw_trans_recv(struct cli_request *req, trans/trans2 raw async interface - only BLOBs used in this interface. note that this doesn't yet support multi-part requests ****************************************************************************/ -struct cli_request *smb_raw_trans_send_backend(struct cli_tree *tree, +struct smbcli_request *smb_raw_trans_send_backend(struct smbcli_tree *tree, struct smb_trans2 *parms, uint8_t command) { int wct = 14 + parms->in.setup_count; - struct cli_request *req; + struct smbcli_request *req; char *outdata,*outparam; int i; int padding; @@ -217,7 +217,7 @@ struct cli_request *smb_raw_trans_send_backend(struct cli_tree *tree, else padding = 3; - req = cli_request_setup(tree, command, wct, padding); + req = smbcli_request_setup(tree, command, wct, padding); if (!req) { return NULL; } @@ -230,7 +230,7 @@ struct cli_request *smb_raw_trans_send_backend(struct cli_tree *tree, memset(req->out.data, 0, padding); if (command == SMBtrans && parms->in.trans_name) { - namelen = cli_req_append_string(req, parms->in.trans_name, + namelen = smbcli_req_append_string(req, parms->in.trans_name, STR_TERMINATE); } @@ -252,14 +252,14 @@ struct cli_request *smb_raw_trans_send_backend(struct cli_tree *tree, SSVAL(req->out.vwv,VWV(14)+i*2,parms->in.setup[i]); } if (parms->in.params.data) { - cli_req_append_blob(req, &parms->in.params); + smbcli_req_append_blob(req, &parms->in.params); } if (parms->in.data.data) { - cli_req_append_blob(req, &parms->in.data); + smbcli_req_append_blob(req, &parms->in.data); } - if (!cli_request_send(req)) { - cli_request_destroy(req); + if (!smbcli_request_send(req)) { + smbcli_request_destroy(req); return NULL; } @@ -271,13 +271,13 @@ struct cli_request *smb_raw_trans_send_backend(struct cli_tree *tree, note that this doesn't yet support multi-part requests ****************************************************************************/ -struct cli_request *smb_raw_trans_send(struct cli_tree *tree, +struct smbcli_request *smb_raw_trans_send(struct smbcli_tree *tree, struct smb_trans2 *parms) { return smb_raw_trans_send_backend(tree, parms, SMBtrans); } -struct cli_request *smb_raw_trans2_send(struct cli_tree *tree, +struct smbcli_request *smb_raw_trans2_send(struct smbcli_tree *tree, struct smb_trans2 *parms) { return smb_raw_trans_send_backend(tree, parms, SMBtrans2); @@ -286,11 +286,11 @@ struct cli_request *smb_raw_trans2_send(struct cli_tree *tree, /* trans2 synchronous blob interface */ -NTSTATUS smb_raw_trans2(struct cli_tree *tree, +NTSTATUS smb_raw_trans2(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, struct smb_trans2 *parms) { - struct cli_request *req; + struct smbcli_request *req; req = smb_raw_trans2_send(tree, parms); if (!req) return NT_STATUS_UNSUCCESSFUL; return smb_raw_trans2_recv(req, mem_ctx, parms); @@ -300,11 +300,11 @@ NTSTATUS smb_raw_trans2(struct cli_tree *tree, /* trans synchronous blob interface */ -NTSTATUS smb_raw_trans(struct cli_tree *tree, +NTSTATUS smb_raw_trans(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, struct smb_trans2 *parms) { - struct cli_request *req; + struct smbcli_request *req; req = smb_raw_trans_send(tree, parms); if (!req) return NT_STATUS_UNSUCCESSFUL; return smb_raw_trans_recv(req, mem_ctx, parms); @@ -313,16 +313,16 @@ NTSTATUS smb_raw_trans(struct cli_tree *tree, /**************************************************************************** receive a SMB nttrans response allocating the necessary memory ****************************************************************************/ -NTSTATUS smb_raw_nttrans_recv(struct cli_request *req, +NTSTATUS smb_raw_nttrans_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, struct smb_nttrans *parms) { uint32_t total_data, recvd_data=0; uint32_t total_param, recvd_param=0; - if (!cli_request_receive(req) || - cli_request_is_error(req)) { - return cli_request_destroy(req); + if (!smbcli_request_receive(req) || + smbcli_request_is_error(req)) { + return smbcli_request_destroy(req); } /* sanity check */ @@ -331,10 +331,10 @@ NTSTATUS smb_raw_nttrans_recv(struct cli_request *req, "SMBnttrans", CVAL(req->in.hdr,HDR_COM))); req->status = NT_STATUS_UNSUCCESSFUL; - return cli_request_destroy(req); + return smbcli_request_destroy(req); } - CLI_CHECK_MIN_WCT(req, 18); + SMBCLI_CHECK_MIN_WCT(req, 18); /* parse out the lengths */ total_param = IVAL(req->in.vwv, 3); @@ -346,18 +346,18 @@ NTSTATUS smb_raw_nttrans_recv(struct cli_request *req, if (parms->out.data.length != total_data || parms->out.params.length != total_param) { req->status = NT_STATUS_NO_MEMORY; - return cli_request_destroy(req); + return smbcli_request_destroy(req); } parms->out.setup_count = CVAL(req->in.vwv, 35); - CLI_CHECK_WCT(req, 18 + parms->out.setup_count); + SMBCLI_CHECK_WCT(req, 18 + parms->out.setup_count); if (parms->out.setup_count > 0) { int i; parms->out.setup = talloc(mem_ctx, 2 * parms->out.setup_count); if (!parms->out.setup) { req->status = NT_STATUS_NO_MEMORY; - return cli_request_destroy(req); + return smbcli_request_destroy(req); } for (i=0;i<parms->out.setup_count;i++) { parms->out.setup[i] = SVAL(req->in.vwv, VWV(18+i)); @@ -379,7 +379,7 @@ NTSTATUS smb_raw_nttrans_recv(struct cli_request *req, /* they must *only* shrink */ DEBUG(1,("smb_raw_receive_nttrans: data/params expanded!\n")); req->status = NT_STATUS_BUFFER_TOO_SMALL; - return cli_request_destroy(req); + return smbcli_request_destroy(req); } total_data = total_data2; @@ -400,7 +400,7 @@ NTSTATUS smb_raw_nttrans_recv(struct cli_request *req, param_count + param_disp > total_param) { DEBUG(1,("smb_raw_receive_nttrans: Buffer overflow\n")); req->status = NT_STATUS_BUFFER_TOO_SMALL; - return cli_request_destroy(req); + return smbcli_request_destroy(req); } /* check the server isn't being nasty */ @@ -408,7 +408,7 @@ NTSTATUS smb_raw_nttrans_recv(struct cli_request *req, raw_trans_oob(req, data_ofs, data_count)) { DEBUG(1,("smb_raw_receive_nttrans: out of bounds parameters!\n")); req->status = NT_STATUS_BUFFER_TOO_SMALL; - return cli_request_destroy(req); + return smbcli_request_destroy(req); } if (data_count) { @@ -431,9 +431,9 @@ NTSTATUS smb_raw_nttrans_recv(struct cli_request *req, break; } - if (!cli_request_receive(req) || - cli_request_is_error(req)) { - return cli_request_destroy(req); + if (!smbcli_request_receive(req) || + smbcli_request_is_error(req)) { + return smbcli_request_destroy(req); } /* sanity check */ @@ -441,12 +441,12 @@ NTSTATUS smb_raw_nttrans_recv(struct cli_request *req, DEBUG(0,("smb_raw_receive_nttrans: Expected nttranss, got command 0x%02x\n", CVAL(req->in.hdr, HDR_COM))); req->status = NT_STATUS_UNSUCCESSFUL; - return cli_request_destroy(req); + return smbcli_request_destroy(req); } } failed: - return cli_request_destroy(req); + return smbcli_request_destroy(req); } @@ -454,10 +454,10 @@ failed: nttrans raw - only BLOBs used in this interface. at the moment we only handle a single primary request ****************************************************************************/ -struct cli_request *smb_raw_nttrans_send(struct cli_tree *tree, +struct smbcli_request *smb_raw_nttrans_send(struct smbcli_tree *tree, struct smb_nttrans *parms) { - struct cli_request *req; + struct smbcli_request *req; char *outdata, *outparam; int i; int align = 0; @@ -467,7 +467,7 @@ struct cli_request *smb_raw_nttrans_send(struct cli_tree *tree, align = 3; } - req = cli_request_setup(tree, SMBnttrans, + req = smbcli_request_setup(tree, SMBnttrans, 19 + parms->in.setup_count, align + parms->in.params.length + @@ -502,8 +502,8 @@ struct cli_request *smb_raw_nttrans_send(struct cli_tree *tree, memcpy(outparam, parms->in.data.data, parms->in.data.length); } - if (!cli_request_send(req)) { - cli_request_destroy(req); + if (!smbcli_request_send(req)) { + smbcli_request_destroy(req); return NULL; } @@ -514,11 +514,11 @@ struct cli_request *smb_raw_nttrans_send(struct cli_tree *tree, /**************************************************************************** receive a SMB nttrans response allocating the necessary memory ****************************************************************************/ -NTSTATUS smb_raw_nttrans(struct cli_tree *tree, +NTSTATUS smb_raw_nttrans(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, struct smb_nttrans *parms) { - struct cli_request *req; + struct smbcli_request *req; req = smb_raw_nttrans_send(tree, parms); if (!req) { diff --git a/source4/libcli/raw/smb_signing.c b/source4/libcli/raw/smb_signing.c index 9c02fe50ec..ddde58fd88 100644 --- a/source4/libcli/raw/smb_signing.c +++ b/source4/libcli/raw/smb_signing.c @@ -30,7 +30,7 @@ struct smb_basic_signing_context { /*********************************************************** SMB signing - Common code before we set a new signing implementation ************************************************************/ -static BOOL set_smb_signing_common(struct cli_transport *transport) +static BOOL set_smb_signing_common(struct smbcli_transport *transport) { if (!(transport->negotiate.sec_mode & (NEGOTIATE_SECURITY_SIGNATURES_REQUIRED|NEGOTIATE_SECURITY_SIGNATURES_ENABLED))) { @@ -58,7 +58,7 @@ static BOOL set_smb_signing_common(struct cli_transport *transport) /*********************************************************** SMB signing - Common code for 'real' implementations ************************************************************/ -static BOOL set_smb_signing_real_common(struct cli_transport *transport) +static BOOL set_smb_signing_real_common(struct smbcli_transport *transport) { if (transport->negotiate.sign_info.mandatory_signing) { DEBUG(5, ("Mandatory SMB signing enabled!\n")); @@ -77,7 +77,7 @@ static void mark_packet_signed(struct request_buffer *out) SSVAL(out->hdr, HDR_FLG2, flags2); } -static BOOL signing_good(struct cli_request *req, unsigned int seq, BOOL good) +static BOOL signing_good(struct smbcli_request *req, unsigned int seq, BOOL good) { if (good) { if (!req->transport->negotiate.sign_info.doing_signing) { @@ -96,7 +96,7 @@ static BOOL signing_good(struct cli_request *req, unsigned int seq, BOOL good) req->transport->negotiate.sign_info.doing_signing = False; if (req->transport->negotiate.sign_info.free_signing_context) req->transport->negotiate.sign_info.free_signing_context(req->transport); - cli_null_set_signing(req->transport); + smbcli_null_set_signing(req->transport); return True; } else { /* bad packet after signing started - fail and disconnect. */ @@ -206,7 +206,7 @@ BOOL check_signed_incoming_message(struct request_buffer *in, DATA_BLOB *mac_key /*********************************************************** SMB signing - Simple implementation - calculate a MAC to send. ************************************************************/ -static void cli_request_simple_sign_outgoing_message(struct cli_request *req) +static void smbcli_request_simple_sign_outgoing_message(struct smbcli_request *req) { struct smb_basic_signing_context *data = req->transport->negotiate.sign_info.signing_context; @@ -233,7 +233,7 @@ static void cli_request_simple_sign_outgoing_message(struct cli_request *req) /*********************************************************** SMB signing - Simple implementation - check a MAC sent by server. ************************************************************/ -static BOOL cli_request_simple_check_incoming_message(struct cli_request *req) +static BOOL smbcli_request_simple_check_incoming_message(struct smbcli_request *req) { struct smb_basic_signing_context *data = req->transport->negotiate.sign_info.signing_context; @@ -249,7 +249,7 @@ static BOOL cli_request_simple_check_incoming_message(struct cli_request *req) /*********************************************************** SMB signing - Simple implementation - free signing context ************************************************************/ -static void cli_transport_simple_free_signing_context(struct cli_transport *transport) +static void smbcli_transport_simple_free_signing_context(struct smbcli_transport *transport) { struct smb_basic_signing_context *data = transport->negotiate.sign_info.signing_context; @@ -263,7 +263,7 @@ static void cli_transport_simple_free_signing_context(struct cli_transport *tran /*********************************************************** SMB signing - Simple implementation - setup the MAC key. ************************************************************/ -BOOL cli_transport_simple_set_signing(struct cli_transport *transport, +BOOL smbcli_transport_simple_set_signing(struct smbcli_transport *transport, const DATA_BLOB user_session_key, const DATA_BLOB response) { @@ -293,9 +293,9 @@ BOOL cli_transport_simple_set_signing(struct cli_transport *transport, /* Initialise the sequence number */ data->next_seq_num = 0; - transport->negotiate.sign_info.sign_outgoing_message = cli_request_simple_sign_outgoing_message; - transport->negotiate.sign_info.check_incoming_message = cli_request_simple_check_incoming_message; - transport->negotiate.sign_info.free_signing_context = cli_transport_simple_free_signing_context; + transport->negotiate.sign_info.sign_outgoing_message = smbcli_request_simple_sign_outgoing_message; + transport->negotiate.sign_info.check_incoming_message = smbcli_request_simple_check_incoming_message; + transport->negotiate.sign_info.free_signing_context = smbcli_transport_simple_free_signing_context; return True; } @@ -304,7 +304,7 @@ BOOL cli_transport_simple_set_signing(struct cli_transport *transport, /*********************************************************** SMB signing - NULL implementation - calculate a MAC to send. ************************************************************/ -static void cli_request_null_sign_outgoing_message(struct cli_request *req) +static void smbcli_request_null_sign_outgoing_message(struct smbcli_request *req) { /* we can't zero out the sig, as we might be trying to send a transport request - which is NBT-level, not SMB level and doesn't @@ -315,7 +315,7 @@ static void cli_request_null_sign_outgoing_message(struct cli_request *req) /*********************************************************** SMB signing - NULL implementation - check a MAC sent by server. ************************************************************/ -static BOOL cli_request_null_check_incoming_message(struct cli_request *req) +static BOOL smbcli_request_null_check_incoming_message(struct smbcli_request *req) { return True; } @@ -324,7 +324,7 @@ static BOOL cli_request_null_check_incoming_message(struct cli_request *req) /*********************************************************** SMB signing - NULL implementation - free signing context ************************************************************/ -static void cli_null_free_signing_context(struct cli_transport *transport) +static void smbcli_null_free_signing_context(struct smbcli_transport *transport) { } @@ -334,13 +334,13 @@ static void cli_null_free_signing_context(struct cli_transport *transport) @note Used as an initialisation only - it will not correctly shut down a real signing mechanism */ -BOOL cli_null_set_signing(struct cli_transport *transport) +BOOL smbcli_null_set_signing(struct smbcli_transport *transport) { transport->negotiate.sign_info.signing_context = NULL; - transport->negotiate.sign_info.sign_outgoing_message = cli_request_null_sign_outgoing_message; - transport->negotiate.sign_info.check_incoming_message = cli_request_null_check_incoming_message; - transport->negotiate.sign_info.free_signing_context = cli_null_free_signing_context; + transport->negotiate.sign_info.sign_outgoing_message = smbcli_request_null_sign_outgoing_message; + transport->negotiate.sign_info.check_incoming_message = smbcli_request_null_check_incoming_message; + transport->negotiate.sign_info.free_signing_context = smbcli_null_free_signing_context; return True; } @@ -348,7 +348,7 @@ BOOL cli_null_set_signing(struct cli_transport *transport) /*********************************************************** SMB signing - TEMP implementation - calculate a MAC to send. ************************************************************/ -static void cli_request_temp_sign_outgoing_message(struct cli_request *req) +static void smbcli_request_temp_sign_outgoing_message(struct smbcli_request *req) { /* mark the packet as signed - BEFORE we sign it...*/ mark_packet_signed(&req->out); @@ -363,7 +363,7 @@ static void cli_request_temp_sign_outgoing_message(struct cli_request *req) /*********************************************************** SMB signing - TEMP implementation - check a MAC sent by server. ************************************************************/ -static BOOL cli_request_temp_check_incoming_message(struct cli_request *req) +static BOOL smbcli_request_temp_check_incoming_message(struct smbcli_request *req) { return True; } @@ -371,7 +371,7 @@ static BOOL cli_request_temp_check_incoming_message(struct cli_request *req) /*********************************************************** SMB signing - NULL implementation - free signing context ************************************************************/ -static void cli_temp_free_signing_context(struct cli_transport *transport) +static void smbcli_temp_free_signing_context(struct smbcli_transport *transport) { return; } @@ -382,7 +382,7 @@ static void cli_temp_free_signing_context(struct cli_transport *transport) @note Used as an initialisation only - it will not correctly shut down a real signing mechanism */ -BOOL cli_temp_set_signing(struct cli_transport *transport) +BOOL smbcli_temp_set_signing(struct smbcli_transport *transport) { if (!set_smb_signing_common(transport)) { return False; @@ -390,9 +390,9 @@ BOOL cli_temp_set_signing(struct cli_transport *transport) transport->negotiate.sign_info.signing_context = NULL; - transport->negotiate.sign_info.sign_outgoing_message = cli_request_temp_sign_outgoing_message; - transport->negotiate.sign_info.check_incoming_message = cli_request_temp_check_incoming_message; - transport->negotiate.sign_info.free_signing_context = cli_temp_free_signing_context; + transport->negotiate.sign_info.sign_outgoing_message = smbcli_request_temp_sign_outgoing_message; + transport->negotiate.sign_info.check_incoming_message = smbcli_request_temp_check_incoming_message; + transport->negotiate.sign_info.free_signing_context = smbcli_temp_free_signing_context; return True; } @@ -400,20 +400,20 @@ BOOL cli_temp_set_signing(struct cli_transport *transport) /** * Free the signing context */ -void cli_transport_free_signing_context(struct cli_transport *transport) +void smbcli_transport_free_signing_context(struct smbcli_transport *transport) { if (transport->negotiate.sign_info.free_signing_context) { transport->negotiate.sign_info.free_signing_context(transport); } - cli_null_set_signing(transport); + smbcli_null_set_signing(transport); } /** * Sign a packet with the current mechanism */ -void cli_request_calculate_sign_mac(struct cli_request *req) +void smbcli_request_calculate_sign_mac(struct smbcli_request *req) { req->transport->negotiate.sign_info.sign_outgoing_message(req); } @@ -424,7 +424,7 @@ void cli_request_calculate_sign_mac(struct cli_request *req) * @return False if we had an established signing connection * which had a back checksum, True otherwise */ -BOOL cli_request_check_sign_mac(struct cli_request *req) +BOOL smbcli_request_check_sign_mac(struct smbcli_request *req) { BOOL good; @@ -442,9 +442,9 @@ BOOL cli_request_check_sign_mac(struct cli_request *req) } -BOOL cli_init_signing(struct cli_transport *transport) +BOOL smbcli_init_signing(struct smbcli_transport *transport) { - if (!cli_null_set_signing(transport)) { + if (!smbcli_null_set_signing(transport)) { return False; } |