samba.git
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)

14 years agos4-smbtorture: add --option=torture:spoolss_check_size=yes.
Günther Deschner [Fri, 19 Feb 2010 13:25:19 +0000 (14:25 +0100)]
s4-smbtorture: add --option=torture:spoolss_check_size=yes.

This disables the size calculation comparison by default.

Guenther
(cherry picked from commit f2ecec3dcdafd63cd72d13019a998bf99539a9ba)

The last 18 patches address bug #6727 (Printer issues on 3.4.x).

14 years agos4-smbtorture: fix smbtorture after GetPrinterData{Ex} after IDL changes.
Günther Deschner [Thu, 4 Mar 2010 21:40:31 +0000 (22:40 +0100)]
s4-smbtorture: fix smbtorture after GetPrinterData{Ex} after IDL changes.

Guenther

14 years agos4-smbtorture: fix RPC-SPOOLSS-WIN after PrinterData IDL changes.
Günther Deschner [Fri, 5 Mar 2010 19:32:16 +0000 (20:32 +0100)]
s4-smbtorture: fix RPC-SPOOLSS-WIN after PrinterData IDL changes.

Guenther
(cherry picked from commit 58c9070746a3e0725f5d3a3ce6deda8fad0c5974)

14 years agos4-spoolss: fix dcesrv_spoolss_GetPrinterData build.
Günther Deschner [Fri, 5 Mar 2010 15:34:17 +0000 (16:34 +0100)]
s4-spoolss: fix dcesrv_spoolss_GetPrinterData build.

really not my day today...

Guenther
(cherry picked from commit 91ff11d50458a951ab0adc9b37bcb0ef4ee09e15)

14 years agos4-spoolss: fix spoolss_GetPrinterData implementation after IDL change.
Günther Deschner [Thu, 4 Mar 2010 17:21:50 +0000 (18:21 +0100)]
s4-spoolss: fix spoolss_GetPrinterData implementation after IDL change.

Guenther

14 years agos3: re-run make samba3-idl.
Günther Deschner [Fri, 5 Mar 2010 16:17:49 +0000 (17:17 +0100)]
s3: re-run make samba3-idl.

Guenther

14 years agos3-libads: fix get_remote_printer_publishing_data after spoolss_EnumPrinterDataEx...
Günther Deschner [Thu, 4 Mar 2010 16:58:49 +0000 (17:58 +0100)]
s3-libads: fix get_remote_printer_publishing_data after spoolss_EnumPrinterDataEx IDL change.

Guenther
(cherry picked from commit 8e6dd25391d77b69859a3b622a1b116fa8000a40)

14 years agos3-spoolss: fix _spoolss_EnumPrinterDataEx after idl
Günther Deschner [Thu, 4 Mar 2010 15:47:33 +0000 (16:47 +0100)]
s3-spoolss: fix _spoolss_EnumPrinterDataEx after idl

Guenther
(cherry picked from commit 55326549852a3ab1114a8cb1536578ae02183eb8)

14 years agos3-rpcclient: fix rpcclient after spoolss_EnumPrinterDataEx IDL change.
Günther Deschner [Thu, 4 Mar 2010 15:47:10 +0000 (16:47 +0100)]
s3-rpcclient: fix rpcclient after spoolss_EnumPrinterDataEx IDL change.

Guenther
(cherry picked from commit becbb624eb90b84ff20b128de1aee5f5acfc3dbc)

14 years agos3-net: fix net after spoolss_EnumPrinterDataEx IDL change.
Günther Deschner [Thu, 4 Mar 2010 15:46:53 +0000 (16:46 +0100)]
s3-net: fix net after spoolss_EnumPrinterDataEx IDL change.

Guenther
(cherry picked from commit a99ac4f236d9a93d4ca8bd874cbab89b155c644a)

14 years agospoolss: fix spoolss_EnumPrinterDataEx IDL.
Günther Deschner [Thu, 4 Mar 2010 15:40:31 +0000 (16:40 +0100)]
spoolss: fix spoolss_EnumPrinterDataEx IDL.

Guenther
(cherry picked from commit 4df1047e8398a9af4df94c7e245d993d1f60ef5f)

14 years agos3-rpcclient: fix rpcclient after spoolss_GetPrinterData{Ex} IDL change.
Günther Deschner [Thu, 4 Mar 2010 14:46:28 +0000 (15:46 +0100)]
s3-rpcclient: fix rpcclient after spoolss_GetPrinterData{Ex} IDL change.

Guenther
(cherry picked from commit 7643afa70e879efc059c75b8309bf89dbb3c459b)

14 years agos3-spoolss: fix _spoolss_GetPrinterDataEx after IDL change.
Günther Deschner [Thu, 4 Mar 2010 14:39:59 +0000 (15:39 +0100)]
s3-spoolss: fix _spoolss_GetPrinterDataEx after IDL change.

Guenther
(cherry picked from commit fbb6d00eed6bca960aa53a5967a2dea426cacfe2)

14 years agospoolss: rollback GetPrinterData[Ex] IDL.
Günther Deschner [Thu, 4 Mar 2010 14:38:18 +0000 (15:38 +0100)]
spoolss: rollback GetPrinterData[Ex] IDL.

Guenther
(cherry picked from commit 0e779b573bf5c27bf08ceefa09a7e2b07691f948)

14 years agos3-rpcclient: fix rpcclient after spoolss_SetPrinterData{Ex} IDL change.
Günther Deschner [Thu, 4 Mar 2010 14:34:49 +0000 (15:34 +0100)]
s3-rpcclient: fix rpcclient after spoolss_SetPrinterData{Ex} IDL change.

Guenther
(cherry picked from commit 4956650369156dfff96ccc827e55697ec642240d)

14 years agos3-net: fix net after spoolss_SetPrinterData{Ex} IDL change.
Günther Deschner [Thu, 4 Mar 2010 14:34:22 +0000 (15:34 +0100)]
s3-net: fix net after spoolss_SetPrinterData{Ex} IDL change.

Guenther
(cherry picked from commit 37ca9288d2631b48a8eb50c01d6c0cc462d8ee31)

14 years agos3-spoolss: fix _spoolss_SetPrinterData{Ex} after IDL change.
Günther Deschner [Thu, 4 Mar 2010 16:00:34 +0000 (17:00 +0100)]
s3-spoolss: fix _spoolss_SetPrinterData{Ex} after IDL change.

Guenther
(cherry picked from commit 9a934832797c3e72859770719e05d19a5eefa14d)

14 years agospoolss: rollback SetPrinterData{Ex} IDL.
Günther Deschner [Wed, 3 Mar 2010 17:22:57 +0000 (18:22 +0100)]
spoolss: rollback SetPrinterData{Ex} IDL.

Guenther
(cherry picked from commit 0528515be44c40603827bb153ff0e2bac7b0f041)

14 years agoFix bug #7234 - Symlink delete fails but incorrectly reports success to client.
Jeremy Allison [Wed, 10 Mar 2010 22:06:18 +0000 (14:06 -0800)]
Fix bug #7234 - Symlink delete fails but incorrectly reports success to client.

Typo called LSTAT instead of STAT in the unlink by pathname path.

Jeremy.
(cherry picked from commit 367ddc3d1b525525a9dae077335e33dc0017b58e)

14 years agos3:build: Fix automatic building of vfs_tsmsm if gpfs and dmapi are present.
Michael Adam [Mon, 8 Mar 2010 21:32:41 +0000 (22:32 +0100)]
s3:build: Fix automatic building of vfs_tsmsm if gpfs and dmapi are present.

Michael
(cherry picked from commit 9113e14b291c10c824d2d8ea5cb28ffc0adcb63b)

Fix bug #7231 (vfs_tsmsm not built automatically).

14 years agos3: Fix a NULL pointer dereference
Volker Lendecke [Tue, 9 Mar 2010 10:14:14 +0000 (11:14 +0100)]
s3: Fix a NULL pointer dereference

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

Thanks!

Volker
(cherry picked from commit 25452a2268ac7013da28125f3df22085139af12d)

Fix bug #7229 (NULL pointer dereference).

14 years agos3:winbindd: add DEBUG(10,...) for the end of each top level
Stefan Metzmacher [Fri, 5 Mar 2010 10:16:12 +0000 (11:16 +0100)]
s3:winbindd: add DEBUG(10,...) for the end of each top level

That will hopefully make debugging a bit easier (at least for me).

metze
(cherry picked from commit 31293c64a323eb59fd8e81cd44bb33768a43e0c0)

Fix bug #7225 (Make winbindd logs more verbose for troubleshooting).

14 years agovfs_netatalk: Segfault if hide files or veto files has no ".AppleDouble"
SATOH Fumiyasu [Wed, 10 Mar 2010 03:15:44 +0000 (12:15 +0900)]
vfs_netatalk: Segfault if hide files or veto files has no ".AppleDouble"

Fix bug #1206 (netatalk vfs causes segfaults in samba).

14 years agoWHATSNEW: Start release notes for Samba 3.5.2.
Karolin Seeger [Tue, 9 Mar 2010 09:36:06 +0000 (10:36 +0100)]
WHATSNEW: Start release notes for Samba 3.5.2.

Karolin

14 years agoVERSION: Raise version number up to 3.5.2.
Karolin Seeger [Tue, 9 Mar 2010 09:33:30 +0000 (10:33 +0100)]
VERSION: Raise version number up to 3.5.2.

Karolin

14 years agoRevert "Fix bug #7067 - Linux asynchronous IO (aio) can cause smbd to fail to respond...
Karolin Seeger [Mon, 8 Mar 2010 19:34:39 +0000 (20:34 +0100)]
Revert "Fix bug #7067 - Linux asynchronous IO (aio) can cause smbd to fail to respond to a read or write."

This reverts commit a6ae7a552f851a399991262377cc0e062e40ac20.

This fixes bug #7222 (All users have full rigths on all shares) (CVE-2010-0728).
(cherry picked from commit 1c9494c76cc9686c61e0966f38528d3318f3176f)

14 years agoWHATSNEW: Prepare release notes for Samba 3.5.1.
Karolin Seeger [Mon, 8 Mar 2010 19:32:49 +0000 (20:32 +0100)]
WHATSNEW: Prepare release notes for Samba 3.5.1.

Karolin
(cherry picked from commit cd499eaf0418fa0a3034c5ba4709278a302ea980)

14 years agos3: Fix the build of net_afs.c with --fake-kaserver=yes, bug 7216
Volker Lendecke [Sat, 6 Mar 2010 11:57:35 +0000 (12:57 +0100)]
s3: Fix the build of net_afs.c with --fake-kaserver=yes, bug 7216

Thanks to Geza Gemes <geza@kzsdabas.hu> for filing this bug
(cherry picked from commit 5a3633faf12cdec41dc18064d5364a3fd067a22d)

14 years agomount.cifs: don't allow it to be run as setuid root program
Jeff Layton [Tue, 26 Jan 2010 13:36:11 +0000 (08:36 -0500)]
mount.cifs: don't allow it to be run as setuid root program

mount.cifs has been the subject of several "security" fire drills due to
distributions installing it as a setuid root program. This program has
not been properly audited for security and the Samba team highly
recommends that it not be installed as a setuid root program at this
time.

To make that abundantly clear, this patch forcibly disables the ability
for mount.cifs to run as a setuid root program. People are welcome to
trivially patch this out, but they do so at their own peril.

A security audit and redesign of this program is in progress and we hope
that we'll be able to remove this in the near future.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
The last 3 patches address bug #6853 (mount.cifs race that allows user to
replace mountpoint with a symlink).

14 years agomount.cifs: check for invalid characters in device name and mountpoint
Jeff Layton [Tue, 26 Jan 2010 13:36:03 +0000 (08:36 -0500)]
mount.cifs: check for invalid characters in device name and mountpoint

It's apparently possible to corrupt the mtab if you pass embedded
newlines to addmntent. Apparently tabs are also a problem with certain
earlier glibc versions. Backslashes are also a minor issue apparently,
but we can't reasonably filter those.

Make sure that neither the devname or mountpoint contain any problematic
characters before allowing the mount to proceed.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
14 years agomount.cifs: take extra care that mountpoint isn't changed during mount
Jeff Layton [Tue, 26 Jan 2010 13:35:35 +0000 (08:35 -0500)]
mount.cifs: take extra care that mountpoint isn't changed during mount

It's possible to trick mount.cifs into mounting onto the wrong directory
by replacing the mountpoint with a symlink to a directory. mount.cifs
attempts to check the validity of the mountpoint, but there's still a
possible race between those checks and the mount(2) syscall.

To guard against this, chdir to the mountpoint very early, and only deal
with it as "." from then on out.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
14 years agos3: net_share.c: fix argc handling
Holger Hetterich [Wed, 3 Mar 2010 11:58:15 +0000 (12:58 +0100)]
s3: net_share.c: fix argc handling

The "net share" command was no longer possible because it enters
the net_share function with argc == 0.

Fix bug #7203 (net share doesn't work anymore).