samba.git
14 years agos3: Fix a winbind crash when scanning trusts
Volker Lendecke [Wed, 21 Apr 2010 15:04:49 +0000 (17:04 +0200)]
s3: Fix a winbind crash when scanning trusts

add_trusted_domain() for a new domain always needs to be followed by a
setup_domain_child(). This was not always done, in particular not when walking
to the forest root for additional trusts.

This is a minimal patch, we need to fix add_trusted_domain().

Fix bug #7389 (Fix a winbind crash when scanning trusted domains).

14 years agoFix bug #7384 - dptr_Close has a bitmap leak.
Ira Cooper [Fri, 23 Apr 2010 17:55:46 +0000 (10:55 -0700)]
Fix bug #7384 - dptr_Close has a bitmap leak.

s3: Fix to dptr_Close

This fixes a bitmap "leak" in dptr_Close by making it use the same internal
routines the rest of the code does.
(cherry picked from commit dd2025947136f28b22b70de59309e149a1f45f3d)

14 years agos3-net_conf: Display an error on net conf import failures.
Jim McDonough [Wed, 21 Apr 2010 18:51:54 +0000 (20:51 +0200)]
s3-net_conf: Display an error on net conf import failures.

When something goes wrong, such as a typo in a parameter
name, we'll now display the failure instead of just returning
with -1 and no message.

Fix bug #7378 ("net conf import" fails silently on parameter typo).

14 years agos3 torture: Prevent smbcli segfault when running smbtorture3 against an smbd with...
Tim Prouty [Mon, 4 Jan 2010 20:57:34 +0000 (12:57 -0800)]
s3 torture: Prevent smbcli segfault when running smbtorture3 against an smbd with security=share

Fix bug #7370 (3.5.2 smbclient segfaults when used against old samba
"security = share").

14 years agos3-docs: Improve "winbind nss info" section in man smb.conf.
Karolin Seeger [Fri, 16 Apr 2010 07:23:30 +0000 (09:23 +0200)]
s3-docs: Improve "winbind nss info" section in man smb.conf.

Karolin
(cherry picked from commit 20fc769179377bf037f4d5efe1afbaf77d4c9292)

14 years agoFix bug #7288 - SMB job IDs in CUPS job names wrong.
Jeremy Allison [Fri, 26 Mar 2010 01:22:16 +0000 (18:22 -0700)]
Fix bug #7288 - SMB job IDs in CUPS job names wrong.

Based on a patch from Michael Karcher <samba@mkarcher.dialup.fu-berlin.de>.

I think this is the correct fix. It causes cups_job_submit to use
print_parse_jobid(), which I've moved into printing/lpq_parse.c (to allow the
link to work).

It turns out the old print_parse_jobid() was *broken*, in that the pjob
filename was set as an absolute path - not relative to the sharename (due to it
not going through the VFS calls).

This meant that the original code doing a strncmp on the first part of the
filename would always fail - it starts with a "/", not the relative pathname of
PRINT_SPOOL_PREFIX ("smbprn.").

This fix could fix some other mysterious printing bugs - probably the ones
Guenther noticed where job control fails on non-cups backends.

Contains c79ca41baf15b4ef7eb287d343b17a53ba41e852 and
92332fb2368c641db1552d1f2a2f7b3deaa11519 from master.

Jeremy.

14 years agos3-libsmbclient: Fix incomplete description of function return values in libsmbclient.h.
Derrell Lipman [Tue, 13 Apr 2010 18:32:14 +0000 (20:32 +0200)]
s3-libsmbclient: Fix incomplete description of function return values in libsmbclient.h.

Fix bug #7345.

14 years agolibwbclient: Re-Fix a bug that was fixed with e5741e27c4c
Volker Lendecke [Tue, 13 Apr 2010 10:09:21 +0000 (12:09 +0200)]
libwbclient: Re-Fix a bug that was fixed with e5741e27c4c

> r21878: Fix a bug with smbd serving a windows terminal server: If winbind
> decides smbd to be idle it might happen that smbd needs to do a winbind
> operation (for example sid2name) as non-root. This then fails to get the
> privileged pipe. When later on on the same connection another authentication
> request comes in, we try to do the CRAP auth via the non-privileged pipe.
>
> This adds a winbindd_priv_request_response() request that kills the existing
> winbind pipe connection if it's not privileged.

The fix for this was lost during the conversion to libwbclient.

Thanks to Ira Cooper <samba@ira.wakeful.net> for pointing this out!

Volker

Fix bug #7357.

14 years agos3:winbindd: make "smbcontrol winbindd validate-cache" reliable again
Stefan Metzmacher [Thu, 8 Apr 2010 10:45:54 +0000 (12:45 +0200)]
s3:winbindd: make "smbcontrol winbindd validate-cache" reliable again

commit 73577205cf81644e7fe853eaf3e6459f7f443096
(s3:winbindd: fix problems with SIGCHLD handling (bug #7317))
broke this.

metze
(cherry picked from commit eb9b7d0363669574de8ec380089407890f15eac2)

14 years agos3:winbindd: remove unused variables
Stefan Metzmacher [Thu, 1 Apr 2010 16:10:47 +0000 (18:10 +0200)]
s3:winbindd: remove unused variables

metze
(cherry picked from commit e18ddb6036f5e0a2211e89a7c9b5514c30a653cf)

14 years agos3:winbindd: fix problems with SIGCHLD handling (bug #7317)
Stefan Metzmacher [Thu, 1 Apr 2010 14:23:06 +0000 (16:23 +0200)]
s3:winbindd: fix problems with SIGCHLD handling (bug #7317)

The main problem is that we call CatchChild() within the
parent winbindd, which overwrites the signal handler
that was registered by winbindd_setup_sig_chld_handler().

That means winbindd_sig_chld_handler() and winbind_child_died()
are never triggered when a winbindd domain child dies.
As a result will get "broken pipe" for all requests to that domain.

To reduce the risk of similar bugs in future we call
CatchChild() in winbindd_reinit_after_fork() now.

We also use a full winbindd_reinit_after_fork() in the
cache validation child now instead instead of just resetting
the SIGCHLD handler by hand. This will also fix possible
tdb problems on systems without pread/pwrite and disabled mmap
as we now correctly reopen the tdb handle for the child.

metze
(cherry picked from commit 73577205cf81644e7fe853eaf3e6459f7f443096)

14 years agos3-docs: Fix typo in man idmap_ad.
Karolin Seeger [Tue, 13 Apr 2010 18:06:14 +0000 (20:06 +0200)]
s3-docs: Fix typo in man idmap_ad.

Karolin
(cherry picked from commit 6389fac6db2f54d148222009b5e209cef5c6bdd7)

14 years agos3:lib/time: remove TIME_T_MIN/MAX defines
Björn Jacke [Wed, 6 Jan 2010 23:41:50 +0000 (00:41 +0100)]
s3:lib/time: remove TIME_T_MIN/MAX defines

we already get them from lib/util/time.h
(cherry picked from commit f5729dbb6e720cb6076ea053f1ad0680259e6b39)

The last two patches address bug #7352 (TIME_T_MAX defines inconsistent).

14 years agolib/util: move TIME_T_MIN/MAX defines into header file (cherry picked from commit...
Björn Jacke [Wed, 6 Jan 2010 23:40:09 +0000 (00:40 +0100)]
lib/util: move TIME_T_MIN/MAX defines into header file (cherry picked from commit 571ee54b791b93ad46e09ed563ef4a5582dcf0c8)

14 years agoFix bug #7339 - MSDFS is non-functional in 3.5.x
Jeremy Allison [Fri, 9 Apr 2010 03:32:36 +0000 (20:32 -0700)]
Fix bug #7339 - MSDFS is non-functional in 3.5.x

In the refactoring around filename_convert, the split between the functions
resolve_dfspath() and resolve_dfspath_wcard() was lost, leaving us only with
resolve_dfspath_wcard().

Internally resolve_dfspath_wcard() calls dfs_redirect() only with a
"allow_wcards" flag of true, wheras the old resolve_dfspath() would call with a
value of false. The loss of this case causes dfs_redirect to always masquerade
DFS links as directories, even when they are being queried directly by a trans2
QPATHINFO call. We should only masquerade DFS links as directories when called
from a SMBsearch or trans2 findfirst/findnext - which was the intent of the
"allow_wcards" flag.

This patch adds back an allow_wcards bool parameter to
resolve_dfspath_wcard(). This bool is set from the state of the ucf_flags when
filename_convert() is called.

I will follow this up with a new smbclient-based torture test that will prevent
us from ever regressing our DFS support again.

Jeremy.
(cherry picked from commit 358781559526f962c96c1af88cd104946c507d05)

14 years agoWHATSNEW: Start release notes for Samba 3.5.3.
Karolin Seeger [Wed, 7 Apr 2010 08:41:07 +0000 (10:41 +0200)]
WHATSNEW: Start release notes for Samba 3.5.3.

Karolin

14 years agoVERSION: Raise version number up to 3.5.3.
Karolin Seeger [Wed, 7 Apr 2010 08:39:08 +0000 (10:39 +0200)]
VERSION: Raise version number up to 3.5.3.

Karolin

14 years agoWHATSNEW: Update changes since 3.5.1.
Karolin Seeger [Thu, 1 Apr 2010 13:25:13 +0000 (15:25 +0200)]
WHATSNEW: Update changes since 3.5.1.

Karolin

14 years agos3:winbindd: make sure we don't try rpc requests against unaccessable domains
Stefan Metzmacher [Thu, 1 Apr 2010 07:29:38 +0000 (09:29 +0200)]
s3:winbindd: make sure we don't try rpc requests against unaccessable domains

This makes sure we don't crash while trying to dereference domain->conn.cli->foo
while trying to establish a rpc connection to the server.

This fixes bug #7316.

metze
(cherry picked from commit d930904b997d310aeff781bde1e7e3ce47dde8a1)

14 years agoWHATSNEW: Update changes since 3.5.1.
Karolin Seeger [Thu, 1 Apr 2010 09:32:46 +0000 (11:32 +0200)]
WHATSNEW: Update changes since 3.5.1.

Karolin

14 years agoWHATSNEW: Prepare release notes for Samba 3.5.2.
Karolin Seeger [Thu, 1 Apr 2010 09:22:59 +0000 (11:22 +0200)]
WHATSNEW: Prepare release notes for Samba 3.5.2.

Karolin

14 years agos3: signals are processed twice in child.
Bo Yang [Tue, 9 Feb 2010 09:02:20 +0000 (17:02 +0800)]
s3: signals are processed twice in child.

Signed-off-by: Bo Yang <boyang@samba.org>
(cherry picked from commit 8c8bb51de1ac2baa46ac0736fae12c034288e5d4)

Fix bug #7206 (duplicate signal handler, signals are processed twice in child
process).

14 years agoFix bug 7310 - DOS attribute inconsistency with MS Office
Jeremy Allison [Wed, 31 Mar 2010 05:16:37 +0000 (22:16 -0700)]
Fix bug 7310 - DOS attribute inconsistency with MS Office

On rename we need to set the archive bit on the renamed file.

Jeremy

14 years agos3:registry: eliminate race condition in creating/scanning sorted subkeys
Michael Adam [Mon, 8 Feb 2010 10:01:47 +0000 (11:01 +0100)]
s3:registry: eliminate race condition in creating/scanning sorted subkeys

Called, from key_exists, scan_sorted_subkeys re-creates the sorted
subkeys record of the given key and then searches through it.
The race is that between creation and parsing of the sorted subkey
record, another process that stores some other subkey of the same
parent key will delete the sorted subkey record, resulting in an
WERR_BADFILE of an operation that should actually succeed.

This patch fixes the issue by wrapping the creation and parsing
into a transaction.

Michael
(cherry picked from commit a752bbd10d661ebc93b8d51bd583eb62eb00ad18)

Fix bug #7314 (registry: creation of sorted subkey record is racy (not atomic)).

14 years agos3:make "net conf addshare" atomic by wrapping all writes in one transaction
Michael Adam [Fri, 29 Jan 2010 14:04:25 +0000 (15:04 +0100)]
s3:make "net conf addshare" atomic by wrapping all writes in one transaction

Michael
(cherry picked from commit 09f3ed102472304d6b4446a6fab9cf6f05c9176a)

Fix bug #7313 (Net conf addshare is not atomic).

14 years agos3: Remove the unused parameter "persistent" from fetch_locked_internal (cherry picke...
Volker Lendecke [Fri, 5 Mar 2010 14:30:22 +0000 (15:30 +0100)]
s3: Remove the unused parameter "persistent" from fetch_locked_internal (cherry picked from commit a5db27936e9c6aad99300ea46808481803f57e08)

The last 32 patches address bug #7232 (CTDB persistent transactions are racy).

14 years agos3: db->persistent==true was handled earlier, make this more obvious (cherry picked...
Volker Lendecke [Fri, 5 Mar 2010 14:28:39 +0000 (15:28 +0100)]
s3: db->persistent==true was handled earlier, make this more obvious (cherry picked from commit c7835a4845bbc7e4d340a75229866b2d4946f6eb)

14 years agos3: Add "g_lock_do" as a convenience wrapper function (cherry picked from commit...
Volker Lendecke [Fri, 12 Mar 2010 13:22:54 +0000 (14:22 +0100)]
s3: Add "g_lock_do" as a convenience wrapper function (cherry picked from commit 79100c242153ea174a4405afd45cbf635da313aa)

14 years agos3: Fix timeout calculation if g_lock_lock is given a timeout < 60s
Volker Lendecke [Tue, 16 Feb 2010 14:21:25 +0000 (15:21 +0100)]
s3: Fix timeout calculation if g_lock_lock is given a timeout < 60s

Detected while showing this code to obnox :-)
(cherry picked from commit f8b246e44c819b909b23b4b98ef0999c84d2f4ff)

14 years agos3: Slightly increase parallelism in g_lock
Volker Lendecke [Tue, 16 Feb 2010 11:31:58 +0000 (12:31 +0100)]
s3: Slightly increase parallelism in g_lock

There's no need to still hold the g_lock tdb-level lock while telling the
waiters to retry
(cherry picked from commit 83542d973ca771353109c7da4b0391d6ba910f53)

14 years agos3: Avoid starving locks when many processes die at the same time
Volker Lendecke [Tue, 16 Feb 2010 11:28:53 +0000 (12:28 +0100)]
s3: Avoid starving locks when many processes die at the same time

In g_lock_unlock we have a little race between the process_exists and
messaging_send call: We only send to 5 waiters now, they all might have died
between us checking their existence and sending the message. This change makes
g_lock_lock retry at least once every minute.
(cherry picked from commit be919d6faed198cdc29322a4d9491946c0b044b3)

14 years agos3: Avoid a thundering herd in g_lock_unlock
Volker Lendecke [Tue, 16 Feb 2010 11:22:08 +0000 (12:22 +0100)]
s3: Avoid a thundering herd in g_lock_unlock

Only notify the first 5 pending lock waiters. This avoids a thundering herd
problem that is really nasty in a cluster. It also makes acquiring a lock a bit
more FIFO, lock waiters are added to the end of the array.
(cherry picked from commit 725b3654f831fbe0388cc09f46269903c9eef1d7)

14 years agos3: Optimize g_lock_lock for a heavily contended case
Volker Lendecke [Mon, 15 Feb 2010 15:57:16 +0000 (16:57 +0100)]
s3: Optimize g_lock_lock for a heavily contended case

Only check the existence of the lock owner in g_lock_parse, check the rest of
the records only when we got the lock successfully. This reduces the load on
process_exists which can involve a network roundtrip in the clustered case.
(cherry picked from commit 07978bd175395e0dc770f68fff5b8bd8b0fdeb51)

14 years agos3: Fix handling of processes that died in g_lock
Volker Lendecke [Mon, 15 Feb 2010 15:49:46 +0000 (16:49 +0100)]
s3: Fix handling of processes that died in g_lock

g_lock_parse might have thrown away entries from the locks array because the
processes were not around anymore. Don't store the orphaned entries.
(cherry picked from commit f3bdb163f461175c50b4930fa3464beaee30f4a8)

14 years agos3: Fix a typo (cherry picked from commit bac235dd302570850bb25194ff4bd39b6d653f0d)
Volker Lendecke [Mon, 15 Feb 2010 15:35:06 +0000 (16:35 +0100)]
s3: Fix a typo (cherry picked from commit bac235dd302570850bb25194ff4bd39b6d653f0d)

14 years agoFix warning messages on compile in g_lock.c Volker & Michael please check.
Jeremy Allison [Sat, 13 Feb 2010 06:21:19 +0000 (22:21 -0800)]
Fix warning messages on compile in g_lock.c Volker & Michael please check.

Jeremy.
(cherry picked from commit 10e54fb422d9f1ae6d33e5fabbf8c651b0e57a8c)

14 years agos3:g_lock: remove a nested event loop, replacing the inner loop by select
Michael Adam [Sat, 23 Jan 2010 00:17:06 +0000 (01:17 +0100)]
s3:g_lock: remove a nested event loop, replacing the inner loop by select

This made smbd crash in g_lock_lock() when trying to start a
transaction on a db with an already started transaction,
e.g. in a tcon_and_X where the share_info.tdb was not yet
initialized but share_info.tdb was already locked by another
process or writing acces to the winreg rpc pipe where the
registry tdb was already locked by another process.

What we really _want_ to do here by design is to react to
MSG_DBWRAP_G_LOCK_RETRY messages that are either sent
by a client doing g_lock_unlock or by ourselves when
we receive a CTDB_SRVID_SAMBA_NOTIFY or
CTDB_SRVID_RECONFIGURE message from ctdbd, i.e. when
either a client holding a lock or a complete node
has died.

Doing this properly involves calling tevent_loop_once(),
but doing this here with the main ctdbd messaging context
creates a nested event loop when g_lock_lock() is called
from the main event loop.

So as a quick fix, we act a little corasely here: we do
a select on the ctdb connection fd and when it is readable
or we get EINTR, then we retry without actually parsing
any ctdb packages or dispatching messages. This means that
we retry more often than necessary and intended by design,
but this does not harm and it is unobtrusive. When we have
finished, the main loop will pick up all the messages and
ctdb packets. The only extra twist is that we cannot use
timed events here but have to handcode a timeout for select.

Michael
(cherry picked from commit 83fffbeb44441a87569e543054af21d975eb20ae)

14 years agos3:ctdb_conn: add ctdbd_conn_get_fd() to get the fd out of the ctdb connection
Michael Adam [Fri, 22 Jan 2010 23:05:15 +0000 (00:05 +0100)]
s3:ctdb_conn: add ctdbd_conn_get_fd() to get the fd out of the ctdb connection

Michael
(cherry picked from commit e4af0bc5af2c3ee025ca7fac251c3672ba2c8dd5)

14 years agos3:g_lock: remove an unreached code path.
Michael Adam [Fri, 22 Jan 2010 14:56:28 +0000 (15:56 +0100)]
s3:g_lock: remove an unreached code path.

Michael
(cherry picked from commit 8e306b51b79d3dacd68be9f13aa8455e2eb4c03f)

14 years agos3:dbwrap_ctdb: fix reading/storing of special key __db_sequence_number__
Michael Adam [Mon, 18 Jan 2010 16:26:04 +0000 (17:26 +0100)]
s3:dbwrap_ctdb: fix reading/storing of special key __db_sequence_number__

The key for reading and writing was inconsistent due to a
off by one data length.

Michael
(cherry picked from commit 1933214108d1a71bc6473a696ce35020a427d8f4)

14 years agos3:dbwrap_ctdb: exit early when nothing has been written in transaction_commit.
Michael Adam [Wed, 13 Jan 2010 22:53:54 +0000 (23:53 +0100)]
s3:dbwrap_ctdb: exit early when nothing has been written in transaction_commit.

This skips update of the __db_sequence_number__ record when nothing else has
been written. There are transactions that are just openend and then nothing
is written until transaction_commit is called. This is for instance the case
with registry initialization routines: They start a transaction and only
write somthing when the registry has not been initialized yet.
So this change will skip many db_seqnum bumps and TRANS3_COMMIT roundtrips.

Michael
(cherry picked from commit c311697aded87ce624d40cbf14e05d6e6377c257)

14 years agos3:dbwrap_ctdb: fix brown paperbag bug in ctdb_transaction_commit.
Michael Adam [Wed, 13 Jan 2010 22:51:34 +0000 (23:51 +0100)]
s3:dbwrap_ctdb: fix brown paperbag bug in ctdb_transaction_commit.

I carefully prepared the return value only to "return 0;" at the bottom. :-(
This may well have hit us for instance in the nested cancel case
and produced random errors.

Michael
(cherry picked from commit 1d594bd734a2f7146ed52872456a16c5e41816f1)

14 years agos3:dbwrap_ctdb: fix logic error in pull_newest_from_marshall_buffer().
Michael Adam [Tue, 5 Jan 2010 23:37:21 +0000 (00:37 +0100)]
s3:dbwrap_ctdb: fix logic error in pull_newest_from_marshall_buffer().

The logic bug was that if a record was found in the marshall buffer,
then always the ctdb header of tha last record in the marshall buffer
was returned, and not the ctdb header of the last occurrence of the
requested record.

This is fixed by introducing an additional temporary variable.

Michael
(cherry picked from commit 524072b56bf659002410a817749bf86fe6f51e83)

14 years agos3:dbwrap_ctdb: fix an uninitialized variable.
Michael Adam [Tue, 5 Jan 2010 15:17:27 +0000 (16:17 +0100)]
s3:dbwrap_ctdb: fix an uninitialized variable.

Michael
(cherry picked from commit 1505b69dea6044a13a59f672e22f5833256cb981)

14 years agos3:dbwrap_ctdb: fix two "may be used uninitialized" warnings
Michael Adam [Fri, 11 Dec 2009 23:38:14 +0000 (00:38 +0100)]
s3:dbwrap_ctdb: fix two "may be used uninitialized" warnings

Michael
(cherry picked from commit fb981cdb8282d3b9b46d9ca515a5685add232a72)

14 years agos3:dbwrap_ctdb: fix db_ctdb_fetch_db_seqnum_from_db() when NT_STATUS_NOT_FOUND.
Michael Adam [Fri, 11 Dec 2009 23:30:37 +0000 (00:30 +0100)]
s3:dbwrap_ctdb: fix db_ctdb_fetch_db_seqnum_from_db() when NT_STATUS_NOT_FOUND.

Don't treat this as an error but return seqnum 0 instead.

Michael
(cherry picked from commit 10a44ee6930bb51b4b20ce42f35bc455ac1b7293)

14 years agos3:build: remove checks for deprecated ctdb controls.
Michael Adam [Fri, 11 Dec 2009 15:45:38 +0000 (16:45 +0100)]
s3:build: remove checks for deprecated ctdb controls.

Michael
(cherry picked from commit 9113ce82b59c718ac709eb01b125e9e6746a96b7)

14 years agos3:dbwrap_ctdb: maintain a database sequence number that bumps in transactions
Michael Adam [Fri, 11 Dec 2009 13:07:28 +0000 (14:07 +0100)]
s3:dbwrap_ctdb: maintain a database sequence number that bumps in transactions

For persistent databases, 64bit integer is kept in a special record
__db_sequence_number__. This record is incremented with each completed
transaction.

The retry mechanism for failing TRANS3_COMMIT controls inside the
db_ctdb_transaction_commit() function now relies one a modified
behaviour of ctdbd's treatment of persistent databases in recoveries.
Recently, a special treatment for persistent databases had been
introduced in ctdb (1.0.108) to work around the problems with the
orinal design of persistent transactions.
Now with the rewrite we need to revert to the old behaviour that
ctdb always takes the newest copies of all records.

This change also paves the way for a next step, which will make
recovery use the db seqnum to tell which node has the newest copy
of a persistent db and use that node's copy. This will greatly
reduce the amount of data transferred with each recovery.

Michael
(cherry picked from commit 3fe7ce141d6afe3825b06c5feb90558911e4df1e)

14 years agos3:dbwrap_ctdb: change db_ctdb_transaction_store() to return NTSTATUS.
Michael Adam [Fri, 11 Dec 2009 11:30:57 +0000 (12:30 +0100)]
s3:dbwrap_ctdb: change db_ctdb_transaction_store() to return NTSTATUS.

The return values calculated by the callers were wrong anyways since
the new marshalling code does not set the local tdbs tdb error code.

Michael
(cherry picked from commit 26225d3e798892b39b3c238b0bee465bffac6550)

14 years agos3:dbwrap_ctdb: update (C)
Michael Adam [Fri, 11 Dec 2009 09:35:50 +0000 (10:35 +0100)]
s3:dbwrap_ctdb: update (C)

Michael
(cherry picked from commit 5a0c42770b349877928a2b3fd8316903dd62e5b7)

14 years agobuild: Add a configure check for CTDB_CONTROL_TRANS3_COMMIT.
Michael Adam [Fri, 4 Dec 2009 10:49:21 +0000 (11:49 +0100)]
build: Add a configure check for CTDB_CONTROL_TRANS3_COMMIT.

This is the new implementation of ctdb transactions using the
global lock feature. It is needed by the current dbwrap_ctdb code.

Michael
(cherry picked from commit d4c0afa841ecdae1cab955cc73360deae23f5873)

14 years agos3:dbwrap_ctdb: start rewrite of transactions using the global lock (g_lock)
Michael Adam [Thu, 3 Dec 2009 16:29:54 +0000 (17:29 +0100)]
s3:dbwrap_ctdb: start rewrite of transactions using the global lock (g_lock)

This simplifies the transaction code a lot:

* transaction_start essentially consists of acquiring a global lock.

* No write operations at all are performed on the local database
  until the transaction is committed: Every store operation is just
  going into the marshall buffer.

* The commit operation calls a new simplified TRANS3_COMMIT control
  in ctdb which rolls out thae changes to all nodes including the
  node that is performing the transaction.

Michael
(cherry picked from commit 16bc6ba2268e3660d026076264de8666356e00bf)

14 years agos3: Add tdb_data_equal (cherry picked from commit ebc08b9938a4d266be16ca7e06d27813952...
Volker Lendecke [Thu, 3 Dec 2009 17:43:49 +0000 (18:43 +0100)]
s3: Add tdb_data_equal (cherry picked from commit ebc08b9938a4d266be16ca7e06d27813952cd00f)

14 years agos3:torture: add a test LOCAL-DBTRANS to torture dbwrap with transactions.
Volker Lendecke [Fri, 11 Dec 2009 14:37:52 +0000 (15:37 +0100)]
s3:torture: add a test LOCAL-DBTRANS to torture dbwrap with transactions.

14 years agos3: setup debug for smbtorture (cherry picked from commit b13dd17840a598ae3441e48b130...
Volker Lendecke [Sun, 6 Dec 2009 23:36:51 +0000 (00:36 +0100)]
s3: setup debug for smbtorture (cherry picked from commit b13dd17840a598ae3441e48b130a2b2a2b940572)

14 years agos3: Add ctdb_conn_msg_ctx() (cherry picked from commit 12abab711b58237ddccfa1d9bb526f...
Volker Lendecke [Fri, 4 Dec 2009 12:22:30 +0000 (13:22 +0100)]
s3: Add ctdb_conn_msg_ctx() (cherry picked from commit 12abab711b58237ddccfa1d9bb526f8c7dbb6e9f)

14 years agos3: Implement global locks in a g_lock tdb
Volker Lendecke [Sun, 25 Oct 2009 15:12:12 +0000 (16:12 +0100)]
s3: Implement global locks in a g_lock tdb

This is the basis to implement global locks in ctdb without depending on a
shared file system. The initial goal is to make ctdb persistent transactions
deterministic without too many timeouts.
(cherry picked from commit 4c1c3f2549f32fd069e0e7bf3aec299213f1e85b)

14 years agos3-smbd: add a rate limited cleanup of brl, connections and locking db
Andrew Tridgell [Sat, 6 Feb 2010 05:08:56 +0000 (21:08 -0800)]
s3-smbd: add a rate limited cleanup of brl, connections and locking db

On unclean shutdown we can end up with stale entries in the brlock,
connections and locking db. Previously we would do the cleanup on
every unclean exit, but that can cause smbd to be completely
unavailable for several minutes when a large number of child smbd
processes exit.

This adds a rate limited cleanup of the databases, with the default
that cleanup happens at most every 20s
(cherry picked from commit dd498d2eecf124a03b6117ddab892a1112f9e9db)

The last 4 patches address bug #7312 (Many disconnecting clients renders
clustered samba unusuable for some time).

14 years agos3-brlock: we don't need these MSG_SMB_UNLOCK calls now
Andrew Tridgell [Sat, 6 Feb 2010 05:02:24 +0000 (21:02 -0800)]
s3-brlock: we don't need these MSG_SMB_UNLOCK calls now

These have been replaced with the min timeout in blocking.c
(cherry picked from commit 74267d652485cdcb711f734f0d80da0fb1495867)

14 years agos3-brlock: add a minimim retry time for pending blocking locks
Andrew Tridgell [Sat, 6 Feb 2010 04:59:43 +0000 (20:59 -0800)]
s3-brlock: add a minimim retry time for pending blocking locks

When we are waiting on a pending byte range lock, another smbd might
exit uncleanly, and therefore not notify us of the removal of the
lock, and thus not trigger the lock to be retried.

We coped with this up to now by adding a message_send_all() in the
SIGCHLD and cluster reconfigure handlers to send a MSG_SMB_UNLOCK to
all smbd processes. That would generate O(N^2) work when a large
number of clients disconnected at once (such as on a network outage),
which could leave the whole system unusable for a very long time (many
minutes, or even longer).

By adding a minimum re-check time for pending byte range locks we
avoid this problem by ensuring that pending locks are retried at a
more regular interval.
(cherry picked from commit 5b398edbee672392f2cea260ab17445ecca927d7)

14 years agos3-events: make the old timed events compatible with tevent
Andrew Tridgell [Sat, 6 Feb 2010 03:14:45 +0000 (19:14 -0800)]
s3-events: make the old timed events compatible with tevent

tevent ensures that a timed event is only called once. The old events
code relied on the called handler removing the event itself. If the
handler removed the event after calling a function which invoked the
event loop then the timed event could loop forever.

This change makes the two timed event systems more compatible, by
allowing the handler to free the te if it wants to, but ensuring it is
off the linked list of events before the handler is called, and
ensuring it is freed even if the handler doesn't free it.
(cherry picked from commit 5dbf175c75bd6139f3238f36665000641f7f7f79)

14 years agoFix bug 7307 - man net usershare mistake
Jeremy Allison [Mon, 29 Mar 2010 21:24:18 +0000 (14:24 -0700)]
Fix bug 7307 - man net usershare mistake

Fix bad usage message, reported by headset001@yahoo.com.

Jeremy.
(cherry picked from commit e14a6fbf8c9e4d16b2727e48c708ceccfd157e59)

14 years agoFix bug #7283 - vfs_acl_tdb does not work as expected.
Jeremy Allison [Wed, 24 Mar 2010 17:02:18 +0000 (10:02 -0700)]
Fix bug #7283 - vfs_acl_tdb does not work as expected.

both vfs_acl_common.c and vfs_acl_tdb.c were using the connection
handle, thus conflicted. Fix this.

Jeremy.

14 years agos3:winbindd: correctly retry if the netlogon pipe gets disconnected during a logon...
Stefan Metzmacher [Mon, 29 Mar 2010 20:03:55 +0000 (22:03 +0200)]
s3:winbindd: correctly retry if the netlogon pipe gets disconnected during a logon call

This fixes hopefully the last part of bug #7295.

metze
(cherry picked from commit 4c6cde99c0751a073120d8bc36d40922d8027344)

14 years agos3:rpc_client: remove more unused code
Stefan Metzmacher [Thu, 25 Mar 2010 14:54:29 +0000 (15:54 +0100)]
s3:rpc_client: remove more unused code

metze
(cherry picked from commit cac9981b1a88a37c703a76a951b0691fa4ba7b4b)

14 years agos3:rpc_client: remove unused code, we handle transport failures in the transport...
Stefan Metzmacher [Thu, 25 Mar 2010 14:29:05 +0000 (15:29 +0100)]
s3:rpc_client: remove unused code, we handle transport failures in the transport layer now

metze
(cherry picked from commit 13cf592bb8478453dccd4d78bdb4dabec7aeddc2)

14 years agos3:winbindd_reconnect: don't only reconnect on NT_STATUS_UNSUCCESSFUL
Stefan Metzmacher [Mon, 29 Mar 2010 14:31:13 +0000 (16:31 +0200)]
s3:winbindd_reconnect: don't only reconnect on NT_STATUS_UNSUCCESSFUL

metze
(cherry picked from commit 6bd5a2a3739938f95fce23ab2da652c9b5a48111)

14 years agos3:winbindd_cm: invalidate connection if cm_connect_netlogon() fails
Stefan Metzmacher [Thu, 25 Mar 2010 14:25:47 +0000 (15:25 +0100)]
s3:winbindd_cm: invalidate connection if cm_connect_netlogon() fails

metze
(cherry picked from commit 94a4bcd2f0c0464e192556679c6636639cb307ea)

14 years agos3:winbindd: consistently use TALLOC_FREE(conn->foo_pipe) is we create a new connection
Stefan Metzmacher [Thu, 25 Mar 2010 14:17:07 +0000 (15:17 +0100)]
s3:winbindd: consistently use TALLOC_FREE(conn->foo_pipe) is we create a new connection

metze
(cherry picked from commit 4f391fedac7111683d13f2d79fee7c0dbc27f86e)

14 years agos3:winbindd_cm: use rpccli_is_connected() helper function
Stefan Metzmacher [Thu, 25 Mar 2010 14:15:57 +0000 (15:15 +0100)]
s3:winbindd_cm: use rpccli_is_connected() helper function

metze
(cherry picked from commit d980c06a994d032a833adc8d56d2f2c037f8fdaf)

14 years agos3:winbindd_cm: use cli_state_is_connected() helper function
Stefan Metzmacher [Thu, 25 Mar 2010 14:14:02 +0000 (15:14 +0100)]
s3:winbindd_cm: use cli_state_is_connected() helper function

metze
(cherry picked from commit 408a3eb35a0e61b5d66a3b48ebbd1a6796672d0f)

14 years agos3:rpc_client: return at least 10 sec as old timeout in rpccli_set_timeout() instead...
Stefan Metzmacher [Sun, 28 Mar 2010 17:34:34 +0000 (19:34 +0200)]
s3:rpc_client: return at least 10 sec as old timeout in rpccli_set_timeout() instead of 0

metze
(cherry picked from commit 3e70da3f470eeb122f95477fb48d89939f501b3e)

14 years agos3:rpc_client: add set_timeout hook to rpc_cli_transport
Stefan Metzmacher [Thu, 25 Mar 2010 14:51:51 +0000 (15:51 +0100)]
s3:rpc_client: add set_timeout hook to rpc_cli_transport

metze
(cherry picked from commit 99664ad15460530b6fb44957b6c57823f09884bf)

14 years agos3:rpc_client: add rpccli_is_connected()
Stefan Metzmacher [Thu, 25 Mar 2010 14:00:38 +0000 (15:00 +0100)]
s3:rpc_client: add rpccli_is_connected()

metze
(cherry picked from commit 4f41b53487ac9bc96c7960e8edab464558656373)

14 years agos3:rpc_client: don't mix layers and keep a reference to cli_state in the caller
Stefan Metzmacher [Mon, 29 Mar 2010 12:58:19 +0000 (14:58 +0200)]
s3:rpc_client: don't mix layers and keep a reference to cli_state in the caller

We should not rely on the backend to have a reference to the cli_state.
This will make it possible for the backend to set its cli_state reference
to NULL, when the transport is dead.

metze
(cherry picked from commit dc09b12681ea0e6d4c2b0f1c99dfeb1f23019c65)

14 years agos3:rpc_transport_np: add comment about bad usage in a destructor
Stefan Metzmacher [Thu, 25 Mar 2010 13:10:25 +0000 (14:10 +0100)]
s3:rpc_transport_np: add comment about bad usage in a destructor

metze
(cherry picked from commit 5f8fc63515a02aaf55719cb8d3be8ce695178fe9)

14 years agos3:rpc_transport_np: use cli_state_is_connected() helper
Stefan Metzmacher [Thu, 25 Mar 2010 13:08:42 +0000 (14:08 +0100)]
s3:rpc_transport_np: use cli_state_is_connected() helper

metze
(cherry picked from commit b862351da8624df893ec77e020a456c1d23c58ed)

14 years agos3:libsmb: add cli_state_is_connected() function
Stefan Metzmacher [Thu, 25 Mar 2010 12:20:56 +0000 (13:20 +0100)]
s3:libsmb: add cli_state_is_connected() function

metze
(cherry picked from commit d7bf30ef92031ffddcde3680b38e602510bcae24)

14 years agos3:libsmb: don't let cli_shutdown() segfault with a NULL cli_state
Stefan Metzmacher [Mon, 29 Mar 2010 16:23:40 +0000 (18:23 +0200)]
s3:libsmb: don't let cli_shutdown() segfault with a NULL cli_state

metze
(similar to commit 47e10ab9a85960c78af807b66b99bcd139713644)

14 years agos3:rpc_transport_np: handle trans rdata like the output of a normal read
Stefan Metzmacher [Sat, 20 Feb 2010 08:08:16 +0000 (09:08 +0100)]
s3:rpc_transport_np: handle trans rdata like the output of a normal read

Inspired by bug #7159.

metze
(cherry picked from commit 911287285cc4c8485b75edfad3c1ece901a69b0b)

14 years agos3: Fix bug 7212, "getent group does not return group members"
Volker Lendecke [Mon, 29 Mar 2010 14:59:48 +0000 (16:59 +0200)]
s3: Fix bug 7212, "getent group does not return group members"

14 years agoFix bug 7297 - smbd crashes with CUPS printers and no [printers] share defined.
Jeremy Allison [Fri, 26 Mar 2010 00:09:23 +0000 (17:09 -0700)]
Fix bug 7297 - smbd crashes with CUPS printers and no [printers] share defined.

Ensure we don't dereference an array with an index of -1.

Jeremy.

14 years agos3 ntlm_auth: Don't malloc data that will be talloc_free()d
Kai Blin [Thu, 25 Mar 2010 21:22:56 +0000 (22:22 +0100)]
s3 ntlm_auth: Don't malloc data that will be talloc_free()d

This fixes bug #7290
Thanks to Mohan <mohann@silver-peak.com> for the bug report.

14 years agoFix bug #7269 - Job management commands don't work for CUPS queues.
Michael Karcher [Thu, 25 Mar 2010 00:33:21 +0000 (17:33 -0700)]
Fix bug #7269 - Job management commands don't work for CUPS queues.

Samba needs to retrieve pjob->sysjob from the CUPS response (as
is done in the iprint backend).

14 years agoFix bug 7075 - bug in vfs_scannedonly rmdir implementation.
Jeremy Allison [Fri, 5 Feb 2010 00:23:32 +0000 (16:23 -0800)]
Fix bug 7075 - bug in vfs_scannedonly rmdir implementation.

Check for NULL on opendir, correctly call next rmdir.

Jeremy.

14 years agos3: Fix a bad memleak in winbind
Volker Lendecke [Mon, 22 Mar 2010 14:29:19 +0000 (15:29 +0100)]
s3: Fix a bad memleak in winbind
(cherry picked from commit 13400a6589a20452097bc338fa742d834bbd6a34)

Fix bug #7278 (winbind has a bad memleak).

14 years agos3: Fix bug 7202 for multi-threaded applications
Volker Lendecke [Sun, 21 Mar 2010 16:49:06 +0000 (17:49 +0100)]
s3: Fix bug 7202 for multi-threaded applications

Thanks to Sergey Tereschenko <serg.partizan@gmail.com> for providing good
feedback!

Volker

14 years agos3: Fix bug 7202
Volker Lendecke [Sat, 20 Mar 2010 14:23:17 +0000 (15:23 +0100)]
s3: Fix bug 7202

Make sure _nss_wins_gethostbyname_r has a talloc stackframe available

Thanks to Sergey Tereschenko <serg.partizan@gmail.com> for reporting the bug!

Volker

14 years agos3-winreg: Fix _winreg_QueryValue crash bugs and implement windows behavior.
Günther Deschner [Thu, 11 Mar 2010 11:21:08 +0000 (12:21 +0100)]
s3-winreg: Fix _winreg_QueryValue crash bugs and implement windows behavior.

Found by RPC-WINREG smbtorture test.

Guenther
(cherry picked from commit cddc542ba5f30316ff4ee8fa591a54808b7be4c8)

The last 4 patches address bug #7258 (NULL pointer derref crash in
_winreg_QueryValue).

14 years agos3-winreg: add some debug statements to _winreg_QueryValue().
Günther Deschner [Wed, 10 Mar 2010 13:17:23 +0000 (14:17 +0100)]
s3-winreg: add some debug statements to _winreg_QueryValue().

Guenther
(cherry picked from commit c5ba525748fdab6b182e35673983719b7c235127)

14 years agos3: re-run make samba3-idl.
Günther Deschner [Wed, 17 Mar 2010 11:06:39 +0000 (12:06 +0100)]
s3: re-run make samba3-idl.

Guenther

14 years agowinreg: fix winreg_QueryValue IDL.
Günther Deschner [Fri, 5 Mar 2010 20:56:50 +0000 (21:56 +0100)]
winreg: fix winreg_QueryValue IDL.

Note that before this change pidl generated code that just dereferenced size_is
and length_is values from unique pointers without checking whether these
pointers were actually NULL.

With this change, pidl now throws a warning like:

warning: Got pointer for `data_size', expected fully derefenced variable

which is not correct, probably because pidl does not evaluate the C expression.

Guenther
(cherry picked from commit f258e98e177f0f75bab99654b9f32b10bb7ce37f)

14 years agos3-printing: Fix "printer admin" functionality.
Jeremy Allison [Thu, 18 Mar 2010 10:21:15 +0000 (11:21 +0100)]
s3-printing: Fix "printer admin" functionality.

Fix bug #7255 ("printer admin" parameter does not work as expected).
(cherry picked from commit 0d6d068bc4f76c2816f969fcce6013e1945794d4)

14 years agos3-spoolss: Fix value-needed calculation in_spoolss_EnumPrinterData().
Günther Deschner [Tue, 16 Mar 2010 09:30:04 +0000 (10:30 +0100)]
s3-spoolss: Fix value-needed calculation in_spoolss_EnumPrinterData().

Guenther

Fix bug #7256 (incorrect value-needed calculation in
_spoolss_EnumPrinterData()).

14 years agos3: Fix an uninitialized variable read
Volker Lendecke [Sun, 14 Mar 2010 20:18:34 +0000 (21:18 +0100)]
s3: Fix an uninitialized variable read

Found by Laurent Gaffie <laurent.gaffie@gmail.com>

Thanks for that,

Volker

Fix bug #7254 (An uninitialized variable read could cause an smbd crash).

14 years agos3:smbd: make sure we always have a valid talloc stackframe
Stefan Metzmacher [Mon, 15 Mar 2010 13:42:17 +0000 (14:42 +0100)]
s3:smbd: make sure we always have a valid talloc stackframe

metze
(cherry picked from commit 386f15c62bb4d3517de719c750252e06cf3b1fb1)

Last 3 patches address bug #7251 (Segfault in DEBUG(2,("waiting for
connections...)

14 years agotalloc_stack: reset stackframe pointers to NULL
Stefan Metzmacher [Mon, 15 Mar 2010 13:39:11 +0000 (14:39 +0100)]
talloc_stack: reset stackframe pointers to NULL

This makes it easier to debug the code in future.

metze
(cherry picked from commit d23581b4d7a4936002c1d2d748836aead9215120)

14 years agotalloc_stack: make sure we never let talloc_tos() return ts->talloc_stack[-1]
Stefan Metzmacher [Mon, 15 Mar 2010 13:32:52 +0000 (14:32 +0100)]
talloc_stack: make sure we never let talloc_tos() return ts->talloc_stack[-1]

In smbd there's a small gab between TALLOC_FREE(frame); before
we call smbd_parent_loop() where we don't have a valid talloc stackframe.

smbd_parent_loop() calls talloc_stackframe() only within the while(1) loop.
As DEBUG(2,("waiting for connections")) uses talloc_tos() to construct
the time header for the debug message we crash on some systems.

metze
(cherry picked from commit 10ed809a1a31be50ce09142eb99b3a243ae8b940)

14 years agos3-netlogon: Fix bug #7237: _netr_SamLogon segfaults for clients sending NULL domain.
Günther Deschner [Thu, 11 Mar 2010 23:30:52 +0000 (00:30 +0100)]
s3-netlogon: Fix bug #7237: _netr_SamLogon segfaults for clients sending NULL domain.

Thanks to Marc Muehlfeld <muehlfeld@medizinische-genetik.de>.

Guenther

14 years agos3:release-scripts: fix create-tarball to treat vendor patch level correctly
Michael Adam [Mon, 8 Mar 2010 22:37:21 +0000 (23:37 +0100)]
s3:release-scripts: fix create-tarball to treat vendor patch level correctly
(cherry picked from commit b845025daf2da85eb1af6cbfa7878cf59a32f2a6)