1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

68 Commits

Author SHA1 Message Date
Stefan Metzmacher
f6592c427d s3:smbd: fix compiler warnings in notify_internal.c
metze
2012-07-26 10:02:07 +02:00
Andrew Bartlett
666dba3353 s3-param: Rename loadparm_s3_context -> loadparm_s3_helpers
This helps clarify the role of this structure and wrapper function.

The purpose here is to provide helper functions to the lib/param
loadparm_context that point back at the s3 lp_ functions.  This allows
a struct loadparm_context to be passed to any point in the code, and
always refer to the correct loadparm system.  If this has not been
set, the variables loaded in the lib/param code will be returned.

As requested by Michael Adam.

Andrew Bartlett

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Jun 27 17:11:16 CEST 2012 on sn-devel-104
2012-06-27 17:11:16 +02:00
Michael Adam
73b200064f s3:util: rename procid_equal() to serverid_equal()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-21 08:27:32 +02:00
Christian Ambach
09494ed613 s3:smbd fix some compiler warnings 2012-05-08 22:37:05 +02:00
Volker Lendecke
8173331150 s3: Fix Coverity ID 2747: FORWARD_NULL
For the notify cleanup process we have a notify context without a
messaging entry. We will never call notify_add/remove for this, but
the code should protect against this.
2012-04-19 17:37:37 +02:00
Volker Lendecke
ee8d55622f s3: Fix Coverity ID 2749: REVERSE_INULL 2012-04-19 17:37:37 +02:00
Andrew Bartlett
338e5a1d35 s3-dbwrap: push lp_ctx up another layer in the stack
This will allow db_open_tdb() to be called from common code, which may
already have a loadparm context loaded.

It also slowly moves the lp_ctx up the stack, as required to remove
the library loop between smbconf and the registry.

Andrew Bartlett
2012-04-18 12:04:59 +10:00
Volker Lendecke
843432d56f s3: New notify implementation
From notify_internal.c:

        /*
         * The notify database is split up into two databases: One
         * relatively static index db and the real notify db with the
         * volatile entries.
         */

This change is necessary to make notify scale better in a cluster
2012-04-17 10:21:02 +02:00
Volker Lendecke
1cc7abf8aa s3: Remove the sys_notify dependency from notify_internal
Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Fri Mar 23 12:12:51 CET 2012 on sn-devel-104
2012-03-23 12:12:51 +01:00
Volker Lendecke
7dcc2bf7af s3: Remove "conn" param from notify_init() 2012-03-21 12:52:10 +01:00
Volker Lendecke
91f77253e7 s3: Remove "conn" param from sys_notify_context_create 2012-03-21 12:52:09 +01:00
Volker Lendecke
8e256a2734 s3: Pass "conn" to sys_notify_watch() 2012-03-21 12:52:09 +01:00
Volker Lendecke
8044db0a4d s3: Pass "conn" to notify_add() 2012-03-21 12:52:09 +01:00
Volker Lendecke
4319076cca s3: Pass "path" through vfs_notify_watch 2012-03-21 12:52:09 +01:00
Volker Lendecke
8503eecabb s3-notify: Lift "/." handling up one level
This slightly simplifies the code

Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Fri Mar 16 14:28:44 CET 2012 on sn-devel-104
2012-03-16 14:28:42 +01:00
Volker Lendecke
640a7d0db7 s3-notify: Simplify if-expressions 2012-03-16 11:20:11 +01:00
Volker Lendecke
21f72a1ac3 s3: Use talloc_tos() in notify_send()
Signed-off-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Thu Mar 15 12:43:41 CET 2012 on sn-devel-104
2012-03-15 12:43:41 +01:00
Volker Lendecke
f69c6920d4 s3: Fix lock ordering in notify_add
It's not necessary to keep the global notify record locked during
the inotify and notify_onelevel.tdb operations.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-03-15 11:00:24 +01:00
Volker Lendecke
a1fd41d834 s3: properly free the notify_onelevel record
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-03-15 11:00:24 +01:00
Volker Lendecke
21375a6e58 s3: Replace some callers of cluster_id_equal
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-03-15 11:00:24 +01:00
Volker Lendecke
81ec0cc602 s3: Remove the separate server_id arg to notify_init
The server_id is tied to the messaging_context

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-03-15 11:00:24 +01:00
Volker Lendecke
157a6916a9 s3: Fix blank line endings
Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Thu Mar 15 10:59:46 CET 2012 on sn-devel-104
2012-03-15 10:59:46 +01:00
Jelmer Vernooij
ce4531ee31 tdb_wrap: Move to specific directory.
It's a bit confusing to mix low-level and high-level libraries.  We had
multiple libraries in one directory, and there were have circular
dependencies with other libraries outside that directory (in this case,
samba-hostconfig).

Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Sat Mar 10 23:13:01 CET 2012 on sn-devel-104
2012-03-10 23:13:01 +01:00
Volker Lendecke
45e61fcf61 s3: Add a "lock_order" argument to db_open
This will be used to enforce a lock hierarchy between the databases. We have
seen deadlocks between locking.tdb, brlock.tdb, serverid.tdb and notify*.tdb.
These should be fixed by refusing a dbwrap_fetch_locked that does not follow a
defined lock hierarchy.
2012-01-18 14:48:04 +01:00
Andrew Bartlett
01c934c81e lib/util: Add back control of mmap and hash size in tdb for top level build
This passes down a struct loadparm_context to allow these
parameters to be checked.  This may be s3 or s4 context, allowing the
#if _SAMBA_BUILD_ macro to go away safely.

Andrew Bartlett
2011-10-13 14:06:07 +02:00
Michael Adam
506349832c s3:smbd: convert notify db to use dbwrap wrapper functions
Avoid direct use of the db_record and db_context structs.
2011-10-11 14:17:57 +02:00
Michael Adam
0b5c4a601a s3:dbwrap: move all .c and .h files of dbwrap to lib/dbwrap/
Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Fri Jul 29 13:34:22 CEST 2011 on sn-devel-104
2011-07-29 13:34:22 +02:00
Michael Adam
1abdd9b2bb s3:dbwrap: move db_open() to a file dbwrap_open.c of its own.
Also start new folder lib/dbwrap/ where dbwrap_open.c is stored and
make the fallbacke implementation functoins non-static and create a
dbwrap_private.h header file that contains their prototypes.
2011-07-29 12:23:13 +02:00
Rusty Russell
d925b327f4 tdb_compat: Higher level API fixes.
My previous patches fixed up all direct TDB callers, but there are a
few utility functions and the db_context functions which are still
using the old -1 / 0 return codes.

It's clearer to fix up all the callers of these too, so everywhere is
consistent: non-zero means an error.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20 11:18:35 +02:00
Andrew Bartlett
ad0a07c531 s3-talloc Change TALLOC_ZERO_P() to talloc_zero()
Using the standard macro makes it easier to move code into common, as
TALLOC_ZERO_P isn't standard talloc.
2011-06-09 12:40:08 +02:00
Günther Deschner
d8cfca3a9b s3: only include tdb headers where needed.
Guenther
2011-05-06 10:48:10 +02:00
Andrew Bartlett
1475013963 lib/util Move source3 tdb_wrap_open() into the common code.
This #if _SAMBA_BUILD == 3 is very unfortunate, as it means that in
the top level build, these options are not available for these
databases.  However, having two different tdb_wrap lists is a worse
fate, so this will do for now.

Andrew Bartlett
2011-05-06 07:51:24 +02:00
Jeremy Allison
02af307585 More simple const fixes. 2011-05-05 23:56:07 +02:00
Günther Deschner
ab36d597e7 s3-messages: make ndr_messaging.h part of messages.h.
Guenther
2011-03-30 01:13:09 +02:00
Günther Deschner
b2af281e50 s3-messages: only include messages.h where needed.
Guenther
2011-03-30 01:13:09 +02:00
Günther Deschner
8c24ebf371 s3: include smbd/smbd.h where needed.
Guenther
2011-03-30 01:13:08 +02:00
Günther Deschner
0e771263ee s3-includes: only include system/filesys.h when needed.
Guenther
2011-03-30 01:13:07 +02:00
Jeremy Allison
f98d217514 Change to using TDB_INCOMPATIBLE_HASH (the jenkins hash) on all
TDB_CLEAR_IF_FIRST tdb's. For tdb's like gencache where we open
without CLEAR_IF_FIRST and then with CLEAR_IF_FIRST if corrupt
this is still safe to use as if opening an existing tdb the new
hash will be ignored - it's only used on creating a new tdb not
opening an old one.

Jeremy.
2010-09-27 17:18:54 -07:00
Volker Lendecke
3b2efdc7d7 s3: Remove talloc_autofree_context() from notify_internal_parent_init() 2010-09-26 17:36:40 +02:00
Günther Deschner
7a05ca2c9c s3-build: use dbwrap.h only where needed.
Guenther
2010-08-26 00:25:55 +02:00
Jelmer Vernooij
b8268cf7b0 s3: Remove use of iconv_convenience. 2010-05-18 11:45:31 +02:00
Günther Deschner
c6ebab846d s3: only include gen_ndr headers where needed.
This shrinks include/includes.h.gch by the size of 7 MB and reduces build time
as follows:

ccache build w/o patch
real    4m21.529s
ccache build with patch
real    3m6.402s

pch build w/o patch
real    4m26.318s
pch build with patch
real    3m6.932s

Guenther
2010-05-06 00:22:59 +02:00
Christian Ambach
96ae3ee803 fix a segfault in the notify subsystem
When the notify_array cannot be loaded correctly,
do not keep the half-baked parsing results in the global variable.

This can lead to segfaults next time notify_load is entered and
the seqnum has not changed. This has been seen in a case
where mixed smbd versions were running in a CTDB cluster
(versions with and w/o commit c216d1e6 that changed the
notify_entry structure).
There will be missed notifications until all smbds are at the
same software level, but this should be acceptable and is better
than crashing and interrupting client operations.

This fix cleans up the notify_array, removes the unparseable data
from the TDB and returns a fresh notify_array that can be worked
with.

The NDR_PRINT_DEBUG had to be moved to only be called when the
parsing succeeded, it was seen to cause additional segfaults.

The status variable is intentionally left to NT_STATUS_OK to not
make callers abort and report errors to the clients and make them
disconnect.

Signed-off-by: Christian Ambach <christian.ambach@de.ibm.com>
2010-04-06 14:09:06 +02:00
Volker Lendecke
6392eaf6a3 s3: Add a comment to notify_internal_parent_init, this is pretty confusing 2010-03-25 16:46:23 +01:00
Volker Lendecke
ed189459b9 s3: Make sure our CLEAR_IF_FIRST optimization works for the notify tdbs
The notify tdb files are opened at tconX time, which leads to one fcntl lock
for CLEAR_IF_FIRST detection per smbd. This opens the tdbs in the parent and
holds it, so that tdb_reopen_all correctly catches the CLEAR_IF_FIRST bit.
2010-03-25 16:40:44 +01:00
Andrew Tridgell
3f0898a9f5 s3-smbd: convert lanman and notify code to TYPESAFE_QSORT() 2010-02-14 18:44:21 +11:00
Volker Lendecke
44f75eded1 s3: notify_onelevel does not use seqnums, so don't open asking for it 2010-02-12 12:08:22 +01:00
Volker Lendecke
b6303f0372 s3: Fix a crash in notify_remove_onelevel when "change notify = no" 2009-11-05 15:08:57 +01:00
Volker Lendecke
b5afbb687d s3: Fix the talloc hierarchy in notify_remove_onelevel
We want to free the record early, not when talloc_tos() is free'ed.
2009-11-05 14:44:25 +01:00
Volker Lendecke
3b666bf0f9 Fix notify_onelevel: notify is not necessarily enabled
Thanks to Günther Deschner!

Volker
2009-04-30 12:25:46 +02:00