[SCM] Samba Shared Repository - branch v3-2-stable updated - release-3-2-0pre2-32-g1acab45

Karolin Seeger kseeger at samba.org
Fri Mar 7 09:10:28 GMT 2008


The branch, v3-2-stable has been updated
       via  1acab453875c2189b685d766e404159b741ebca8 (commit)
       via  fdfd080622a62487936550927b085379951d24f2 (commit)
       via  a5adb0ee7d73fe7b6c8f0171d96bbf324549a862 (commit)
       via  b50f23b37e1e85bdf56c86e1c2657ca6be90656f (commit)
       via  353824ae95cf3c0ef243ba91e03c45f44375351b (commit)
       via  a2d2531e1d088ee2510e7faed308286b4ff67938 (commit)
       via  afdece916bb221f5a8327e8c61fa75d63e76e228 (commit)
       via  2441cc6f7ed090964109d36409030e4b9014fc28 (commit)
       via  8ba288c06f7503c3c9e6320c2e51e41e800cb593 (commit)
       via  c60e0eccfe65a138fb556a9b3a7aacc900d81776 (commit)
       via  584d904c4b149baf6857892c53d84e28a7a685ea (commit)
       via  c24fb2e196f294602617a370f359ab8e492a2ba2 (commit)
       via  714f022c157bc4cb7b2a58c4fd775b3c65d5cbc1 (commit)
       via  3f287a1d9bdb0c71e1e55abe92649b54a8ec49eb (commit)
       via  7969360129a28b6ccc6bf9553679fc39736cc6a7 (commit)
       via  2bc47b688af4f9d36e0fa0f86ea3ff497c063325 (commit)
       via  baeaa9c0eec8d2c8207c26cfb86cc896eae62aca (commit)
       via  e14e440a74625b03585f5e80391175211fac62c9 (commit)
      from  25a63d044e82ae3cbd9b8e350fcf4cf548236caa (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-stable


- Log -----------------------------------------------------------------
commit 1acab453875c2189b685d766e404159b741ebca8
Author: Günther Deschner <gd at samba.org>
Date:   Thu Mar 6 16:43:05 2008 +0100

    Re-run make idl.
    
    Guenther
    (cherry picked from commit c0bc09854f0cea03bc0cc6845244ff12ca7229b6)

commit fdfd080622a62487936550927b085379951d24f2
Author: Günther Deschner <gd at samba.org>
Date:   Thu Mar 6 16:41:24 2008 +0100

    Ignore Kerberos PAC type 12.
    
    Until we worked out the PAC_TYPE_UNKNOWN_12 format (or received documentation)
    ignore it so that the PAC parsing can proceed.
    
    Guenther
    (cherry picked from commit 3630ec26c99fdea46c47117d026f9bffb2c4590a)

commit a5adb0ee7d73fe7b6c8f0171d96bbf324549a862
Author: Günther Deschner <gd at samba.org>
Date:   Thu Mar 6 14:47:21 2008 +0100

    Re-run make idl.
    
    Guenther
    (cherry picked from commit 9ccda75b376b559f81ed11e729bc11a1c83f6861)

commit b50f23b37e1e85bdf56c86e1c2657ca6be90656f
Author: Günther Deschner <gd at samba.org>
Date:   Thu Mar 6 14:15:07 2008 +0100

    Slowly making progress on PAC_UNKNOWN_12.
    
    unknown1 and unknown2 are offset headers for the strings.
    
    Guenther
    (cherry picked from commit 7af70e75b9abf92921f33ec4207ad486ee2493d6)

commit 353824ae95cf3c0ef243ba91e03c45f44375351b
Author: Günther Deschner <gd at samba.org>
Date:   Thu Mar 6 19:47:28 2008 +0100

    Fix the build of cifs.spnego.
    
    Guenther
    (cherry picked from commit 9eaaf17d30388ef9446fb18e69197baa699b7eac)

commit a2d2531e1d088ee2510e7faed308286b4ff67938
Author: Günther Deschner <gd at samba.org>
Date:   Thu Mar 6 20:44:28 2008 +0100

    Fix _dssetup_DsRoleGetPrimaryDomainInformation().
    
    Guenther
    (cherry picked from commit 5eb7b7a9db4bda40660df5ab67bfea99e75716f9)

commit afdece916bb221f5a8327e8c61fa75d63e76e228
Author: Derrell Lipman <derrell.lipman at unwireduniverse.com>
Date:   Thu Mar 6 09:00:37 2008 -0500

    Check for NULL pointers before dereferencing them.
    (cherry picked from commit 6f65390cec218a6aac4370ee381f30439617dcec)

commit 2441cc6f7ed090964109d36409030e4b9014fc28
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Mar 1 12:11:22 2008 +0100

    Change default bufsize to 512k
    
    I did not do any scientific tests, but the dummy test on my laptop against a
    w2k3 vmware shows that in this specific situation going beyond 512k seems not
    to gain anything anymore.
    
    smb: \> iosize 64512
    iosize is now 64512
    smb: \> lcd /dev
    smb: \> get random null
    getting file \random of size 104857600 as null (33453,1 kb/s) (average 19718,5 kb/s)
    smb: \> get random null
    getting file \random of size 104857600 as null (34236,0 kb/s) (average 20509,1 kb/s)
    smb: \> iosize 524288
    iosize is now 524288
    smb: \> get random null
    getting file \random of size 104857600 as null (49042,1 kb/s) (average 22521,9 kb/s)
    smb: \> get random null
    getting file \random of size 104857600 as null (49420,8 kb/s) (average 23432,9 kb/s)
    smb: \> iosize 1048576
    iosize is now 1048576
    smb: \> get random null
    getting file \random of size 104857600 as null (49420,8 kb/s) (average 24284,2 kb/s)
    smb: \> get random null
    getting file \random of size 104857600 as null (49136,3 kb/s) (average 25076,9 kb/s)
    (cherry picked from commit 1bcfef6a9093aa873550a263dc142c8a3f5edffd)

commit 8ba288c06f7503c3c9e6320c2e51e41e800cb593
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Mar 1 12:05:09 2008 +0100

    Use io_bufsize as window size in smbclient get command
    (cherry picked from commit e602f06cbba852a7eacd15b2511ef2571a95cc80)

commit c60e0eccfe65a138fb556a9b3a7aacc900d81776
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Feb 28 15:26:01 2008 +0100

    Convert cli_read to use cli_pull
    (cherry picked from commit d69b20111a849152a7d9108763207c813bf9068b)

commit 584d904c4b149baf6857892c53d84e28a7a685ea
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Feb 28 15:21:33 2008 +0100

    Add async cli_pull support
    
    This is the big (and potentially controversial) one. It took a phone call to
    explain to metze what is going on inside cli_pull_read_done, but I would really
    like everybody to understand this function. It is a very good and reasonably
    complex example of async programming. If we want more asynchronism in s3, this
    is what we will have to deal with :-)
    
    Make use of it in the smbclient "get" command.
    
    Volker
    (cherry picked from commit 76f9b360ee1d973630d82d401eeddce858189301)

commit c24fb2e196f294602617a370f359ab8e492a2ba2
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Feb 28 14:41:25 2008 +0100

    Add infrastructure to support async SMB requests
    (cherry picked from commit e2153301351559f30f2714345f4c1ca6c5f1a45f)

commit 714f022c157bc4cb7b2a58c4fd775b3c65d5cbc1
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Feb 28 13:55:53 2008 +0100

    Add basic infrastructure for general async requests
    (cherry picked from commit 9f8b2a87ee8bba930b776dcfda608a5639f6d55a)

commit 3f287a1d9bdb0c71e1e55abe92649b54a8ec49eb
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Mar 6 11:42:48 2008 +0100

    Fix an uninitialized variable, Coverity ID 481
    (cherry picked from commit 9e4f576abfdd5605f4db9bb87c22ec68c94ff850)

commit 7969360129a28b6ccc6bf9553679fc39736cc6a7
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Mar 6 11:37:01 2008 +0100

    Fix a memleak
    
    Fixes Coverity ID 557
    (cherry picked from commit fe882a575152233de6f4bf2143aca681319b0226)

commit 2bc47b688af4f9d36e0fa0f86ea3ff497c063325
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Mar 6 11:27:49 2008 +0100

    Check the right pointer for non-NULL
    
    Fix Coverity ID 558, 559
    (cherry picked from commit 8e33d19d93ef57a9438aad085aaf04b7c09fe09b)

commit baeaa9c0eec8d2c8207c26cfb86cc896eae62aca
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Mar 6 17:43:25 2008 -0800

    Fix bug #5267 - nmbd shuts down when network interfaces go down.
    Cause nmbd to wait for an interface, in a mode where SIGTERM
    will kills us (same way we wait on startup for an interface).
    Jeremy.
    (cherry picked from commit 5440c752ff270cc674d46f2dfa2ceb47dac030f6)

commit e14e440a74625b03585f5e80391175211fac62c9
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Mar 6 14:44:07 2008 -0800

    client[ADDR_INDEX] is an IPv4 mapped to IPv6, but
    the list item is not. Try and match the IPv4 part of
    address only. This will happen a lot on IPv6 enabled
    systems with IPv4 allow/deny lists in smb.conf.
    Bug #5311.
    Jeremy.
    (cherry picked from commit 7c3550f82c51ce173b13e568762f728ecb881e85)

-----------------------------------------------------------------------

Summary of changes:
 source/Makefile.in                  |    6 +-
 source/client/client.c              |   47 ++--
 source/include/async_req.h          |   89 ++++++
 source/include/async_smb.h          |   62 +++++
 source/include/client.h             |   30 ++
 source/include/includes.h           |    2 +
 source/lib/access.c                 |   26 ++-
 source/lib/async_req.c              |   68 +++++
 source/libaddns/dnssock.c           |    1 +
 source/librpc/gen_ndr/krb5pac.h     |   14 +-
 source/librpc/gen_ndr/ndr_krb5pac.c |  153 ++++-------
 source/librpc/gen_ndr/ndr_krb5pac.h |    3 +-
 source/librpc/idl/krb5pac.idl       |   17 +-
 source/libsmb/async_smb.c           |  483 ++++++++++++++++++++++++++++++++
 source/libsmb/clidfs.c              |    2 +-
 source/libsmb/clireadwrite.c        |  519 +++++++++++++++++++++++++++--------
 source/libsmb/libsmb_server.c       |    8 +-
 source/nmbd/nmbd.c                  |   68 +++--
 source/nsswitch/wins.c              |    1 +
 source/rpc_server/srv_dssetup_nt.c  |    7 +-
 20 files changed, 1294 insertions(+), 312 deletions(-)
 create mode 100644 source/include/async_req.h
 create mode 100644 source/include/async_smb.h
 create mode 100644 source/lib/async_req.c
 create mode 100644 source/libsmb/async_smb.c


Changeset truncated at 500 lines:

diff --git a/source/Makefile.in b/source/Makefile.in
index 3df7958..7a94c07 100644
--- a/source/Makefile.in
+++ b/source/Makefile.in
@@ -323,7 +323,7 @@ LIB_WITHOUT_PROTO_OBJ = $(LIBSAMBAUTIL_OBJ) \
 	lib/messages.o librpc/gen_ndr/ndr_messaging.o lib/messages_local.o \
 	lib/messages_ctdbd.o lib/packet.o lib/ctdbd_conn.o lib/talloc_stack.o \
 	lib/interfaces.o lib/rbtree.o lib/memcache.o \
-	lib/util_transfer_file.o
+	lib/util_transfer_file.o lib/async_req.o
 
 LIB_WITH_PROTO_OBJ = $(VERSION_OBJ) lib/charcnv.o lib/debug.o lib/fault.o \
 	  lib/interface.o lib/md4.o \
@@ -410,7 +410,7 @@ LIBSMB_OBJ = libsmb/clientgen.o libsmb/cliconnect.o libsmb/clifile.o \
 	     libsmb/clistr.o libsmb/cliquota.o libsmb/clifsinfo.o libsmb/clidfs.o \
              libsmb/smberr.o libsmb/credentials.o libsmb/pwd_cache.o \
 	     libsmb/clioplock.o $(ERRORMAP_OBJ) libsmb/clirap2.o \
-	     libsmb/smb_seal.o $(DOSERR_OBJ) \
+	     libsmb/smb_seal.o $(DOSERR_OBJ) libsmb/async_smb.o \
 	     $(RPC_PARSE_OBJ1) $(LIBSAMBA_OBJ) $(LIBNMB_OBJ)
 
 RPC_CLIENT_OBJ1 = rpc_client/cli_netlogon.o rpc_client/cli_srvsvc.o
@@ -1316,7 +1316,7 @@ bin/umount.cifs at EXEEXT@: $(BINARY_PREREQS) $(CIFS_UMOUNT_OBJ) @BUILD_POPT@
 	@echo Linking $@
 	@$(CC) $(FLAGS) -o $@ $(CIFS_UMOUNT_OBJ) $(DYNEXP) $(LDFLAGS) @POPTLIBS@
 
-bin/cifs.spnego at EXEEXT@: $(BINARY_PREREQS) $(CIFS_SPNEGO_OBJ) $(LIBSMBCLIENT_OBJ0) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@
+bin/cifs.spnego at EXEEXT@: $(BINARY_PREREQS) $(CIFS_SPNEGO_OBJ) $(LIBSMBCLIENT_OBJ0) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@
 	@echo Linking $@
 	@$(CC) $(FLAGS) -o $@ $(CIFS_SPNEGO_OBJ) $(DYNEXP) $(LDFLAGS) \
 		-lkeyutils $(LIBS) $(LIBSMBCLIENT_OBJ0) $(KRB5LIBS) \
diff --git a/source/client/client.c b/source/client/client.c
index f7ed33a..79b7dfe 100644
--- a/source/client/client.c
+++ b/source/client/client.c
@@ -43,7 +43,7 @@ static bool grepable = false;
 static char *cmdstr = NULL;
 static const char *cmd_ptr = NULL;
 
-static int io_bufsize = 64512;
+static int io_bufsize = 524288;
 
 static int name_type = 0x20;
 extern int max_protocol;
@@ -964,22 +964,30 @@ static int cmd_echo(void)
  Get a file from rname to lname
 ****************************************************************************/
 
+static NTSTATUS writefile_sink(char *buf, size_t n, void *priv)
+{
+	int *pfd = (int *)priv;
+	if (writefile(*pfd, buf, n) == -1) {
+		return map_nt_error_from_unix(errno);
+	}
+	return NT_STATUS_OK;
+}
+
 static int do_get(const char *rname, const char *lname_in, bool reget)
 {
 	TALLOC_CTX *ctx = talloc_tos();
 	int handle = 0, fnum;
 	bool newhandle = false;
-	char *data = NULL;
 	struct timeval tp_start;
-	int read_size = io_bufsize;
 	uint16 attr;
 	SMB_OFF_T size;
 	off_t start = 0;
-	off_t nread = 0;
+	ssize_t nread = 0;
 	int rc = 0;
 	struct cli_state *targetcli = NULL;
 	char *targetname = NULL;
 	char *lname = NULL;
+	NTSTATUS status;
 
 	lname = talloc_strdup(ctx, lname_in);
 	if (!lname) {
@@ -1038,36 +1046,15 @@ static int do_get(const char *rname, const char *lname_in, bool reget)
 	DEBUG(1,("getting file %s of size %.0f as %s ",
 		 rname, (double)size, lname));
 
-	if(!(data = (char *)SMB_MALLOC(read_size))) {
-		d_printf("malloc fail for size %d\n", read_size);
+	status = cli_pull(targetcli, fnum, start, size, io_bufsize,
+			  writefile_sink, (void *)&handle, &nread);
+	if (!NT_STATUS_IS_OK(status)) {
+		d_fprintf(stderr, "parallel_read returned %s\n",
+			  nt_errstr(status));
 		cli_close(targetcli, fnum);
 		return 1;
 	}
 
-	while (1) {
-		int n = cli_read(targetcli, fnum, data, nread + start, read_size);
-
-		if (n <= 0)
-			break;
-
-		if (writefile(handle,data, n) != n) {
-			d_printf("Error writing local file\n");
-			rc = 1;
-			break;
-		}
-
-		nread += n;
-	}
-
-	if (nread + start < size) {
-		DEBUG (0, ("Short read when getting file %s. Only got %ld bytes.\n",
-			    rname, (long)nread));
-
-		rc = 1;
-	}
-
-	SAFE_FREE(data);
-
 	if (!cli_close(targetcli, fnum)) {
 		d_printf("Error %s closing remote file\n",cli_errstr(cli));
 		rc = 1;
diff --git a/source/include/async_req.h b/source/include/async_req.h
new file mode 100644
index 0000000..6df5360
--- /dev/null
+++ b/source/include/async_req.h
@@ -0,0 +1,89 @@
+/*
+   Unix SMB/CIFS implementation.
+   Infrastructure for async requests
+   Copyright (C) Volker Lendecke 2008
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ASYNC_REQ_H__
+#define __ASYNC_REQ_H__
+
+#include "includes.h"
+
+/*
+ * An async request moves between the following 4 states.
+ */
+enum async_req_state {
+	ASYNC_REQ_INIT,		/* we are creating the request */
+	ASYNC_REQ_IN_PROGRESS,	/* we are waiting the request to complete */
+	ASYNC_REQ_DONE,		/* the request is finished */
+	ASYNC_REQ_ERROR };	/* an error has occured */
+
+struct async_req {
+	/* the external state - will be queried by the caller */
+	enum async_req_state state;
+
+	/* a private pointer for use by the async function implementation */
+	void *private_data;
+
+	/* print yourself, for debugging purposes */
+	char *(*print)(TALLOC_CTX *mem_ctx, struct async_req *);
+
+	/* status code when finished */
+	NTSTATUS status;
+
+	/* the event context we are using */
+	struct event_context *event_ctx;
+
+	/* information on what to do on completion */
+	struct {
+		void (*fn)(struct async_req *);
+		void *priv;
+	} async;
+};
+
+/*
+ * Print an async_req structure for debugging purposes
+ */
+char *async_req_print(TALLOC_CTX *mem_ctx, struct async_req *req);
+
+/*
+ * Create an async request
+ */
+struct async_req *async_req_new(TALLOC_CTX *mem_ctx, struct event_context *ev);
+
+/*
+ * An async request has successfully finished, invoke the callback
+ */
+void async_req_done(struct async_req *req);
+
+/*
+ * An async request has seen an error, invoke the callback
+ */
+void async_req_error(struct async_req *req, NTSTATUS status);
+
+/*
+ * Convenience helper to easily check alloc failure within a callback.
+ *
+ * Call pattern would be
+ * p = talloc(mem_ctx, bla);
+ * if (async_req_nomem(p, req)) {
+ *	return;
+ * }
+ *
+ */
+bool async_req_nomem(const void *p, struct async_req *req);
+
+#endif
diff --git a/source/include/async_smb.h b/source/include/async_smb.h
new file mode 100644
index 0000000..19408be
--- /dev/null
+++ b/source/include/async_smb.h
@@ -0,0 +1,62 @@
+/*
+   Unix SMB/CIFS implementation.
+   Infrastructure for async SMB client requests
+   Copyright (C) Volker Lendecke 2008
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+
+/*
+ * Create a fresh async smb request
+ */
+
+struct async_req *cli_request_new(TALLOC_CTX *mem_ctx,
+				  struct event_context *ev,
+				  struct cli_state *cli,
+				  uint8_t num_words, size_t num_bytes,
+				  struct cli_request **preq);
+
+/*
+ * Convenience function to get the SMB part out of an async_req
+ */
+
+struct cli_request *cli_request_get(struct async_req *req);
+
+/*
+ * Fetch an error out of a NBT packet
+ */
+
+NTSTATUS cli_pull_error(char *buf);
+
+/*
+ * Compatibility helper for the sync APIs: Fake NTSTATUS in cli->inbuf
+ */
+
+void cli_set_error(struct cli_state *cli, NTSTATUS status);
+
+/*
+ * Create a temporary event context for use in the sync helper functions
+ */
+
+struct cli_tmp_event *cli_tmp_event_ctx(TALLOC_CTX *mem_ctx,
+					struct cli_state *cli);
+
+/*
+ * Attach an event context permanently to a cli_struct
+ */
+
+NTSTATUS cli_add_event_ctx(struct cli_state *cli,
+			   struct event_context *event_ctx);
diff --git a/source/include/client.h b/source/include/client.h
index d29a2e7..52dc513 100644
--- a/source/include/client.h
+++ b/source/include/client.h
@@ -192,6 +192,36 @@ struct cli_state {
 
 	bool force_dos_errors;
 	bool case_sensitive; /* False by default. */
+
+	struct event_context *event_ctx;
+	struct fd_event *fd_event;
+	char *evt_inbuf;
+
+	struct cli_request *outstanding_requests;
+};
+
+struct cli_request {
+	struct cli_request *prev, *next;
+	struct async_req *async;
+
+	struct cli_state *cli;
+
+	struct smb_trans_enc_state *enc_state;
+
+	uint16_t mid;
+
+	char *outbuf;
+	size_t sent;
+	char *inbuf;
+
+	union {
+		struct {
+			off_t ofs;
+			size_t size;
+			ssize_t received;
+			uint8_t *rcvbuf;
+		} read;
+	} data;
 };
 
 typedef struct file_info {
diff --git a/source/include/includes.h b/source/include/includes.h
index a2c3a0c..269baa5 100644
--- a/source/include/includes.h
+++ b/source/include/includes.h
@@ -723,6 +723,8 @@ typedef char fstring[FSTRING_LEN];
 #include "ctdbd_conn.h"
 #include "talloc_stack.h"
 #include "memcache.h"
+#include "async_req.h"
+#include "async_smb.h"
 
 /* used in net.c */
 struct functable {
diff --git a/source/lib/access.c b/source/lib/access.c
index 6a46344..db5d007 100644
--- a/source/lib/access.c
+++ b/source/lib/access.c
@@ -178,20 +178,36 @@ static bool string_match(const char *tok,const char *s)
 static bool client_match(const char *tok, const void *item)
 {
 	const char **client = (const char **)item;
-	bool match = false;
 
 	/*
 	 * Try to match the address first. If that fails, try to match the host
 	 * name if available.
 	 */
 
-	if ((match = string_match(tok, client[ADDR_INDEX])) == false) {
-		if (client[NAME_INDEX][0] != 0) {
-			match = string_match(tok, client[NAME_INDEX]);
+	if (string_match(tok, client[ADDR_INDEX])) {
+		return true;
+	}
+
+	if (strnequal(client[ADDR_INDEX],"::ffff:",7) &&
+			!strnequal(tok, "::ffff:",7)) {
+		/* client[ADDR_INDEX] is an IPv4 mapped to IPv6, but
+ 		 * the list item is not. Try and match the IPv4 part of
+ 		 * address only. This will happen a lot on IPv6 enabled
+ 		 * systems with IPv4 allow/deny lists in smb.conf.
+ 		 * Bug #5311. JRA.
+ 		 */
+		if (string_match(tok, (client[ADDR_INDEX])+7)) {
+			return true;
 		}
 	}
 
-	return match;
+	if (client[NAME_INDEX][0] != 0) {
+		if (string_match(tok, client[NAME_INDEX])) {
+			return true;
+		}
+	}
+
+	return false;
 }
 
 /* list_match - match an item against a list of tokens with exceptions */
diff --git a/source/lib/async_req.c b/source/lib/async_req.c
new file mode 100644
index 0000000..01154ca
--- /dev/null
+++ b/source/lib/async_req.c
@@ -0,0 +1,68 @@
+/*
+   Unix SMB/CIFS implementation.
+   Infrastructure for async requests
+   Copyright (C) Volker Lendecke 2008
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+
+char *async_req_print(TALLOC_CTX *mem_ctx, struct async_req *req)
+{
+	return talloc_asprintf(mem_ctx, "async_req: state=%d, status=%s, "
+			       "priv=%s", req->state, nt_errstr(req->status),
+			       talloc_get_name(req->private_data));
+}
+
+struct async_req *async_req_new(TALLOC_CTX *mem_ctx, struct event_context *ev)
+{
+	struct async_req *result;
+
+	result = TALLOC_ZERO_P(mem_ctx, struct async_req);
+	if (result == NULL) {
+		return NULL;
+	}
+	result->state = ASYNC_REQ_IN_PROGRESS;
+	result->event_ctx = ev;
+	result->print = async_req_print;
+	return result;
+}
+
+void async_req_done(struct async_req *req)
+{
+	req->status = NT_STATUS_OK;
+	req->state = ASYNC_REQ_DONE;
+	if (req->async.fn != NULL) {
+		req->async.fn(req);
+	}
+}
+
+void async_req_error(struct async_req *req, NTSTATUS status)
+{
+	req->status = status;
+	req->state = ASYNC_REQ_ERROR;
+	if (req->async.fn != NULL) {
+		req->async.fn(req);
+	}
+}
+
+bool async_req_nomem(const void *p, struct async_req *req)
+{
+	if (p != NULL) {
+		return false;
+	}
+	async_req_error(req, NT_STATUS_NO_MEMORY);
+	return true;
+}
diff --git a/source/libaddns/dnssock.c b/source/libaddns/dnssock.c
index 72bbf60..7c8bd41 100644
--- a/source/libaddns/dnssock.c
+++ b/source/libaddns/dnssock.c
@@ -118,6 +118,7 @@ static DNS_ERROR dns_udp_open( const char *nameserver,
 	   the receiver (in this example case "123.456.789.1")
 	   and the specified port number. */
 
+	ZERO_STRUCT(RecvAddr);
 	RecvAddr.sin_family = AF_INET;
 	RecvAddr.sin_port = htons( DNS_UDP_PORT );
 	RecvAddr.sin_addr.s_addr = ulAddress;
diff --git a/source/librpc/gen_ndr/krb5pac.h b/source/librpc/gen_ndr/krb5pac.h
index 8a14825..2d799ea 100644
--- a/source/librpc/gen_ndr/krb5pac.h
+++ b/source/librpc/gen_ndr/krb5pac.h
@@ -27,9 +27,9 @@ struct PAC_LOGON_INFO {
 
 struct PAC_UNKNOWN_12 {
 	uint16_t upn_size;/* [value(2*strlen_m(upn_name))] */
-	uint16_t unknown1;
+	uint16_t upn_offset;
 	uint16_t domain_size;/* [value(2*strlen_m(domain_name))] */
-	uint16_t unknown2;
+	uint16_t domain_offset;
 	uint16_t unknown3;
 	uint16_t unknown4;
 	uint32_t unknown5;
@@ -67,12 +67,16 @@ enum PAC_TYPE
 #endif
 ;
 
+struct DATA_BLOB_REM {
+	DATA_BLOB remaining;/* [flag(LIBNDR_FLAG_REMAINING)] */
+};
+
 union PAC_INFO {
 	struct PAC_LOGON_INFO_CTR logon_info;/* [case(PAC_TYPE_LOGON_INFO)] */
 	struct PAC_SIGNATURE_DATA srv_cksum;/* [case(PAC_TYPE_SRV_CHECKSUM)] */
 	struct PAC_SIGNATURE_DATA kdc_cksum;/* [case(PAC_TYPE_KDC_CHECKSUM)] */
 	struct PAC_LOGON_NAME logon_name;/* [case(PAC_TYPE_LOGON_NAME)] */
-	struct PAC_UNKNOWN_12 unknown;/* [case(PAC_TYPE_UNKNOWN_12)] */
+	struct DATA_BLOB_REM unknown;/* [subcontext(0),case(PAC_TYPE_UNKNOWN_12)] */


-- 
Samba Shared Repository


More information about the samba-cvs mailing list