summaryrefslogtreecommitdiff
path: root/libcli/smb
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-09-07 19:07:51 +0200
committerStefan Metzmacher <metze@samba.org>2011-11-24 19:02:30 +0100
commit5e7cf194d2d25787e3af807a3a37f570ce5298dc (patch)
tree2cda9325798897a101a1d415135f3d8326ffeef9 /libcli/smb
parent2a570e6305715dd4d64947ce5d702e227916f33b (diff)
downloadsamba-5e7cf194d2d25787e3af807a3a37f570ce5298dc.tar.gz
samba-5e7cf194d2d25787e3af807a3a37f570ce5298dc.tar.bz2
samba-5e7cf194d2d25787e3af807a3a37f570ce5298dc.zip
smbXcli: split out a smb1cli_req_flags() function
metze
Diffstat (limited to 'libcli/smb')
-rw-r--r--libcli/smb/smbXcli_base.c81
1 files changed, 55 insertions, 26 deletions
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index ed5f5a5776..22bd34175e 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -737,6 +737,52 @@ static uint8_t *smbXcli_iov_concat(TALLOC_CTX *mem_ctx,
return buf;
}
+static void smb1cli_req_flags(enum protocol_types protocol,
+ uint32_t smb1_capabilities,
+ uint8_t smb_command,
+ uint8_t additional_flags,
+ uint8_t clear_flags,
+ uint8_t *_flags,
+ uint16_t additional_flags2,
+ uint16_t clear_flags2,
+ uint16_t *_flags2)
+{
+ uint8_t flags = 0;
+ uint16_t flags2 = 0;
+
+ if (protocol >= PROTOCOL_LANMAN1) {
+ flags |= FLAG_CASELESS_PATHNAMES;
+ flags |= FLAG_CANONICAL_PATHNAMES;
+ }
+
+ if (protocol >= PROTOCOL_LANMAN2) {
+ flags2 |= FLAGS2_LONG_PATH_COMPONENTS;
+ flags2 |= FLAGS2_EXTENDED_ATTRIBUTES;
+ }
+
+ if (protocol >= PROTOCOL_NT1) {
+ flags2 |= FLAGS2_IS_LONG_NAME;
+
+ if (smb1_capabilities & CAP_UNICODE) {
+ flags2 |= FLAGS2_UNICODE_STRINGS;
+ }
+ if (smb1_capabilities & CAP_STATUS32) {
+ flags2 |= FLAGS2_32_BIT_ERROR_CODES;
+ }
+ if (smb1_capabilities & CAP_EXTENDED_SECURITY) {
+ flags2 |= FLAGS2_EXTENDED_SECURITY;
+ }
+ }
+
+ flags |= additional_flags;
+ flags &= ~clear_flags;
+ flags2 |= additional_flags2;
+ flags2 &= ~clear_flags2;
+
+ *_flags = flags;
+ *_flags2 = flags2;
+}
+
struct tevent_req *smb1cli_req_create(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct smbXcli_conn *conn,
@@ -773,32 +819,15 @@ struct tevent_req *smb1cli_req_create(TALLOC_CTX *mem_ctx,
state->ev = ev;
state->conn = conn;
- if (conn->protocol >= PROTOCOL_LANMAN1) {
- flags |= FLAG_CASELESS_PATHNAMES;
- flags |= FLAG_CANONICAL_PATHNAMES;
- }
-
- if (conn->protocol >= PROTOCOL_LANMAN2) {
- flags2 |= FLAGS2_LONG_PATH_COMPONENTS;
- flags2 |= FLAGS2_EXTENDED_ATTRIBUTES;
- }
-
- if (conn->protocol >= PROTOCOL_NT1) {
- if (conn->smb1.capabilities & CAP_UNICODE) {
- flags2 |= FLAGS2_UNICODE_STRINGS;
- }
- if (conn->smb1.capabilities & CAP_STATUS32) {
- flags2 |= FLAGS2_32_BIT_ERROR_CODES;
- }
- if (conn->smb1.capabilities & CAP_EXTENDED_SECURITY) {
- flags2 |= FLAGS2_EXTENDED_SECURITY;
- }
- }
-
- flags |= additional_flags;
- flags &= ~clear_flags;
- flags2 |= additional_flags2;
- flags2 &= ~clear_flags2;
+ smb1cli_req_flags(conn->protocol,
+ conn->smb1.capabilities,
+ smb_command,
+ additional_flags,
+ clear_flags,
+ &flags,
+ additional_flags2,
+ clear_flags2,
+ &flags2);
SIVAL(state->smb1.hdr, 0, SMB_MAGIC);
SCVAL(state->smb1.hdr, HDR_COM, smb_command);