[SCM] Samba Shared Repository - branch master updated
Volker Lendecke
vlendec at samba.org
Mon Jan 17 00:48:02 MST 2011
The branch, master has been updated
via d3abc90 s3: Avoid a few calls to cli_errstr
via c7a5933 s3: Remove some unused code
via 6f3e110 s3: Convert cli_lock64 to cli_smb
via dd2f234 s3: Convert cli_lock to use cli_locktype
via 0e2854f s3: Convert cli_locktype to cli_smb
via 7b054ec s3: Make passing up "result_parent" from cli_smb optional
via b33f114 s3: Remove unused cli_send_keepalive
via 6e684c8 s3: Remove unused cli_send/receive_trans
via cba5a26 s3: Convert try_trans2 to cli_trans
via 8ac68fc s3: Convert cli_api to cli_trans
via cb412d2 s3: Make cli_setpathinfo_basic use cli_setpathinfo
via 21d5485 s3: Add cli_setpathinfo
via 2068b96 s3: Rename cli_setpathinfo->cli_setpathinfo_basic
via 2d44a05 s3: Remove unused cli_send/receive_nt_trans
via d5decfb s3: Convert try_nttrans to cli_trans
via 5dee39b s3: Move dump_ntquota* to smbcquotas.c
via a1f5417 s3: Convert cli_set_fs_quota_info to cli_trans
via 797c027 s3: Convert cli_get_fs_quota_info to cli_trans
via 483e044 s3: Convert cli_list_user_quota to cli_trans
via eb7db50 s3: Convert cli_set_user_quota to cli_trans
via e2a9671 s3: Convert cli_get_user_quota to cli_trans
via bc5554b s3: Fix some nonempty blank lines
via d920462 s3: Fix a C++ warning
via 674dcd6 s3: Remove cli_send_trans from cli_qpathinfo_alt_name
via fc8bfee s3: Remove cli_send_trans from cli_oem_change_password
from 7320f19 ldb: new ABI sigs file
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit d3abc90401c65e66de26cdfb2432ef023732dce7
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 21:13:29 2011 +0100
s3: Avoid a few calls to cli_errstr
Autobuild-User: Volker Lendecke <vlendec at samba.org>
Autobuild-Date: Mon Jan 17 08:47:25 CET 2011 on sn-devel-104
commit c7a5933e4b907d0dc50c01b299a5822392c86049
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 20:16:25 2011 +0100
s3: Remove some unused code
commit 6f3e11088c2783ccc5c7e785d3a67afb82e20db0
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 20:09:17 2011 +0100
s3: Convert cli_lock64 to cli_smb
commit dd2f234412a004ca8c259b60302f1aac42c3a882
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 20:04:17 2011 +0100
s3: Convert cli_lock to use cli_locktype
commit 0e2854f7433680b9b76002b0ff3d3b039661bd43
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 19:50:46 2011 +0100
s3: Convert cli_locktype to cli_smb
commit 7b054ecaed589ed4228fe5cd5680540f8fef201d
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 19:20:43 2011 +0100
s3: Make passing up "result_parent" from cli_smb optional
commit b33f1147a6074b547a908b6c07fe2d4679c36383
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 19:11:45 2011 +0100
s3: Remove unused cli_send_keepalive
commit 6e684c8460ed5be9347aec36bb51bd8c823a0565
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 13:13:20 2011 +0100
s3: Remove unused cli_send/receive_trans
commit cba5a26734686deeed4785eabd87d7608b3d90f4
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 13:12:16 2011 +0100
s3: Convert try_trans2 to cli_trans
commit 8ac68fc3cbff6acb9b780f01a61c2457555fd579
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 13:07:35 2011 +0100
s3: Convert cli_api to cli_trans
commit cb412d22eba8cdb81878628aa4bce3ca4591770f
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 12:56:09 2011 +0100
s3: Make cli_setpathinfo_basic use cli_setpathinfo
commit 21d5485e062e37f112ce82ab3ae4e73c53ce081d
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 12:49:59 2011 +0100
s3: Add cli_setpathinfo
commit 2068b96dce77735a9b93bee49b5750c574e79652
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 12:45:22 2011 +0100
s3: Rename cli_setpathinfo->cli_setpathinfo_basic
commit 2d44a0583b6e32849741d97ccac8bd0468d0e7e8
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 12:34:43 2011 +0100
s3: Remove unused cli_send/receive_nt_trans
commit d5decfbb260a6770e5023abada56dbe5d9e02e7b
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 12:33:24 2011 +0100
s3: Convert try_nttrans to cli_trans
commit 5dee39b5bf65faaf8695b72dfc6247ef4789ef49
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 12:26:45 2011 +0100
s3: Move dump_ntquota* to smbcquotas.c
commit a1f541723d40f95e7fff13e8c06a037306deccce
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 12:14:26 2011 +0100
s3: Convert cli_set_fs_quota_info to cli_trans
commit 797c027cc898a88ec7873a3d34908b09eb2e68ce
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 12:03:07 2011 +0100
s3: Convert cli_get_fs_quota_info to cli_trans
commit 483e0447f5afaf6ef6d636447f7759117039ac06
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 11:53:03 2011 +0100
s3: Convert cli_list_user_quota to cli_trans
commit eb7db50f60b96433c62ac7755b8ff771d4aa48ce
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 11:33:35 2011 +0100
s3: Convert cli_set_user_quota to cli_trans
commit e2a96711d708dd6df32bc68883a5bb0ef908a639
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 08:34:58 2011 +0100
s3: Convert cli_get_user_quota to cli_trans
commit bc5554bdcc9ece0e1f443653d87a541f74210fa0
Author: Volker Lendecke <vl at samba.org>
Date: Sat Jan 15 16:07:31 2011 +0100
s3: Fix some nonempty blank lines
commit d9204622e371f1f88be0f0d20c7365d440c616bc
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 9 19:54:33 2011 +0100
s3: Fix a C++ warning
commit 674dcd68a635c183a7cafb9547d2b2f1b0a24081
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 9 19:44:13 2011 +0100
s3: Remove cli_send_trans from cli_qpathinfo_alt_name
commit fc8bfeea31528b2842fdde22203d576fab8adb92
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 9 19:13:15 2011 +0100
s3: Remove cli_send_trans from cli_oem_change_password
-----------------------------------------------------------------------
Summary of changes:
source3/auth/auth_server.c | 6 +-
source3/client/smbspool.c | 16 +-
source3/include/proto.h | 55 ++---
source3/libsmb/clientgen.c | 21 +--
source3/libsmb/clifile.c | 209 ++++++--------
source3/libsmb/cliprint.c | 105 -------
source3/libsmb/cliquota.c | 448 ++++++++++------------------
source3/libsmb/clirap.c | 228 ++++++---------
source3/libsmb/clitrans.c | 672 ------------------------------------------
source3/libsmb/libsmb_file.c | 12 +-
source3/smbd/smb2_server.c | 2 +-
source3/torture/scanner.c | 113 ++++----
source3/utils/smbcacls.c | 2 +-
source3/utils/smbcquotas.c | 181 ++++++++++--
14 files changed, 590 insertions(+), 1480 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/auth/auth_server.c b/source3/auth/auth_server.c
index ac757d5..fc46ce0 100644
--- a/source3/auth/auth_server.c
+++ b/source3/auth/auth_server.c
@@ -135,11 +135,11 @@ static struct cli_state *server_cryptkey(TALLOC_CTX *mem_ctx)
this one...
*/
- if (!NT_STATUS_IS_OK(cli_session_setup(cli, "", "", 0, "", 0,
- ""))) {
+ status = cli_session_setup(cli, "", "", 0, "", 0, "");
+ if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(mutex);
DEBUG(0,("%s rejected the initial session setup (%s)\n",
- desthost, cli_errstr(cli)));
+ desthost, nt_errstr(status)));
cli_shutdown(cli);
return NULL;
}
diff --git a/source3/client/smbspool.c b/source3/client/smbspool.c
index 0804eb5..c80ad42 100644
--- a/source3/client/smbspool.c
+++ b/source3/client/smbspool.c
@@ -558,6 +558,7 @@ smb_print(struct cli_state * cli, /* I - SMB connection */
tbytes; /* Total bytes read */
char buffer[8192], /* Buffer for copy */
*ptr; /* Pointer into title */
+ NTSTATUS nt_status;
/*
@@ -574,10 +575,12 @@ smb_print(struct cli_state * cli, /* I - SMB connection */
* Open the printer device...
*/
- if (!NT_STATUS_IS_OK(cli_open(cli, title, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE, &fnum))) {
+ nt_status = cli_open(cli, title, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE,
+ &fnum);
+ if (!NT_STATUS_IS_OK(nt_status)) {
fprintf(stderr, "ERROR: %s opening remote spool %s\n",
- cli_errstr(cli), title);
- return (get_exit_code(cli, cli_nt_error(cli)));
+ nt_errstr(nt_status), title);
+ return get_exit_code(cli, nt_status);
}
/*
@@ -602,10 +605,11 @@ smb_print(struct cli_state * cli, /* I - SMB connection */
tbytes += nbytes;
}
- if (!NT_STATUS_IS_OK(cli_close(cli, fnum))) {
+ nt_status = cli_close(cli, fnum);
+ if (!NT_STATUS_IS_OK(nt_status)) {
fprintf(stderr, "ERROR: %s closing remote spool %s\n",
- cli_errstr(cli), title);
- return (get_exit_code(cli, cli_nt_error(cli)));
+ nt_errstr(nt_status), title);
+ return get_exit_code(cli, nt_status);
} else {
return (0);
}
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 0e66a52..f3ec4d1 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1746,7 +1746,6 @@ void cli_shutdown(struct cli_state *cli);
void cli_sockopt(struct cli_state *cli, const char *options);
uint16 cli_setpid(struct cli_state *cli, uint16 pid);
bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
-bool cli_send_keepalive(struct cli_state *cli);
struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
struct cli_state *cli, uint16_t num_echos,
DATA_BLOB data);
@@ -1786,6 +1785,11 @@ struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
uint8_t *data,
size_t data_len);
NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
+NTSTATUS cli_setpathinfo(struct cli_state *cli,
+ uint16_t level,
+ const char *path,
+ uint8_t *data,
+ size_t data_len);
struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
struct event_context *ev,
@@ -2247,20 +2251,21 @@ void cli_oplock_handler(struct cli_state *cli,
int cli_print_queue(struct cli_state *cli,
void (*fn)(struct print_job_info *));
int cli_printjob_del(struct cli_state *cli, int job);
-int cli_spl_open(struct cli_state *cli, const char *fname, int flags, int share_mode);
-bool cli_spl_close(struct cli_state *cli, uint16_t fnum);
/* The following definitions come from libsmb/cliquota.c */
NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
-bool cli_get_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
-bool cli_set_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
-bool cli_list_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_LIST **pqt_list);
-bool cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
-bool cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
-void dump_ntquota(SMB_NTQUOTA_STRUCT *qt, bool _verbose, bool _numeric, void (*_sidtostring)(fstring str, struct dom_sid *sid, bool _numeric));
-void dump_ntquota_list(SMB_NTQUOTA_LIST **qtl, bool _verbose, bool _numeric, void (*_sidtostring)(fstring str, struct dom_sid *sid, bool _numeric));
+NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
+ SMB_NTQUOTA_STRUCT *pqt);
+NTSTATUS cli_set_user_quota(struct cli_state *cli, int quota_fnum,
+ SMB_NTQUOTA_STRUCT *pqt);
+NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
+ SMB_NTQUOTA_LIST **pqt_list);
+NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
+ SMB_NTQUOTA_STRUCT *pqt);
+NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
+ SMB_NTQUOTA_STRUCT *pqt);
/* The following definitions come from libsmb/clirap.c */
@@ -2293,12 +2298,12 @@ NTSTATUS cli_qpathinfo1(struct cli_state *cli,
time_t *write_time,
SMB_OFF_T *size,
uint16 *mode);
-bool cli_setpathinfo(struct cli_state *cli, const char *fname,
- time_t create_time,
- time_t access_time,
- time_t write_time,
- time_t change_time,
- uint16 mode);
+NTSTATUS cli_setpathinfo_basic(struct cli_state *cli, const char *fname,
+ time_t create_time,
+ time_t access_time,
+ time_t write_time,
+ time_t change_time,
+ uint16 mode);
struct tevent_req *cli_qpathinfo2_send(TALLOC_CTX *mem_ctx,
struct event_context *ev,
struct cli_state *cli,
@@ -2580,24 +2585,6 @@ size_t clistr_align_out(struct cli_state *cli, const void *p, int flags);
/* The following definitions come from libsmb/clitrans.c */
-bool cli_send_trans(struct cli_state *cli, int trans,
- const char *pipe_name,
- int fid, int flags,
- uint16 *setup, unsigned int lsetup, unsigned int msetup,
- const char *param, unsigned int lparam, unsigned int mparam,
- const char *data, unsigned int ldata, unsigned int mdata);
-bool cli_receive_trans(struct cli_state *cli,int trans,
- char **param, unsigned int *param_len,
- char **data, unsigned int *data_len);
-bool cli_send_nt_trans(struct cli_state *cli,
- int function,
- int flags,
- uint16 *setup, unsigned int lsetup, unsigned int msetup,
- char *param, unsigned int lparam, unsigned int mparam,
- char *data, unsigned int ldata, unsigned int mdata);
-bool cli_receive_nt_trans(struct cli_state *cli,
- char **param, unsigned int *param_len,
- char **data, unsigned int *data_len);
struct tevent_req *cli_trans_send(
TALLOC_CTX *mem_ctx, struct event_context *ev,
struct cli_state *cli, uint8_t cmd,
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 2c49a8b..3816419 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -766,25 +766,6 @@ bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive)
return ret;
}
-/****************************************************************************
-Send a keepalive packet to the server
-****************************************************************************/
-
-bool cli_send_keepalive(struct cli_state *cli)
-{
- if (cli->fd == -1) {
- DEBUG(3, ("cli_send_keepalive: fd == -1\n"));
- return false;
- }
- if (!send_keepalive(cli->fd)) {
- close(cli->fd);
- cli->fd = -1;
- DEBUG(0,("Error sending keepalive packet to client.\n"));
- return false;
- }
- return true;
-}
-
struct cli_echo_state {
uint16_t vwv[1];
DATA_BLOB data;
@@ -973,7 +954,7 @@ NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
pnum_bytes, pbytes);
fail:
TALLOC_FREE(ev);
- if (NT_STATUS_IS_OK(status)) {
+ if (NT_STATUS_IS_OK(status) && (result_parent != NULL)) {
*result_parent = req;
}
return status;
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index 331777b..68dd6c8 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -3,17 +3,17 @@
client file operations
Copyright (C) Andrew Tridgell 1994-1998
Copyright (C) Jeremy Allison 2001-2009
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -205,6 +205,41 @@ NTSTATUS cli_setpathinfo_recv(struct tevent_req *req)
return tevent_req_simple_recv_ntstatus(req);
}
+NTSTATUS cli_setpathinfo(struct cli_state *cli,
+ uint16_t level,
+ const char *path,
+ uint8_t *data,
+ size_t data_len)
+{
+ TALLOC_CTX *frame = talloc_stackframe();
+ struct tevent_context *ev;
+ struct tevent_req *req;
+ NTSTATUS status = NT_STATUS_NO_MEMORY;
+
+ if (cli_has_async_calls(cli)) {
+ /*
+ * Can't use sync call while an async call is in flight
+ */
+ status = NT_STATUS_INVALID_PARAMETER;
+ goto fail;
+ }
+ ev = tevent_context_init(frame);
+ if (ev == NULL) {
+ goto fail;
+ }
+ req = cli_setpathinfo_send(ev, ev, cli, level, path, data, data_len);
+ if (req == NULL) {
+ goto fail;
+ }
+ if (!tevent_req_poll_ntstatus(req, ev, &status)) {
+ goto fail;
+ }
+ status = cli_setpathinfo_recv(req);
+ fail:
+ TALLOC_FREE(frame);
+ return status;
+}
+
/****************************************************************************
Hard/Symlink a file (UNIX extensions).
Creates new name (sym)linked to oldname.
@@ -2462,48 +2497,38 @@ NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
uint32_t offset, uint32_t len,
int timeout, unsigned char locktype)
{
- char *p;
- int saved_timeout = cli->timeout;
-
- memset(cli->outbuf,'\0',smb_size);
- memset(cli->inbuf,'\0', smb_size);
-
- cli_set_message(cli->outbuf,8,0,True);
-
- SCVAL(cli->outbuf,smb_com,SMBlockingX);
- SSVAL(cli->outbuf,smb_tid,cli->cnum);
- cli_setup_packet(cli);
-
- SCVAL(cli->outbuf,smb_vwv0,0xFF);
- SSVAL(cli->outbuf,smb_vwv2,fnum);
- SCVAL(cli->outbuf,smb_vwv3,locktype);
- SIVALS(cli->outbuf, smb_vwv4, timeout);
- SSVAL(cli->outbuf,smb_vwv6,0);
- SSVAL(cli->outbuf,smb_vwv7,1);
-
- p = smb_buf(cli->outbuf);
- SSVAL(p, 0, cli->pid);
- SIVAL(p, 2, offset);
- SIVAL(p, 6, len);
+ uint16_t vwv[8];
+ uint8_t bytes[10];
+ NTSTATUS status;
+ int saved_timeout;
- p += 10;
+ SCVAL(vwv + 0, 0, 0xff);
+ SCVAL(vwv + 0, 1, 0);
+ SSVAL(vwv + 1, 0, 0);
+ SSVAL(vwv + 2, 0, fnum);
+ SCVAL(vwv + 3, 0, locktype);
+ SCVAL(vwv + 3, 1, 0);
+ SIVALS(vwv + 4, 0, timeout);
+ SSVAL(vwv + 6, 0, 0);
+ SSVAL(vwv + 7, 0, 1);
- cli_setup_bcc(cli, p);
+ SSVAL(bytes, 0, cli->pid);
+ SIVAL(bytes, 2, offset);
+ SIVAL(bytes, 6, len);
- cli_send_smb(cli);
+ saved_timeout = cli->timeout;
if (timeout != 0) {
- cli->timeout = (timeout == -1) ? 0x7FFFFFFF : (timeout + 2*1000);
+ cli->timeout = (timeout == -1)
+ ? 0x7FFFFFFF : (timeout + 2*1000);
}
- if (!cli_receive_smb(cli)) {
- cli->timeout = saved_timeout;
- return NT_STATUS_UNSUCCESSFUL;
- }
+ status = cli_smb(talloc_tos(), cli, SMBlockingX, 0, 8, vwv,
+ 10, bytes, NULL, 0, NULL, NULL, NULL, NULL);
cli->timeout = saved_timeout;
- return cli_nt_error(cli);
+ return status;
}
/****************************************************************************
@@ -2512,54 +2537,15 @@ NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
****************************************************************************/
bool cli_lock(struct cli_state *cli, uint16_t fnum,
- uint32_t offset, uint32_t len, int timeout, enum brl_type lock_type)
+ uint32_t offset, uint32_t len, int timeout,
+ enum brl_type lock_type)
{
- char *p;
- int saved_timeout = cli->timeout;
-
- memset(cli->outbuf,'\0',smb_size);
- memset(cli->inbuf,'\0', smb_size);
-
- cli_set_message(cli->outbuf,8,0,True);
-
- SCVAL(cli->outbuf,smb_com,SMBlockingX);
- SSVAL(cli->outbuf,smb_tid,cli->cnum);
- cli_setup_packet(cli);
-
- SCVAL(cli->outbuf,smb_vwv0,0xFF);
- SSVAL(cli->outbuf,smb_vwv2,fnum);
- SCVAL(cli->outbuf,smb_vwv3,(lock_type == READ_LOCK? 1 : 0));
- SIVALS(cli->outbuf, smb_vwv4, timeout);
- SSVAL(cli->outbuf,smb_vwv6,0);
- SSVAL(cli->outbuf,smb_vwv7,1);
-
- p = smb_buf(cli->outbuf);
- SSVAL(p, 0, cli->pid);
- SIVAL(p, 2, offset);
- SIVAL(p, 6, len);
-
- p += 10;
-
- cli_setup_bcc(cli, p);
-
- cli_send_smb(cli);
-
- if (timeout != 0) {
- cli->timeout = (timeout == -1) ? 0x7FFFFFFF : (timeout*2 + 5*1000);
- }
-
- if (!cli_receive_smb(cli)) {
- cli->timeout = saved_timeout;
- return False;
- }
-
- cli->timeout = saved_timeout;
-
- if (cli_is_error(cli)) {
- return False;
- }
+ NTSTATUS status;
- return True;
+ status = cli_locktype(cli, fnum, offset, len, timeout,
+ (lock_type == READ_LOCK? 1 : 0));
+ cli_set_error(cli, status);
+ return NT_STATUS_IS_OK(status);
}
/****************************************************************************
@@ -2681,11 +2667,14 @@ NTSTATUS cli_unlock(struct cli_state *cli,
****************************************************************************/
bool cli_lock64(struct cli_state *cli, uint16_t fnum,
- uint64_t offset, uint64_t len, int timeout, enum brl_type lock_type)
+ uint64_t offset, uint64_t len, int timeout,
+ enum brl_type lock_type)
{
- char *p;
+ uint16_t vwv[8];
+ uint8_t bytes[20];
int saved_timeout = cli->timeout;
int ltype;
+ NTSTATUS status;
if (! (cli->capabilities & CAP_LARGE_FILES)) {
return cli_lock(cli, fnum, offset, len, timeout, lock_type);
@@ -2694,47 +2683,34 @@ bool cli_lock64(struct cli_state *cli, uint16_t fnum,
ltype = (lock_type == READ_LOCK? 1 : 0);
ltype |= LOCKING_ANDX_LARGE_FILES;
- memset(cli->outbuf,'\0',smb_size);
- memset(cli->inbuf,'\0', smb_size);
-
- cli_set_message(cli->outbuf,8,0,True);
-
- SCVAL(cli->outbuf,smb_com,SMBlockingX);
- SSVAL(cli->outbuf,smb_tid,cli->cnum);
- cli_setup_packet(cli);
+ SCVAL(vwv + 0, 0, 0xff);
+ SCVAL(vwv + 0, 1, 0);
+ SSVAL(vwv + 1, 0, 0);
+ SSVAL(vwv + 2, 0, fnum);
+ SCVAL(vwv + 3, 0, ltype);
+ SCVAL(vwv + 3, 1, 0);
+ SIVALS(vwv + 4, 0, timeout);
+ SSVAL(vwv + 6, 0, 0);
+ SSVAL(vwv + 7, 0, 1);
- SCVAL(cli->outbuf,smb_vwv0,0xFF);
- SSVAL(cli->outbuf,smb_vwv2,fnum);
- SCVAL(cli->outbuf,smb_vwv3,ltype);
- SIVALS(cli->outbuf, smb_vwv4, timeout);
- SSVAL(cli->outbuf,smb_vwv6,0);
- SSVAL(cli->outbuf,smb_vwv7,1);
+ SIVAL(bytes, 0, cli->pid);
+ SOFF_T_R(bytes, 4, offset);
+ SOFF_T_R(bytes, 12, len);
- p = smb_buf(cli->outbuf);
- SIVAL(p, 0, cli->pid);
- SOFF_T_R(p, 4, offset);
- SOFF_T_R(p, 12, len);
- p += 20;
-
- cli_setup_bcc(cli, p);
- cli_send_smb(cli);
+ saved_timeout = cli->timeout;
if (timeout != 0) {
- cli->timeout = (timeout == -1) ? 0x7FFFFFFF : (timeout + 5*1000);
+ cli->timeout = (timeout == -1)
+ ? 0x7FFFFFFF : (timeout + 2*1000);
}
- if (!cli_receive_smb(cli)) {
- cli->timeout = saved_timeout;
- return False;
- }
+ status = cli_smb(talloc_tos(), cli, SMBlockingX, 0, 8, vwv,
+ 20, bytes, NULL, 0, NULL, NULL, NULL, NULL);
cli->timeout = saved_timeout;
- if (cli_is_error(cli)) {
- return False;
- }
-
- return True;
+ cli_set_error(cli, status);
+ return NT_STATUS_IS_OK(status);
}
/****************************************************************************
@@ -4047,14 +4023,13 @@ NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA
{
uint16_t vwv[3];
NTSTATUS status;
- struct tevent_req *result_parent;
SSVAL(vwv+0, 0, fnum);
SSVAL(vwv+1, 0, code>>16);
SSVAL(vwv+2, 0, (code&0xFFFF));
status = cli_smb(talloc_tos(), cli, SMBioctl, 0, 3, vwv, 0, NULL,
- &result_parent, 0, NULL, NULL, NULL, NULL);
+ NULL, 0, NULL, NULL, NULL, NULL);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list