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

6817 Commits

Author SHA1 Message Date
Volker Lendecke
770b0e40d2 lib: Pass sockname and timeout to ctdbd_messaging_connection
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-03 00:01:11 +02:00
Volker Lendecke
025fb48360 lib: Move lp_ctdbd_socket() to cluster_support.c
There we have a #ifdef CTDB_SOCKET anyway

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-03 00:01:11 +02:00
Volker Lendecke
ccd31e0c18 lib: Pass parameters to ctdbd_init_connection()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-03 00:01:11 +02:00
Volker Lendecke
0bc244ee58 lib: Store sockname in ctdbd_connection
We'll need it in ctdbd_traverse()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-03 00:01:11 +02:00
Volker Lendecke
6c86062453 lib: Remove temporary ctdb_connection in ctdb_control
I can just assume this is a bad hack for a condition that should have been
fixed in a different way. Today we pretty much expect a messaging_context to be
properly initialized everywhere, and this includes a ctdb connection.

If something later fails due to this commit, we need to do a
messaging_init before the offending call

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-03 00:01:11 +02:00
Volker Lendecke
2aedb2d085 lib: Store ctdb_timeout in ctdb_connection
This lifts the call to lp_ctdb_timeout() up

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-03 00:01:11 +02:00
Volker Lendecke
54c7b05283 lib: Lift lp_ctdbd_socket() call up one level
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-03 00:01:11 +02:00
Volker Lendecke
00954a975b lib: We can do ACCRIGHTS style fdpassing
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11053

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Thu Oct  1 05:55:42 CEST 2015 on sn-devel-104
2015-10-01 05:55:42 +02:00
Volker Lendecke
0499cee903 lib: Support fd passing using the 4.3BSD way
This is required on Solaris

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11053

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-10-01 02:55:21 +02:00
Volker Lendecke
f4e06a9bce lib: Move some routines around in msghdr.c
This way we only need one #ifdef for ACCRIGHTS

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11053

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-10-01 02:55:21 +02:00
Volker Lendecke
2c675aad40 lib: We only need the fd-passing check once
unix_dgram_send will tell us as well

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11053

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-10-01 02:55:21 +02:00
Volker Lendecke
620b7467ad lib: Remove ctdb_serverids_exist
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-09-30 23:51:13 +02:00
Volker Lendecke
103658ddd0 lib: Remove serverids_exist
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-30 23:51:13 +02:00
Volker Lendecke
b542ce7db3 lib: Use messaging_dgm_get_unique in serverid_exists
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-09-30 23:51:13 +02:00
Volker Lendecke
c793fb8a66 lib: Use serverid_exists in server_id_db_check_exclusive
If there's another process around there will typically be at most
one process. So there is no real need to run the plural version of
serverid_exists.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-09-30 23:51:13 +02:00
Volker Lendecke
37f01c869d messages_dgm: Add messaging_dgm_get_unique
To be able to read, we need to open the lockfile O_RDWR instead of O_WRONLY

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-09-30 23:51:13 +02:00
Michael Adam
348dd41871 s3:lib:interface: break an overly long line
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-09-30 23:51:12 +02:00
Volker Lendecke
edd18f7a1d messages_dgm: Fix an incorrect cast
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Sep 30 17:36:32 CEST 2015 on sn-devel-104
2015-09-30 17:36:32 +02:00
Volker Lendecke
cfca46a565 messages_dgm: No includes.h necessary
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-09-30 14:35:20 +02:00
Christof Schmitt
96c48b3c06 s3: Move call to prctl_set_comment to reinit_after_fork
This save a few lines of code.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2015-09-24 08:00:16 +02:00
Volker Lendecke
a1187bb873 dbwrap: Remove talloc from dbwrap_watch_record_stored()
This happens on every store to locking.tdb for example, so we should
make it cheap.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Sep 22 07:50:58 CEST 2015 on sn-devel-104
2015-09-22 07:50:57 +02:00
Volker Lendecke
1a8750a2c6 dbwrap: Convert dbwrap_record_watchers_key to not use talloc
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-09-22 04:51:16 +02:00
Volker Lendecke
2e0e06c3c5 dbwrap: Simplify dbwrap_record_watchers_key()
It took a bit for me to figure out what the rec_key parameter to
dbwrap_record_watchers_key does. I think it's simpler to parse the watcher key
in dbwrap_record_watch_recv to retrieve the watched record key than to store it

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-09-22 04:51:16 +02:00
Volker Lendecke
9964d60e3e dbwrap: Make dbwrap_db_id return size_t
This will make an on-stack db-id easier

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-09-22 04:51:16 +02:00
Stefan Metzmacher
1aabd9298d s3:lib/messages: use 'msg.lock' and 'msg.sock' for messaging related subdirs
In Samba 4.2, we used lock_path("msg") (with 0700) for the socket directory,
while we use lock_path("msg") (with 0755) for the lock file directory.

This generates a conflict that prevents samba, smbd, nmbd and winbindd
from starting after an upgrade.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11515

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2015-09-17 06:03:17 +02:00
Stefan Metzmacher
b0fa8316be s3:lib/messages: add missing allocation check for priv_path
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11515

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2015-09-17 06:03:17 +02:00
Ralph Wuerthner
e139f19327 s3: add suport for SMB3_10 and SMB3_11 protocols in smbstatus
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11472

Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Aug 29 07:05:10 CEST 2015 on sn-devel-104
2015-08-29 07:05:10 +02:00
Volker Lendecke
c9d97e3a2e lib: Make sid_linearize take a uint8_t
We marshall into a binary buffer, uint8_t better reflects that.

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): Thu Aug 27 00:40:58 CEST 2015 on sn-devel-104
2015-08-27 00:40:58 +02:00
Volker Lendecke
4a442e2eb7 lib: Make sid_parse take a uint8_t
sid_parse takes a binary blob, uint8_t reflects this a bit
better than char * does

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-08-26 21:41:12 +02:00
Roel van Meer
4e178ed498 s3-util: Compare the maximum allowed length of a NetBIOS name
This fixes a problem where is_myname() returns true if one of our names
is a substring of the specified name.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11427

Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2015-08-25 18:43:14 +02:00
Stefan Metzmacher
ce3c77fb45 s3:lib: fix some corner cases of open_socket_out_cleanup()
In case of timeouts we retry the async_connect_send() and forgot
to remember it, this results in an abort() in async_connect_cleanup()
as the fd is already closed when calling fcntl(F_SETFL).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2015-08-17 17:43:36 +02:00
Michael Adam
a4aaea6910 s3:lib: remove unused dummyparam.c
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-07-31 01:55:29 +02:00
Uri Simchoni
102a4503b3 source3/lib: include config.h before any glibc headers
config.h may have some flags which affect glibc behavior, e.g.
_FILE_OFFSET_BITS=64. To make sure these flags have the desired
effect, config.h must be included before any glibc header files.

This commit does not fix a specific known bug. It changes the code to
comply with coding conventions.

Signed-off-by: Uri Simchoni <urisimchoni@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: "Stefan Metzmacher" <metze@samba.org>
2015-07-17 01:38:15 +02:00
Volker Lendecke
539125c99d ctdbd_conn: Move release_ip handling into process.c
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Jul 14 09:56:25 CEST 2015 on sn-devel-104
2015-07-14 09:56:25 +02:00
Volker Lendecke
55233940c6 ctdbd_conn: Do an early return from ctdb_read_req
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-07-14 06:51:21 +02:00
Volker Lendecke
41b413916b ctdbd_conn: Return early from ctdbd_msg_call_back
... if the callback returns != 0

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-07-14 06:51:21 +02:00
Volker Lendecke
db1bee97f2 ctdbd_conn: Make register_with_ctdbd use an int-returning callback
This will allow an early return from ctdbd_msg_call_back so that we can also
handle CTDB_SRVID_RELEASE_IP via register_with_ctdbd.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-07-14 06:51:21 +02:00
Volker Lendecke
eca508f3c8 ctdbd_conn: Convert ctdb_read_req to return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-07-14 06:51:21 +02:00
Volker Lendecke
177b6a4571 ctdbd_conn: Convert ctdb_handle_message to return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-07-14 06:51:21 +02:00
Volker Lendecke
9bb10caff8 ctdbd_conn: Make ctdb_read_packet return 0/errno
A little less dependencies

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-07-14 06:51:21 +02:00
Volker Lendecke
0b9a8a042f ctdbd_conn: Rename "ret"->"ok"
We'll need "ret" soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-07-14 06:51:21 +02:00
Volker Lendecke
44968456cb ctdbd_conn: Fix a memleak
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-07-14 06:51:21 +02:00
Volker Lendecke
93c91bddd8 Remove ctdb_conn.[ch]
This was only used in notify_internal.c

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): Wed Jul  8 02:53:33 CEST 2015 on sn-devel-104
2015-07-08 02:53:32 +02:00
Volker Lendecke
e749174dd8 lib: Add server_id_db_set_exclusive
This is used for server names where only one instance can exist.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-07-07 23:51:23 +02:00
Christof Schmitt
1d25a51591 sharesec: Remove error message for unmarshall_sec_desc failure
In a cluster setup, running sharesec -D results in an empty record that
triggers this message. The situation is correctly handled in the code
(unmarshall_sec_desc fails and sharesec uses the default), so simply
remove the message in this case.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-07-06 20:19:12 +02:00
Volker Lendecke
6fc65aaf95 lib: Fix rundown of open_socket_out()
Under valgrind I've seen the abort in async_connect_cleanup kick in. Yes, it's
good that we check these return codes!

Bug: https://bugzilla.samba.org/show_bug.cgi?id=11316
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: "Stefan (metze) Metzmacher" <metze@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Jun 30 20:24:37 CEST 2015 on sn-devel-104
2015-06-30 20:24:37 +02:00
Michael Adam
5c1ed7f18f ctdbd_conn: use the right error code from ctdbd_connect for debug and return
ctdbd_connect() explicitly returns the errno.
Using errno instead of ret misses some important
manually set return values and might use the
errno that is changed by close(fd).

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Fri Jun 26 17:21:26 CEST 2015 on sn-devel-104
2015-06-26 17:21:26 +02:00
Michael Adam
3320a565fb ctdbd_conn: lower the debug level 0 for failing connection to ctdbd.
If e.g. samba fails to start because it can not open the
connection to ctdbd, we want to see some indication in the
logs about this.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2015-06-26 14:18:15 +02:00
Volker Lendecke
e6564bf663 lib: Fix CID 1128556 Dereference after null check
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-06-23 22:12:09 +02:00
Volker Lendecke
252f8137d3 lib: Fix CID 1272858 Copy-paste error
Coverity is wrong here, but it's a good idea to consolidate the close-loop

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-06-23 22:12:09 +02:00