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

7273 Commits

Author SHA1 Message Date
Volker Lendecke
e62ff6c41d unix_msg: Fix unix_dgram_send_queue_init
We should not free a DLIST element

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

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Sep 14 19:30:28 CEST 2016 on sn-devel-144
2016-09-14 19:30:27 +02:00
Volker Lendecke
5f764be23d unix_msg: Fix CID 1372875 Double close
The two error callers of unix_dgram_sendq_schedule_free already run down the
sendq in the error case.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
2016-09-14 15:42:26 +02:00
Amitay Isaacs
b9f120dfa1 s3-ctdb: Use correct db_id size in marshalling record buffer
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-09-14 08:39:28 +02:00
Ralph Boehme
7a0ff3bc26 unix_msg: add a test for dgram socket caching
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Sep 13 04:11:30 CEST 2016 on sn-devel-144
2016-09-13 04:11:30 +02:00
Ralph Boehme
95f3d9bb49 unix_msg: always create a send queue for a peer
Previously, we only created a send queue for a peer if the initial send
to the non-blocking non-connected socket reported EWOULDBOCK (because
the channel was full).

With this change, we now always create a send queue and use a connected,
non-blocking datagram socket from the beginning.

Initially, the socket of the send queue is set to non-blocking mode and
we attempt a direct send via sendmsg(). If that returns EWOULDBOCK, we
set the send queue to blocking mode and let the threadpool handle the
IO.

When a send queue becomes empty, we set the send queue socket back to
non-blocking.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-09-13 00:19:27 +02:00
Ralph Boehme
16d0766621 unix_msg: introduce send queue caching
This introduces caching of unix datagram send queues. Right now send
queues are only created for peers if the channel to the peer is full and
a send reported EWOULDBLOCK.

At this stage, performance will actually be slightly worse, because now
if there's a cached queue for a peer without queued messages, we don't
attempt direct send anymore until the send queue is removed from the
cache.

The next commit will modify unix_msg to always create a send queue with
the datagram socket in connected mode and again attempt an non-blocking
send on the connected socket first. Then only if that returns
EWOULDBLOCK, the send has to go through the threadpool.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-09-13 00:19:27 +02:00
Ralph Boehme
bb526a61d1 unix_msg: add flag to prepare_socket_nonblock()
This allows prepare_socket_nonblock() to be called to set a socket to
non-blocking (as before) as well as blocking. This will be used in a
subsequent commit.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-09-13 00:19:26 +02:00
Ralph Boehme
d2b0694666 messaging: Call messaging_dgm_send under become_root only if necessary
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-09-13 00:19:26 +02:00
Ralph Boehme
e0de912793 unix_msg: Return errno from find_send_queue
Signed-off-by: : Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-09-13 00:19:26 +02:00
Ralph Boehme
3f45fcebdc unix_msg: modify find_send_queue() to take a struct sockaddr_un
In one of the next commits unix_dgram_send_queue_init() will be moved
into find_send_queue and that takes a struct sockaddr_un.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-09-13 00:19:26 +02:00
Volker Lendecke
754f8eff48 lib: Avoid a few casts
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Sep  9 15:55:50 CEST 2016 on sn-devel-144
2016-09-09 15:55:50 +02:00
Volker Lendecke
9395d958d6 pthreadpool: Signal job completion without the pool mutex
This essentially reverts 1c4284c739. We now call an alien function from
within pthreadpool, and we should not hold a mutex during that call. The alien
function could (and pthreadpool_tevent_job_signal actually does) lock a mutex.
We can't guarantee proper lock ordering here, so in theory we could deadlock. I
haven't seen it in the wild yet, but I could imagine that both _parent pieces
in pthreadpool and tevent could trigger such a deadlock.

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 Aug 30 04:06:20 CEST 2016 on sn-devel-144
2016-08-30 04:06:20 +02:00
Volker Lendecke
e7e18c432d pthreadpool: We always want asserts to abort()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-08-30 00:13:10 +02:00
Volker Lendecke
0ea6cebd61 pthreadpool: Fix formatting
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-08-30 00:13:10 +02:00
Volker Lendecke
f4e25ec963 lib: Use tdb_storev in gencache
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): Mon Aug 29 22:51:34 CEST 2016 on sn-devel-144
2016-08-29 22:51:34 +02:00
Volker Lendecke
4d9ff07150 dbwrap: Use tdb_storev in dbwrap_ctdb
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-08-29 19:03:27 +02:00
Volker Lendecke
28f2849584 dbwrap_watch: Add dsize to DEBUG, avoid casts
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-08-29 19:03:26 +02:00
Amitay Isaacs
2d47c2b7a1 s3-netapi: Fix format-nonliteral warning
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12168

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-08-24 01:33:50 +02:00
Amitay Isaacs
e9b8751b58 s3-lib: Fix format-nonliteral warning
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12168

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-08-24 01:33:50 +02:00
Amitay Isaacs
d123085f69 s3-lib: Remove unused function sprintf_append
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12168

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-08-24 01:33:50 +02:00
Volker Lendecke
a343fbc6f1 lib: Remove unused source3/lib/asys
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-08-24 01:33:49 +02:00
Volker Lendecke
bbcf2204b5 lib: Add pthreadpool_tevent
This is a replacement for fncall.[ch] without having to go through
a pipe for job completion signalling

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-08-24 01:33:48 +02:00
Volker Lendecke
d7e51286e7 lib: add job data to to callback
The pthreadpool_tevent wrapper will need this

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-08-24 01:33:48 +02:00
Volker Lendecke
5593467eb1 lib: Move pipe signalling to pthreadpool_pipe.c
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-08-24 01:33:48 +02:00
Volker Lendecke
e47bf91fcb lib: Use pthreadpool_pipe instead of pthreadpool
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-08-24 01:33:48 +02:00
Volker Lendecke
fccb5fb20e lib: Add pthreadpool_pipe
First step to separate the signalling mechanism from the core pthreadpool code.
A later patch will add a pthreadpool that directly indicates job completion via
tevent_threaded_schedule_immediate.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-08-24 01:33:48 +02:00
Volker Lendecke
110f9258dd lib: enable threaded immediates in source3
Logically this belongs into the previous patch, but tevent deserves isolated
patches :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-08-24 01:33:48 +02:00
Volker Lendecke
bad738cbc4 messaging_dgm: Fix signed/unsigned hickups
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 Aug 23 10:46:17 CEST 2016 on sn-devel-144
2016-08-23 10:46:17 +02:00
Volker Lendecke
a2086e9973 lib: Cleanup includes in messages_dgm
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Aug 20 09:41:33 CEST 2016 on sn-devel-144
2016-08-20 09:41:33 +02:00
Amitay Isaacs
a37048f8d4 s3-lib: Pass missing argument for format string
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12163

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
2016-08-18 19:51:10 +02:00
Stefan Metzmacher
5066a6db4b s3:lib/pthreadpool: fix the build on older systems
Some systems required an explicit <signal.h>, which comes
via "system/wait.h"

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Aug 16 19:09:55 CEST 2016 on sn-devel-144
2016-08-16 19:09:55 +02:00
Volker Lendecke
57001580bb lib: Use replace.h properly in pthreadpool
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): Fri Aug 12 04:26:09 CEST 2016 on sn-devel-144
2016-08-12 04:26:09 +02:00
Amitay Isaacs
afa41f023b dbwrap: Fix structure initialization
Bug: https://bugzilla.samba.org/show_bug.cgi?id=12134
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Aug  9 15:15:43 CEST 2016 on sn-devel-144
2016-08-09 15:15:43 +02:00
Ralph Boehme
25df582739 dbwrap_ctdb: treat empty records in ltdb as non-existing
When fetching records from remote ctdb nodes via ctdbd_parse() or in
db_ctdb_traverse(), we already check for tombstone records and skip
them. This was originally also done for the ltdb checks.

See also bug: https://bugzilla.samba.org/show_bug.cgi?id=10008
(commit 1cae59ce11).

Commit 925625b528 reverted part of the
patch of bug 10008 due to a deadlock it introduced.

This patch re-introduces the consistent treatment of empty records in
the ltdb but avoids the deadlock by correctly signalling
NT_STATUS_NOT_FOUND if an empty record is found authoritatively in
the ltdb and not calling ctdb in this case.

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

Pair-Programmed-With: Michael Adam <obnox@samba.org>

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Tue Aug  9 04:38:44 CEST 2016 on sn-devel-144
2016-08-09 04:38:44 +02:00
Michael Adam
6147ed70ff s3:lib: fix a typo in comment for talloc_sub_basic()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Thu Aug  4 22:08:35 CEST 2016 on sn-devel-144
2016-08-04 22:08:35 +02:00
Volker Lendecke
f396449e7a lib: Move "message_send_all" to serverid.c
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>
2016-07-28 05:00:19 +02:00
Ralph Boehme
9c1cd31c0f s3/lib: add smbd_cleanupd.tdb
This will be used between cleanupd and smbd for passing information
about exitted smbd childs.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12022

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2016-07-28 05:00:18 +02:00
Amitay Isaacs
2ac9d0afa6 dbwrap_ctdb: Remove setting of database priority from samba
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-07-25 21:29:42 +02:00
Volker Lendecke
fddee66e20 lib: Fix a signed/unsigned mixup
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): Sat Jul 16 00:17:03 CEST 2016 on sn-devel-144
2016-07-16 00:17:03 +02:00
Volker Lendecke
fb71692128 dbwrap: Remove dbwrap_watchers.tdb based code
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-07-15 20:43:16 +02:00
Volker Lendecke
db22df4172 lib: Convert g_lock to new dbwrap_watch
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-07-15 16:56:13 +02:00
Volker Lendecke
54d0dbeae6 dbwrap: Add an alternative implementation of dbwrap_watch_record_send
The existing one with a separate dbwrap_watchers.tdb turns out to
create a performance penalty in a clustered environment. Non-clustered,
dbwrap_parse_record on non-existent records is very cheap, but in a
cluster environment this is very noticable.

This implementation puts the watcher information into the records itself. For
large records, this might be another performance penalty, because we have to
assemble the final record together with talloc and memcpy, but this might be
fixed later with a tdb_storev call.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-07-15 16:56:13 +02:00
Volker Lendecke
a672379bd9 dbwrap: Add overflow protection to dbwrap_record_watchers_key()
It's highly unlinkely that this will ever kick in, because our current tdb keys
are rather small, but offset calculations without overflow checks are bad.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-07-15 16:56:13 +02:00
Volker Lendecke
e364e5114a g_lock: Use "blocker" argument to dbwrap_record_watch_send
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-07-15 16:56:13 +02:00
Volker Lendecke
d4ca284333 dbwrap: Add "blocker" to record_watch_send
Typicall, when we watch a record, we wait for a process to give up some
resource. Be it an oplock, a share mode or the g_lock. If everything goes well,
the blocker sends us a message. If the blocker dies hard, we want to also be
informed immediately.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-07-15 16:56:13 +02:00
Volker Lendecke
7d84267923 lib: Add server_id_watch_send
This is a brute force variant, trying twice a second. We'll have better
variants with tmsgd in the future.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-07-15 16:56:13 +02:00
Volker Lendecke
c3af7a377d lib: Allow NULL blob for messaging_send()
... something I've wanted to do for ages :-)

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 Jul 14 20:50:15 CEST 2016 on sn-devel-144
2016-07-14 20:50:15 +02:00
Volker Lendecke
aca68e5dbb lib: Avoid a "procid_is_local" call
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-07-14 17:14:11 +02:00
Volker Lendecke
05c400e1d8 lib: Print own pid in messaging_init
This turned out to be some valuable debugging aid for me

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-07-14 17:14:11 +02:00
Ralph Boehme
a391e9202d s3-messaging: use messaging_ctdbd_reinit() in messaging_reinit()
This is the last step to fix a regression introduced by

  3fe3226daa and
  3fe3226daa8488e0fa787c40359c3401b6f05fc0^

where we pass the ctdb-messaging object conn to db_open() and add a
reference to it to the private db_ctdb_ctx for later use. Unfortunately
reinit_after_fork() destroys conn, leaving us with an invalid reference.

The previous patches added new lower level functions
messaging_ctdbd_reinit() and ctdbd_reinit_connection(), finally use them
them from messaging_reinit(). They preserve the conn object and simply
reinitialize the IPC fd.

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

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Jul 11 23:45:20 CEST 2016 on sn-devel-144
2016-07-11 23:45:20 +02:00
Ralph Boehme
f991381356 s3-messaging/ctdb: add messaging_ctdbd_reinit()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2016-07-11 20:05:06 +02:00
Ralph Boehme
c6373aba00 s3-messaging/ctdb: split messaging_ctdbd_init()
Split out and internal function from messaging_ctdbd_init() that does
the connection setup. Keep the conn object allocation in
messaging_ctdbd_init().

This is in preperation of adding messaging_ctdbd_reinit() which will use
the new internal function as well.

messaging_ctdbd_init_internal() has a new reinit flag,
messaging_ctdbd_init() calls with reinit=false resulting in unmodified
behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2016-07-11 20:05:06 +02:00
Ralph Boehme
84da49f89b ctdbd_conn: add ctdbd_reinit_connection()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2016-07-11 20:05:06 +02:00
Ralph Boehme
1184931001 ctdbd_conn: split ctdbd_init_connection()
Split ctdbd_init_connection() into an internal function that does the
connection setup and only keep the conn object allocation in
ctdbd_init_connection().

This is in preperation of adding ctdbd_reinit_connection() which will
use the new internal function as well.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2016-07-11 20:05:06 +02:00
Jeremy Allison
6318615a63 s3: tldap: Make tldap_gensec_bind_send()/tldap_gensec_bind_recv() static.
Only expose a synchronous tldap_gensec_bind() call, as it can't
really be async anyway.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Jun 28 11:19:33 CEST 2016 on sn-devel-144
2016-06-28 11:19:33 +02:00
Jeremy Allison
48569065c8 s3: tldap: Remove asynchronous calls to gensec_update_send()/_recv() as for the spnego backend they're synchronous anyway.
This should prevent nested event loops, and won't make the
code performance worse anyway.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-06-28 07:27:18 +02:00
Amitay Isaacs
030fd72b32 s3-ctdb: Return an error when unexpected reply is received
CTDB can send CTDB_REPLY_ERROR in case it encounters an error condition.
This is treated as successful migration as "ret" is not set.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Jun 24 22:39:23 CEST 2016 on sn-devel-144
2016-06-24 22:39:23 +02:00
Amitay Isaacs
22d1d7de22 s3-ctdb: Fail CTDB connection only on INACTIVE state
If the node has flag NODE_FLAGS_PERMANENTLY_DISABLED, then it is
still working.  Only avoid connections if node has any of the flags
in NODE_FLAGS_INACTIVE.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Jun 23 23:38:44 CEST 2016 on sn-devel-144
2016-06-23 23:38:44 +02:00
Andreas Schneider
169e8aeda5 s3-libnetapi: Correctly check for lp_realm.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2016-06-15 16:31:17 +02:00
Volker Lendecke
6279773fed lib: Fix CID 1362566 Dereference null return value
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-06-07 14:34:11 +02:00
Volker Lendecke
dd27469123 lib: Move poll_funcs to lib/
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-06-07 14:34:10 +02:00
Volker Lendecke
6dcf81a202 lib: Move msghdr to lib/util/
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-06-07 14:34:10 +02:00
Amitay Isaacs
768f356f99 lib/poll_funcs: Build as SAMBA_SUBSYSTEM
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
2016-06-07 14:34:10 +02:00
Uri Simchoni
b79ea7d3fb s3-sysquotas: remove special handling of EDQUOT
The sysquotas module has several supported backends for
getting/setting user/group quota. This patch removes a check
by the common code, to see if the backend has returned EDQUOT.

Before this patch, it was OK for a backend to return with error
and errno set to EDQUOT, and that meant success, but with a warning
that the user/group is over quota. This is the system behavior on
some Unices. This patch removes this from the protocol between the
sysquota module and its backend drivers - it's the responsibility
of the backend to return 0 iff it has fulfilled the request to get or
set quota.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-06-01 00:57:32 +02:00
Uri Simchoni
3b352d3526 s3-sysquotas-linux: do not check for EDQUOT
When obtaining user/group quota, remove check for EDQUOT
errno return. Apparently on some Unices, EDQUOT means that
the get-quota function has succeeded, but the user/group is
over-quota. Not so in Linux.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-06-01 00:57:32 +02:00
Jeremy Allison
b5f1ce892a s3: lib: ldap: Use struct sockaddr_storage to cope with IPv6.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2016-05-29 05:37:12 +02:00
Uri Simchoni
847eff3b4b s3-sysquotas-linux - cleanup
Now that the module supports only the current Linux quota
interface, it does not need a two-level hierarchy.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Uri Simchoni <uri@samba.org>
Autobuild-Date(master): Thu May 26 18:54:12 CEST 2016 on sn-devel-144
2016-05-26 18:54:12 +02:00
Uri Simchoni
38356bed80 s3-sysquotas-linux: remove check for EDQUOT on getting user quota
The same check is done by sys_get_quota() which is the only caller.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-05-26 15:21:16 +02:00
Uri Simchoni
9fa8b5cf84 s3-sysquotas-linux: remove support for old interfaces
Remove support for Linux quota interfaces that predate the
2.6.x kernel series. Glibc has been supporting the "current"
quota interface for over 10 years now...

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-05-26 15:21:16 +02:00
Uri Simchoni
59133295bb s3-quotas: fix sysquotas_4B quota fetching for BSD
Correctly copy block hard/soft limits from the OS-specific structure
to samba structure.

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

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-05-23 23:28:12 +02:00
Jeremy Allison
5985383167 s3: lib: util: Add map_process_lock_to_ofd_lock() utility function.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Jeff Layton <jlayton@samba.org>
2016-05-21 01:28:28 +02:00
Jeremy Allison
bb93b24b18 s3: lib: Add 'int op' parameter to fcntl_getlock().
Will allow us to move to open file description locks
from process-associated locks.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Jeff Layton <jlayton@samba.org>
2016-05-21 01:28:28 +02:00
Volker Lendecke
404acae05c dbwrap_ctdb: Remove get_my_vnn dependency
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 May 17 16:54:36 CEST 2016 on sn-devel-144
2016-05-17 16:54:36 +02:00
Volker Lendecke
1dcdd862e5 dbwrap_ctdb: Fix some 32-bit hickups
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-05-17 13:18:31 +02:00
Volker Lendecke
3bd368b12d ctdbd_conn: Remove messages.h dependency
This removes a circular dependency

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-05-17 13:18:31 +02:00
Volker Lendecke
46be182ccb dbwrap: Add "msg_ctx" to db_open_ctdb
Another step towards making ctdbd_conn.c independent of messages.c. No call to
ctdb_conn_msg_ctx() anymore

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-05-17 13:18:31 +02:00
Volker Lendecke
3fe3226daa dbwrap_ctdb: Pass in ctdbd_connection
This removes one circular dependency of dbwrap_ctdb to messages.c: No call to
messaging_ctdbd_connection() anymore from dbwrap_ctdb.c.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-05-17 13:18:31 +02:00
Volker Lendecke
0a367f5fd4 dbwrap_ctdb: Add "conn" to db_ctdb_ctx
This minimizes the use of messaging_ctdbd_connection() to
db_open_ctx(). Next step will move this into db_open().

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-05-17 13:18:31 +02:00
Volker Lendecke
e3fcf90f15 dbwrap_ctdb: Align loop index with terminator
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-05-17 13:18:31 +02:00
Volker Lendecke
069d79bbd9 lib: Move async message handling out of ctdbd_conn
messages_ctdbd.c is the code that is genuinely interested in
async messages from ctdb, so let it take care of them.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-05-17 13:18:31 +02:00
Volker Lendecke
33c8861fc5 ctdbd_conn: Expose ctdb socket readability handler
This will obsolete ctdbd_register_msg_ctx soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-05-17 13:18:31 +02:00
Volker Lendecke
120f86755a ctdbd_conn: "sockname" is not needed anymore
Previously it was used in ctdb_traverse(), but with ff72a8a this is no longer
the case

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-05-17 13:18:31 +02:00
Volker Lendecke
0b8896d51e ctdbd_conn: Simplify two DEBUGs
msg->hdr.length is a uint32 and we have PRIu32

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-05-17 13:18:31 +02:00
Volker Lendecke
a1309d5321 ctdbd_conn: remove ctdb_processes_exist
The singular call was the only user. Remove the complex plural one. We can
always dig it up from git history if we need it.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-05-17 13:18:31 +02:00
Volker Lendecke
93b982faad lib: Give base64.c its own .h
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-05-04 01:28:23 +02:00
Ralph Boehme
719e42294d s3/lib: add remote arch caching
This allows caching the remote arch string in gencache. A subsequent
commit will use this in SMB2 negprot.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-05-04 01:28:22 +02:00
Ralph Boehme
44c236ac7f s3/lib: add get_remote_arch_from_str()
This will be used when fetching remote arch from gencache.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-05-04 01:28:22 +02:00
Ralph Boehme
6b5b004918 s3/lib: rework get_remote_arch_str() to use an array
By using C99 designated array initializers we can simplify the code and
remove the dependency on initializers appearing in a particular order.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-05-04 01:28:22 +02:00
Uri Simchoni
d28282ce57 xfs quotas - fix case of no quota for user
Fixup commit ce82f66b9f
Add missing success return value when user has no quota record
(this is considered success with no quota)

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Apr 29 05:39:14 CEST 2016 on sn-devel-144
2016-04-29 05:39:14 +02:00
Volker Lendecke
cce6b677ff dbwrap_ctdb: Fix ENOENT->NT_STATUS_NOT_FOUND
Bug: https://bugzilla.samba.org/show_bug.cgi?id=11844
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Apr 26 14:34:14 CEST 2016 on sn-devel-144
2016-04-26 14:34:14 +02:00
Volker Lendecke
ad5a4a9e36 ctdbd_conn: Make "cstatus" int32_t
This converts the "cstatus" parameter of ctdbd_control_local to what it is
defined as in the packet: int32_t. It was used inconsistently throughout the
code.

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): Mon Apr 25 21:54:24 CEST 2016 on sn-devel-144
2016-04-25 21:54:24 +02:00
Volker Lendecke
2bd1bcf50c ctdbd_conn: Add some more debug info
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-04-25 18:29:21 +02:00
Volker Lendecke
445ad6e8e4 ctdbd_conn: Use ctdbd_control_local where possible
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-04-25 18:29:21 +02:00
Volker Lendecke
f0525d4e07 ctdbd_conn: Avoid "includes.h"
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-04-25 18:29:21 +02:00
Volker Lendecke
ff72a8ae82 lib: Move ctdbd_init_connection out of ctdbd_traverse()
2 effects: This removes the [un]become_root calls from ctdbd_conn,
and it makes it possible to re-use the traversal connections, should
the setup/teardown become a problem in the future.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-04-25 18:29:20 +02:00
Volker Lendecke
966cef0d41 ctdbd_conn: Remove unused ctdbd_messaging_connection
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-04-25 18:29:20 +02:00
Volker Lendecke
e2d39aefae lib: Use ctdbd_init_connection in messaging_ctdbd_init
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-04-25 18:29:20 +02:00
Volker Lendecke
1ff4002b23 ctdbd_conn: Make ctdbd_init_connection public
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-04-25 18:29:20 +02:00
Volker Lendecke
b1277acb44 ctdbd_conn: Use ctdbd_init_connection in ctdbd_probe
We are only interested in ctdb connectability here.
ctdbd_messaging_connection() does a few more calls not required here

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-04-25 18:29:20 +02:00
Volker Lendecke
14beae7cc9 ctdbd_conn: Use sys_poll_intr
This pulls in far less dependencies than poll_intr_one_fd and is not much more
complex to call

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-04-25 18:29:20 +02:00
Volker Lendecke
d59ae31cca ctdbd_conn: Adapt loop counter's type to the loop limit
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-04-25 18:29:20 +02:00
Volker Lendecke
d5e77a81da tldap: Add tldap_gensec_bind
This enables sasl sign/sealed connections via tldap

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-04-15 15:32:11 +02:00
Volker Lendecke
830fd785a2 tldap: Add tldap_get/set_stream
This will be used to replace a nonencrypted socket with a sasl sealed one.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-04-15 15:32:11 +02:00
Ralph Boehme
983a55bc45 CVE-2016-2115: s3:lib/netapi: use SMB_SIGNING_IPC_DEFAULT
Use SMB_SIGNING_IPC_DEFAULT for RPC connections.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2016-04-12 19:25:26 +02:00
Uri Simchoni
0124d3e6a5 nfs-quota: do not fail on ECONNREFUSED
Trying to differentiate between "no quota" and real
error conditions - if the connection to rpc.quotad
is refused it could simply mean that the remote host
has no quota and therefore report this as success with
no quota.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-03-31 20:30:11 +02:00
Uri Simchoni
ce82f66b9f xfs-quota: do not fail if user has no quota
XFS fails quotactl(Q_XGETQUOTA) with ENOENT if the user
or group has no quota assigned to it. This is not an error
condition - simply report 0 quota in this case.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-03-31 20:30:11 +02:00
Uri Simchoni
faaaae3c57 sys-quotas: do not fail if user has no quota
If the user/group has no quota, do not treat that as
error condition. Instead, return zero quota.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-03-31 20:30:10 +02:00
Uri Simchoni
98b74866e9 asys: call clock_gettime_mono() only on profile-enabled build
Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-03-28 20:45:16 +02:00
Jeremy Allison
ce75fbf4e3 s3: smbd: Remove many common uses of lp_posix_pathnames().
Check the smb_filename->flags field, or req->posix_pathnames
instead, depending on what is available.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2016-03-24 22:57:16 +01:00
Jeremy Allison
dc5dad4813 s3: Filenames: Add uint32_t flags parameter to synthetic_smb_fname().
Get it from parent/deriving smb_filename if present.
Use 0 (as usually this a Windows-style lookup) if
not.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2016-03-24 22:57:16 +01:00
Jeremy Allison
2e302d7007 s3: smbd: Add uint32_t flags field to struct smb_filename.
Only one defined flag for now, SMB_FILENAME_POSIX_PATH.
Define as the same as FSP_POSIX_FLAGS_PATHNAMES to keep
the value consistent.

Set this inside unix_convert() when a posix path parse
is selected.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2016-03-24 22:57:16 +01:00
Jeremy Allison
09325a0ea6 s3:smbd: Move lp_posix_pathnames() out of ea_list_has_invalid_name().
External uses will be replaced by checks on struct smb_filename flags.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2016-03-24 22:57:16 +01:00
Jeremy Allison
b4246f863c s3:lib: Move internal lp_posix_pathnames() call out of utility function synthetic_smb_fname_split().
Make it a passed in parameter instead.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2016-03-10 20:55:09 +01:00
Jeremy Allison
153af65e44 s3:lib: Remove the const SMB_STRUCT_STAT * parameter from synthetic_smb_fname_split().
Only one caller uses this, and this can be handled externally.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2016-03-10 20:55:09 +01:00
Jeremy Allison
e2056f843d s3:lib: Rewrite synthetic_smb_fname_split() to use split_stream_filename().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2016-03-10 20:55:09 +01:00
Jeremy Allison
59f6a73c93 s3:lib. Add split_stream_filename() Not yet used.
Will replace internals of synthetic_smb_fname_split().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2016-03-10 20:55:09 +01:00
Volker Lendecke
dbcdacc58d lib: Avoid a gencache_parse when setting a delete marker
We know that we want to put something into _notrans, no point in
doing another round trip into gencache.tdb.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-03-07 17:58:16 +01:00
Volker Lendecke
639b3ca48a lib: Avoid looking at fcntl'ed gencache.tdb
gencache_notrans.tdb is much cheaper to look at than gencache.tdb because it's
mutexed and thus avoids expensive fcntl locks. This patch aggressively uses the
shared _notrans tdb for both positive and negative entries. It's a replacement
for the memcache copy in every process that was removed a few patches ago.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-03-07 17:58:16 +01:00
Volker Lendecke
b3dd6fd8a4 lib: Simplify gencache_pull_timeout callers
gencache_pull_timeout used to point at the "/" right after the timeout.  None
of the callers was interested in the "/", they are interested in the payload.

Increment the endpointer in gencache_pull_timeout and rename it.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-03-07 17:58:16 +01:00
Volker Lendecke
6797014d45 lib: Make gencache_pull_timeout look at uint8_t
At this point we're still looking at TDB_DATA. This patch moves the casts to a
more appropriate place.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-03-07 17:58:16 +01:00
Volker Lendecke
1ff902fc32 lib: Remove memcache from gencache
The main reason for this was to avoid access to the fcntl-governed transaction
based gencache.tdb. A later patch will make this unnecessary by filling
gencache_notrans more aggressively.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-03-07 17:58:16 +01:00
Volker Lendecke
b6f90f713a lib: Fix a typo in gencache
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-03-07 17:58:16 +01:00
Volker Lendecke
f0e35154fe lib: Simplify gencache_del
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-03-07 17:58:16 +01:00
Volker Lendecke
f857f30236 lib: skip deleted entries in gencache_iterate
"net cache flush" can give nasty error messages like

Couldn't delete entry! key = IDMAP/UID2SID/12345

These happen when there's an already deleted entry in
gencache_notrans.tdb, indicated by a 0 timeout. This happens if two
gencache_del function calls have happened right after the other and a
gencache_stabilize has not wiped them.

In gencache_iterate, don't show these deleted entries

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-03-07 17:58:16 +01:00
Volker Lendecke
8e0e4f5994 g_lock: Remove some unneeded includes
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Sun Mar  6 19:34:42 CET 2016 on sn-devel-144
2016-03-06 19:34:42 +01:00
Volker Lendecke
ae41ea144a lib: Introduce SERVER_ID_BUF_LENGTH
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
2016-03-06 16:21:12 +01:00
Ira Cooper
58d3462bc5 source3: Honor the core soft limit of the OS.
We should honor the soft limits set by the operating system.

In any case, 16M doesn't make a useful coredump for modern
Samba.

Signed-off-by: Ira Cooper <ira@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Mar  5 00:39:48 CET 2016 on sn-devel-144
2016-03-05 00:39:48 +01:00
Ralph Boehme
0ea6a070c4 s3:lib/asys: measure async request syscall duration
This uses time functions from lib/util/ which requires pulling in
samba-util. This sucks, but there's just no way of rewrapping a minimal
time utility library without modifying the public samba-util.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-03-02 01:22:14 +01:00
Aurelien Aptel
1f9d1f9cd7 s3/lib/netapi/tests/netuser.c: fix wrong closing paren
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Revewied-by: Jeremy Allison <jra@samba.org>
2016-02-25 22:06:27 +01:00
Volker Lendecke
2f6a69d807 lib: Avoid an unnecessary cast
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-02-23 22:03:17 +01:00
Volker Lendecke
3a1685db0b lib: Remove "includes.h" from util_file.c
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-02-23 22:03:17 +01:00
Volker Lendecke
b4b8c8ca01 lib: Add file_pload_send/recv
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-02-23 22:03:17 +01:00
Volker Lendecke
3de5d8fdfd lib: Add "mem_ctx" to file_lines_pload
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-02-23 22:03:17 +01:00
Volker Lendecke
908df8ec13 lib: Extract sys_popen()
This was added by Jeremy with 3cf31a194f, do the (C) accordingly

sys_popen is a pretty isolated functionality, and I'd like to use it
soon without "includes.h", needed by "proto.h"

Except for one malloc->talloc this is supposed to be a 1:1 copy

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-02-23 22:03:16 +01:00
Volker Lendecke
8338fe6ac8 lib: Remove sys_waitpid
We have waitpid in libreplace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-02-23 22:03:16 +01:00
Volker Lendecke
b7b7b0a819 lib: Fix whitespace
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-02-23 22:03:16 +01:00
Christof Schmitt
4b56ce3abd util_sd: Also accept hex input for ALLOW/DENIED
Implement this by explicitly checking for decimal or hexadecimal input.
This avoids using sscanf with %i and a signed integer type, and it also
matches the code paths for flags and mask that also have an explicit
check.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-02-20 00:46:29 +01:00
Stefan Metzmacher
719428f587 s3:dbwrap: add dbwrap_tdb_require_mutexes:*= option
This is similar to dbwrap_tdb_mutexes:*= (which is autodetected by default),
but dbwrap_tdb_require_mutexes is off by default.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-02-08 22:32:23 +01:00
Volker Lendecke
9219756a36 tldap: Add a missing TALLOC_FREE(frame)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-02-08 22:32:23 +01:00
Michael Adam
d6f5fc8c2d dlist: remove unneeded argument from DLIST_DEMOTE()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-02-06 21:48:17 +01:00
Michael Adam
476672b647 dlist: remove unneeded type argument from DLIST_ADD_END()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-02-06 21:48:17 +01:00
Christof Schmitt
68bb5e2ba2 gencache: Remove unused defines
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2016-02-03 21:27:08 +01:00
Volker Lendecke
7434723ecd tldap: Parse a search entry only if it is one
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>

Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Wed Feb  3 18:12:44 CET 2016 on sn-devel-144
2016-02-03 18:12:43 +01:00
Volker Lendecke
f09cebd4fc tldap: Make tldap_search use tldap_search_all
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2016-02-03 15:04:11 +01:00
Volker Lendecke
0d1165a424 tldap: Add tldap_pending_reqs()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2016-02-03 15:04:11 +01:00
Volker Lendecke
d29c45ce41 tldap: Add tldap_search_all
Signed-off-by: Volker Lendecke <vl@samba.org>

TLDAPRC
Reviewed-by: Guenther Deschner <gd@samba.org>
2016-02-03 15:04:11 +01:00
Volker Lendecke
b6244ae257 tldap: Avoid a "ret == false"
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2016-02-03 15:04:11 +01:00
Volker Lendecke
2c3cf3ce60 lib: Introduce TLDAPRC
Make ldap return codes type safe

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2016-02-03 15:04:11 +01:00
Volker Lendecke
2bd88bff04 tldap: Parse the sasl output blob
Reviewed-by: Guenther Deschner <gd@samba.org>
2016-02-03 15:04:11 +01:00
Volker Lendecke
3673752f68 tldap: Slightly simplify tldap_search_cb
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2016-02-03 15:04:11 +01:00
Volker Lendecke
22f06c2e6f tldap: Mark server down if read failed
This matches tldap_msg_sent

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2016-02-03 15:04:11 +01:00
Uri Simchoni
465c3d9a4e smbd quotas: avoid stat of foreign file systems
When determining the block device of our file system, avoid
stat'ing paths which are definitely not the mount point of
our file system. This is done to avoid stalling smbd due to
unresponsive network file systems (e.g. NFS) which are not
related to the SMB shares.

See discussion in samba-technical for vfs_fileid:
https://lists.samba.org/archive/samba-technical/2016-January/111553.html

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jan 27 03:35:48 CET 2016 on sn-devel-144
2016-01-27 03:35:47 +01:00
Uri Simchoni
c6ed45fe71 s3-lib: introduce sys_realpath()
Add sys_realpath() function that captures the OS variations
on realpath().

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-01-27 00:22:22 +01:00
Michael Adam
8284b34f95 s3:lib: extend interpret_interface() to optionally read speed, caps, and index from config
New syntax for interfaces parameter:

  interfaces = address[;key=value[,key=value[,...]]]

- keys can be 'speed', 'capability', and 'if_index'.

- speed is in bits per second.

- capability can be RSS and RDMA.

- if_index should be used with care, because
  these indexes should not conicide with indexes
  the kernel sets...

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2016-01-26 07:33:16 +01:00
Michael Adam
3785be8d4e s3:lib: remove an unmotivated comment from interpret_interface()
This seems to be a left-over from historic code.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2016-01-26 07:33:16 +01:00
Michael Adam
e569ffd831 s3:lib: copy speed, cap, and index in add_interface()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2016-01-26 07:33:16 +01:00
Michael Adam
a2894cf4e0 s3:lib: add braces around if-block in my_sam_name()
Clean-up after moving the function.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Tue Jan 26 03:19:18 CET 2016 on sn-devel-144
2016-01-26 03:19:18 +01:00
Michael Adam
d67d8e194b s3:lib: remove supefluous comments from map_my_name()
cleanup after moving

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-01-26 00:06:16 +01:00
Michael Adam
6eaf40f5a4 s3:lib: fix white spaces in my_sam_name()
Clean-up after function has been moved.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-01-26 00:06:16 +01:00
Ralph Boehme
1e60a3f009 smbstatus: show signing state of sessions and tcons
Show the signing state of sesssions tcons in smbstatus. This is SMB2/3
only. SMB1 support will be added in a later commit.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-01-22 07:52:21 +01:00
Ralph Boehme
8d8af479e2 s3:lib/conn_tdb: store the connection dialect
This will be used in a subsequent commit that will print the signing
cipher in smbstatus. We need the connection dialect for that.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-01-22 07:52:21 +01:00
Ralph Boehme
780743d1b2 smbstatus: show encrpytion state of tree connects
Show the encrpytion state of tcons in smbstatus. This is SMB3 only. CIFS
UNIX extensions encryption will be added in a later commit.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-01-22 07:52:21 +01:00
Ralph Boehme
e0fc93112f smbstatus: show encrpytion state of sessions
Show the encrpytion state of sessions in smbstatus. This is SMB3
only. CIFS UNIX extensions encryption will be added in a later commit.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-01-22 07:52:21 +01:00
Ralph Boehme
f59ef038ed smbstatus: rework connection dialect printing
In a later change I want to print the signing cipher which depends upon
the connection dialect. So let's store the connection dialect in the
sessionid struct and move the code that maps dialect integers to strings
to smbstatus.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-01-22 07:52:20 +01:00
Michael Adam
ef269c9ddc substitute: Fix talloc_sub_basic for %G in the case of a local user.
This fixes a regression introduced by the fix for bug 10286.

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

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jan 22 05:03:25 CET 2016 on sn-devel-144
2016-01-22 05:03:25 +01:00
Michael Adam
8ff3257c4c s3:passdb: move my_sam_name() from passdb to util_name.c
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-01-22 01:55:09 +01:00
Günther Deschner
ecc7022d7c s3-util: skip S-1-18 sids in token generaion in sid_array_from_info3().
Bug: https://bugzilla.samba.org/show_bug.cgi?id=11677

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Jan 16 01:24:04 CET 2016 on sn-devel-144
2016-01-16 01:24:04 +01:00
Günther Deschner
a92420911d s3-util: add helper functions to deal with the S-1-18 domain.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=11677

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-01-15 22:19:07 +01:00
Jelmer Vernooij
4ab7a00ac4 Use full path to dlinklist.h in includes.
Signed-off-by: Jelmer Vernooij <jelmer@jelmer.uk>
2016-01-13 04:43:22 +01:00
Volker Lendecke
551e268ac3 tldap: Use struct initializer in tldap_search
Avoids a call to ZERO_STRUCT

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): Mon Jan 11 01:31:59 CET 2016 on sn-devel-144
2016-01-11 01:31:59 +01:00
Volker Lendecke
8842235a82 tldap: Avoid includes.h
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-01-10 22:24:17 +01:00
Volker Lendecke
5021974f2a lib: Introduce util_tsock.h
This avoids includes.h in source3/lib/util_tsock.c

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-01-10 22:24:17 +01:00
Volker Lendecke
3df9e9c7ae tldap: tevent_req_create NULLs out "state"
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-01-10 22:24:17 +01:00
Volker Lendecke
e48184935e tldap: Use "size_t" for talloc_array_length result
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-01-10 22:24:17 +01:00
Volker Lendecke
8215409153 tldap: Remove an unneeded "return;"
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-01-10 22:24:17 +01:00
Volker Lendecke
245064d5a3 tldap: Remove unneeded vars
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-01-10 22:24:17 +01:00
Volker Lendecke
57a0bc9a9f lib: Use asn1_has_error()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-01-06 00:54:18 +01:00
Ralph Boehme
00e952e3c6 s3: fix encryption help messages
Encryption is a SMB3 feature and not tied to UNIX extensions, so fix the
help messages of various utilities.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Dec 22 02:22:50 CET 2015 on sn-devel-144
2015-12-22 02:22:50 +01:00
Ralph Boehme
1650e793ed s3:lib/errmap_unix: map EOVERFLOW to NT_STATUS_ALLOTTED_SPACE_EXCEEDED
vfs_fruit returns the correct error NT_STATUS_ALLOTTED_SPACE_EXCEEDED
when an attempt is made to extend the AFP_AfpInfo stream beyond 60
bytes.

This will be used in a subsequent commit in vfs_fruit.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-12-21 23:21:17 +01:00
Volker Lendecke
6aaa8b695e lib: Remove ntstatus.h from gencache.h
No clue why I put it there, sorry for the noise...

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2015-12-16 04:14:20 +01:00
Volker Lendecke
79f946cdb6 lib: Remove unused talloc_append_blob
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-12-14 20:23:13 +01:00
Volker Lendecke
8ca3a58ec9 gencache: Refactor gencache_set_data_blob
Replace 3 calls into talloc with 1. Add an overflow check.

With this change, it will be easier to avoid the talloc call for small
blobs in the future and do it on the stack.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-12-14 20:23:13 +01:00
Volker Lendecke
640870ee20 lib: Separate out xx_path() & callers
We should not have to #include proto.h just for cache_path() or so

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-12-14 20:23:13 +01:00
Volker Lendecke
c281573399 lib: Use directory_create_or_exist in xx_path
directory_create_or_exist is a little different: It does the lstat first and
sets the umask properly, but I think this is more correct than the xx_path()
version before.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-12-14 20:23:13 +01:00
Volker Lendecke
d547d030e0 gencache: True->true, False->false
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-12-14 20:23:13 +01:00
Volker Lendecke
5ef9184964 lib: Add gencache.h
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-12-14 20:23:13 +01:00
Jeremy Allison
07c4967d6c s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
Remove lp_posix_pathnames() out of ms_has_wild().

NB. The usage of ms_has_wild() inside set_namearray()
should *never* have been looking at lp_posix_pathnames()
anyway, as this is a config option that needs to look
at wildcards. This was probably an old (but never
triggered) bug.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-12-13 22:59:27 +01:00
Ralph Boehme
c2de8425d9 s3:talloc_dict: fix a SIGBUS when dereferencing unaligned pointers
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Nov 30 22:31:16 CET 2015 on sn-devel-104
2015-11-30 22:31:16 +01:00
Volker Lendecke
c701e46431 lib: Fix CID 1338432 Unchecked return value
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-11-10 21:20:18 +01:00
Volker Lendecke
c66592bcf7 lib: Move some procid functions out of util.c
Including proto.h just for pid_to_procid() is a pain...

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-11-09 07:53:18 +01:00
Volker Lendecke
f0bfd61556 lib: Increase a debuglevel
We do this every time when a process exits. If that process has
properly cleaned up after itself, we spit out this message.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-11-09 07:53:18 +01:00
Mathieu Parent
c315fce17e Fix various spelling errors
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Nov  6 13:43:45 CET 2015 on sn-devel-104
2015-11-06 13:43:45 +01:00
Andreas Schneider
6361063995 s3-lib: Get the real initial uid for selftest
We need this that if we connect as the user who started smbd, we are
able to perform privileged operation like creating a user.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-11-05 09:23:15 +01:00
Amitay Isaacs
a82ee238b5 ctdb-daemon: Rename struct ctdb_control_tcp_addr to ctdb_connection
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:15 +01:00
Amitay Isaacs
563f518283 ctdb-daemon: Remove struct ctdb_client_notify_deregister
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:15 +01:00
Amitay Isaacs
b936145951 ctdb-daemon: Rename struct ctdb_client_notify_register to ctdb_notify_data_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:15 +01:00
Amitay Isaacs
b99436e425 ctdb-daemon: Rename struct ctdb_rec_data to ctdb_rec_data_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:14 +01:00
Amitay Isaacs
afc5d8a442 ctdb-daemon: Rename struct ctdb_node_map to ctdb_node_map_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:14 +01:00
Amitay Isaacs
1c828b4ed6 ctdb-daemon: Rename struct ctdb_reply_control to ctdb_reply_control_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:14 +01:00
Amitay Isaacs
e1fed53e2a ctdb-daemon: Rename struct ctdb_req_control to ctdb_req_control_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:14 +01:00
Amitay Isaacs
acf858defb ctdb-daemon: Rename struct ctdb_req_message to ctdb_req_message_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:14 +01:00
Amitay Isaacs
277c21f0cd ctdb-daemon: Rename struct ctdb_reply_call to ctdb_reply_call_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:14 +01:00
Amitay Isaacs
e0c42c5698 ctdb-daemon: Rename struct ctdb_req_call to ctdb_req_call_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:14 +01:00
Volker Lendecke
e11008ea4e lib: Include samba_util.h in server_id_db.h
Usually this came in via server_id.h's includes.h. This will go.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-10-28 16:00:20 +01:00
Amitay Isaacs
20b82ea28e ctdb-include: Remove unused header file include/ctdb.h
This was part of libctdb which has been removed.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-28 12:53:15 +01:00
Volker Lendecke
f1c49d7656 messaging: Fix creating the dgm lockfile
There might be situations where the lock directory moves to a
location where a previous installation left the datagram sockets
(Yes, I just came across this). We can't really deal with it except
by just removing the socket without properly checking.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Oct 22 02:14:29 CEST 2015 on sn-devel-104
2015-10-22 02:14:29 +02:00
Christof Schmitt
b041a589ae Remove function name from callers of DBG_*
It is now added automatically.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-21 23:13:17 +02:00
Volker Lendecke
3194a4d342 lib: Remove unused serverid_get_random_unique_id
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-10-19 15:12:22 +02:00
Volker Lendecke
22b320caa0 lib: Add some debug to dgm_ref
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-10-19 12:09:10 +02:00
Volker Lendecke
01d7e26f7f lib: Push down unique generation one level
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-10-19 12:09:10 +02:00
Volker Lendecke
a788fd3065 lib: Remove unused global my_unique_id
The unique_id is now always attached to a messaging_context.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-10-19 12:09:10 +02:00
Volker Lendecke
62f2b86f4f lib: Remove unused procid_is_me()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-10-19 12:09:10 +02:00
Volker Lendecke
da88b0da66 lib: Remove unused procid_self()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-10-19 12:09:10 +02:00
Volker Lendecke
6eb6622c13 lib: Remove procid_self() from messages.c
This together with the removal of procid_self obsoletes the global
my_unique.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-10-19 12:09:10 +02:00
Volker Lendecke
b9fd6e2484 lib: Fix pid_to_procid()
Putting in my_unique_id is just wrong. Now that we have
a cheap way to read everyone's unique ids out of the lockfile,
we can fix it.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-10-19 12:09:10 +02:00
Anoop C S
c4bdba97b4 s3.lib: Remove invalid switch case from sysquotas_nfs
getquota_rslt structure from rquota.h defines the enum
named status whose values start from 1. But in
sysquotas_nfs.c we have an invalid check for status 0.
This change is to remove that particular switch case.

Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-16 20:24:20 +02:00
Ralph Boehme
23f674488a s3:lib: validate domain name in lookup_wellknown_name()
If domain argument is not an empty string, only search the matching
wellknown domain name.

As the only wellknown domain with a name is "NT Authority", passing ""
to lookup_wellknown_name() will search all domains inlcuding "NT
Authority".

Passing "NT Authority" otoh will obviously only search that domain.

This change makes lookup_wellknown_name() behave like this:

in domain         | in name       | ok | out sid | out domain
========================================================
                    Dialup          +    S-1-5-1   NT Authority
NT Authority        Dialup          +    S-1-5-1   NT Authority
Creator Authority   Dialup          -    -         -
                    Creator Owner   +    S-1-3-0   ""
Creator Authority   Creator Owner   -    -         -
NT Authority        Creator Owner   -    -         -

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2015-10-15 19:56:14 +02:00
Ralph Boehme
880b79addc s3:lib/messages: fix error check in messaging_filtered_read_send()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Oct 14 10:21:09 CEST 2015 on sn-devel-104
2015-10-14 10:21:09 +02:00
Volker Lendecke
826bffc7e6 lib: Fix CID 1327227 Uninitialized scalar variable
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-14 02:19:14 +02:00
Volker Lendecke
e73ccc06ef Rely on /dev/urandom
This removes quite a bit of code. All reasonable systems have /dev/urandom
these days. Linux, Solaris and the BSDs do.  In case we find a system
without /dev/urandom, we will have to go hunting in other libraries.

The main reason for this is speed: On Ubuntu 14.04 doing direct reads from
/dev/urandom is 2-3 times faster than our md4 based code. On virtualized
FreeBSD 10 the difference is even larger.

My first approach was to use fopen/fread. It was even faster, but less
than twice as fast. So I thought we could save the additional complexity
when having to deal with throwing away buffers when forking and the
additional memory footprint per process.

With this simple generate_random_buffer it will be easier to adapt new
syscalls to get randomness.

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 Oct 13 04:25:39 CEST 2015 on sn-devel-104
2015-10-13 04:25:38 +02:00
Volker Lendecke
258ce91f31 lib: Move sys_rw* to lib/util
genrand.c will require it soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-13 01:23:07 +02:00
Volker Lendecke
2bc55c5321 lib: Make messaging_send_iov_from return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:06 +02:00
Volker Lendecke
678ad954e8 lib: Make messaging_ctdbd_init return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:06 +02:00
Volker Lendecke
7ae694372c lib: Use poll_intr_one_fd in ctdb_read_packet
This is an actual bug fix if someone sets "ctdb timeout" to something != 0

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:06 +02:00
Volker Lendecke
a599b96f29 lib: Remove messaging_tevent_context() dependency from ctdbd_conn.c
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:06 +02:00
Volker Lendecke
6cc1e660ee lib: Make ctdbd_probe return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:06 +02:00
Volker Lendecke
a6ddb99133 lib: Make ctdb_unwatch return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:06 +02:00
Volker Lendecke
b02fd997d2 lib: Make ctdb_watch_us return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:06 +02:00
Volker Lendecke
2d00fcda69 lib: Make ctdbd_control_local return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:06 +02:00
Volker Lendecke
a039463d82 lib: Make ctdbd_register_ips return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:06 +02:00
Volker Lendecke
4caf48ecb3 lib: Make ctdbd_traverse return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:06 +02:00
Volker Lendecke
b78c282a91 lib: Make ctdbd_parse return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:06 +02:00
Volker Lendecke
4636912985 lib: Make ctdbd_migrate return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:06 +02:00
Volker Lendecke
210e1fb265 lib: Make ctdbd_db_attach return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:06 +02:00
Volker Lendecke
fdfc7299a6 lib: Make ctdbd_messaging_send_iov return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:05 +02:00
Volker Lendecke
546d8b4129 lib: Make ctdbd_messaging_connection return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:05 +02:00
Volker Lendecke
9da6cce5c0 lib: Make ctdbd_init_connection return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:05 +02:00
Volker Lendecke
03fd13f01a lib: Make ctdbd_register_msg_ctx return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:05 +02:00
Volker Lendecke
f3c88bd6c2 lib: Make get_cluster_vnn return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:05 +02:00
Volker Lendecke
84ad1a1372 lib: Make register_with_ctdbd return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:05 +02:00
Volker Lendecke
7b8853fc42 lib: Rename ctdbd_control_unix to ctdbd_control
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:05 +02:00
Volker Lendecke
fd6293c987 lib: Remove ctdbd_control
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:05 +02:00
Volker Lendecke
108b6270f7 lib: Use ctdbd_control_unix in ctdbd_register_ips
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:05 +02:00
Volker Lendecke
dae02e9adb lib: Use ctdbd_control_unix in ctdbd_db_attach
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:05 +02:00
Volker Lendecke
a44894506e lib: Use ctdbd_control_unix in ctdbd_db_attach
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:05 +02:00
Volker Lendecke
24d0add465 lib: Use ctdbd_control_unix in ctdbd_dbpath
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:05 +02:00
Volker Lendecke
ab79b952de lib: Use ctdbd_control_unix in ctdbd_working
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:05 +02:00
Volker Lendecke
4d43101500 lib: Rename a variable
We'll have "int ret" in the next commit

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:05 +02:00
Volker Lendecke
a8c035fb6d lib: Use ctdbd_control_unix in get_cluster_vnn
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:05 +02:00
Volker Lendecke
a5438e09af lib: Use ctdbd_control_unix in register_with_ctdbd
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:05 +02:00