idra/samba.git
12 years agopassdb: Call with correct backend methods instead of default methods
Amitay Isaacs [Wed, 10 Aug 2011 07:32:32 +0000 (17:32 +1000)]
passdb: Call with correct backend methods instead of default methods

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

12 years agopassdb: Added python wrapper to passdb
Amitay Isaacs [Wed, 10 Aug 2011 03:53:43 +0000 (13:53 +1000)]
passdb: Added python wrapper to passdb

 - Added python wrapper for samu structure.

 - Added python wrapper for passdb methods:

   domain_info(), getsampwnam(), getsampwsid(), create_user(),
   delete_user(), add_sam_account(), delete_sam_account(),
   update_sam_account(), rename_sam_account(), search_users()

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

12 years agopassdb: Add a function to read secrets db from a specified path
Amitay Isaacs [Wed, 10 Aug 2011 03:50:26 +0000 (13:50 +1000)]
passdb: Add a function to read secrets db from a specified path

This allows to load secrets db from a different location. The original
secrets_init() now calls secrets_init_path() with lp_private_dir().

12 years agopassdb: Add a function to expose loaded backend list.
Amitay Isaacs [Wed, 10 Aug 2011 03:46:34 +0000 (13:46 +1000)]
passdb: Add a function to expose loaded backend list.

This function is used in python wrapper to list available python backends.

12 years agowaf: Add SAMBA3_PYTHON context to build python wrappers in samba3
Amitay Isaacs [Wed, 10 Aug 2011 03:43:18 +0000 (13:43 +1000)]
waf: Add SAMBA3_PYTHON context to build python wrappers in samba3

12 years agosamba-tool: Remove gpo setacl command
Amitay Isaacs [Wed, 3 Aug 2011 05:09:19 +0000 (15:09 +1000)]
samba-tool: Remove gpo setacl command

12 years agos3:smb2cli: pass more fields to smb2cli_req_create()/smb2cli_req_send()
Stefan Metzmacher [Fri, 12 Aug 2011 15:26:13 +0000 (17:26 +0200)]
s3:smb2cli: pass more fields to smb2cli_req_create()/smb2cli_req_send()

The caller should take care of the global cli_state values.

metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Fri Aug 12 19:38:27 CEST 2011 on sn-devel-104

12 years agos3:smb2cli: allow 32bit dyn_len in smb2cli_req_create()/smb2cli_req_send()
Stefan Metzmacher [Fri, 12 Aug 2011 15:23:04 +0000 (17:23 +0200)]
s3:smb2cli: allow 32bit dyn_len in smb2cli_req_create()/smb2cli_req_send()

metze

12 years agos3:libsmb: keep a cli_smb_state->one_way
Stefan Metzmacher [Fri, 12 Aug 2011 15:40:04 +0000 (17:40 +0200)]
s3:libsmb: keep a cli_smb_state->one_way

This moves the SMB1 specific stuff to cli_smb_req_create(),
instead of having it in the core dispatching code.

metze

12 years agos3:libsmb: abstract the incoming dispatch function via a function pointer
Stefan Metzmacher [Fri, 12 Aug 2011 12:50:09 +0000 (14:50 +0200)]
s3:libsmb: abstract the incoming dispatch function via a function pointer

This will allow handling of SMB2 in future.

metze

12 years agos3:libsmb: split out cli_state_dispatch_smb1() from cli_smb_received()
Stefan Metzmacher [Fri, 12 Aug 2011 12:41:23 +0000 (14:41 +0200)]
s3:libsmb: split out cli_state_dispatch_smb1() from cli_smb_received()

metze

12 years agos3:libsmb: add missing TALLOC_FREE(frame) to cli_smb_received()
Stefan Metzmacher [Fri, 12 Aug 2011 12:44:44 +0000 (14:44 +0200)]
s3:libsmb: add missing TALLOC_FREE(frame) to cli_smb_received()

metze

12 years agos3:smb2_server: make sure we prefer responses over requests on the client socket
Stefan Metzmacher [Fri, 5 Aug 2011 18:34:43 +0000 (20:34 +0200)]
s3:smb2_server: make sure we prefer responses over requests on the client socket

metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Fri Aug 12 16:46:43 CEST 2011 on sn-devel-104

12 years agoselftest:Samba4: test --domain-critical-only in provision_vampire_dc()
Stefan Metzmacher [Thu, 11 Aug 2011 21:07:35 +0000 (23:07 +0200)]
selftest:Samba4: test --domain-critical-only in provision_vampire_dc()

This way only only replicate critical objects during the initial join
as DC, then we'll replicate the whole domain while 'samba' is running.

metze

Signed-off-by: Andrew Tridgell <tridge@samba.org>
Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Fri Aug 12 14:07:50 CEST 2011 on sn-devel-104

12 years agos3:samba-tool: add --domain-critical-only to "samba-tool domain join"
Stefan Metzmacher [Mon, 8 Aug 2011 09:15:35 +0000 (11:15 +0200)]
s3:samba-tool: add --domain-critical-only to "samba-tool domain join"

metze

Signed-off-by: Andrew Tridgell <tridge@samba.org>
12 years agos4:py/samba/join: add domain_critical_only=False to join_DC/join_RODC
Stefan Metzmacher [Mon, 8 Aug 2011 09:01:21 +0000 (11:01 +0200)]
s4:py/samba/join: add domain_critical_only=False to join_DC/join_RODC

metze

Signed-off-by: Andrew Tridgell <tridge@samba.org>
12 years agos4:py/samba/drs_utils: pass down req/req_level to self.net.replicate_chunk()
Stefan Metzmacher [Mon, 8 Aug 2011 08:47:12 +0000 (10:47 +0200)]
s4:py/samba/drs_utils: pass down req/req_level to self.net.replicate_chunk()

metze

Signed-off-by: Andrew Tridgell <tridge@samba.org>
12 years agos4:libnet_vampire: don't keep the replication state if DRSUAPI_DRS_CRITICAL_ONLY...
Stefan Metzmacher [Tue, 9 Aug 2011 10:23:29 +0000 (12:23 +0200)]
s4:libnet_vampire: don't keep the replication state if DRSUAPI_DRS_CRITICAL_ONLY was used

In that case we have incomplete information and need to start
from 0 in the next run.

metze

Signed-off-by: Andrew Tridgell <tridge@samba.org>
12 years agos4:libnet: passdown the DsGetNCChangesReq* to the libnet_BecomeDC_StoreChunk handler
Stefan Metzmacher [Mon, 8 Aug 2011 08:29:05 +0000 (10:29 +0200)]
s4:libnet: passdown the DsGetNCChangesReq* to the libnet_BecomeDC_StoreChunk handler

metze

Signed-off-by: Andrew Tridgell <tridge@samba.org>
12 years agoselftest:target/Samba4: use the correct configuration in setup_vampire_dc()
Stefan Metzmacher [Tue, 9 Aug 2011 10:20:54 +0000 (12:20 +0200)]
selftest:target/Samba4: use the correct configuration in setup_vampire_dc()

This allows "TDB_NO_FSYNC=1 make -j test TESTS=vampire" to work.

metze

Signed-off-by: Andrew Tridgell <tridge@samba.org>
12 years agos3:libsmb: keep the request order in cli_smb_req_unset_pending()
Stefan Metzmacher [Fri, 12 Aug 2011 06:39:15 +0000 (08:39 +0200)]
s3:libsmb: keep the request order in cli_smb_req_unset_pending()

metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Fri Aug 12 12:36:03 CEST 2011 on sn-devel-104

12 years agos3:libsmb: use tevent_req_defer_callback() unless there's only one request in cli_smb...
Stefan Metzmacher [Thu, 11 Aug 2011 10:45:26 +0000 (12:45 +0200)]
s3:libsmb: use tevent_req_defer_callback() unless there's only one request in cli_smb_received()

Callers of tevent_req_done() (or similar functions) have to return directly.
Otherwise the callback could invalidate the current stack state,
which is likely to trigger segfaults.

If there was only one pending request and we just got the response
for that one, we can use tevent_req_done() directly.

Otherwise there're more pending requests and we need to call
cli_state_receive_next() or we got the response for chained requests.
Both means that we have to use tevent_req_defer_callback().

metze

12 years agos3:libsmb: make use of cli_state_receive_next() in cli_smb_received()
Stefan Metzmacher [Thu, 11 Aug 2011 10:28:06 +0000 (12:28 +0200)]
s3:libsmb: make use of cli_state_receive_next() in cli_smb_received()

metze

12 years agos3:libsmb: notify all request about failures in cli_smb_req_set_pending()
Stefan Metzmacher [Thu, 11 Aug 2011 10:26:31 +0000 (12:26 +0200)]
s3:libsmb: notify all request about failures in cli_smb_req_set_pending()

It's up to the caller to notify the current request,
but we have to notify all other pending requests if
we're not able to read the next response from the server.

metze

12 years agos3:libsmb: split out cli_state_receive_next() from cli_smb_req_set_pending()
Stefan Metzmacher [Thu, 11 Aug 2011 10:16:02 +0000 (12:16 +0200)]
s3:libsmb: split out cli_state_receive_next() from cli_smb_req_set_pending()

metze

12 years agos3:libsmb: use talloc_stackframe() in cli_smb_received()
Stefan Metzmacher [Thu, 11 Aug 2011 10:07:55 +0000 (12:07 +0200)]
s3:libsmb: use talloc_stackframe() in cli_smb_received()

metze

12 years agos3:libsmb: call cli_smb_req_unset_pending() before tevent_req_done() also for chained...
Stefan Metzmacher [Thu, 11 Aug 2011 10:18:58 +0000 (12:18 +0200)]
s3:libsmb: call cli_smb_req_unset_pending() before tevent_req_done() also for chained requests

metze

12 years agos3:libsmb: reset the destructor in cli_smb_req_unset_pending()
Stefan Metzmacher [Thu, 11 Aug 2011 10:18:26 +0000 (12:18 +0200)]
s3:libsmb: reset the destructor in cli_smb_req_unset_pending()

metze

12 years agos3:libsmb: add cli_state_notify_pending() and use it
Stefan Metzmacher [Thu, 11 Aug 2011 07:35:38 +0000 (09:35 +0200)]
s3:libsmb: add cli_state_notify_pending() and use it

If we got a problem on the connection we need to notify every
pending request. But we need to make use of tevent_req_defer_callback()
before tevent_req_nterror(), otherwise the callback, triggered
by tevent_req_nterror(), could invalidate the state of current caller,
which will likely cause segfaults.

metze

12 years agos4-test: use standard process model for 'dc' server
Andrew Tridgell [Fri, 12 Aug 2011 04:37:04 +0000 (14:37 +1000)]
s4-test: use standard process model for 'dc' server

this provides us with both 'standard' and 'single' process models in
selftest, ensuring that we test the standard process model in the
build farm

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Fri Aug 12 11:06:50 CEST 2011 on sn-devel-104

12 years agosocket-wrapped: added wrappers for dup() and dup2()
Andrew Tridgell [Fri, 12 Aug 2011 04:28:03 +0000 (14:28 +1000)]
socket-wrapped: added wrappers for dup() and dup2()

The Samba4 standard process model uses dup() on incoming sockets as an
optimisation (it makes select() a tiny bit faster when used).

Adding dup() to socket wrapper allows us to use the standard process
model in selftest

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

12 years agos3:selftest: run smbtorture3 CHAIN1/CHAIN2 tests
Stefan Metzmacher [Thu, 11 Aug 2011 20:32:49 +0000 (22:32 +0200)]
s3:selftest: run smbtorture3 CHAIN1/CHAIN2 tests

metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Fri Aug 12 09:37:04 CEST 2011 on sn-devel-104

12 years agotevent: don't force the nesting flag to false in the destructor
Andrew Tridgell [Fri, 12 Aug 2011 01:56:28 +0000 (11:56 +1000)]
tevent: don't force the nesting flag to false in the destructor

the tevent destructor is called in tevent_re_initialise(), to reset
the event context back to its original state for creating child
processes. We need the nesting flag to stay the same

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Fri Aug 12 05:18:25 CEST 2011 on sn-devel-104

12 years agos4-dbcheck: offer to fix dsServiceName to be in GUID form
Andrew Tridgell [Thu, 11 Aug 2011 06:59:11 +0000 (16:59 +1000)]
s4-dbcheck: offer to fix dsServiceName to be in GUID form

this fixes the dsServiceName so it can handle server renames

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

12 years agos4-dsdb: don't cache the NTDS settings DN
Andrew Tridgell [Thu, 11 Aug 2011 06:29:24 +0000 (16:29 +1000)]
s4-dsdb: don't cache the NTDS settings DN

this DN can change due to a server rename, so we cannot cache it. It
is set by provision, but not anywhere else.

This seems to not have a large performance impact

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

12 years agos4-join: make dsServiceName a GUID in @ROOTDSE on join
Andrew Tridgell [Thu, 11 Aug 2011 06:05:11 +0000 (16:05 +1000)]
s4-join: make dsServiceName a GUID in @ROOTDSE on join

when joining another domain as a DC we should setup our dsServiceName
in @ROOTDSE to be a GUID so we can cope with later server renames

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

12 years agos4-provision: create dsServiceName in @ROOTDSE in GUID form
Andrew Tridgell [Thu, 11 Aug 2011 05:45:43 +0000 (15:45 +1000)]
s4-provision: create dsServiceName in @ROOTDSE in GUID form

this allows for handling of server renames as the GUID doesn't change

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

12 years agos4-dsdb: expand dsServiceName from GUID form at runtime
Andrew Tridgell [Thu, 11 Aug 2011 05:44:32 +0000 (15:44 +1000)]
s4-dsdb: expand dsServiceName from GUID form at runtime

this allows dsServiceName to be stored as an extended DN or GUID form
in @ROOTDSE, and its string form will be found at runtime.

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

12 years agos4-dsdb: remove the naming_fsmo and pdc_fsmo modules
Andrew Tridgell [Thu, 11 Aug 2011 05:43:22 +0000 (15:43 +1000)]
s4-dsdb: remove the naming_fsmo and pdc_fsmo modules

these are not needed now that the rootdse modules calculates the
validFSMOs attribute at runtime

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

12 years agos4-dsdb: calculate validFSMOs at runtime instead of pre-computing
Andrew Tridgell [Thu, 11 Aug 2011 05:40:53 +0000 (15:40 +1000)]
s4-dsdb: calculate validFSMOs at runtime instead of pre-computing

this changes the rootdse to compute the validFSMOs attribute at
runtime by checking the fSMORoleOwner attribute on the appropriate
DN. This avoids the need for the pdc_fsmo and naming_fsmo modules.

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

12 years agotevent: fix documentation for tevent_context_init_byname()
Sumit Bose [Thu, 11 Aug 2011 10:39:57 +0000 (12:39 +0200)]
tevent: fix documentation for tevent_context_init_byname()

Signed-off-by: Simo Sorce <idra@samba.org>
Autobuild-User: Simo Sorce <idra@samba.org>
Autobuild-Date: Thu Aug 11 21:56:37 CEST 2011 on sn-devel-104

12 years agotevent: Set FD_CLOEXEC on epoll handle
Sumit Bose [Thu, 11 Aug 2011 10:30:48 +0000 (12:30 +0200)]
tevent: Set FD_CLOEXEC on epoll handle

If an application using libtevent starts a new process the epoll file descriptor
is leaked to the new process if the event context is not freed explicitly. By
setting FD_CLOEXEC this is not needed anymore.

Signed-off-by: Simo Sorce <idra@samba.org>
12 years agos3-messaging: Do not register to classes we are not going to use.
Simo Sorce [Thu, 11 Aug 2011 03:28:09 +0000 (23:28 -0400)]
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

12 years agos3-messaging: Change classification of MSG_SMB_CONF_UPDATED.
Simo Sorce [Thu, 11 Aug 2011 03:25:56 +0000 (23:25 -0400)]
s3-messaging: Change classification of MSG_SMB_CONF_UPDATED.

smbd is not the only daemon interested in smb.conf changes. Move this
message to the GENERAL class so that all interested partied (nmbd,
winbindd, spoolssd, etc..) can receive this notification.

Signed-off-by: Andreas Schneider <asn@samba.org>
12 years agos3-messaging: Fix messaging classes.
Simo Sorce [Thu, 11 Aug 2011 03:10:48 +0000 (23:10 -0400)]
s3-messaging: Fix messaging classes.

This has been broken since ff0ac5b0 (May 2007).
Basically all messages were belonging to the General class except for CTDB
messages.
This fixed the message_send_all() function to correctly compute the class, and
fixes registrations to include all they need to cope with the fact not all
messages are of calss general (registrations rotted a bit because as long as
FLAG_MSG_GENERAL was defined the process woould receive all messages).

Signed-off-by: Andreas Schneider <asn@samba.org>
12 years agos3-messaging: Remove obsolete class.
Simo Sorce [Thu, 11 Aug 2011 03:36:06 +0000 (23:36 -0400)]
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>
12 years agos3:build(autoconf): fix bug #8369: remove irritating "." targets when recent system...
Michael Adam [Thu, 11 Aug 2011 08:49:30 +0000 (10:49 +0200)]
s3:build(autoconf): fix bug #8369: remove irritating "." targets when recent system libs exist

Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Thu Aug 11 13:26:27 CEST 2011 on sn-devel-104

12 years agoAdapt tally_histogram to Samba coding conventions
Volker Lendecke [Wed, 10 Aug 2011 17:53:53 +0000 (19:53 +0200)]
Adapt tally_histogram to Samba coding conventions

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Wed Aug 10 21:12:59 CEST 2011 on sn-devel-104

12 years agoAdapt get_max_bucket to Samba coding conventions
Volker Lendecke [Wed, 10 Aug 2011 17:52:58 +0000 (19:52 +0200)]
Adapt get_max_bucket to Samba coding conventions

12 years agoAdapt tally_approx_median to Samba coding conventions
Volker Lendecke [Wed, 10 Aug 2011 17:52:40 +0000 (19:52 +0200)]
Adapt tally_approx_median to Samba coding conventions

12 years agoAdapt bucket_range to Samba coding conventions
Volker Lendecke [Wed, 10 Aug 2011 17:52:15 +0000 (19:52 +0200)]
Adapt bucket_range to Samba coding conventions

12 years agoAdapt tally_mean to Samba coding conventions
Volker Lendecke [Wed, 10 Aug 2011 17:51:56 +0000 (19:51 +0200)]
Adapt tally_mean to Samba coding conventions

12 years agoAdapt divls64 to Samba coding conventions
Volker Lendecke [Wed, 10 Aug 2011 17:51:26 +0000 (19:51 +0200)]
Adapt divls64 to Samba coding conventions

12 years agoAvoid some // style comments in divls64
Volker Lendecke [Wed, 10 Aug 2011 17:50:52 +0000 (19:50 +0200)]
Avoid some // style comments in divls64

12 years agoAdapt divlu64 to Samba coding conventions
Volker Lendecke [Wed, 10 Aug 2011 17:49:55 +0000 (19:49 +0200)]
Adapt divlu64 to Samba coding conventions

12 years agoAvoid some // style comments in divlu64
Volker Lendecke [Wed, 10 Aug 2011 17:49:23 +0000 (19:49 +0200)]
Avoid some // style comments in divlu64

12 years agoAdapt fls64 to Samba coding conventions
Volker Lendecke [Wed, 10 Aug 2011 17:46:52 +0000 (19:46 +0200)]
Adapt fls64 to Samba coding conventions

12 years agoAdapt tally_num to Samba coding conventions
Volker Lendecke [Wed, 10 Aug 2011 17:46:37 +0000 (19:46 +0200)]
Adapt tally_num to Samba coding conventions

12 years agoAdapt tally_add to Samba coding conventions
Volker Lendecke [Wed, 10 Aug 2011 17:46:24 +0000 (19:46 +0200)]
Adapt tally_add to Samba coding conventions

12 years agoAdapt renormalize to Samba coding conventions
Volker Lendecke [Wed, 10 Aug 2011 17:46:00 +0000 (19:46 +0200)]
Adapt renormalize to Samba coding conventions

12 years agoAdapt shift_overflows to Samba coding conventions
Volker Lendecke [Wed, 10 Aug 2011 17:45:40 +0000 (19:45 +0200)]
Adapt shift_overflows to Samba coding conventions

12 years agoAdapt bucket_min to Samba coding conventions
Volker Lendecke [Wed, 10 Aug 2011 17:45:24 +0000 (19:45 +0200)]
Adapt bucket_min to Samba coding conventions

12 years agoAdapt bucket_of to Samba coding conventions
Volker Lendecke [Wed, 10 Aug 2011 17:45:14 +0000 (19:45 +0200)]
Adapt bucket_of to Samba coding conventions

12 years agoAdapt tally_new to Samba coding conventions
Volker Lendecke [Wed, 10 Aug 2011 17:44:45 +0000 (19:44 +0200)]
Adapt tally_new to Samba coding conventions

12 years agoSlightly simplify tally_new
Volker Lendecke [Wed, 10 Aug 2011 17:44:10 +0000 (19:44 +0200)]
Slightly simplify tally_new

12 years agoFix a c++ warning
Volker Lendecke [Wed, 10 Aug 2011 17:43:21 +0000 (19:43 +0200)]
Fix a c++ warning

12 years agoFix a c++ warning
Volker Lendecke [Wed, 10 Aug 2011 17:42:54 +0000 (19:42 +0200)]
Fix a c++ warning

12 years agos3: Adapt msg_idmap.c to Samba coding conventions
Volker Lendecke [Fri, 5 Aug 2011 16:22:20 +0000 (18:22 +0200)]
s3: Adapt msg_idmap.c to Samba coding conventions

12 years agos3: Fix some nonempty blank lines
Volker Lendecke [Fri, 5 Aug 2011 16:17:43 +0000 (18:17 +0200)]
s3: Fix some nonempty blank lines

12 years agos3: Fix some typos -- Simo, please check
Volker Lendecke [Wed, 10 Aug 2011 17:40:18 +0000 (19:40 +0200)]
s3: Fix some typos -- Simo, please check

12 years agoselftest: Always test the spoolss deamon.
Andreas Schneider [Wed, 10 Aug 2011 16:05:07 +0000 (18:05 +0200)]
selftest: Always test the spoolss deamon.

Autobuild-User: Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date: Wed Aug 10 19:29:14 CEST 2011 on sn-devel-104

12 years agos3-spoolss: Fix prototypes warnings.
Andreas Schneider [Wed, 10 Aug 2011 10:48:30 +0000 (12:48 +0200)]
s3-spoolss: Fix prototypes warnings.

Signed-off-by: Andreas Schneider <asn@samba.org>
12 years agos3-printing: Do not try to force reload.
Simo Sorce [Wed, 10 Aug 2011 13:27:24 +0000 (09:27 -0400)]
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>
12 years agos3-spoolss: do not call pcap_cache_reload() directly
Simo Sorce [Wed, 10 Aug 2011 13:20:24 +0000 (09:20 -0400)]
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>
12 years agos3-printing: Add child handler to bq process
Simo Sorce [Wed, 10 Aug 2011 12:59:44 +0000 (08:59 -0400)]
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>
12 years agos3-spoolss: Fix printers related messaging
Simo Sorce [Tue, 9 Aug 2011 20:46:21 +0000 (16:46 -0400)]
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>
12 years agos3-prefork: Fix use of child id.
Simo Sorce [Tue, 9 Aug 2011 20:44:52 +0000 (16:44 -0400)]
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>
12 years agos3-printing: make sure to block SIGHUP ...
Simo Sorce [Mon, 8 Aug 2011 14:08:46 +0000 (10:08 -0400)]
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>
12 years agos3-spoolss: Use a global variable for the pool
Simo Sorce [Mon, 8 Aug 2011 18:15:14 +0000 (14:15 -0400)]
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>
12 years agos3-printing: Allow bq process to have own logfile
Simo Sorce [Fri, 5 Aug 2011 19:14:26 +0000 (15:14 -0400)]
s3-printing: Allow bq process to have own logfile

Signed-off-by: Andreas Schneider <asn@samba.org>
12 years agos3-spoolssd: Use the child_id to open log files
Simo Sorce [Fri, 5 Aug 2011 14:08:23 +0000 (10:08 -0400)]
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>
12 years agos3-prefork: Pass the child a child_id
Simo Sorce [Fri, 5 Aug 2011 14:34:05 +0000 (10:34 -0400)]
s3-prefork: Pass the child a child_id

Signed-off-by: Andreas Schneider <asn@samba.org>
12 years agos3-printing: Force pcap reload when all ready
Simo Sorce [Thu, 4 Aug 2011 12:56:01 +0000 (08:56 -0400)]
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>
12 years agos3-prefork: Return tsocket_address for client and server
Simo Sorce [Tue, 19 Jul 2011 19:07:42 +0000 (15:07 -0400)]
s3-prefork: Return tsocket_address for client and server

Signed-off-by: Andreas Schneider <asn@samba.org>
12 years agos3-prefork: Pass messaging context around too
Simo Sorce [Mon, 18 Jul 2011 14:39:50 +0000 (10:39 -0400)]
s3-prefork: Pass messaging context around too

Pair-Programmed-With: Andreas Schneider <asn@samba.org>

Signed-off-by: Andreas Schneider <asn@samba.org>
12 years agos3-prefork: Set up a SIGCHLD handler by default
Simo Sorce [Fri, 20 May 2011 03:56:02 +0000 (23:56 -0400)]
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>
12 years agos3:spoolssd Start spoolssd from printing_subsystem_init
Simo Sorce [Wed, 18 May 2011 15:24:30 +0000 (11:24 -0400)]
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>
12 years agos3-printing: Rework how the background process is started
Simo Sorce [Wed, 3 Aug 2011 21:04:50 +0000 (17:04 -0400)]
s3-printing: Rework how the background process is started

Signed-off-by: Andreas Schneider <asn@samba.org>
12 years agos3-prefork: Provide a cleanup function
Simo Sorce [Mon, 16 May 2011 14:46:35 +0000 (10:46 -0400)]
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>
12 years agos3-prefork: Inline Doxygen Documentation
Simo Sorce [Mon, 16 May 2011 14:23:59 +0000 (10:23 -0400)]
s3-prefork: Inline Doxygen Documentation

Signed-off-by: Andreas Schneider <asn@samba.org>
12 years agos3-prefork: better timing out semantics
Simo Sorce [Tue, 10 May 2011 13:08:21 +0000 (09:08 -0400)]
s3-prefork: better timing out semantics

If this child has no clients, let the lock functions block for 1 second,
and then immediately reschedule the operation. This means we catch the lock
as soon as possible on a free child.

If, instead, we are already serving a client, we want to be non blocking,
so we timeout immediately on getting the lock, and then we sleep a 1/10th of
a second.
This means that a busy child will be slightly slower on picking up the lock,
but we won't block the existing client from communicating with us as we
immediately react to activity on the already opened file handler.

Signed-off-by: Andreas Schneider <asn@samba.org>
12 years agos3-prefork: add support for multiple listning file descriptors
Simo Sorce [Tue, 10 May 2011 12:39:14 +0000 (08:39 -0400)]
s3-prefork: add support for multiple listning file descriptors

Signed-off-by: Andreas Schneider <asn@samba.org>
12 years agos3-spoolssd: propagate SIGHUP to children
Simo Sorce [Mon, 9 May 2011 12:50:11 +0000 (08:50 -0400)]
s3-spoolssd: propagate SIGHUP to children

Signed-off-by: Andreas Schneider <asn@samba.org>
12 years agos3-prefork: provide way to send a signal to all children
Simo Sorce [Mon, 9 May 2011 12:49:50 +0000 (08:49 -0400)]
s3-prefork: provide way to send a signal to all children

Signed-off-by: Andreas Schneider <asn@samba.org>
12 years agos3-spoolssd: expand children pool when necessary
Simo Sorce [Mon, 9 May 2011 09:37:29 +0000 (05:37 -0400)]
s3-spoolssd: expand children pool when necessary

Signed-off-by: Andreas Schneider <asn@samba.org>
12 years agos3-prefork: provide means to expand the pool size
Simo Sorce [Mon, 9 May 2011 08:51:47 +0000 (04:51 -0400)]
s3-prefork: provide means to expand the pool size

Signed-off-by: Andreas Schneider <asn@samba.org>
12 years agos3-spoolssd: Use parametric option for prefork parameters
Simo Sorce [Mon, 9 May 2011 08:38:06 +0000 (04:38 -0400)]
s3-spoolssd: Use parametric option for prefork parameters

example:
spoolssd:prefork = 10:100: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>
12 years agos3-spoolss: make listening asynchronous
Simo Sorce [Thu, 5 May 2011 21:59:00 +0000 (17:59 -0400)]
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>
12 years agos3-spoolssd: Use the prefork framework in spoolssd
Simo Sorce [Thu, 21 Apr 2011 19:06:18 +0000 (15:06 -0400)]
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>
12 years agos3-rpc_server: add termination function
Simo Sorce [Mon, 25 Apr 2011 21:24:15 +0000 (17:24 -0400)]
s3-rpc_server: add termination function

This way we can act when a client disconnects.

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