[SCM] Samba Shared Repository - branch master updated
Volker Lendecke
vlendec at samba.org
Thu Oct 14 06:36:02 MDT 2010
The branch, master has been updated
via c2533f9 s3: Remove smbd_server_conn from construct_reply
via 63e08ef s3: Lift smbd_server_conn from receive_smb_talloc
via a2db154 s3: Lift smbd_server_conn from receive_smb_raw_talloc
via fa0de39 s3: Lift smbd_server_conn from receive_smb_raw_talloc_partial_read
via cac60a7 s3: Remove some explicit smbd_server_conn refs in process_smb()
via 81bdb59 s3: Rename "conn" to the more used "sconn" in process_smb()
from 9a3810f s4:samldb LDB module - attempt to fix integer handling on big-endian platforms
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit c2533f94b561e9b22d621b7515c6606d39ffec89
Author: Volker Lendecke <vl at samba.org>
Date: Sun Oct 3 18:16:21 2010 +0200
s3: Remove smbd_server_conn from construct_reply
Autobuild-User: Volker Lendecke <vlendec at samba.org>
Autobuild-Date: Thu Oct 14 12:35:07 UTC 2010 on sn-devel-104
commit 63e08ef8854bd9bde940fee774e94a6749825008
Author: Volker Lendecke <vl at samba.org>
Date: Sun Oct 3 18:13:39 2010 +0200
s3: Lift smbd_server_conn from receive_smb_talloc
commit a2db154caa104c9606e343391ff9ffe33f1610a7
Author: Volker Lendecke <vl at samba.org>
Date: Sun Oct 3 18:11:37 2010 +0200
s3: Lift smbd_server_conn from receive_smb_raw_talloc
commit fa0de39551323bbc57998956de1be382e1f20134
Author: Volker Lendecke <vl at samba.org>
Date: Sun Oct 3 18:08:51 2010 +0200
s3: Lift smbd_server_conn from receive_smb_raw_talloc_partial_read
commit cac60a7041f0c37246f26f71c3c868e2adf5dc20
Author: Volker Lendecke <vl at samba.org>
Date: Sun Oct 3 18:05:17 2010 +0200
s3: Remove some explicit smbd_server_conn refs in process_smb()
commit 81bdb5910c8f84bd9e83c76a78370884e8f638f8
Author: Volker Lendecke <vl at samba.org>
Date: Sun Oct 3 18:04:05 2010 +0200
s3: Rename "conn" to the more used "sconn" in process_smb()
-----------------------------------------------------------------------
Summary of changes:
source3/smbd/process.c | 77 +++++++++++++++++++++++++-----------------------
1 files changed, 40 insertions(+), 37 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 763ee56..ff2b8fc 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -244,7 +244,8 @@ static NTSTATUS read_packet_remainder(int fd, char *buffer,
static NTSTATUS receive_smb_raw_talloc_partial_read(TALLOC_CTX *mem_ctx,
const char lenbuf[4],
- int fd, char **buffer,
+ struct smbd_server_connection *sconn,
+ char **buffer,
unsigned int timeout,
size_t *p_unread,
size_t *len_ret)
@@ -258,16 +259,14 @@ static NTSTATUS receive_smb_raw_talloc_partial_read(TALLOC_CTX *mem_ctx,
memcpy(writeX_header, lenbuf, 4);
status = read_fd_with_timeout(
- fd, writeX_header + 4,
+ sconn->sock, writeX_header + 4,
STANDARD_WRITE_AND_X_HEADER_SIZE,
STANDARD_WRITE_AND_X_HEADER_SIZE,
timeout, NULL);
if (!NT_STATUS_IS_OK(status)) {
- char addr[INET6_ADDRSTRLEN];
DEBUG(0, ("read_fd_with_timeout failed for client %s read "
- "error = %s.\n",
- get_peer_addr(fd, addr, sizeof(addr)),
+ "error = %s.\n", sconn->client_id.addr,
nt_errstr(status)));
return status;
}
@@ -277,8 +276,7 @@ static NTSTATUS receive_smb_raw_talloc_partial_read(TALLOC_CTX *mem_ctx,
* valid writeX call.
*/
- if (is_valid_writeX_buffer(smbd_server_conn,
- (uint8_t *)writeX_header)) {
+ if (is_valid_writeX_buffer(sconn, (uint8_t *)writeX_header)) {
/*
* If the data offset is beyond what
* we've read, drain the extra bytes.
@@ -288,7 +286,7 @@ static NTSTATUS receive_smb_raw_talloc_partial_read(TALLOC_CTX *mem_ctx,
if (doff > STANDARD_WRITE_AND_X_HEADER_SIZE) {
size_t drain = doff - STANDARD_WRITE_AND_X_HEADER_SIZE;
- if (drain_socket(fd, drain) != drain) {
+ if (drain_socket(sconn->sock, drain) != drain) {
smb_panic("receive_smb_raw_talloc_partial_read:"
" failed to drain pending bytes");
}
@@ -343,7 +341,8 @@ static NTSTATUS receive_smb_raw_talloc_partial_read(TALLOC_CTX *mem_ctx,
if(toread > 0) {
status = read_packet_remainder(
- fd, (*buffer) + 4 + STANDARD_WRITE_AND_X_HEADER_SIZE,
+ sconn->sock,
+ (*buffer) + 4 + STANDARD_WRITE_AND_X_HEADER_SIZE,
timeout, toread);
if (!NT_STATUS_IS_OK(status)) {
@@ -357,7 +356,8 @@ static NTSTATUS receive_smb_raw_talloc_partial_read(TALLOC_CTX *mem_ctx,
return NT_STATUS_OK;
}
-static NTSTATUS receive_smb_raw_talloc(TALLOC_CTX *mem_ctx, int fd,
+static NTSTATUS receive_smb_raw_talloc(TALLOC_CTX *mem_ctx,
+ struct smbd_server_connection *sconn,
char **buffer, unsigned int timeout,
size_t *p_unread, size_t *plen)
{
@@ -368,7 +368,8 @@ static NTSTATUS receive_smb_raw_talloc(TALLOC_CTX *mem_ctx, int fd,
*p_unread = 0;
- status = read_smb_length_return_keepalive(fd, lenbuf, timeout, &len);
+ status = read_smb_length_return_keepalive(sconn->sock, lenbuf, timeout,
+ &len);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -376,11 +377,12 @@ static NTSTATUS receive_smb_raw_talloc(TALLOC_CTX *mem_ctx, int fd,
if (CVAL(lenbuf,0) == 0 && min_recv_size &&
(smb_len_large(lenbuf) > /* Could be a UNIX large writeX. */
(min_recv_size + STANDARD_WRITE_AND_X_HEADER_SIZE)) &&
- !srv_is_signing_active(smbd_server_conn) &&
- smbd_server_conn->smb1.echo_handler.trusted_fde == NULL) {
+ !srv_is_signing_active(sconn) &&
+ sconn->smb1.echo_handler.trusted_fde == NULL) {
return receive_smb_raw_talloc_partial_read(
- mem_ctx, lenbuf, fd, buffer, timeout, p_unread, plen);
+ mem_ctx, lenbuf, sconn, buffer, timeout,
+ p_unread, plen);
}
if (!valid_packet_size(len)) {
@@ -401,7 +403,7 @@ static NTSTATUS receive_smb_raw_talloc(TALLOC_CTX *mem_ctx, int fd,
memcpy(*buffer, lenbuf, sizeof(lenbuf));
- status = read_packet_remainder(fd, (*buffer)+4, timeout, len);
+ status = read_packet_remainder(sconn->sock, (*buffer)+4, timeout, len);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -410,7 +412,8 @@ static NTSTATUS receive_smb_raw_talloc(TALLOC_CTX *mem_ctx, int fd,
return NT_STATUS_OK;
}
-static NTSTATUS receive_smb_talloc(TALLOC_CTX *mem_ctx, int fd,
+static NTSTATUS receive_smb_talloc(TALLOC_CTX *mem_ctx,
+ struct smbd_server_connection *sconn,
char **buffer, unsigned int timeout,
size_t *p_unread, bool *p_encrypted,
size_t *p_len,
@@ -422,14 +425,12 @@ static NTSTATUS receive_smb_talloc(TALLOC_CTX *mem_ctx, int fd,
*p_encrypted = false;
- status = receive_smb_raw_talloc(mem_ctx, fd, buffer, timeout,
+ status = receive_smb_raw_talloc(mem_ctx, sconn, buffer, timeout,
p_unread, &len);
if (!NT_STATUS_IS_OK(status)) {
- char addr[INET6_ADDRSTRLEN];
DEBUG(1, ("read_smb_length_return_keepalive failed for "
"client %s read error = %s.\n",
- get_peer_addr(fd, addr, sizeof(addr)),
- nt_errstr(status)));
+ sconn->client_id.addr, nt_errstr(status)));
return status;
}
@@ -445,7 +446,7 @@ static NTSTATUS receive_smb_talloc(TALLOC_CTX *mem_ctx, int fd,
}
/* Check the incoming SMB signature. */
- if (!srv_check_sign_mac(smbd_server_conn, *buffer, seqnum, trusted_channel)) {
+ if (!srv_check_sign_mac(sconn, *buffer, seqnum, trusted_channel)) {
DEBUG(0, ("receive_smb: SMB Signature verification failed on "
"incoming packet!\n"));
return NT_STATUS_INVALID_NETWORK_RESPONSE;
@@ -1569,7 +1570,8 @@ static connection_struct *switch_message(uint8 type, struct smb_request *req, in
Construct a reply to the incoming packet.
****************************************************************************/
-static void construct_reply(char *inbuf, int size, size_t unread_bytes,
+static void construct_reply(struct smbd_server_connection *sconn,
+ char *inbuf, int size, size_t unread_bytes,
uint32_t seqnum, bool encrypted,
struct smb_perfcount_data *deferred_pcd)
{
@@ -1580,8 +1582,8 @@ static void construct_reply(char *inbuf, int size, size_t unread_bytes,
smb_panic("could not allocate smb_request");
}
- if (!init_smb_request(req, smbd_server_conn, (uint8 *)inbuf,
- unread_bytes, encrypted, seqnum)) {
+ if (!init_smb_request(req, sconn, (uint8 *)inbuf, unread_bytes,
+ encrypted, seqnum)) {
exit_server_cleanly("Invalid SMB request");
}
@@ -1636,7 +1638,7 @@ static void construct_reply(char *inbuf, int size, size_t unread_bytes,
/****************************************************************************
Process an smb from the client
****************************************************************************/
-static void process_smb(struct smbd_server_connection *conn,
+static void process_smb(struct smbd_server_connection *sconn,
uint8_t *inbuf, size_t nread, size_t unread_bytes,
uint32_t seqnum, bool encrypted,
struct smb_perfcount_data *deferred_pcd)
@@ -1648,37 +1650,38 @@ static void process_smb(struct smbd_server_connection *conn,
DEBUG( 6, ( "got message type 0x%x of len 0x%x\n", msg_type,
smb_len(inbuf) ) );
DEBUG(3, ("Transaction %d of length %d (%u toread)\n",
- conn->trans_num, (int)nread, (unsigned int)unread_bytes));
+ sconn->trans_num, (int)nread, (unsigned int)unread_bytes));
if (msg_type != 0) {
/*
* NetBIOS session request, keepalive, etc.
*/
- reply_special(conn, (char *)inbuf, nread);
+ reply_special(sconn, (char *)inbuf, nread);
goto done;
}
- if (smbd_server_conn->using_smb2) {
+ if (sconn->using_smb2) {
/* At this point we're not really using smb2,
* we make the decision here.. */
if (smbd_is_smb2_header(inbuf, nread)) {
- smbd_smb2_first_negprot(smbd_server_conn, inbuf, nread);
+ smbd_smb2_first_negprot(sconn, inbuf, nread);
return;
} else if (nread >= smb_size && valid_smb_header(inbuf)
&& CVAL(inbuf, smb_com) != 0x72) {
/* This is a non-negprot SMB1 packet.
Disable SMB2 from now on. */
- smbd_server_conn->using_smb2 = false;
+ sconn->using_smb2 = false;
}
}
show_msg((char *)inbuf);
- construct_reply((char *)inbuf,nread,unread_bytes,seqnum,encrypted,deferred_pcd);
- conn->trans_num++;
+ construct_reply(sconn, (char *)inbuf, nread, unread_bytes, seqnum,
+ encrypted, deferred_pcd);
+ sconn->trans_num++;
done:
- conn->smb1.num_requests++;
+ sconn->smb1.num_requests++;
/* The timeout_processing function isn't run nearly
often enough to implement 'max log size' without
@@ -1687,7 +1690,7 @@ done:
level 10. Checking every 50 SMBs is a nice
tradeoff of performance vs log file size overrun. */
- if ((conn->smb1.num_requests % 50) == 0 &&
+ if ((sconn->smb1.num_requests % 50) == 0 &&
need_to_check_log_size()) {
change_to_root_user();
check_log_size();
@@ -2301,7 +2304,7 @@ static void smbd_server_connection_read_handler(
}
/* TODO: make this completely nonblocking */
- status = receive_smb_talloc(mem_ctx, fd,
+ status = receive_smb_talloc(mem_ctx, conn,
(char **)(void *)&inbuf,
0, /* timeout */
&unread_bytes,
@@ -2311,7 +2314,7 @@ static void smbd_server_connection_read_handler(
smbd_unlock_socket(conn);
} else {
/* TODO: make this completely nonblocking */
- status = receive_smb_talloc(mem_ctx, fd,
+ status = receive_smb_talloc(mem_ctx, conn,
(char **)(void *)&inbuf,
0, /* timeout */
&unread_bytes,
@@ -2733,7 +2736,7 @@ static void smbd_echo_reader(struct tevent_context *ev,
DEBUG(10,("echo_handler[%d]: reading pdu\n", (int)sys_getpid()));
- status = receive_smb_talloc(state->pending, sconn->sock,
+ status = receive_smb_talloc(state->pending, sconn,
(char **)(void *)&state->pending[num_pending].iov_base,
0 /* timeout */,
&unread,
--
Samba Shared Repository
More information about the samba-cvs
mailing list