[SCM] Samba Shared Repository - branch v3-6-test updated
Volker Lendecke
vlendec at samba.org
Mon Jan 17 01:46:05 MST 2011
The branch, v3-6-test has been updated
via 7d63763 s3: Avoid a few calls to cli_errstr
via 4e21d00 s3: Remove some unused code
via 7ce911f s3: Convert cli_lock64 to cli_smb
via 9b0054a s3: Convert cli_lock to use cli_locktype
via 59c9d39 s3: Convert cli_locktype to cli_smb
via 7e12286 s3: Make passing up "result_parent" from cli_smb optional
via 691c608 s3: Remove unused cli_send_keepalive
via 7e59340 s3: Remove unused cli_send/receive_trans
via bcc286d s3: Convert try_trans2 to cli_trans
via 1f8e986 s3: Convert cli_api to cli_trans
via 9af4f33 s3: Make cli_setpathinfo_basic use cli_setpathinfo
via 1153ee0 s3: Add cli_setpathinfo
via abe22e6 s3: Rename cli_setpathinfo->cli_setpathinfo_basic
via 5462da8 s3: Remove unused cli_send/receive_nt_trans
via 7b21fbc s3: Convert try_nttrans to cli_trans
via 54cde57 s3: Move dump_ntquota* to smbcquotas.c
via b5a3820 s3: Convert cli_set_fs_quota_info to cli_trans
via 06dce8e s3: Convert cli_get_fs_quota_info to cli_trans
via 1e62f0d s3: Convert cli_list_user_quota to cli_trans
via c846268 s3: Convert cli_set_user_quota to cli_trans
via ea90955 s3: Convert cli_get_user_quota to cli_trans
via d064806 s3: Fix some nonempty blank lines
via d0b7a48 s3: Fix a C++ warning
via 54c60f0 s3: Remove cli_send_trans from cli_qpathinfo_alt_name
via aa1fa27 s3: Remove cli_send_trans from cli_oem_change_password
from 313b42a s3: Avoid some calls to cli_errstr
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test
- Log -----------------------------------------------------------------
commit 7d637632dff47f11dd291930779c1b1514c4fe54
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 4e21d00e9495fdeceb7960adca6b7fc43304b457
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 20:16:25 2011 +0100
s3: Remove some unused code
commit 7ce911f8675aa20549985a2d6d30a40c4c11622b
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 20:09:17 2011 +0100
s3: Convert cli_lock64 to cli_smb
commit 9b0054a615b56ae53154f1f8adc1c039208140f2
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 59c9d390987ad8dc6205cff0504b623a91445983
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 19:50:46 2011 +0100
s3: Convert cli_locktype to cli_smb
commit 7e12286d299bca07e3c9fa64c38e48de18b65cd2
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 691c60812495033e4bca0ef7bcd225a29a41ffe9
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 19:11:45 2011 +0100
s3: Remove unused cli_send_keepalive
commit 7e59340d7c472c196d5a63363478fd9d5b739a83
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 13:13:20 2011 +0100
s3: Remove unused cli_send/receive_trans
commit bcc286d5170c03727d92c71134fd4b91cd3c87d4
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 13:12:16 2011 +0100
s3: Convert try_trans2 to cli_trans
commit 1f8e986577bf5737eba7b6f49ec905ec5e853fc4
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 13:07:35 2011 +0100
s3: Convert cli_api to cli_trans
commit 9af4f3333262a0d846afb75827f2626edb3e11f8
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 1153ee0197deb9f15353484a098d24f8e709da22
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 12:49:59 2011 +0100
s3: Add cli_setpathinfo
commit abe22e6772cdcc400d60c020e58ae420c171c08f
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 12:45:22 2011 +0100
s3: Rename cli_setpathinfo->cli_setpathinfo_basic
commit 5462da80a2df8e1e498bc7fd63ae31ca5c0da1cd
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 7b21fbc91ddf5aeffa0d5cb3d93bd3ee91283c37
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 12:33:24 2011 +0100
s3: Convert try_nttrans to cli_trans
commit 54cde57c03d54b40886486da0076adf9b2adc834
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 16 12:26:45 2011 +0100
s3: Move dump_ntquota* to smbcquotas.c
commit b5a3820b25793c07a0b90b9a69eadc03b56c0184
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 06dce8e1ffc5e30512897623e9a7ef10d665bf8c
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 1e62f0d81e117d4a132f81d03532a6b6dedee83d
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 c8462682d7b426c658aeea5277e85c4cc99e90f7
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 ea909554fedf370175c06e2dc362fbface3897e5
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 d0648065581e9ec1901e93a05ff5f0384f9cc936
Author: Volker Lendecke <vl at samba.org>
Date: Sat Jan 15 16:07:31 2011 +0100
s3: Fix some nonempty blank lines
commit d0b7a481cf0e46fd741000eff08cf8e673278a17
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 9 19:54:33 2011 +0100
s3: Fix a C++ warning
commit 54c60f00c490d157903226df9b99dec4b572d3dc
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 aa1fa272e51d67d4affc1f44278e1c6da2049db4
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/smbcquotas.c | 181 ++++++++++--
13 files changed, 589 insertions(+), 1479 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