[SCM] Samba Shared Repository - branch v4-0-stable updated

Karolin Seeger kseeger at samba.org
Wed Jul 30 03:00:19 MDT 2014


The branch, v4-0-stable has been updated
       via  40001e9 VERSION: Disable git snapshots for the 4.0.20 release.
       via  c0a48a5 WHATSNEW: Add release notes for Samba 4.0.20.
       via  00b7b14 ldb-samba: fix a memory leak in ldif_canonicalise_objectCategory()
       via  690012e s3: SMB2 : Fix leak of blocking lock records in the database.
       via  0a7cda5 s3: smb2: Simplify logic in reprocess_blocked_smb2_lock().
       via  4e3414d s3: smb2: Remove unused code from remove_pending_lock().
       via  7ff37ef selftest: teardown the environments also on getting SIGPIPE
       via  fac9504 libwbclient: allow only one initial_blob/challenge_blob in wbcCredentialCache()
       via  f484138 s3: libwbclient: Don't break out of loop too soon - find all parameters.
       via  375c351 s3:smb2_read: let smb2_sendfile_send_data() behave like send_file_readX()
       via  cfbd1da torture4: Make raw.lock.multilock fail after 20 seconds
       via  d06fad8 torture4: Adapt comment to code
       via  90ca1fd s4: smbtorture: Add multi-lock test. Regression test for bug #10684.
       via  6207d7f s3: smbd: Locking - re-add pending lock records if we fail to acquire a lock (and the lock hasn't timed out).
       via  b1be3eb s3: smbd: Locking - treat lock timeout the same as any other error.
       via  9df5a51 s3: smbd: Locking - add and use utility function lock_timed_out().
       via  18fc716 s3: smbd: Locking - convert to using utility macro used elsewhere.
       via  f0cf96d net/doc: make clear that net vampire is for NT4 domains only
       via  09e777f selftest/subunithelper.py: correctly pass testsuite-uxsuccess to end_testsuite()
       via  c9a2f59 selftest/subunithelper.py: correctly handle fail_immediately in end_testsuite of FilterOps
       via  eef4181 selftest/subunithelper.py: correctly handle unexpected success in FilterOps
       via  78b755d script/autobuild: use --force-rebase option
       via  a064b7c torture3: Fix bug 10687
       via  4448c2e smbd: Avoid double-free in get_print_db_byname
       via  a4622ad s3: smbd: Locking, fix off-by one calculation in brl_pending_overlap().
       via  2d1dd83 smbstatus: Fix an uninitialized variable
       via  039297d s3:winbindd - fix bad bugfix for bug #10280 - winbind panic if AD server is down.
       via  34e7133 s3/s4: smbd, rpc, ldap, cldap, kdc services.
       via  8a62b81 msg_channel: Fix a 100% CPU loop
       via  a25becd autobuild: delete $NSS_MODULES in "make clean"
       via  d6ce4d6 VERSION: Bump version up to 4.0.20.
       via  5a9c841 Merge tag 'samba-4.0.19' into v4-0-test
       via  989e320 winbindd: Ensure we do not look at rid_array before checking if it was returned
       via  cd90613 printing: fix purge of all print jobs
       via  74e6cd6 s3: smb2: Move from using SBVAL to put NTTIMEs on the wire to put_long_date_timespec.
       via  375d445 s3: smb2: Move from using SBVAL to put NTTIMEs on the wire to put_long_date_timespec.
       via  1f70ad9 VERSION: Bump version number up to 4.0.19...
      from  55c6def VERSION: Disable git snapshot for the 4.0.19 release.

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


- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 VERSION                             |    2 +-
 WHATSNEW.txt                        |   81 ++++++++++++++-
 docs-xml/manpages/net.8.xml         |    2 +
 lib/ldb-samba/ldif_handlers.c       |    7 +-
 nsswitch/libwbclient/wbc_pam.c      |   30 ++++--
 script/autobuild.py                 |    4 +-
 selftest/selftest.pl                |   25 +++--
 selftest/subunithelper.py           |   25 ++++-
 source3/Makefile.in                 |    2 +-
 source3/lib/msg_channel.c           |   12 ++
 source3/locking/brlock.c            |    2 +-
 source3/locking/share_mode_lock.c   |    1 +
 source3/printing/printing.c         |   23 ++++-
 source3/printing/printing_db.c      |    4 +-
 source3/smbd/blocking.c             |  195 +++++++++++++++++++++++------------
 source3/smbd/server.c               |    6 +-
 source3/smbd/smb2_close.c           |  127 ++++++++++-------------
 source3/smbd/smb2_create.c          |   85 ++++++++--------
 source3/smbd/smb2_lock.c            |   69 +++++--------
 source3/smbd/smb2_read.c            |   69 ++++++++++---
 source3/torture/torture.c           |    2 +-
 source3/winbindd/winbindd_cache.c   |    4 +-
 source3/winbindd/winbindd_rpc.c     |    6 +-
 source4/cldap_server/cldap_server.c |    8 ++-
 source4/dns_server/dns_server.c     |    9 ++-
 source4/kdc/kdc.c                   |   12 ++-
 source4/ldap_server/ldap_server.c   |    8 ++-
 source4/rpc_server/dcerpc_server.c  |    8 ++-
 source4/torture/raw/lock.c          |   97 +++++++++++++++++
 29 files changed, 636 insertions(+), 289 deletions(-)


Changeset truncated at 500 lines:

diff --git a/VERSION b/VERSION
index d22fc5c..0693f17 100644
--- a/VERSION
+++ b/VERSION
@@ -25,7 +25,7 @@
 ########################################################
 SAMBA_VERSION_MAJOR=4
 SAMBA_VERSION_MINOR=0
-SAMBA_VERSION_RELEASE=19
+SAMBA_VERSION_RELEASE=20
 
 ########################################################
 # If a official release has a serious bug              #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 813fca9..49640f6 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,4 +1,81 @@
                    ==============================
+                   Release Notes for Samba 4.0.20
+                           July 30, 2014
+                   ==============================
+
+
+This is the latest stable release of the Samba 4.0 release series.
+
+
+Changes since 4.0.19:
+---------------------
+
+o   Jeremy Allison <jra at samba.org>
+    * BUG 3124: s3: smb2: Fix 'xcopy /d' with samba shares.
+    * BUG 10653: Samba won't start on a machine configured with only IPv4.
+    * BUG 10673: s3: SMB2: Fix leak of blocking lock records in the database.
+    * BUG 10684: SMB1 blocking locks can fail notification on unlock, causing
+      client timeout.
+    * BUG 10685: s3: smbd: Locking, fix off-by one calculation in
+      brl_pending_overlap().
+    * BUG 10692: wbcCredentialCache fails if challenge_blob is not first.
+
+
+o   Andrew Bartlett <abartlet at samba.org>
+    * BUG 10627: rid_array used before status checked - segmentation fault due
+      to null pointer dereference.
+
+
+o   David Disseldorp <ddiss at samba.org>
+    * BUG 10612: printing: Fix purge of all print jobs.
+
+
+o   Björn Jacke <bj at sernet.de>
+    * BUG 3263: net/doc: Make clear that net vampire is for NT4 domains only.
+    * BUG 10657: autobuild: Delete $NSS_MODULES in "make clean".
+
+
+o   Volker Lendecke <vl at samba.org>
+    * BUG 10663: msg_channel: Fix a 100% CPU loop.
+    * BUG 10680: smbstatus: Fix an uninitialized variable.
+    * BUG 10687: 'RW2' smbtorture test fails when -N <numprocs> is set to 2 due
+      to the invalid status check in the second client.
+    * BUG 10699: smbd: Avoid double-free in get_print_db_byname.
+
+
+o   Stefan Metzmacher <metze at samba.org>
+    * BUG 10469: ldb-samba: fix a memory leak in
+      ldif_canonicalise_objectCategory().
+    * BUG 10692: wbcCredentialCache fails if challenge_blob is not first.
+    * BUG 10696: Backport autobuild/selftest fixes from master.
+    * BUG 10706: s3:smb2_read: let smb2_sendfile_send_data() behave like
+      send_file_readX().
+
+
+######################################################################
+Reporting bugs & Development Discussion
+#######################################
+
+Please discuss this release on the samba-technical mailing list or by
+joining the #samba-technical IRC channel on irc.freenode.net.
+
+If you do report problems then please try to send high quality
+feedback. If you don't provide vital information to help us track down
+the problem then you will probably be ignored.  All bug reports should
+be filed under the Samba 4.0 product in the project's Bugzilla
+database (https://bugzilla.samba.org/).
+
+
+======================================================================
+== Our Code, Our Bugs, Our Responsibility.
+== The Samba Team
+======================================================================
+
+
+Release notes for older releases follow:
+----------------------------------------
+
+                   ==============================
                    Release Notes for Samba 4.0.19
                            June 23, 2014
                    ==============================
@@ -52,8 +129,8 @@ database (https://bugzilla.samba.org/).
 ======================================================================
 
 
-Release notes for older releases follow:
-----------------------------------------
+----------------------------------------------------------------------
+
 
                    ==============================
                    Release Notes for Samba 4.0.18
diff --git a/docs-xml/manpages/net.8.xml b/docs-xml/manpages/net.8.xml
index 3765af9..bd46cff 100644
--- a/docs-xml/manpages/net.8.xml
+++ b/docs-xml/manpages/net.8.xml
@@ -981,6 +981,8 @@ to run this against the PDC, from a Samba machine joined as a BDC. </para>
 
 <para>Export users, aliases and groups from remote server to 
 local server.  You need to run this against the PDC, from a Samba machine joined as a BDC. 
+This vampire command cannot be used against an Active Directory, only
+against an NT4 Domain Controller.
 </para>
 </refsect2>
 
diff --git a/lib/ldb-samba/ldif_handlers.c b/lib/ldb-samba/ldif_handlers.c
index c7385f6..93cce29 100644
--- a/lib/ldb-samba/ldif_handlers.c
+++ b/lib/ldb-samba/ldif_handlers.c
@@ -483,8 +483,13 @@ static int ldif_canonicalise_objectCategory(struct ldb_context *ldb, void *mem_c
 		const char *lDAPDisplayName = talloc_strndup(tmp_ctx, (char *)in->data, in->length);
 		sclass = dsdb_class_by_lDAPDisplayName(schema, lDAPDisplayName);
 		if (sclass) {
-			struct ldb_dn *dn = ldb_dn_new(mem_ctx, ldb,  
+			struct ldb_dn *dn = ldb_dn_new(tmp_ctx, ldb,
 						       sclass->defaultObjectCategory);
+			if (dn == NULL) {
+				talloc_free(tmp_ctx);
+				return LDB_ERR_OPERATIONS_ERROR;
+			}
+
 			*out = data_blob_string_const(ldb_dn_alloc_casefold(mem_ctx, dn));
 			talloc_free(tmp_ctx);
 
diff --git a/nsswitch/libwbclient/wbc_pam.c b/nsswitch/libwbclient/wbc_pam.c
index f183cc6..ae70d67 100644
--- a/nsswitch/libwbclient/wbc_pam.c
+++ b/nsswitch/libwbclient/wbc_pam.c
@@ -1208,6 +1208,25 @@ wbcErr wbcCredentialCache(struct wbcCredentialCacheParams *params,
 		goto fail;
 	}
 
+	for (i=0; i<params->num_blobs; i++) {
+		if (strcasecmp(params->blobs[i].name, "initial_blob") == 0) {
+			if (initial_blob != NULL) {
+				status = WBC_ERR_INVALID_PARAM;
+				goto fail;
+			}
+			initial_blob = &params->blobs[i];
+			continue;
+		}
+		if (strcasecmp(params->blobs[i].name, "challenge_blob") == 0) {
+			if (challenge_blob != NULL) {
+				status = WBC_ERR_INVALID_PARAM;
+				goto fail;
+			}
+			challenge_blob = &params->blobs[i];
+			continue;
+		}
+	}
+
 	if (params->domain_name != NULL) {
 		status = wbcRequestResponse(WINBINDD_INFO, NULL, &response);
 		if (!WBC_ERROR_IS_OK(status)) {
@@ -1225,17 +1244,6 @@ wbcErr wbcCredentialCache(struct wbcCredentialCacheParams *params,
 	}
 	request.data.ccache_ntlm_auth.uid = getuid();
 
-	for (i=0; i<params->num_blobs; i++) {
-		if (strcasecmp(params->blobs[i].name, "initial_blob") == 0) {
-			initial_blob = &params->blobs[i];
-			break;
-		}
-		if (strcasecmp(params->blobs[i].name, "challenge_blob") == 0) {
-			challenge_blob = &params->blobs[i];
-			break;
-		}
-	}
-
 	request.data.ccache_ntlm_auth.initial_blob_len = 0;
 	request.data.ccache_ntlm_auth.challenge_blob_len = 0;
 	request.extra_len = 0;
diff --git a/script/autobuild.py b/script/autobuild.py
index 76e777c..a54cb15 100755
--- a/script/autobuild.py
+++ b/script/autobuild.py
@@ -417,11 +417,11 @@ def rebase_tree(rebase_url, rebase_branch = "master"):
             show=True, dir=test_master)
     run_cmd("git fetch %s" % rebase_remote, show=True, dir=test_master)
     if options.fix_whitespace:
-        run_cmd("git rebase --whitespace=fix %s/%s" %
+        run_cmd("git rebase --force-rebase --whitespace=fix %s/%s" %
                 (rebase_remote, rebase_branch),
                 show=True, dir=test_master)
     else:
-        run_cmd("git rebase %s/%s" %
+        run_cmd("git rebase --force-rebase %s/%s" %
                 (rebase_remote, rebase_branch),
                 show=True, dir=test_master)
     diff = run_cmd("git --no-pager diff HEAD %s/%s" %
diff --git a/selftest/selftest.pl b/selftest/selftest.pl
index b516eef..a823652 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -61,14 +61,6 @@ my $prefix = "./st";
 my @includes = ();
 my @excludes = ();
 
-sub pipe_handler {
-	my $sig = shift @_;
-	print STDERR "Exiting early because of SIGPIPE.\n";
-	exit(1);
-}
-
-$SIG{PIPE} = \&pipe_handler;
-
 sub find_in_list($$)
 {
 	my ($list, $fullname) = @_;
@@ -721,12 +713,24 @@ my @exported_envvars = (
         "GID_RFC2307TEST"
 );
 
-$SIG{INT} = $SIG{QUIT} = $SIG{TERM} = sub { 
+sub sighandler($)
+{
 	my $signame = shift;
+
+	$SIG{INT} = $SIG{QUIT} = $SIG{TERM} = 'DEFAULT';
+	$SIG{PIPE} = 'IGNORE';
+
+	open(STDOUT, ">&STDERR") or die "can't dup STDOUT to STDERR: $!";
+
+	print "$0: PID[$$]: Got SIG${signame} teardown environments.\n";
 	teardown_env($_) foreach(keys %running_envs);
-	die("Received signal $signame");
+	system("pstree -p $$");
+	print "$0: PID[$$]: Exiting...\n";
+	exit(1);
 };
 
+$SIG{INT} = $SIG{QUIT} = $SIG{TERM} = $SIG{PIPE} = \&sighandler;
+
 sub setup_env($$)
 {
 	my ($name, $prefix) = @_;
@@ -822,6 +826,7 @@ sub teardown_env($)
 {
 	my ($envname) = @_;
 	return if ($envname eq "none");
+	print STDERR "teardown_env($envname)\n";
 	my $env = get_running_env($envname);
 	$env->{target}->teardown_env($env);
 	delete $running_envs{$envname};
diff --git a/selftest/subunithelper.py b/selftest/subunithelper.py
index 057e139..6f1fdce 100644
--- a/selftest/subunithelper.py
+++ b/selftest/subunithelper.py
@@ -24,7 +24,7 @@ import subunit.iso8601
 import testtools
 from testtools import content, content_type
 
-VALID_RESULTS = ['success', 'successful', 'failure', 'fail', 'skip', 'knownfail', 'error', 'xfail', 'skip-testsuite', 'testsuite-failure', 'testsuite-xfail', 'testsuite-success', 'testsuite-error', 'uxsuccess']
+VALID_RESULTS = ['success', 'successful', 'failure', 'fail', 'skip', 'knownfail', 'error', 'xfail', 'skip-testsuite', 'testsuite-failure', 'testsuite-xfail', 'testsuite-success', 'testsuite-error', 'uxsuccess', 'testsuite-uxsuccess']
 
 class TestsuiteEnabledTestResult(testtools.testresult.TestResult):
 
@@ -158,6 +158,9 @@ def parse_results(msg_ops, statistics, fh):
                 exitcode = 1
             elif result == "testsuite-xfail":
                 msg_ops.end_testsuite(testname, "xfail", reason)
+            elif result == "testsuite-uxsuccess":
+                msg_ops.end_testsuite(testname, "uxsuccess", reason)
+                exitcode = 1
             elif result == "testsuite-error":
                 msg_ops.end_testsuite(testname, "error", reason)
                 exitcode = 1
@@ -301,8 +304,14 @@ class FilterOps(testtools.testresult.TestResult):
 
     def addUnexpectedSuccess(self, test, details=None):
         test = self._add_prefix(test)
+        self.uxsuccess_added+=1
+        self.total_uxsuccess+=1
         self._ops.addUnexpectedSuccess(test, details)
+        if self.output:
+            self._ops.output_msg(self.output)
         self.output = None
+        if self.fail_immediately:
+            raise ImmediateFail()
 
     def addFailure(self, test, details=None):
         test = self._add_prefix(test)
@@ -362,12 +371,18 @@ class FilterOps(testtools.testresult.TestResult):
 
         if self.xfail_added > 0:
             xfail = True
-        if self.fail_added > 0 or self.error_added > 0:
+        if self.fail_added > 0 or self.error_added > 0 or self.uxsuccess_added > 0:
             xfail = False
 
         if xfail and result in ("fail", "failure"):
             result = "xfail"
 
+        if self.uxsuccess_added > 0 and result != "uxsuccess":
+            result = "uxsuccess"
+            if reason is None:
+                reason = "Subunit/Filter Reason"
+            reason += "\n uxsuccess[%d]" % self.uxsuccess_added
+
         if self.fail_added > 0 and result != "failure":
             result = "failure"
             if reason is None:
@@ -381,6 +396,12 @@ class FilterOps(testtools.testresult.TestResult):
             reason += "\n errors[%d]" % self.error_added
 
         self._ops.end_testsuite(name, result, reason)
+        if result not in ("success", "xfail"):
+            if self.output:
+                self._ops.output_msg(self.output)
+            if self.fail_immediately:
+                raise ImmediateFail()
+        self.output = None
 
     def __init__(self, out, prefix=None, suffix=None, expected_failures=None,
                  strip_ok_output=False, fail_immediately=False,
diff --git a/source3/Makefile.in b/source3/Makefile.in
index ad3112c..8d2a2cd 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -3223,7 +3223,7 @@ clean:: cleanlibs
 	-rm -f core */*~ *~ \
 		*/*.o */*/*.o */*/*/*.o */*/*/*/*.o \
 		../testsuite/*/*.o \
-		../nsswitch/*.o ../nsswitch/*/*.o ../nsswitch/*/*/*.o ../nsswitch/*. at SHLIBEXT@ \
+		../nsswitch/*.o ../nsswitch/*/*.o ../nsswitch/*/*/*.o ../nsswitch/*. at SHLIBEXT@ $(NSS_MODULES) \
 		../client/*.o \
 		*/*. at SHLIBEXT@ */*/*. at SHLIBEXT@ */*/*/*. at SHLIBEXT@ \
 		$(TOPFILES) $(BIN_PROGS) $(SBIN_PROGS) \
diff --git a/source3/lib/msg_channel.c b/source3/lib/msg_channel.c
index 5f6ddeb..8c97e21 100644
--- a/source3/lib/msg_channel.c
+++ b/source3/lib/msg_channel.c
@@ -213,6 +213,7 @@ fail:
 }
 
 static void msg_read_got_ctdb(struct tevent_req *subreq);
+static int msg_read_state_destructor(struct msg_read_state *s);
 
 struct tevent_req *msg_read_send(TALLOC_CTX *mem_ctx,
 				 struct tevent_context *ev,
@@ -248,6 +249,8 @@ struct tevent_req *msg_read_send(TALLOC_CTX *mem_ctx,
 	}
 
 	channel->pending_req = req;
+	talloc_set_destructor(state, msg_read_state_destructor);
+
 	channel->ev = ev;
 
 	msg_tdb_event = messaging_tdb_event(state, channel->msg, ev);
@@ -268,6 +271,12 @@ struct tevent_req *msg_read_send(TALLOC_CTX *mem_ctx,
 	return req;
 }
 
+static int msg_read_state_destructor(struct msg_read_state *s)
+{
+	s->channel->pending_req = NULL;
+	return 0;
+}
+
 static void msg_read_got_ctdb(struct tevent_req *subreq)
 {
 	struct tevent_req *req = tevent_req_callback_data(
@@ -278,6 +287,8 @@ static void msg_read_got_ctdb(struct tevent_req *subreq)
 	enum ndr_err_code ndr_err;
 	int ret;
 
+	state->channel->pending_req = NULL;
+
 	ret = ctdb_msg_read_recv(subreq, talloc_tos(),
 				 &blob.data, &blob.length);
 	TALLOC_FREE(subreq);
@@ -316,6 +327,7 @@ static void msg_read_got_ctdb(struct tevent_req *subreq)
 		return;
 	}
 	tevent_req_set_callback(subreq, msg_read_got_ctdb, req);
+	state->channel->pending_req = req;
 }
 
 int msg_read_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index 1a912c7..c73b7c2 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -229,7 +229,7 @@ static bool brl_pending_overlap(const struct lock_struct *lock, const struct loc
 {
 	if ((lock->start <= pend_lock->start) && (lock->start + lock->size > pend_lock->start))
 		return True;
-	if ((lock->start >= pend_lock->start) && (lock->start <= pend_lock->start + pend_lock->size))
+	if ((lock->start >= pend_lock->start) && (lock->start < pend_lock->start + pend_lock->size))
 		return True;
 	return False;
 }
diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c
index 6782f59..d9076db 100644
--- a/source3/locking/share_mode_lock.c
+++ b/source3/locking/share_mode_lock.c
@@ -487,6 +487,7 @@ static int traverse_fn(struct db_record *rec, void *_state)
 		return 0;
 	}
 	for (i=0; i<d->num_share_modes; i++) {
+		d->share_modes[i].stale = false; /* [skip] in idl */
 		state->fn(&d->share_modes[i],
 			  d->servicepath, d->base_name,
 			  state->private_data);
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 5a35ad0..9b382dc 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -3365,13 +3365,28 @@ WERROR print_queue_purge(const struct auth_session_info *server_info,
 	if ( can_job_admin )
 		become_root();
 
-	for (i=0;i<njobs;i++) {
-		bool owner = is_owner(server_info, lp_const_servicename(snum),
-				      queue[i].sysjob);
+	for (i = 0; i < njobs; i++) {
+		struct tdb_print_db *pdb;
+		int jobid;
+		bool owner;
+		pdb = get_print_db_byname(lp_const_servicename(snum));
+		if (pdb == NULL) {
+			DEBUG(1, ("failed to find printdb for %s\n",
+				  lp_const_servicename(snum)));
+			continue;
+		}
+		jobid = sysjob_to_jobid_pdb(pdb, queue[i].sysjob);
+		if (jobid == (uint32_t)-1) {
+			DEBUG(2, ("jobid for system job %d not found\n",
+				  queue[i].sysjob));
+			continue;	/* unix job */
+		}
+		owner = is_owner(server_info, lp_const_servicename(snum),
+				 jobid);
 
 		if (owner || can_job_admin) {
 			print_job_delete1(server_event_context(), msg_ctx,
-					  snum, queue[i].sysjob);
+					  snum, jobid);
 		}
 	}
 
diff --git a/source3/printing/printing_db.c b/source3/printing/printing_db.c
index ecb8ff6..b721317 100644
--- a/source3/printing/printing_db.c
+++ b/source3/printing/printing_db.c
@@ -65,9 +65,9 @@ struct tdb_print_db *get_print_db_byname(const char *printername)
 			if (p->ref_count)
 				continue;
 			if (p->tdb) {
-				if (tdb_close(print_db_head->tdb)) {
+				if (tdb_close(p->tdb)) {
 					DEBUG(0,("get_print_db: Failed to close tdb for printer %s\n",
-								print_db_head->printer_name ));
+								p->printer_name ));
 					return NULL;
 				}
 			}
diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c
index 100944c..7132084 100644
--- a/source3/smbd/blocking.c
+++ b/source3/smbd/blocking.c
@@ -430,6 +430,25 @@ static void blocking_lock_reply_error(struct blocking_lock_record *blr, NTSTATUS
 }
 
 /****************************************************************************
+ Utility function that returns true if a lock timed out.
+*****************************************************************************/
+
+static bool lock_timed_out(const struct blocking_lock_record *blr)
+{
+	struct timeval tv_curr;
+
+	if (timeval_is_zero(&blr->expire_time)) {
+		return false; /* Never times out. */
+	}
+
+	tv_curr = timeval_current();
+	if (timeval_compare(&blr->expire_time, &tv_curr) <= 0) {
+		return true;
+	}
+	return false;
+}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list