summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-02-28 14:04:54 +0100
committerVolker Lendecke <vl@samba.org>2008-02-28 14:20:17 +0100
commitbe4a76a861f3a152f1d1aebf937b06e1628f2d55 (patch)
treee75e6a6059f2e9486c85df929a85c11f828d1e98
parent57a9fba097a5f5af7833eaf4355667dbfacaec43 (diff)
downloadsamba-be4a76a861f3a152f1d1aebf937b06e1628f2d55.tar.gz
samba-be4a76a861f3a152f1d1aebf937b06e1628f2d55.tar.bz2
samba-be4a76a861f3a152f1d1aebf937b06e1628f2d55.zip
Add cli_setup_packet_buf
This is == cli_setup_packet but takes an explicit buffer argument (This used to be commit f64b46dc278899c3449cfd3dbb614aadcf5614d3)
-rw-r--r--source3/libsmb/clientgen.c54
1 files changed, 32 insertions, 22 deletions
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 592f050e90..64191239d3 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -450,31 +450,41 @@ bool cli_send_smb_direct_writeX(struct cli_state *cli,
Setup basics in a outgoing packet.
****************************************************************************/
-void cli_setup_packet(struct cli_state *cli)
+void cli_setup_packet_buf(struct cli_state *cli, char *buf)
{
+ uint16 flags2;
cli->rap_error = 0;
- SSVAL(cli->outbuf,smb_pid,cli->pid);
- SSVAL(cli->outbuf,smb_uid,cli->vuid);
- SSVAL(cli->outbuf,smb_mid,cli->mid);
- if (cli->protocol > PROTOCOL_CORE) {
- uint16 flags2;
- if (cli->case_sensitive) {
- SCVAL(cli->outbuf,smb_flg,0x0);
- } else {
- /* Default setting, case insensitive. */
- SCVAL(cli->outbuf,smb_flg,0x8);
- }
- flags2 = FLAGS2_LONG_PATH_COMPONENTS;
- if (cli->capabilities & CAP_UNICODE)
- flags2 |= FLAGS2_UNICODE_STRINGS;
- if ((cli->capabilities & CAP_DFS) && cli->dfsroot)
- flags2 |= FLAGS2_DFS_PATHNAMES;
- if (cli->capabilities & CAP_STATUS32)
- flags2 |= FLAGS2_32_BIT_ERROR_CODES;
- if (cli->use_spnego)
- flags2 |= FLAGS2_EXTENDED_SECURITY;
- SSVAL(cli->outbuf,smb_flg2, flags2);
+ SIVAL(buf,smb_rcls,0);
+ SSVAL(buf,smb_pid,cli->pid);
+ memset(buf+smb_pidhigh, 0, 12);
+ SSVAL(buf,smb_uid,cli->vuid);
+ SSVAL(buf,smb_mid,cli->mid);
+
+ if (cli->protocol <= PROTOCOL_CORE) {
+ return;
+ }
+
+ if (cli->case_sensitive) {
+ SCVAL(buf,smb_flg,0x0);
+ } else {
+ /* Default setting, case insensitive. */
+ SCVAL(buf,smb_flg,0x8);
}
+ flags2 = FLAGS2_LONG_PATH_COMPONENTS;
+ if (cli->capabilities & CAP_UNICODE)
+ flags2 |= FLAGS2_UNICODE_STRINGS;
+ if ((cli->capabilities & CAP_DFS) && cli->dfsroot)
+ flags2 |= FLAGS2_DFS_PATHNAMES;
+ if (cli->capabilities & CAP_STATUS32)
+ flags2 |= FLAGS2_32_BIT_ERROR_CODES;
+ if (cli->use_spnego)
+ flags2 |= FLAGS2_EXTENDED_SECURITY;
+ SSVAL(buf,smb_flg2, flags2);
+}
+
+void cli_setup_packet(struct cli_state *cli)
+{
+ cli_setup_packet_buf(cli, cli->outbuf);
}
/****************************************************************************