summaryrefslogtreecommitdiff
path: root/source3/lib/serverid.c
AgeCommit message (Collapse)AuthorFilesLines
2025-09-29lib: Add a safeguard for misconfigured directory permissionsVolker Lendecke1-0/+7
An installation I've seen had the path to the msg.lock directory set up such that only root could access it. We're calling serverid_exists() as non-root, so this is a pretty bad error. Log this as an error in syslog by default and assume this PID still exists. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Mon Sep 29 08:14:22 UTC 2025 on atb-devel-224
2025-09-29lib: Remove an #include "includes.h"Volker Lendecke1-2/+4
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2020-05-06lib/messaging: Move messages_dgm out of source3Amitay Isaacs1-1/+1
... so CTDB can also use it. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org>
2017-12-05lib: Remove unused serverid.tdbVolker Lendecke1-344/+0
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Dec 5 04:58:26 CET 2017 on sn-devel-144
2017-12-05messaging: Remove the "n_sent" arg from message_send_allVolker Lendecke1-7/+1
The only user of this is an informative message in smbcontrol. I don't think that's worth the effort. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2017-09-26lib: Add "unique_id" to ctdbd_process_existsVolker Lendecke1-1/+1
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13042 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-07-25ctdb_conn: Use messaging_ctdb_connectionVolker Lendecke1-3/+3
Replace messaging_ctdbd_connection Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2017-06-21lib: Give messages_ctdbd.c its own headerVolker Lendecke1-0/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2017-01-22lib: Add lib/util/server_id.hVolker Lendecke1-0/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2016-07-28lib: Move "message_send_all" to serverid.cVolker Lendecke1-0/+95
Trying to trim down messages.c a bit: Sending to all processes that are registered in serverid.tdb and filtering to me is not really logic of general messaging but more of the serverid code. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2015-10-19lib: Remove unused serverid_get_random_unique_idVolker Lendecke1-12/+0
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Mon Oct 19 15:12:22 CEST 2015 on sn-devel-104
2015-09-30lib: Remove ctdb_serverids_existVolker Lendecke1-3/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2015-09-30lib: Remove serverids_existVolker Lendecke1-211/+0
The only reason for this complex monster was an overload of ctdbd. When opening files, we unconditionally checked all share modes for validity. This meant thousands of serverid_exists calls per second for popular directories. This has long gone, now we only check for validity if a conflict happens. The only remaining caller is net serverid wipedbs, an administrative command. If that loads ctdbd, so be it. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2015-09-30lib: Use messaging_dgm_get_unique in serverid_existsVolker Lendecke1-6/+30
This is a relevant change: I was experimenting with server_id_db_set_exclusive() in "net" and got failures all over the place. The main reason was that "net" by default does not do a serverid_register. With messaging_dgm we have the process' unique id available via the lockfile contents. Using open/read/close is a bit slower than local tdb access, but this version is safe for all processes which have done messaging_init() Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2015-05-28ctdbd_conn: Add callback args to register_with_ctdbdVolker Lendecke1-1/+2
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-11-03serverid: don't leak lock_path onto talloc tosDavid Disseldorp1-1/+9
Also check for allocation failures. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2014-07-31lib: Remove unused serverid_register_msg_flags()Volker Lendecke1-55/+0
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2014-05-27serverid: Fix an incompatible pointer assignmentVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-05-12s3:lib: always use db_open(serverid.tdb)Stefan Metzmacher1-35/+14
We should not create an empty local serverid.tdb in a cluster setup... Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2014-03-31tdb_wrap: Remove tdb_wrap_open_ againVolker Lendecke1-6/+6
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2014-03-31serverid: Avoid passing lp_ctx to tdb_wrap_open in serverid_parent_initVolker Lendecke1-3/+9
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2014-03-24s3:build: remove global CLUSTER_SUPPORT defineStefan Metzmacher1-4/+0
All ctdb specific code is isolated in samba-cluster-support.so now. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Mon Mar 24 19:08:44 CET 2014 on sn-devel-104
2014-03-24s3:serverid: use ctdb_serverids_exist_supported() runtime checkStefan Metzmacher1-5/+9
This is better than a compile time check for HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2014-02-07dbwrap: add a dbwrap_flags argument to db_open()Michael Adam1-1/+2
This is in preparation to support handing flags to backends, in particular activating read only record support for ctdb databases. For a start, this does nothing but adding the parameter, and all databases use DBWRAP_FLAG_NONE. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2012-08-24s3:lib: readd the CTDB_CONTROL_CHECK_SRVIDS optimization to serverids_exist()Stefan Metzmacher1-0/+45
metze
2012-08-24s3:lib: only loop over the server_ids we need to verify in serverids_exist()Stefan Metzmacher1-11/+23
metze
2012-08-24s3:lib: use server_id_is_disconnected() in serverids_exist()Stefan Metzmacher1-0/+4
metze
2012-08-24s3:lib: inline processes_exist() into serverids_exist()Stefan Metzmacher1-14/+99
metze
2012-08-24s3:lib: SERVERID_UNIQUE_ID_NOT_TO_VERIFY only means not to verify the ↵Stefan Metzmacher1-3/+4
'unique_id' part It doesn't mean the the server_id is always valid. metze
2012-08-24s3:lib: implement serverid_exists() as wrapper of serverids_exist()Stefan Metzmacher1-30/+5
metze
2012-08-24s3:lib: remove CTDB_CONTROL_CHECK_SRVIDS optimization in serverids_exist() ↵Stefan Metzmacher1-6/+0
for now This will be readded... metze
2012-08-17s3:lib: implement serverid_equal() as macro of server_id_equal()Stefan Metzmacher1-21/+0
metze
2012-06-27s3-param: Rename loadparm_s3_context -> loadparm_s3_helpersAndrew Bartlett1-1/+1
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-22s3:serverid: don't ignore the result of dbwrap_parse_record()Stefan Metzmacher1-1/+6
metze
2012-06-21s3:move serverid_equal() to serverid.cMichael Adam1-0/+21
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-03-10tdb_wrap: Move to specific directory.Jelmer Vernooij1-1/+1
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-02-15s3: Add SERVERID_UNIQUE_ID_NOT_TO_VERIFY, bug 8760Volker Lendecke1-0/+20
Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Wed Feb 15 21:10:22 CET 2012 on sn-devel-104
2012-01-18s3: Add a "lock_order" argument to db_openVolker Lendecke1-1/+2
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.
2011-12-15s3-dbwrap: Make dbwrap_parse_record return NTSTATUSVolker Lendecke1-4/+6
Also, the parser now returns void. The parser is called if and only if dbwrap_parse_record returns NT_STATUS_OK. Signed-off-by: Michael Adam <obnox@samba.org>
2011-11-30s3-ctdb: Make use of CTDB_CONTROL_CHECK_SRVIDSVolker Lendecke1-0/+13
This should be a lot quicker than PROCESS_EXISTS followed by looking at serverid.tdb Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Wed Nov 30 12:47:27 CET 2011 on sn-devel-104
2011-10-27s3: Add serverids_existVolker Lendecke1-0/+34
2011-10-13lib/util: Add back control of mmap and hash size in tdb for top level buildAndrew Bartlett1-1/+10
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-11s3:serverid: convert to using dbwrap wrapper functions onlyMichael Adam1-16/+24
Avoid direct use of the db_record and db_context structs.
2011-10-11s3:serverid: use dbwrap_traverse_read() in serverid_traverse_read()Michael Adam1-1/+5
This also fixes the return value: originally the int return value of traverse_read which is a count of the records traversed or negative upon failure, was simply casted into a bool return value.
2011-10-11s3:serverid: use dbwrap_traverse() in serverid_traverse()Michael Adam1-1/+4
This also fixes the return value: Originally, the int returned by the traverse method, which is the count of the traverse was casted into a bool return value.
2011-08-22s3: Slightly simplify serverid_existsVolker Lendecke1-1/+1
procid_is_me() works fine in the clustering case as well Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Mon Aug 22 21:28:13 CEST 2011 on sn-devel-104
2011-08-20Re-arrange the optimization to reduce tdb fcntl calls if smbd is notIra Cooper1-1/+5
clustered. procid_is_me() is much cheaper to test and can optimize up to 50% of the calls to serverid_exists(). Volker please check. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Sat Aug 20 01:15:07 CEST 2011 on sn-devel-104
2011-07-29s3:dbwrap: move all .c and .h files of dbwrap to lib/dbwrap/Michael Adam1-1/+1
Autobuild-User: Michael Adam <obnox@samba.org> Autobuild-Date: Fri Jul 29 13:34:22 CEST 2011 on sn-devel-104
2011-07-29s3:dbwrap: move db_open() to a file dbwrap_open.c of its own.Michael Adam1-0/+1
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-06-20tdb_compat: Higher level API fixes.Rusty Russell1-1/+1
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>