summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-05-26 10:48:12 +0200
committerStefan Metzmacher <metze@samba.org>2009-05-26 10:48:12 +0200
commitebc860ebeb7ebaeceae2534faeee49d062f29db8 (patch)
tree70fa4a839250cac4220958f8e23a0d0bd75cb443 /source3/smbd
parent31c6679bf12bbcd6626bfd5066bb2e751314e9c2 (diff)
downloadsamba-ebc860ebeb7ebaeceae2534faeee49d062f29db8.tar.gz
samba-ebc860ebeb7ebaeceae2534faeee49d062f29db8.tar.bz2
samba-ebc860ebeb7ebaeceae2534faeee49d062f29db8.zip
s3:smbd: move SMB1 specific stuff into a substructure of smbd_server_connection
metze
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/globals.h8
-rw-r--r--source3/smbd/process.c18
-rw-r--r--source3/smbd/reply.c4
-rw-r--r--source3/smbd/signing.c26
-rw-r--r--source3/smbd/smb2_server.c2
5 files changed, 30 insertions, 28 deletions
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index c6ab31dc36..fb733355d7 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -330,11 +330,13 @@ struct smbd_smb2_tcon {
};
struct smbd_server_connection {
- struct fd_event *fde;
- uint64_t num_requests;
- struct smb_signing_state *signing_state;
bool allow_smb2;
struct {
+ struct fd_event *fde;
+ uint64_t num_requests;
+ struct smb_signing_state *signing_state;
+ } smb1;
+ struct {
struct tevent_context *event_ctx;
struct tevent_queue *recv_queue;
struct tevent_queue *send_queue;
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 5cad8bfc9a..e014965147 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -1462,7 +1462,7 @@ static void process_smb(struct smbd_server_connection *conn,
trans_num++;
done:
- conn->num_requests++;
+ conn->smb1.num_requests++;
/* The timeout_processing function isn't run nearly
often enough to implement 'max log size' without
@@ -1471,7 +1471,7 @@ done:
level 10. Checking every 50 SMBs is a nice
tradeoff of performance vs log file size overrun. */
- if ((conn->num_requests % 50) == 0 &&
+ if ((conn->smb1.num_requests % 50) == 0 &&
need_to_check_log_size()) {
change_to_root_user();
check_log_size();
@@ -2158,13 +2158,13 @@ void smbd_process(void)
max_recv = MIN(lp_maxxmit(),BUFFER_SIZE);
- smbd_server_conn->fde = event_add_fd(smbd_event_context(),
- smbd_server_conn,
- smbd_server_fd(),
- EVENT_FD_READ,
- smbd_server_connection_handler,
- smbd_server_conn);
- if (!smbd_server_conn->fde) {
+ smbd_server_conn->smb1.fde = event_add_fd(smbd_event_context(),
+ smbd_server_conn,
+ smbd_server_fd(),
+ EVENT_FD_READ,
+ smbd_server_connection_handler,
+ smbd_server_conn);
+ if (!smbd_server_conn->smb1.fde) {
exit_server("failed to create smbd_server_connection fde");
}
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index d5ee918b82..a21c2cfca1 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -2893,7 +2893,7 @@ static void send_file_readbraw(connection_struct *conn,
if ( !req_is_in_chain(req) && (nread > 0) && (fsp->base_fsp == NULL) &&
(fsp->wcp == NULL) &&
- lp_use_sendfile(SNUM(conn), smbd_server_conn->signing_state) ) {
+ lp_use_sendfile(SNUM(conn), smbd_server_conn->smb1.signing_state) ) {
ssize_t sendfile_read = -1;
char header[4];
DATA_BLOB header_blob;
@@ -3412,7 +3412,7 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req,
if (!req_is_in_chain(req) &&
!is_encrypted_packet(req->inbuf) && (fsp->base_fsp == NULL) &&
(fsp->wcp == NULL) &&
- lp_use_sendfile(SNUM(conn), smbd_server_conn->signing_state) ) {
+ lp_use_sendfile(SNUM(conn), smbd_server_conn->smb1.signing_state) ) {
uint8 headerbuf[smb_size + 12 * 2];
DATA_BLOB header;
diff --git a/source3/smbd/signing.c b/source3/smbd/signing.c
index b56eb71f45..9b5e3452f9 100644
--- a/source3/smbd/signing.c
+++ b/source3/smbd/signing.c
@@ -35,8 +35,8 @@ bool srv_check_sign_mac(struct smbd_server_connection *conn,
return true;
}
- *seqnum = smb_signing_next_seqnum(conn->signing_state, false);
- return smb_signing_check_pdu(conn->signing_state,
+ *seqnum = smb_signing_next_seqnum(conn->smb1.signing_state, false);
+ return smb_signing_check_pdu(conn->smb1.signing_state,
(const uint8_t *)inbuf,
*seqnum);
}
@@ -53,7 +53,7 @@ void srv_calculate_sign_mac(struct smbd_server_connection *conn,
return;
}
- smb_signing_sign_pdu(conn->signing_state, (uint8_t *)outbuf, seqnum);
+ smb_signing_sign_pdu(conn->smb1.signing_state, (uint8_t *)outbuf, seqnum);
}
@@ -62,7 +62,7 @@ void srv_calculate_sign_mac(struct smbd_server_connection *conn,
************************************************************/
void srv_cancel_sign_response(struct smbd_server_connection *conn)
{
- smb_signing_cancel_reply(conn->signing_state, true);
+ smb_signing_cancel_reply(conn->smb1.signing_state, true);
}
/***********************************************************
@@ -87,9 +87,9 @@ bool srv_init_signing(struct smbd_server_connection *conn)
break;
}
- conn->signing_state = smb_signing_init(smbd_event_context(),
- allowed, mandatory);
- if (!conn->signing_state) {
+ conn->smb1.signing_state = smb_signing_init(smbd_event_context(),
+ allowed, mandatory);
+ if (!conn->smb1.signing_state) {
return false;
}
@@ -98,7 +98,7 @@ bool srv_init_signing(struct smbd_server_connection *conn)
void srv_set_signing_negotiated(struct smbd_server_connection *conn)
{
- smb_signing_set_negotiated(conn->signing_state);
+ smb_signing_set_negotiated(conn->smb1.signing_state);
}
/***********************************************************
@@ -108,7 +108,7 @@ void srv_set_signing_negotiated(struct smbd_server_connection *conn)
bool srv_is_signing_active(struct smbd_server_connection *conn)
{
- return smb_signing_is_active(conn->signing_state);
+ return smb_signing_is_active(conn->smb1.signing_state);
}
@@ -119,7 +119,7 @@ bool srv_is_signing_active(struct smbd_server_connection *conn)
bool srv_is_signing_negotiated(struct smbd_server_connection *conn)
{
- return smb_signing_is_negotiated(conn->signing_state);
+ return smb_signing_is_negotiated(conn->smb1.signing_state);
}
/***********************************************************
@@ -136,8 +136,8 @@ void srv_set_signing(struct smbd_server_connection *conn,
if (!user_session_key.length)
return;
- negotiated = smb_signing_is_negotiated(conn->signing_state);
- mandatory = smb_signing_is_mandatory(conn->signing_state);
+ negotiated = smb_signing_is_negotiated(conn->smb1.signing_state);
+ mandatory = smb_signing_is_mandatory(conn->smb1.signing_state);
if (!negotiated && !mandatory) {
DEBUG(5,("srv_set_signing: signing negotiated = %u, "
@@ -146,7 +146,7 @@ void srv_set_signing(struct smbd_server_connection *conn,
return;
}
- if (!smb_signing_activate(conn->signing_state,
+ if (!smb_signing_activate(conn->smb1.signing_state,
user_session_key, response)) {
return;
}
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index 562fc567cc..0d901714e0 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -41,7 +41,7 @@ static NTSTATUS smbd_initialize_smb2(struct smbd_server_connection *conn)
NTSTATUS status;
int ret;
- TALLOC_FREE(conn->fde);
+ TALLOC_FREE(conn->smb1.fde);
conn->smb2.event_ctx = smbd_event_context();