[SCM] Samba Shared Repository - branch v3-2-test updated -
release-3-2-0pre2-160-g26d64d2
Volker Lendecke
vlendec at samba.org
Sat Mar 8 21:48:38 GMT 2008
The branch, v3-2-test has been updated
via 26d64d22d65938023a4e45c3893e7021e51f4d9c (commit)
via f556c9e162e2bc0d16710e994a00edc33a146cd5 (commit)
via 0aa195b5d623e1f26f2a1b9e91323a5ddd3ff282 (commit)
via eb8b6f2404e49d6a837935c5b411d78fb6ff23ef (commit)
via cfa1b838144800c0758969921b8904fd62e46c07 (commit)
via fdf4cd99ccb59e126391253d2091707bc8daee43 (commit)
from 85007cf3f2e3df67c524cc67442396c114f6b784 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test
- Log -----------------------------------------------------------------
commit 26d64d22d65938023a4e45c3893e7021e51f4d9c
Author: Volker Lendecke <vl at samba.org>
Date: Sat Mar 8 22:29:35 2008 +0100
Print out the used seed in smbtorture
commit f556c9e162e2bc0d16710e994a00edc33a146cd5
Author: Volker Lendecke <vl at samba.org>
Date: Sat Mar 8 22:28:01 2008 +0100
Correctly calculate the max read size
commit 0aa195b5d623e1f26f2a1b9e91323a5ddd3ff282
Author: Volker Lendecke <vl at samba.org>
Date: Fri Mar 7 15:03:20 2008 +0100
Move inbuf handling to before the PDU handling
In an error case, correctly discard the offending PDU
commit eb8b6f2404e49d6a837935c5b411d78fb6ff23ef
Author: Volker Lendecke <vl at samba.org>
Date: Sun Mar 2 09:43:19 2008 +0100
Pass specific packets to build_nmb and build_dgram
To me it was not clear what parts of struct packet_struct are actually used in
build_packet(). This makes it a bit more clear that only the specific parts are
used.
commit cfa1b838144800c0758969921b8904fd62e46c07
Author: Volker Lendecke <vl at samba.org>
Date: Sat Mar 1 19:54:17 2008 +0100
Fix some typos
commit fdf4cd99ccb59e126391253d2091707bc8daee43
Author: Volker Lendecke <vl at samba.org>
Date: Sat Mar 1 10:22:04 2008 +0100
Build aio_fork by default
... only when --with-aio-support and we can pass file descriptors
-----------------------------------------------------------------------
Summary of changes:
source/configure.in | 7 +++
source/libsmb/async_smb.c | 117 +++++++++++++++++++++---------------------
source/libsmb/clireadwrite.c | 2 +-
source/libsmb/nmblib.c | 10 ++--
source/libsmb/unexpected.c | 4 +-
source/smbd/trans2.c | 2 +-
source/torture/torture.c | 9 ++-
7 files changed, 80 insertions(+), 71 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/configure.in b/source/configure.in
index f884d93..2e6c109 100644
--- a/source/configure.in
+++ b/source/configure.in
@@ -5341,6 +5341,13 @@ int main() { struct aiocb a; return aio_suspend64(&a, 1, NULL); }],
AC_MSG_RESULT(no)
)
+if test x"$samba_cv_HAVE_AIO" = x"yes"; then
+ if test x"$samba_cv_msghdr_msg_control" = x"yes" -o \
+ x"$samba_cv_msghdr_msg_acctright" = x"yes"; then
+ default_shared_modules="$default_shared_modules vfs_aio_fork"
+ fi
+fi
+
#################################################
# check for sendfile support
diff --git a/source/libsmb/async_smb.c b/source/libsmb/async_smb.c
index 21bcd5b..04c22a9 100644
--- a/source/libsmb/async_smb.c
+++ b/source/libsmb/async_smb.c
@@ -174,24 +174,72 @@ static void handle_incoming_pdu(struct cli_state *cli)
{
struct cli_request *req;
uint16_t mid;
- size_t raw_pdu_len, buf_len, pdu_len;
- size_t rest_len;
+ size_t raw_pdu_len, buf_len, pdu_len, rest_len;
+ char *pdu;
NTSTATUS status;
/*
* The encrypted PDU len might differ from the unencrypted one
*/
raw_pdu_len = smb_len(cli->evt_inbuf) + 4;
+ buf_len = talloc_get_size(cli->evt_inbuf);
+ rest_len = buf_len - raw_pdu_len;
+
+ if (buf_len == raw_pdu_len) {
+ /*
+ * Optimal case: Exactly one PDU was in the socket buffer
+ */
+ pdu = cli->evt_inbuf;
+ cli->evt_inbuf = NULL;
+ }
+ else {
+ DEBUG(11, ("buf_len = %d, raw_pdu_len = %d, splitting "
+ "buffer\n", (int)buf_len, (int)raw_pdu_len));
+
+ if (raw_pdu_len < rest_len) {
+ /*
+ * The PDU is shorter, talloc_memdup that one.
+ */
+ pdu = (char *)talloc_memdup(
+ cli, cli->evt_inbuf, raw_pdu_len);
+
+ memmove(cli->evt_inbuf, cli->evt_inbuf + raw_pdu_len,
+ buf_len - raw_pdu_len);
+
+ cli->evt_inbuf = TALLOC_REALLOC_ARRAY(
+ NULL, cli->evt_inbuf, char, rest_len);
+
+ if (pdu == NULL) {
+ status = NT_STATUS_NO_MEMORY;
+ goto invalidate_requests;
+ }
+ }
+ else {
+ /*
+ * The PDU is larger than the rest, talloc_memdup the
+ * rest
+ */
+ pdu = cli->evt_inbuf;
+
+ cli->evt_inbuf = (char *)talloc_memdup(
+ cli, pdu + raw_pdu_len, rest_len);
+
+ if (cli->evt_inbuf == NULL) {
+ status = NT_STATUS_NO_MEMORY;
+ goto invalidate_requests;
+ }
+ }
+
+ }
/*
* TODO: Handle oplock break requests
*/
- if (cli_encryption_on(cli) && CVAL(cli->evt_inbuf, 0) == 0) {
+ if (cli_encryption_on(cli) && CVAL(pdu, 0) == 0) {
uint16_t enc_ctx_num;
- status = get_enc_ctx_num((uint8_t *)cli->evt_inbuf,
- &enc_ctx_num);
+ status = get_enc_ctx_num((uint8_t *)pdu, &enc_ctx_num);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("get_enc_ctx_num returned %s\n",
nt_errstr(status)));
@@ -207,7 +255,7 @@ static void handle_incoming_pdu(struct cli_state *cli)
}
status = common_decrypt_buffer(cli->trans_enc_state,
- cli->evt_inbuf);
+ pdu);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("common_decrypt_buffer returned %s\n",
nt_errstr(status)));
@@ -215,13 +263,13 @@ static void handle_incoming_pdu(struct cli_state *cli)
}
}
- if (!cli_check_sign_mac(cli, cli->evt_inbuf)) {
+ if (!cli_check_sign_mac(cli, pdu)) {
DEBUG(10, ("cli_check_sign_mac failed\n"));
status = NT_STATUS_ACCESS_DENIED;
goto invalidate_requests;
}
- mid = SVAL(cli->evt_inbuf, smb_mid);
+ mid = SVAL(pdu, smb_mid);
DEBUG(10, ("handle_incoming_pdu: got mid %d\n", mid));
@@ -231,64 +279,17 @@ static void handle_incoming_pdu(struct cli_state *cli)
}
}
- buf_len = talloc_get_size(cli->evt_inbuf);
- pdu_len = smb_len(cli->evt_inbuf) + 4;
- rest_len = buf_len - raw_pdu_len;
+ pdu_len = smb_len(pdu) + 4;
if (req == NULL) {
DEBUG(3, ("Request for mid %d not found, dumping PDU\n", mid));
- memmove(cli->evt_inbuf, cli->evt_inbuf + raw_pdu_len,
- buf_len - raw_pdu_len);
-
- cli->evt_inbuf = TALLOC_REALLOC_ARRAY(NULL, cli->evt_inbuf,
- char, rest_len);
+ TALLOC_FREE(pdu);
return;
}
- if (buf_len == pdu_len) {
- /*
- * Optimal case: Exactly one PDU was in the socket buffer
- */
- req->inbuf = talloc_move(req, &cli->evt_inbuf);
- goto done;
- }
-
- DEBUG(11, ("buf_len = %d, pdu_len = %d, splitting buffer\n",
- (int)buf_len, (int)pdu_len));
-
- if (pdu_len < rest_len) {
- /*
- * The PDU is shorter, talloc_memdup that one.
- */
- req->inbuf = (char *)talloc_memdup(
- req, cli->evt_inbuf, pdu_len);
-
- memmove(cli->evt_inbuf,
- cli->evt_inbuf + raw_pdu_len,
- buf_len - raw_pdu_len);
-
- cli->evt_inbuf = TALLOC_REALLOC_ARRAY(
- NULL, cli->evt_inbuf, char, rest_len);
- }
- else {
- /*
- * The PDU is larger than the rest,
- * talloc_memdup the rest
- */
- req->inbuf = talloc_move(req, &cli->evt_inbuf);
-
- cli->evt_inbuf = (char *)talloc_memdup(
- cli, req->inbuf + raw_pdu_len,
- rest_len);
- }
-
- if ((req->inbuf == NULL) || (cli->evt_inbuf == NULL)) {
- status = NT_STATUS_NO_MEMORY;
- goto invalidate_requests;
- }
+ req->inbuf = talloc_move(req, &pdu);
- done:
async_req_done(req->async);
return;
diff --git a/source/libsmb/clireadwrite.c b/source/libsmb/clireadwrite.c
index c618509..9bd8170 100644
--- a/source/libsmb/clireadwrite.c
+++ b/source/libsmb/clireadwrite.c
@@ -24,7 +24,7 @@
****************************************************************************/
static size_t cli_read_max_bufsize(struct cli_state *cli)
{
- if (!client_is_signing_on(cli) && !cli_encryption_on(cli) == false
+ if (!client_is_signing_on(cli) && !cli_encryption_on(cli)
&& (cli->posix_capabilities & CIFS_UNIX_LARGE_READ_CAP)) {
return CLI_SAMBA_MAX_POSIX_LARGE_READX_SIZE;
}
diff --git a/source/libsmb/nmblib.c b/source/libsmb/nmblib.c
index 15a9a93..bfe5e7b 100644
--- a/source/libsmb/nmblib.c
+++ b/source/libsmb/nmblib.c
@@ -849,9 +849,8 @@ static bool send_udp(int fd,char *buf,int len,struct in_addr ip,int port)
If buf == NULL this is a length calculation.
******************************************************************/
-static int build_dgram(char *buf, size_t len, struct packet_struct *p)
+static int build_dgram(char *buf, size_t len, struct dgram_packet *dgram)
{
- struct dgram_packet *dgram = &p->packet.dgram;
unsigned char *ubuf = (unsigned char *)buf;
int offset=0;
@@ -926,9 +925,8 @@ bool nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2)
If buf == NULL this is a length calculation.
******************************************************************/
-static int build_nmb(char *buf, size_t len, struct packet_struct *p)
+static int build_nmb(char *buf, size_t len, struct nmb_packet *nmb)
{
- struct nmb_packet *nmb = &p->packet.nmb;
unsigned char *ubuf = (unsigned char *)buf;
int offset=0;
@@ -1058,11 +1056,11 @@ int build_packet(char *buf, size_t buflen, struct packet_struct *p)
switch (p->packet_type) {
case NMB_PACKET:
- len = build_nmb(buf,buflen,p);
+ len = build_nmb(buf,buflen,&p->packet.nmb);
break;
case DGRAM_PACKET:
- len = build_dgram(buf,buflen,p);
+ len = build_dgram(buf,buflen,&p->packet.dgram);
break;
}
diff --git a/source/libsmb/unexpected.c b/source/libsmb/unexpected.c
index 5fbc33c..df4d211 100644
--- a/source/libsmb/unexpected.c
+++ b/source/libsmb/unexpected.c
@@ -22,7 +22,7 @@
static TDB_CONTEXT *tdbd = NULL;
-/* the key type used in the unexpeceted packet database */
+/* the key type used in the unexpected packet database */
struct unexpected_key {
enum packet_type packet_type;
time_t timestamp;
@@ -32,7 +32,7 @@ struct unexpected_key {
/****************************************************************************
All unexpected packets are passed in here, to be stored in a unexpected
packet database. This allows nmblookup and other tools to receive packets
- erroneoously sent to the wrong port by broken MS systems.
+ erroneously sent to the wrong port by broken MS systems.
**************************************************************************/
void unexpected_packet(struct packet_struct *p)
diff --git a/source/smbd/trans2.c b/source/smbd/trans2.c
index dc90884..008ffed 100644
--- a/source/smbd/trans2.c
+++ b/source/smbd/trans2.c
@@ -3189,7 +3189,7 @@ cap_low = 0x%x, cap_high = 0x%x\n",
}
DEBUG( 4,("call_trans2setfsinfo: "
- "request transport encrption.\n"));
+ "request transport encryption.\n"));
status = srv_request_encryption_setup(conn,
(unsigned char **)ppdata,
diff --git a/source/torture/torture.c b/source/torture/torture.c
index 8d67e51..d8add20 100644
--- a/source/torture/torture.c
+++ b/source/torture/torture.c
@@ -5502,6 +5502,7 @@ static void usage(void)
int gotpass = 0;
bool correct = True;
TALLOC_CTX *frame = talloc_stackframe();
+ int seed = time(NULL);
dbf = x_stdout;
@@ -5547,8 +5548,6 @@ static void usage(void)
argc--;
argv++;
- srandom(time(NULL));
-
fstrcpy(workgroup, lp_workgroup());
while ((opt = getopt(argc, argv, "p:hW:U:n:N:O:o:m:Ld:Aec:ks:b:")) != EOF) {
@@ -5557,7 +5556,7 @@ static void usage(void)
port_to_use = atoi(optarg);
break;
case 's':
- srandom(atoi(optarg));
+ seed = atoi(optarg);
break;
case 'W':
fstrcpy(workgroup,optarg);
@@ -5620,6 +5619,10 @@ static void usage(void)
}
}
+ d_printf("using seed %d\n", seed);
+
+ srandom(seed);
+
if(use_kerberos && !gotuser) gotpass = True;
while (!gotpass) {
--
Samba Shared Repository
More information about the samba-cvs
mailing list