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

1296 Commits

Author SHA1 Message Date
Björn Baumbach
955775023b s3-printing: fix typo
Signed-off-by: Michael Adam <obnox@samba.org>
2011-11-03 10:13:40 +01:00
Andreas Schneider
2f65ae25df s3: Include uid_wrapper where it is missing. 2011-10-27 13:32:02 +02:00
Michael Adam
c7c1a3e276 s3:printing: convert printer_list to use dbwrap wrapper functions
Avoid direct use of the db_record and db_context structs.
2011-10-11 14:17:57 +02:00
Michael Adam
0e28448a78 s3:dbwrap: convert dbwrap_fetch(), dbwrap_fetch_bystring() and dbwrap_fetch_bystring_upper() to NTSTATUS 2011-10-11 14:17:56 +02:00
Volker Lendecke
425b93ef69 s3: Remove the smbd_server_conn ref from create_conn_struct 2011-09-26 14:59:12 +02:00
Andreas Schneider
a9dc2c81ad s3-spoolss: Fix bug #8351 forms migration.
Don't fail if the form already exists (or is builtin now).

Signed-off-by: Andreas Schneider <asn@samba.org>

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Fri Sep  9 03:21:42 CEST 2011 on sn-devel-104
2011-09-09 03:21:42 +02:00
Andreas Schneider
3e8c665465 s3-smbd: Rename reload_printers() and add documentation.
Autobuild-User: Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date: Mon Sep  5 17:59:47 CEST 2011 on sn-devel-104
2011-09-05 17:59:47 +02:00
Andreas Schneider
ad37341949 s3-spoolssd: Remove stale printers only on a valid pcap update.
load_printers() removes stale printers and we should only remove them if
we have a CUPS connection and talked to cups. Else we will remove every
configured printer if cups is not available.

Autobuild-User: Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date: Mon Sep  5 11:18:23 CEST 2011 on sn-devel-104
2011-09-05 11:18:23 +02:00
Simo Sorce
a4188aaf7b s3-spoolss: Remove useless check
If we *really* are a bout to exit (PF_WORKER_EXITING) then the event will not
be called as the loop will exit. Otherwise PF_SRV_MSG_EXIT may not  be honoured
for a long time if we have cients connected, therefore keep handling SIGHUP
properly in those cases.

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:05:06 -04:00
Simo Sorce
feadd849ba s3-spoolssd: Listen on parent messages
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:05:06 -04:00
Simo Sorce
72746498a4 s3-spoolssd: Send a message to the parent when we accept a connection
Every time we accept a connection wanr the parent, so it can run management
routines and reallocate more resources if necessary.

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:05:06 -04:00
Simo Sorce
f07f5c5100 s3-spoolssd: User new prefork helpers to simplify code.
Also stop using the listening as now the prefork code properly sets
the PF_WORKER_ACCEPTING flag and it can be relied upon without having to keep
additional status around.

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:05:05 -04:00
Simo Sorce
e3736f826b s3-prefork: Fix worker flags handling.
We can't have a clear idea of wether the worker is IDLE or BUSY.
The only things we can tell is if it is Alive, whether it is currently
Accepting connections or wether it is Exiting soon.

Remove PF_WORKER_IDLE, PF_WORKER_BUSY and replace their use with
PF_WORKER_ALIVE. Also properly assign PF_WORKER_ACCEPTING so that
users of the API can rely on the flag.

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:05:05 -04:00
Simo Sorce
ee0c69a25e s3-prefork: do not use a lock_fd, just race on accept()
We used a lock mimicking what apache does for preforked children.
But it doesn't work properly in our case because we do not stop once a request
has been served. Clients are allowed to perform multiple requests and keep the
connection open.
This means that if we allow multiple clients per children, then a child could
take the lock and then be asked to do a long or even locking operation by a
client it already is serving. This woulkd cause the whole server to deadlock,
as the child is now busy and also holding on the lock.
Using a race on accept() by having a tevent_fd on the listening socket wait
for read events we never deadlock. At most we cause a bit of contention among
children. But in the generic case connections are much less frequent for us as
clients tend to be long lived. So the little contention we may have is not a
big deal.

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:05:05 -04:00
Simo Sorce
884969ed97 s3-spoolssd: Use prefrok utils to manage children
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:05:04 -04:00
Simo Sorce
0647a93c64 s3-spoolss: Introduce helper function to manage pool.
We were not properly managing allowed clients and pool management was
duplicated across a few callers.
Concentrate all management heuristics in one single function.

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:05:04 -04:00
Simo Sorce
bfd9624818 s3-spoolssd: Fix spoolss logging.
Use the same code as in lsasd.

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:05:04 -04:00
Simo Sorce
23e7e1c158 s3-rpc_server: Replace RPC_SERVICE_MODE_DAEMON checks
Use rpc_daemon_type() macros where appropriate instead.

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:05:03 -04:00
Andreas Schneider
dea21619a2 s3-spoolssd: Check if we were able to create the prefork pool.
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:05:02 -04:00
Simo Sorce
d52343a967 s3-messaging: Do not register to classes we are not going to use.
Signed-off-by: Andreas Schneider <asn@samba.org>

Autobuild-User: Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date: Thu Aug 11 17:09:30 CEST 2011 on sn-devel-104
2011-08-11 17:09:30 +02:00
Simo Sorce
cb1af61cb1 s3-messaging: Remove obsolete class.
The FLAG_MSG_PRINT_NOTIFY class is actually obsolete and never used, as the
only message belonging to it is not used either.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-11 14:57:55 +02:00
Andreas Schneider
9eafbebf9c s3-spoolss: Fix prototypes warnings.
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:06 +02:00
Simo Sorce
c3cfa6be47 s3-printing: Do not try to force reload.
Be more correct in load printers at startup.
If async process have already started we do not need to force a reload, but we
just need to load the printers. If other process have not finished initializing
it makes no sense to try to force them as they are masking SIGHUP unitl init is
done anyway.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:06 +02:00
Simo Sorce
54aaa5a58c s3-spoolss: do not call pcap_cache_reload() directly
The background queue process is repsonsible for that.
Just reload printers if necessary or wait for a message from bq to do that.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:05 +02:00
Simo Sorce
dd4ff4bfdd s3-printing: Add child handler to bq process
The cups backend forks a child to do asynchronous work.
We need a sigchld handler in bq to properly wait for the chilod to finish and
reap it, otherwise it hangs the forever as a zombie process.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:05 +02:00
Simo Sorce
befc539273 s3-spoolss: Fix printers related messaging
Children were not properly receiving messages to reload printers when
the background queue process was dispatching them.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:05 +02:00
Simo Sorce
7a07162558 s3-prefork: Fix use of child id.
Children Ids must start at 1 as 0 represent the father.
Also fix callbacks that restart logs to use a procedd global variable that
holds the Id so that they work correctly both fot the parent process and the
children.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:05 +02:00
Simo Sorce
f00681fe9a s3-printing: make sure to block SIGHUP ...
... until we are ready to handle it.

Also make us ready as early as possible in spoolssd.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:05 +02:00
Simo Sorce
6f682be2ae s3-spoolss: Use a global variable for the pool
This allows for setting up signal handlers earlier which is needed
for the following patch. It also simplify the code in a few places.
After all we never have more than pool active at any time during
spoolssd life span.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:05 +02:00
Simo Sorce
b2f682a8e6 s3-printing: Allow bq process to have own logfile
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:05 +02:00
Simo Sorce
339c106e51 s3-spoolssd: Use the child_id to open log files
This way each child has its own log file and avoid mixing all logs form all
children in the same parent log file.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:05 +02:00
Simo Sorce
fa893e815b s3-prefork: Pass the child a child_id
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:05 +02:00
Simo Sorce
0de09289ae s3-printing: Force pcap reload when all ready
This way we are sure the cache is primed properly and messages can be sent to
processes if necessary as all messaging has been set up.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:05 +02:00
Simo Sorce
227551a07b s3-prefork: Return tsocket_address for client and server
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:04 +02:00
Simo Sorce
2b33b438ba s3-prefork: Pass messaging context around too
Pair-Programmed-With: Andreas Schneider <asn@samba.org>

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:04 +02:00
Simo Sorce
1155280a48 s3-prefork: Set up a SIGCHLD handler by default
We need to properly handle preforked children so it is better to just do that
automatically.

If the parent needs/wants to intercept SIGCHLD events it can set a callback
that will be called by the prefork code once the internal cleanup function that
checks all prefork children has been executed.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:04 +02:00
Simo Sorce
d36a8dc896 s3:spoolssd Start spoolssd from printing_subsystem_init
Use a child for the background updater process
Forward printer update messages from spoolss to background update process.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:04 +02:00
Simo Sorce
9ce6416673 s3-printing: Rework how the background process is started
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:04 +02:00
Simo Sorce
0a910c9347 s3-prefork: Provide a cleanup function
This way the parent doesn't need to know how to handle dead children and
keeps all of that within the prefork abstraction.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:04 +02:00
Simo Sorce
f6ae58f242 s3-prefork: add support for multiple listning file descriptors
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:04 +02:00
Simo Sorce
afde4d8d83 s3-spoolssd: propagate SIGHUP to children
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:04 +02:00
Simo Sorce
de08cd99b2 s3-spoolssd: expand children pool when necessary
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:03 +02:00
Simo Sorce
afc4dda7d0 s3-spoolssd: Use parametric option for prefork parameters
example:
spoolssd:prefork = 10💯5

will configure spoolssd to start with a minimum of 10 preforked children,
a max set to 100 children and spawns/retires 5 children at a time when
ramping up/scaling down.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:03 +02:00
Simo Sorce
595cce89fe s3-spoolss: make listening asynchronous
This also allows to make each children serve more than one client at the same
time if necessary.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:03 +02:00
Simo Sorce
1dd93f40c8 s3-spoolssd: Use the prefork framework in spoolssd
This should make it more scalable and able to handle easily multiple clients at
the same time.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:03 +02:00
Simo Sorce
88b901b6ee s3-printing: No need to register to smbd's children list
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:03 +02:00
Günther Deschner
98f9c88e93 s3-printing: fix some build warnings in queue_process.c
Guenther

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Wed Aug  3 17:48:33 CEST 2011 on sn-devel-104
2011-08-03 17:48:33 +02:00
Simo Sorce
a68f16cb56 s3:server Consolidate printing related initialization
Signed-off-by: Günther Deschner <gd@samba.org>

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Tue Aug  2 17:37:44 CEST 2011 on sn-devel-104
2011-08-02 17:37:44 +02:00
Simo Sorce
2e8a85ec72 s3:smbd - Move printing queue stuff
This way we can properly deal with pcap updates in the background queue process
if it is enabled (on by default) and not perform these actions in the main
smbd process.

Signed-off-by: Günther Deschner <gd@samba.org>
2011-08-02 15:28:03 +02:00
Andreas Schneider
0fef6766b9 s3-rpc_server: Use binding vector in rpc_ep_try_register(). 2011-08-01 08:50:35 +02:00