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

59 Commits

Author SHA1 Message Date
Gary Lockyer
099df25f56 source4 smbd: remove global control pipe from process_standard.
The standard model uses a pipe to signal the worker processes spawned on
accept that the controlling process has terminated and that they should
shut down.  This pipe is currently a static global variable in
process_standard.c.

This patch replaces that global pipe with a file descriptor passed into
the process model init functions, giving  a single mechanism across all process
models.  This paves the way for the addition of a pre-fork process model.

Ensuring that the correct file descriptors are closed, is difficult so
it is best do this only once rather than require the process models to
do this individually.

Notes on debugging pipe ownership:

Add code to log the process id and the file descriptor of the writeable
pipe.

run:
   lsof | grep FIFO | grep samba | grep <process id>
   this will produce lines like:

   samba 25624 him 4w FIFO 0,10 0t0 472206 pipe

   where: 4w is the file descriptor and mode and the number to the left
          of "pipe" is the pipe id.
then:
   lsof | grep FIFO | grep samba | grep <pipe id>

   This will display all the processes with the pipe open and the mode
   only the smbd master process should have it open in write mode.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Sep 28 02:08:34 CEST 2017 on sn-devel-144
2017-09-28 02:08:34 +02:00
Jeremy Allison
306783d6f5 lib: modules: Change XXX_init interface from XXX_init(void) to XXX_init(TALLOC_CTX *)
Not currently used - no logic changes inside.

This will make it possible to pass down a long-lived talloc
context from the loading function for modules to use instead
of having them internally all use talloc_autofree_context()
which is a hidden global.

Updated all known module interface numbers, and added a
WHATSNEW.

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Ralph Böhme <slow@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Apr 22 01:17:00 CEST 2017 on sn-devel-144
2017-04-22 01:17:00 +02:00
Andrew Bartlett
b9f1c8887e s4-process_single: Use pid,task_id as cluster_id in process_single just like process_prefork
This avoids two different process single task servers (eg the drepl
server) sharing the same server id.  The task id starts at 2^31 to
avoid collision with the fd based scheme for connections.

Fix-bug: https://bugzilla.samba.org/show_bug.cgi?id=9598

Reported-by: Matthieu Patou <mat@matws.net>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sat Jan 26 16:13:05 CET 2013 on sn-devel-104
2013-01-26 16:13:04 +01:00
Andrew Bartlett
c5db4eb910 bug9598: s4-process_single: Use pid,fd as cluster_id in process_single just like process_prefork
This avoids two different process single servers (say LDAP and the RPC server) sharing the same
server id.

Fix-bug: https://bugzilla.samba.org/show_bug.cgi?id=9598

Reported-by: Matthieu Patou <mat@matws.net>
Reviewed-by: Matthieu Patou <mat@matws.net>
Signed-off-by: Andrew Bartlett <abartlett@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Jan 25 12:00:04 CET 2013 on sn-devel-104
2013-01-25 12:00:04 +01:00
Michael Adam
25216d7537 s4:smbd: fix typos
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Tue Jun 12 09:21:15 CEST 2012 on sn-devel-104
2012-06-12 09:21:14 +02:00
Jelmer Vernooij
c104e4ca54 source4/smbd: Fix prototypes for all functions. 2011-03-19 03:20:04 +01:00
Andrew Tridgell
046d38faa5 s4-smbd: don't initialise process models more than once
this also removes the event_context parameter from process model
initialisation. It isn't needed, and is confusing when a process model
init can be called from more than one place, possibly with different
event contexts.

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-10-30 23:49:00 +11:00
Andrew Tridgell
6b266b85cf s4-loadparm: 2nd half of lp_ to lpcfg_ conversion
this converts all callers that use the Samba4 loadparm lp_ calling
convention to use the lpcfg_ prefix.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2010-07-16 18:24:27 +10:00
Brad Hards
1e986c1cb3 More spelling fixes across source4/
Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
2010-02-22 21:45:38 +01:00
Andrew Tridgell
a894eeab77 s4-debug: lower the verbosity of a couple of common log messages 2010-01-09 21:59:34 +11:00
Andrew Tridgell
e9a589feac s4-server: kill main daemon if a task fails to initialise
When one of our core tasks fails to initialise it can now ask for the
server as a whole to die, rather than limping along in a degraded
state.
2009-09-18 18:05:55 -07:00
Stefan Metzmacher
29cc638c2c s4:smbd: s/private/private_data
metze
2009-02-02 13:08:36 +01:00
Stefan Metzmacher
183c379fe5 s4:lib/tevent: rename structs
list=""
list="$list event_context:tevent_context"
list="$list fd_event:tevent_fd"
list="$list timed_event:tevent_timer"

for s in $list; do
	o=`echo $s | cut -d ':' -f1`
	n=`echo $s | cut -d ':' -f2`
	r=`git grep "struct $o" |cut -d ':' -f1 |sort -u`
	files=`echo "$r" | grep -v source3 | grep -v nsswitch | grep -v packaging4`
	for f in $files; do
		cat $f | sed -e "s/struct $o/struct $n/g" > $f.tmp
		mv $f.tmp $f
	done
done

metze
2008-12-29 20:46:40 +01:00
Jelmer Vernooij
2ba4a79210 Eliminate another global_loadparm. 2008-09-30 03:20:46 +02:00
Andrew Bartlett
24d0587752 Clarify nomaclature of socket names in process_single and process_prefork
Fix talloc_steal in both cases to steal connected socket (from accept)
onto it's private structure, rather than stealing the bound socket.

Remove termination code from the prefork modal, we want the process to
still stay around, to serve future clients.

Andrew Bartlett and David Disseldorp
(This used to be commit 07590d893e)
2008-02-05 14:51:01 +11:00
Andrew Bartlett
3d5594e74d Rework process_single.c to take advantage of cluster_id() now taking an additional argument.
Andrew Bartlett and David Disseldorp
(This used to be commit c961e7d74e)
2008-02-04 17:53:01 +11:00
Jelmer Vernooij
df408d056e r26672: Janitorial: Remove uses of global_loadparm.
(This used to be commit 18cd08623e)
2008-01-05 13:06:03 -06:00
Jelmer Vernooij
8e2d624a58 r24937: Merge tests spoolss RPC callbacks.
(This used to be commit 9b256a0ca2)
2007-10-10 15:03:39 -05:00
Andrew Tridgell
0479a2f1cb r23792: convert Samba4 to GPLv3
There are still a few tidyups of old FSF addresses to come (in both s3
and s4). More commits soon.
(This used to be commit fcf38a38ac)
2007-10-10 14:59:12 -05:00
Andrew Tridgell
1cd4339b9a r20646: first preparations for cluster enablement. This changes "
uint32_t server_id
to
  struct server_id server_id;

which allows a server ID to have an node number. The node number will
be zero in non-clustered case. This is the most basic hook needed for
clustering, and ctdb.
(This used to be commit 2365abaa99)
2007-10-10 14:37:23 -05:00
Stefan Metzmacher
0671e54079 r19610: fix the build
metze
(This used to be commit 59fe6cfaba)
2007-10-10 14:25:04 -05:00
Andrew Bartlett
3c1e780ec7 r19604: This is a massive commit, and I appologise in advance for it's size.
This merges Samba4 with lorikeet-heimdal, which itself has been
tracking Heimdal CVS for the past couple of weeks.

This is such a big change because Heimdal reorganised it's internal
structures, with the mechglue merge, and because many of our 'wishes' have been granted:  we now have DCE_STYLE GSSAPI, send_to_kdc hooks and many other features merged into the mainline code.  We have adapted to upstream's choice of API in these cases.

In gensec_gssapi and gensec_krb5, we either expect a valid PAC, or NO
PAC.  This matches windows behavour.  We also have an option to
require the PAC to be present (which allows us to automate the testing
of this code).

This also includes a restructure of how the kerberos dependencies are
handled, due to the fallout of the merge.

Andrew Bartlett
(This used to be commit 4826f17351)
2007-10-10 14:25:03 -05:00
Andrew Tridgell
660964f133 r18805: make error message match function name
(This used to be commit e46d8ed53f)
2007-10-10 14:19:12 -05:00
Stefan Metzmacher
ad06a8bd65 r14736: - the ntvfs subsystem should not know about smb_server.h
- the process module subsystem should not know about smb_server.h
- the smb_server module should not know about process models

metze
(This used to be commit bac95bb8f4)
2007-10-10 13:59:17 -05:00
Stefan Metzmacher
651ca6553e r14079: I just found the setproctitle library from alt linux:-)
- add set_title hook to the process models
- use setproctitle library in process_model standard if available
- the the title for the task servers and on connections

metze
(This used to be commit 526f20bbec)
2007-10-10 13:56:49 -05:00
Stefan Metzmacher
7d6c9bf2b2 r12815: try to fix the build on AIX
metze
(This used to be commit 21bc072c7a)
2007-10-10 13:49:59 -05:00
Jelmer Vernooij
d4de4c2d21 r12608: Remove some unused #include lines.
(This used to be commit 70e7449318)
2007-10-10 13:49:03 -05:00
Andrew Bartlett
984860f922 r12267: Try to avoid segfault in kerberos libs, because we talloc_free()'ed
the old event context in the standard process modal child.

Andrew Bartlett
(This used to be commit 0f52a9ab07)
2007-10-10 13:47:25 -05:00
Andrew Tridgell
f308cc1616 r10920: in case of a accept() failure just failing and trying again is no
good, as it is probably a resource constraint, so if we just try again
we will spin (as the incoming socket will still be readable). Using a
sleep(1) solves this by throtting smbd until the resource constraint
goes away.

if the resource constraint doesn't go away, then at least smbd won't
be spinning chewing cpu
(This used to be commit 7a5a9da477)
2007-10-10 13:39:43 -05:00
Andrew Tridgell
7b03af8963 r6530: the server ID of a connection in the single process model should be
based on the new socket fd, not the listening socket!

this fixes locktest with -M single
(This used to be commit 3e1b2742db)
2007-10-10 13:16:23 -05:00
Andrew Tridgell
4c7c38e930 r5411: make network interface selection a bit saner
- if we have no configured network interfaces, then don't start nbtd (when I add dynamic
  interface loading this will change to a delay until a network interface comes up)

- choose the best interface by netmask for torture tests that need a
  specific IP (such as the WINS test). Added iface_best_ip() for that.

- if specific interfaces are chosen in smb.conf, then keep that ordering, and
  default to the first one listed
(This used to be commit 4d08c11407)
2007-10-10 13:10:43 -05:00
Andrew Tridgell
131dc76d56 r5197: moved events code to lib/events/ (suggestion from metze)
(This used to be commit 7f54c8a339)
2007-10-10 13:09:30 -05:00
Andrew Tridgell
1447b9a8c1 r5104: - added support for task based servers. These are servers that within
themselves are run as a single process, but run as a child of the
  main process when smbd is run in the standard model, and run as part
  of the main process when in the single mode.

- rewrote the winbind template code to use the new task services. Also
  fixed the packet queueing

- got rid of event_context_merge() as it is no longer needed
(This used to be commit 339964a596)
2007-10-10 13:09:23 -05:00
Andrew Tridgell
55d4d36993 r5102: This is a major simplification of the logic for controlling top level
servers in smbd. The old code still contained a fairly bit of legacy
from the time when smbd was only handling SMB connection. The new code
gets rid of all of the smb_server specific code in smbd/, and creates
a much simpler infrastructures for new server code.

Major changes include:

 - simplified the process model code a lot.

 - got rid of the top level server and service structures
   completely. The top level context is now the event_context. This
   got rid of service.h and server.h completely (they were the most
   confusing parts of the old code)

 - added service_stream.[ch] for the helper functions that are
   specific to stream type services (services that handle streams, and
   use a logically separate process per connection)

 - got rid of the builtin idle_handler code in the service logic, as
   none of the servers were using it, and it can easily be handled by
   a server in future by adding its own timed_event to the event
   context.

 - fixed some major memory leaks in the rpc server code.

 - added registration of servers, rather than hard coding our list of
   possible servers. This allows for servers as modules in the future.

 - temporarily disabled the winbind code until I add the helper
   functions for that type of server

 - added error checking on service startup. If a configured server
   fails to startup then smbd doesn't startup.

 - cleaned up the command line handling in smbd, removing unused options
(This used to be commit cf6a46c3cb)
2007-10-10 13:09:22 -05:00
Stefan Metzmacher
9327ec51d1 r4728: split up server_services into:
- stream_socket services
  the smb, ldap and rpc service which sets up a srtam socket end then
  waits for connections
and
- task services
  which this you can create a seperate task that do something
  (this is also going through the process_model subsystem
  so with -M standard a new process for this created
  with -M thread a new thread ...

I'll add datagram services later when we whave support for datagram sockets in lib/socket/

see the next commit as an example for service_task's

metze
(This used to be commit d5fa02746c)
2007-10-10 13:08:49 -05:00
Jelmer Vernooij
31ded4901b r3737: - Get rid of the register_subsystem() and register_backend() functions.
- Re-disable tdbtool (it was building fine on my Debian box but other
					machines were having problems)
(This used to be commit 0d7bb2c40b)
2007-10-10 13:05:48 -05:00
Andrew Tridgell
252e010abf r3523: removed a useless level 0 DEBUG()
(This used to be commit b36967466f)
2007-10-10 13:05:28 -05:00
Andrew Tridgell
dde0705807 r3507: - added deferred replies on sharing violation in pvfs open. The
deferred reply is short-circuited immediately when the file is
  closed by another user, allowing it to be opened by the waiting user.

- added a sane set of timeval manipulation routines

- converted all the events code and code that uses it to use struct
  timeval instead of time_t, which allows for microsecond resolution
  instead of 1 second resolution. This was needed for doing the pvfs
  deferred open code, and is why the patch is so big.
(This used to be commit 0d51511d40)
2007-10-10 13:05:23 -05:00
Andrew Tridgell
a99b6219a8 r3481: split out client.h and events.h
(This used to be commit c6f4865744)
2007-10-10 13:05:20 -05:00
Andrew Tridgell
aa34fcebf8 r3466: split out request.h, signing.h, and smb_server.h
(This used to be commit 7c4e6ebf05)
2007-10-10 13:05:17 -05:00
Andrew Tridgell
3643fb1109 r3463: separated out some more headers (asn_1.h, messages.h, dlinklist.h and ioctl.h)
(This used to be commit b97e395c81)
2007-10-10 13:05:17 -05:00
Andrew Tridgell
990d76f7cb r3314: added a option "socket:testnonblock" to the generic socket code. If
you set this option (either on the command line using --option or in
smb.conf) then every socket recv or send will return short by random
amounts. This allows you to test that the non-blocking socket logic in
your code works correctly.

I also removed the flags argument to socket_accept(), and instead made
the new socket inherit the flags of the old socket, which makes more
sense to me.
(This used to be commit 406d356e69)
2007-10-10 13:04:53 -05:00
Andrew Tridgell
fef617c31b r3012: added initial support for byte range locking in the posix vfs. This is
enough for us to pass locktest, but does not yet support lock timeouts
and some of the other esoteric features.
(This used to be commit 58a92abd88)
2007-10-10 12:59:57 -05:00
Andrew Tridgell
9a62dce0ac r2648: - use a destructor on struct server_connection to simplify the
connection termination cleanup, and to ensure that the event
  contexts are properly removed for every process model

- gave auth_context the new talloc treatment, which removes another
  source of memory leaks.
(This used to be commit 230e1cd777)
2007-10-10 12:59:16 -05:00
Andrew Tridgell
764eddb696 r2646: - use a talloc destructor to ensure that sockets from the new socket
library are closed on abnormal termination

- convert the service.h structures to the new talloc methods
(This used to be commit 2dc334a328)
2007-10-10 12:59:16 -05:00
Andrew Tridgell
3e54089bc1 r2588: connect/disconnect is common enough that I don't think a level 0 DEBUG
is warranted to warn that it has happened :)
(This used to be commit ee51eefe17)
2007-10-10 12:59:08 -05:00
Stefan Metzmacher
7d06a06584 r2447: let the server code use the new lib/socket/ stuff
metze
(This used to be commit 2fd577d241)
2007-10-10 12:58:54 -05:00
Stefan Metzmacher
7a0e61f38e r1516: remove the server_connection from the list on the server_socket
and call talloc_destroy(srv_conn->mem_ctx)

also don't follow NULL pointers

metze
(This used to be commit 786c00c3d4)
2007-10-10 12:57:38 -05:00
Stefan Metzmacher
b11e1a41d8 r1515: move dublicate code to a function
metze
(This used to be commit a8ec53c81a)
2007-10-10 12:57:38 -05:00
Stefan Metzmacher
a1748ef743 r1514: close stuff from the server_connection not in the
close_connection fn of a specific service

metze
(This used to be commit 0e1f5e66d3)
2007-10-10 12:57:37 -05:00