[SCM] Samba Shared Repository - branch master updated

Simo Sorce idra at samba.org
Sun Aug 21 08:40:02 MDT 2011


The branch, master has been updated
       via  d713f9e s3-passdb: Only delete 1 entry from memcache.
       via  99bb3ee s3-passdb: Remove always the user from getpwsid cache.
       via  1152aa8 s3-passdb: Keep caches coherent
       via  61ada70 s3-id_cache: Use better names for id cache management ops
       via  177db0a s3-id_cache: Move id caches mgmt out of smbd
       via  0f4ee5d s3-lsasd: Listen on \PIPE\lsass.
       via  8efdac8 s3-lsasd: Add missing ncalrpc listeners.
       via  b501f6f s3-rpc_server: Add create_dcerpc_ncalrpc_socket().
       via  8a1572f s3-rpc_server: Increase epm monitor wait time.
       via  51d4b3c s3-prefork: Listening fds must be in non-blocking mode
       via  a4188aa s3-spoolss: Remove useless check
       via  2c45954 s3-lsasd: Remove useless check
       via  7bb4b99 s3-prefork: Fix code to retire children
       via  feadd84 s3-spoolssd: Listen on parent messages
       via  cce8c72 s3-lsasd: Listen on parent messages
       via  91ba8ae s3-prefork: Add parent->client messaging
       via  98d2bf0 s3-lsasd: Send a message to the parent when we accept a connection
       via  7274649 s3-spoolssd: Send a message to the parent when we accept a connection
       via  5c1a8dc s3-messaging: Add preforked child-parent message types
       via  0f71639 s3-prefork: Improve error detection when handling new connections
       via  75f3da7 s3-prefork: Improve heuristics
       via  89dde6b s3-lsasd: User new prefork helpers to simplify code.
       via  f07f5c5 s3-spoolssd: User new prefork helpers to simplify code.
       via  308e4e0 s3-prefork: add a few more utility functions
       via  df6f320 s3-prefrok: Handle only valid children
       via  e3736f8 s3-prefork: Fix worker flags handling.
       via  ee0c69a s3-prefork: do not use a lock_fd, just race on accept()
       via  0723871 rpc_server: Add forward declaration for dcerpc_transport_t.
       via  5de61e6 s3-waf: Fix build with lsasd.
       via  c538b01 s3-lsasd: Use prefrok utils to manage children
       via  884969e s3-spoolssd: Use prefrok utils to manage children
       via  3451f42 s3-prefork: Add common utilities for daemons
       via  0647a93 s3-spoolss: Introduce helper function to manage pool.
       via  2a0aac0 s3-prefork: Allow better management of allowed_clients
       via  eb8a0c7 s3-winbind: We need to use internal rpc connections in winbind.
       via  bfd9624 s3-spoolssd: Fix spoolss logging.
       via  5b3eb83 s3-lsasd: Import fixes from spoolssd
       via  d5ba5de selftest: Enable testing of the lsa service daemon.
       via  d1bc22e s3-rpc_server: Use rpc_epmapper_mode() in ep_register()
       via  32a53be s3-rpc_server: Use rpc_service_mode() in np_open()
       via  ef24917 s3-rpc_server: Use rpc_service_mode() in rpc_pipe_open_interface()
       via  f9c7b59 selftest: Fix daemon testing to use the new syntax.
       via  23e7e1c s3-rpc_server: Replace RPC_SERVICE_MODE_DAEMON checks
       via  11cbe24 s3-rpc_server: Move config helpers in one place.
       via  5a4e0dd s3-rpc_server: Add helper to define/retrieve daemons configuration
       via  9738ee4 s3-rpc_server: Reduce code duplication
       via  7b715f1 s3-smbd: Start lsasd as deamon.
       via  7abdf6e s3-rpc_server: Correctly register lsa, samr and netlogon.
       via  0364bf0 s3-lsasd: Create a lsa service daemon.
       via  dea2161 s3-spoolssd: Check if we were able to create the prefork pool.
       via  5169dff s3-prefork: Fix cast warning.
       via  e4b566d s3-rpc_server: Make dcerpc_ncacn_accept() public.
       via  312c519 s3-rpc_server: Check explicit for external and daemon server type.
       via  ea3fa58 s3-rpc_server: Fix include order in srv_pipe_hnd.c.
      from  9fa8f27 talloc: Fix talloc-compat pc files/headers.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit d713f9e9f50dfe680f66798098ee5ede3ee80e06
Author: Andreas Schneider <asn at samba.org>
Date:   Sat Aug 20 16:19:43 2011 +0200

    s3-passdb: Only delete 1 entry from memcache.
    
    If we delete or update one user we shouldn't flush the complete
    memcache.
    
    Signed-off-by: Simo Sorce <idra at samba.org>
    
    Autobuild-User: Simo Sorce <idra at samba.org>
    Autobuild-Date: Sun Aug 21 16:39:10 CEST 2011 on sn-devel-104

commit 99bb3eed1dac5d2e81fd213beda414bd65076eea
Author: Andreas Schneider <asn at samba.org>
Date:   Sat Aug 20 14:48:38 2011 +0200

    s3-passdb: Remove always the user from getpwsid cache.
    
    We should do it always, not only in the pdb_default_delete_user()
    function.
    
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 1152aa8e0354ed2446397725b75e905bef3c4afb
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Aug 19 17:36:53 2011 +0200

    s3-passdb: Keep caches coherent
    
    When deleting a user send a message to all interested parties so they can
    purge their caches. Otherwise some processes may positively respond with a
    cached getpwnam, when the user have actully been removed.
    
    Without this some tests that remove and then immediately create users are
    flakey.
    
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 61ada700a6ad010846b132d866c66220e6379054
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Aug 19 18:10:29 2011 +0200

    s3-id_cache: Use better names for id cache management ops
    
    The IDMAP term is normally associated with Winbind's idmap stuff.
    These functions deal with id caching not id mapping.
    
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 177db0a8802842a0eb9801622bee9f4c1592ef88
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Aug 19 17:28:37 2011 +0200

    s3-id_cache: Move id caches mgmt out of smbd
    
    We must leave the MSG_IDMAP_KILL operation in SMBD as it uses smbd
    specific internal globals and makes sense only in the context of a smbd
    daemon.
    The rest is moved under lib/ as we need to deal with id cache cleanups
    in other daemons too (like lsasd).
    
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 0f4ee5d1b7bc1e8122982450dc0730ac1500a9c9
Author: Andreas Schneider <asn at samba.org>
Date:   Sun Aug 21 11:58:36 2011 +0200

    s3-lsasd: Listen on \PIPE\lsass.
    
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 8efdac83ff764de66f3fba63faf6c8fddc409c03
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Aug 18 19:05:27 2011 +0200

    s3-lsasd: Add missing ncalrpc listeners.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit b501f6f75823b98ac349affe8e6e1bd7ba76cd3e
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Aug 18 19:05:10 2011 +0200

    s3-rpc_server: Add create_dcerpc_ncalrpc_socket().
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 8a1572fe1bd1a7a3bb8985a12a738d49cb7d274b
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Aug 18 18:46:16 2011 +0200

    s3-rpc_server: Increase epm monitor wait time.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 51d4b3c55d6e14f9bf9de24367f9f76ba20fa393
Author: Simo Sorce <idra at samba.org>
Date:   Thu Aug 18 12:35:02 2011 -0400

    s3-prefork: Listening fds must be in non-blocking mode
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit a4188aaf7b415a2da7559e7b58a57f8af399d08e
Author: Simo Sorce <idra at samba.org>
Date:   Thu Aug 18 10:39:13 2011 -0400

    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 at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 2c459546221863c960ef49c0ab8f406bad792351
Author: Simo Sorce <idra at samba.org>
Date:   Thu Aug 18 10:35:19 2011 -0400

    s3-lsasd: 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 at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 7bb4b991a54c85e7ca9fcfd15f85a38940ce6dfe
Author: Simo Sorce <idra at samba.org>
Date:   Thu Aug 18 10:31:36 2011 -0400

    s3-prefork: Fix code to retire children
    
    We have to be more careful when retiring children. We cannot stop
    accepting connections as soon as the server tells us to quit because if
    max_children is reached and we still have clients connected, the server will
    not be able to spawn new children until one exits. And children will not exit
    until all the clients closed the connections. So we keep operating past our
    recall until we have 0 connections.
    Also do not try to recall children that still have >= 1 clients connected, they
    couldn't anyway.
    Also use messaging to warn children and not SIGHUP.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit feadd849ba6e36896cf38cada170ff53c4b03258
Author: Simo Sorce <idra at samba.org>
Date:   Wed Aug 17 16:17:10 2011 -0400

    s3-spoolssd: Listen on parent messages
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit cce8c72eb141c8f279003f526de3dc02abc98d43
Author: Simo Sorce <idra at samba.org>
Date:   Wed Aug 17 15:21:52 2011 -0400

    s3-lsasd: Listen on parent messages
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 91ba8aec13f42c83190c5cecf4ec7e0e80d91dcc
Author: Simo Sorce <idra at samba.org>
Date:   Wed Aug 17 15:21:12 2011 -0400

    s3-prefork: Add parent->client messaging
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 98d2bf052e214580a3ca3146b10688c9e1c7bc78
Author: Simo Sorce <idra at samba.org>
Date:   Tue Aug 16 17:34:30 2011 -0400

    s3-lsasd: Send a message to the parent when we accept a connection
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 72746498a4b532e0a30a955dd1b3b854d2de0c59
Author: Simo Sorce <idra at samba.org>
Date:   Tue Aug 16 16:36:43 2011 -0400

    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 at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 5c1a8dcf8e192caa9963e4e3001f6546bcfde538
Author: Simo Sorce <idra at samba.org>
Date:   Tue Aug 16 16:36:12 2011 -0400

    s3-messaging: Add preforked child-parent message types
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 0f71639d3348391b672c9da78f4341785bfd6754
Author: Simo Sorce <idra at samba.org>
Date:   Wed Aug 17 10:53:38 2011 -0400

    s3-prefork: Improve error detection when handling new connections
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 75f3da76e48df79c21e65354768d3f581053127e
Author: Simo Sorce <idra at samba.org>
Date:   Tue Aug 16 18:20:51 2011 -0400

    s3-prefork: Improve heuristics
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 89dde6b7fce3342c828f166e7d76bf4656939ee4
Author: Simo Sorce <idra at samba.org>
Date:   Tue Aug 16 12:01:02 2011 -0400

    s3-lsasd: User new prefork helpers to simplify code.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit f07f5c51000ed9403134e8f4eb3318ec6d572342
Author: Simo Sorce <idra at samba.org>
Date:   Tue Aug 16 11:38:03 2011 -0400

    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 at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 308e4e0126b7841e23a6135f884ba761eaacb58a
Author: Simo Sorce <idra at samba.org>
Date:   Tue Aug 16 11:09:20 2011 -0400

    s3-prefork: add a few more utility functions
    
    Add a few util functions children side so that daemons do not have
    to care about properly setting num_clients and state. Let a common
    helper do it so that they are all consistent.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit df6f320aa47026bbf589a3276a0708ea3f93504b
Author: Simo Sorce <idra at samba.org>
Date:   Tue Aug 16 11:07:27 2011 -0400

    s3-prefrok: Handle only valid children
    
    Children that are about to exit shouldn't be counted as a source of
    connections, and also makes no sense to chenge their allowances if they are
    about to exit.
    Also children with negative num_clients are faulty, exclude them as well.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit e3736f826b434bcdff5493fc533c11eba9bedc61
Author: Simo Sorce <idra at samba.org>
Date:   Tue Aug 16 11:37:41 2011 -0400

    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 at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit ee0c69a25e7a0dca0c54989b1d6887a114d93ed4
Author: Simo Sorce <idra at samba.org>
Date:   Tue Aug 16 09:30:28 2011 -0400

    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 at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 07238713722c7454b87ed9c99d65c37ad3bcee85
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Aug 16 09:52:42 2011 +0200

    rpc_server: Add forward declaration for dcerpc_transport_t.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 5de61e655c8c9c79b07fbe106314d2d80a90520e
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Aug 15 13:25:37 2011 +0200

    s3-waf: Fix build with lsasd.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit c538b012250e5c5db2738ec2dc46f30226cfc6ce
Author: Simo Sorce <idra at samba.org>
Date:   Fri Aug 12 17:21:50 2011 -0400

    s3-lsasd: Use prefrok utils to manage children
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 884969ed97b57ada07ec3f6f3818b6db4896fa20
Author: Simo Sorce <idra at samba.org>
Date:   Fri Aug 12 15:25:48 2011 -0400

    s3-spoolssd: Use prefrok utils to manage children
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 3451f423d6a70da054c06135bc36daf0677b53f9
Author: Simo Sorce <idra at samba.org>
Date:   Fri Aug 12 15:24:17 2011 -0400

    s3-prefork: Add common utilities for daemons
    
    Daemons using the prefork infrastructure may want to use these utils to
    configure and manage a pool of children.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 0647a93c64ce5d87527d6c9e34688f93e7cd03b3
Author: Simo Sorce <idra at samba.org>
Date:   Fri Aug 12 12:24:48 2011 -0400

    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 at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 2a0aac0adcdccc165f5d511d7a1c1d6d0c5d7c9b
Author: Simo Sorce <idra at samba.org>
Date:   Fri Aug 12 12:24:13 2011 -0400

    s3-prefork: Allow better management of allowed_clients
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit eb8a0c76725500d183c50eb795c683f23d4aede7
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Aug 12 11:19:09 2011 +0200

    s3-winbind: We need to use internal rpc connections in winbind.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit bfd96248185a7a7325a0f5991f2655759905c45e
Author: Simo Sorce <idra at samba.org>
Date:   Thu Aug 11 14:23:19 2011 -0400

    s3-spoolssd: Fix spoolss logging.
    
    Use the same code as in lsasd.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 5b3eb835f6facf40c2471c99c3b05995c43e7da1
Author: Simo Sorce <idra at samba.org>
Date:   Thu Aug 11 14:24:05 2011 -0400

    s3-lsasd: Import fixes from spoolssd
    
    Properly rotate log files in children by using a gloabl lsasd_child_id
    variable.
    Simplify code by using a global lsasd_pool variable, we can never use
    more than one prefork pool in the same process anyway.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit d5ba5dec26b48cb1accf88d21ff315ef20e1e4db
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Aug 11 09:51:16 2011 +0200

    selftest: Enable testing of the lsa service daemon.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit d1bc22eeb3acb35ef5c27d0916a45882fa5ab6e4
Author: Simo Sorce <idra at samba.org>
Date:   Wed Aug 10 16:17:44 2011 -0400

    s3-rpc_server: Use rpc_epmapper_mode() in ep_register()
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 32a53be1a4587a72ffe35d8cfd3a97c425a36470
Author: Simo Sorce <idra at samba.org>
Date:   Wed Aug 10 16:13:42 2011 -0400

    s3-rpc_server: Use rpc_service_mode() in np_open()
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit ef24917b5a40c9e70db98af7a306f8219433282d
Author: Simo Sorce <idra at samba.org>
Date:   Wed Aug 10 15:34:37 2011 -0400

    s3-rpc_server: Use rpc_service_mode() in rpc_pipe_open_interface()
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit f9c7b59d3e94f93649b903b5beefe268e277b545
Author: Simo Sorce <idra at samba.org>
Date:   Wed Aug 10 22:04:19 2011 -0400

    selftest: Fix daemon testing to use the new syntax.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 23e7e1c15862070b2296b9f24eb5b7e70f2058c4
Author: Simo Sorce <idra at samba.org>
Date:   Wed Aug 10 15:23:20 2011 -0400

    s3-rpc_server: Replace RPC_SERVICE_MODE_DAEMON checks
    
    Use rpc_daemon_type() macros where appropriate instead.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 11cbe24ac8415bdddef6d2c67cacc578cea850ad
Author: Simo Sorce <idra at samba.org>
Date:   Wed Aug 10 16:33:22 2011 -0400

    s3-rpc_server: Move config helpers in one place.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 5a4e0dd853d2e5fb12031a59665966d14d07bbfc
Author: Simo Sorce <idra at samba.org>
Date:   Wed Aug 10 15:02:24 2011 -0400

    s3-rpc_server: Add helper to define/retrieve daemons configuration
    
    Wtith this set of helper functions we make it easy to configure if we want to
    use an embedded rpc server, or if we want to fork one. Or even just disable it
    and let a third party server be used when the service is configured as
    "external".
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 9738ee40158e9e368f8fcf7db3294c408750dab0
Author: Simo Sorce <idra at samba.org>
Date:   Wed Aug 10 14:25:56 2011 -0400

    s3-rpc_server: Reduce code duplication
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 7b715f15b198def34278eec558ff9cf29bb28a6d
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Aug 2 10:59:05 2011 +0200

    s3-smbd: Start lsasd as deamon.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 7abdf6e57f5fc6d2c9ccd255991aea6fb093388b
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Jul 15 18:34:17 2011 +0200

    s3-rpc_server: Correctly register lsa, samr and netlogon.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 0364bf025c2083d2c54f859183c6f2c58a1db7e9
Author: Andreas Schneider <asn at samba.org>
Date:   Mon May 23 12:39:07 2011 +0200

    s3-lsasd: Create a lsa service daemon.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit dea21619a28ddd69ecf2d6427c9beefc2e2fefa3
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Jul 15 18:08:35 2011 +0200

    s3-spoolssd: Check if we were able to create the prefork pool.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 5169dff3807385f466ef6f2f4bd21a1dbbd8f95d
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Jul 20 14:24:15 2011 +0200

    s3-prefork: Fix cast warning.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit e4b566d6cf7affd2d9fc916e203ad4a249d3e077
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Jul 20 16:26:48 2011 +0200

    s3-rpc_server: Make dcerpc_ncacn_accept() public.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit 312c519c5c129350e6107657e51ae1efb1a655de
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Aug 3 12:14:16 2011 +0200

    s3-rpc_server: Check explicit for external and daemon server type.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

commit ea3fa586e7af13202cc5cc0737cb501c8fb81d79
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Aug 3 12:13:56 2011 +0200

    s3-rpc_server: Fix include order in srv_pipe_hnd.c.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Simo Sorce <idra at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 selftest/target/Samba3.pm              |   14 +-
 source3/Makefile.in                    |   10 +-
 source3/lib/id_cache.c                 |  205 +++++++
 source3/lib/id_cache.h                 |   32 +
 source3/lib/server_prefork.c           |  540 +++++-------------
 source3/lib/server_prefork.h           |   61 ++-
 source3/lib/server_prefork_util.c      |  169 ++++++
 source3/lib/server_prefork_util.h      |   52 ++
 source3/librpc/idl/messaging.idl       |    9 +-
 source3/librpc/rpc/dcerpc_ep.c         |   11 +-
 source3/passdb/lookup_sid.c            |   65 ---
 source3/passdb/lookup_sid.h            |    5 -
 source3/passdb/pdb_interface.c         |   40 ++-
 source3/printing/queue_process.c       |    5 +-
 source3/printing/spoolssd.c            |  292 ++++-------
 source3/rpc_server/lsasd.c             |  969 ++++++++++++++++++++++++++++++++
 source3/rpc_server/rpc_config.c        |  113 ++++
 source3/rpc_server/rpc_config.h        |   70 +++
 source3/rpc_server/rpc_ep_register.c   |    2 +-
 source3/rpc_server/rpc_ncacn_np.c      |   23 +-
 source3/rpc_server/rpc_ncacn_np.h      |    7 +
 source3/rpc_server/rpc_server.c        |   66 ++-
 source3/rpc_server/rpc_server.h        |   11 +
 source3/rpc_server/rpc_service_setup.c |   78 +--
 source3/rpc_server/rpc_service_setup.h |   21 -
 source3/rpc_server/srv_pipe_hnd.c      |   39 +-
 source3/rpc_server/wscript_build       |   11 +-
 source3/smbd/msg_idmap.c               |  110 +----
 source3/smbd/proto.h                   |    2 +-
 source3/smbd/server.c                  |   31 +-
 source3/utils/smbcontrol.c             |    6 +-
 source3/winbindd/winbindd_samr.c       |    4 +-
 source3/wscript_build                  |    4 +-
 33 files changed, 2127 insertions(+), 950 deletions(-)
 mode change 100644 => 100755 selftest/target/Samba3.pm
 create mode 100644 source3/lib/id_cache.c
 create mode 100644 source3/lib/id_cache.h
 create mode 100644 source3/lib/server_prefork_util.c
 create mode 100644 source3/lib/server_prefork_util.h
 create mode 100644 source3/rpc_server/lsasd.c
 create mode 100644 source3/rpc_server/rpc_config.c
 create mode 100644 source3/rpc_server/rpc_config.h
 mode change 100644 => 100755 source3/rpc_server/wscript_build


Changeset truncated at 500 lines:

diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
old mode 100644
new mode 100755
index b767e53..bc8105a
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -285,6 +285,8 @@ sub setup_plugin_s4_dc($$$$)
         auth methods = guest samba4
         domain logons = yes
         rpc_server:epmapper = external
+        rpc_daemon:epmd = disabled
+        rpc_daemon:lsasd = disabled
         rpc_server:tcpip = no
         rpc_server:lsass = external
         rpc_server:lsarpc = external
@@ -901,10 +903,18 @@ sub provision($$$$$$$)
 	lpq cache time = 0
 
 	ncalrpc dir = $prefix_abs/ncalrpc
-	rpc_server:epmapper = daemon
-	rpc_server:spoolss = daemon
+	rpc_server:epmapper = external
+	rpc_server:spoolss = external
+	rpc_server:lsass = external
+	rpc_server:lsarpc = external
+	rpc_server:samr = external
+	rpc_server:netlogon = external
 	rpc_server:tcpip = yes
 
+	rpc_daemon:epmd = fork
+	rpc_daemon:spoolssd = fork
+	rpc_daemon:lsasd = fork
+
         resolv:host file = $dns_host_file
 
         # The samba3.blackbox.smbclient_s3 test uses this to test that
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 41bd45d..39e62cc 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -431,6 +431,7 @@ CRYPTO_OBJ = ../lib/crypto/crc32.o ../lib/crypto/md5.o \
 LIB_OBJ = $(LIBSAMBAUTIL_OBJ) $(UTIL_OBJ) $(CRYPTO_OBJ) $(LIBTSOCKET_OBJ) \
 	  lib/messages.o librpc/gen_ndr/ndr_messaging.o lib/messages_local.o \
 	  lib/messages_ctdbd.o lib/ctdb_packet.o lib/ctdbd_conn.o \
+	  lib/id_cache.o \
 	  ../lib/socket/interfaces.o lib/memcache.o \
 	  lib/talloc_dict.o \
 	  lib/serverid.o \
@@ -466,6 +467,7 @@ LIB_OBJ = $(LIBSAMBAUTIL_OBJ) $(UTIL_OBJ) $(CRYPTO_OBJ) $(LIBTSOCKET_OBJ) \
 	  @CCAN_OBJ@ \
 	  lib/server_contexts.o \
 	  lib/server_prefork.o \
+	  lib/server_prefork_util.o \
 	  lib/ldap_escape.o @CHARSET_STATIC@ \
 	  ../libcli/security/secdesc.o ../libcli/security/access_check.o \
 	  ../libcli/security/secace.o ../libcli/security/object_tree.o \
@@ -738,6 +740,8 @@ RPC_NCACN_NP = rpc_server/srv_pipe_register.o rpc_server/rpc_ncacn_np.o \
 	       rpc_server/rpc_handles.o rpc_server/rpc_contexts.o \
 	       rpc_server/srv_access_check.o
 
+RPC_CONFIG = rpc_server/rpc_config.o
+
 RPC_SERVICE = rpc_server/rpc_server.o
 
 RPC_CRYPTO = rpc_server/dcesrv_ntlmssp.o \
@@ -745,7 +749,7 @@ RPC_CRYPTO = rpc_server/dcesrv_ntlmssp.o \
 		rpc_server/dcesrv_spnego.o
 
 RPC_PIPE_OBJ = rpc_server/srv_pipe.o rpc_server/srv_pipe_hnd.o \
-	       $(RPC_NCACN_NP) $(RPC_SERVICE) $(RPC_CRYPTO)
+	       $(RPC_CONFIG) $(RPC_NCACN_NP) $(RPC_SERVICE) $(RPC_CRYPTO)
 
 RPC_RPCECHO_OBJ = rpc_server/echo/srv_echo_nt.o librpc/gen_ndr/srv_echo.o
 
@@ -912,6 +916,7 @@ SMBD_OBJ_SRV = smbd/server_reload.o \
                smbd/posix_acls.o lib/sysacls.o \
 	       smbd/process.o smbd/service.o param/service.o smbd/error.o \
 	       rpc_server/epmd.o \
+	       rpc_server/lsasd.o \
 	       printing/printspoolss.o printing/spoolssd.o \
 	       lib/sysquotas.o lib/sysquotas_linux.o \
 	       lib/sysquotas_xfs.o lib/sysquotas_4A.o \
@@ -1464,7 +1469,8 @@ WINBINDD_OBJ = \
 		$(PROFILE_OBJ) $(SLCACHE_OBJ) $(SMBLDAP_OBJ) \
 		$(LIBADS_OBJ) $(KRBCLIENT_OBJ) $(POPT_LIB_OBJ) \
 		$(DCUTIL_OBJ) $(IDMAP_OBJ) $(NSS_INFO_OBJ) \
-		$(RPC_NCACN_NP) $(RPC_SAMR_OBJ) $(RPC_LSARPC_OBJ) \
+		$(RPC_CONFIG) $(RPC_NCACN_NP) \
+		$(RPC_SAMR_OBJ) $(RPC_LSARPC_OBJ) \
 		$(NPA_TSTREAM_OBJ) \
 		$(AFS_OBJ) $(AFS_SETTOKEN_OBJ) \
 		$(LIBADS_SERVER_OBJ) \
diff --git a/source3/lib/id_cache.c b/source3/lib/id_cache.c
new file mode 100644
index 0000000..71693c1
--- /dev/null
+++ b/source3/lib/id_cache.c
@@ -0,0 +1,205 @@
+/*
+ * Samba Unix/Linux SMB client library
+ *
+ * Copyright (C) Gregor Beck 2011
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * @brief  Notify smbd about idmap changes
+ * @file   msg_idmap.c
+ * @author Gregor Beck <gb at sernet.de>
+ * @date   Feb 2011
+ *
+ */
+
+#include "includes.h"
+#include "messages.h"
+#include "lib/id_cache.h"
+#include "include/memcache.h"
+#include "idmap_cache.h"
+#include "../librpc/gen_ndr/ndr_security.h"
+#include "../libcli/security/dom_sid.h"
+
+bool id_cache_ref_parse(const char* str, struct id_cache_ref* id)
+{
+	struct dom_sid sid;
+	unsigned long ul;
+	char c, trash;
+
+	if (sscanf(str, "%cID %lu%c", &c, &ul, &trash) == 2) {
+		switch(c) {
+		case 'G':
+			id->id.gid = ul;
+			id->type = GID;
+			return true;
+		case 'U':
+			id->id.uid = ul;
+			id->type = UID;
+			return true;
+		default:
+			break;
+		}
+	} else if (string_to_sid(&sid, str)) {
+		id->id.sid = sid;
+		id->type = SID;
+		return true;
+	} else if (strncmp(str, "USER ", 5) == 0) {
+		id->id.name = str + 5;
+		id->type = USERNAME;
+		return true;
+	}
+	return false;
+}
+
+static bool delete_uid_cache(uid_t puid)
+{
+	DATA_BLOB uid = data_blob_const(&puid, sizeof(puid));
+	DATA_BLOB sid;
+
+	if (!memcache_lookup(NULL, UID_SID_CACHE, uid, &sid)) {
+		DEBUG(3, ("UID %d is not memcached!\n", (int)puid));
+		return false;
+	}
+	DEBUG(3, ("Delete mapping UID %d <-> %s from memcache\n", (int)puid,
+		  sid_string_dbg((struct dom_sid*)sid.data)));
+	memcache_delete(NULL, SID_UID_CACHE, sid);
+	memcache_delete(NULL, UID_SID_CACHE, uid);
+	return true;
+}
+
+static bool delete_gid_cache(gid_t pgid)
+{
+	DATA_BLOB gid = data_blob_const(&pgid, sizeof(pgid));
+	DATA_BLOB sid;
+	if (!memcache_lookup(NULL, GID_SID_CACHE, gid, &sid)) {
+		DEBUG(3, ("GID %d is not memcached!\n", (int)pgid));
+		return false;
+	}
+	DEBUG(3, ("Delete mapping GID %d <-> %s from memcache\n", (int)pgid,
+		  sid_string_dbg((struct dom_sid*)sid.data)));
+	memcache_delete(NULL, SID_GID_CACHE, sid);
+	memcache_delete(NULL, GID_SID_CACHE, gid);
+	return true;
+}
+
+static bool delete_sid_cache(const struct dom_sid* psid)
+{
+	DATA_BLOB sid = data_blob_const(psid, ndr_size_dom_sid(psid, 0));
+	DATA_BLOB id;
+	if (memcache_lookup(NULL, SID_GID_CACHE, sid, &id)) {
+		DEBUG(3, ("Delete mapping %s <-> GID %d from memcache\n",
+			  sid_string_dbg(psid), *(int*)id.data));
+		memcache_delete(NULL, SID_GID_CACHE, sid);
+		memcache_delete(NULL, GID_SID_CACHE, id);
+	} else if (memcache_lookup(NULL, SID_UID_CACHE, sid, &id)) {
+		DEBUG(3, ("Delete mapping %s <-> UID %d from memcache\n",
+			  sid_string_dbg(psid), *(int*)id.data));
+		memcache_delete(NULL, SID_UID_CACHE, sid);
+		memcache_delete(NULL, UID_SID_CACHE, id);
+	} else {
+		DEBUG(3, ("SID %s is not memcached!\n", sid_string_dbg(psid)));
+		return false;
+	}
+	return true;
+}
+
+static bool delete_getpwnam_cache(const char *username)
+{
+	DATA_BLOB name = data_blob_string_const_null(username);
+	DEBUG(6, ("Delete passwd struct for %s from memcache\n",
+		  username));
+	memcache_delete(NULL, GETPWNAM_CACHE, name);
+	return true;
+}
+
+static void flush_gid_cache(void)
+{
+	DEBUG(3, ("Flush GID <-> SID memcache\n"));
+	memcache_flush(NULL, SID_GID_CACHE);
+	memcache_flush(NULL, GID_SID_CACHE);
+}
+
+static void flush_uid_cache(void)
+{
+	DEBUG(3, ("Flush UID <-> SID memcache\n"));
+	memcache_flush(NULL, SID_UID_CACHE);
+	memcache_flush(NULL, UID_SID_CACHE);
+}
+static void delete_from_cache(const struct id_cache_ref* id)
+{
+	switch(id->type) {
+	case UID:
+		delete_uid_cache(id->id.uid);
+		idmap_cache_del_uid(id->id.uid);
+		break;
+	case GID:
+		delete_gid_cache(id->id.gid);
+		idmap_cache_del_gid(id->id.gid);
+		break;
+	case SID:
+		delete_sid_cache(&id->id.sid);
+		idmap_cache_del_sid(&id->id.sid);
+		break;
+	case USERNAME:
+		delete_getpwnam_cache(id->id.name);
+	default:
+		break;
+	}
+}
+
+
+static void id_cache_flush(struct messaging_context *msg_ctx,
+			   void* private_data,
+			   uint32_t msg_type,
+			   struct server_id server_id,
+			   DATA_BLOB* data)
+{
+	const char *msg = data ? (const char *)data->data : NULL;
+
+	if ((msg == NULL) || (msg[0] == '\0')) {
+		flush_gid_cache();
+		flush_uid_cache();
+	} else if (strncmp(msg, "GID", 3)) {
+		flush_gid_cache();
+	} else if (strncmp(msg, "UID", 3)) {
+		flush_uid_cache();
+	} else {
+		DEBUG(0, ("Invalid argument: %s\n", msg));
+	}
+}
+
+static void id_cache_delete(struct messaging_context *msg_ctx,
+			    void *private_data,
+			    uint32_t msg_type,
+			    struct server_id server_id,
+			    DATA_BLOB* data)
+{
+	const char *msg = (data && data->data) ? (const char *)data->data : "<NULL>";
+	struct id_cache_ref id;
+
+	if (!id_cache_ref_parse(msg, &id)) {
+		DEBUG(0, ("Invalid ?ID: %s\n", msg));
+		return;
+	}
+
+	delete_from_cache(&id);
+}
+
+void id_cache_register_msgs(struct messaging_context *ctx)
+{
+	messaging_register(ctx, NULL, ID_CACHE_FLUSH,  id_cache_flush);
+	messaging_register(ctx, NULL, ID_CACHE_DELETE, id_cache_delete);
+}
diff --git a/source3/lib/id_cache.h b/source3/lib/id_cache.h
new file mode 100644
index 0000000..208ce60
--- /dev/null
+++ b/source3/lib/id_cache.h
@@ -0,0 +1,32 @@
+/*
+ * Samba Unix/Linux SMB client library
+ *
+ * Copyright (C) Gregor Beck 2011
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+struct id_cache_ref {
+	union {
+		uid_t uid;
+		gid_t gid;
+		struct dom_sid sid;
+		const char *name;
+	} id;
+	enum {UID, GID, SID, USERNAME} type;
+};
+
+bool id_cache_ref_parse(const char* str, struct id_cache_ref* id);
+
+void id_cache_register_msgs(struct messaging_context *ctx);
diff --git a/source3/lib/server_prefork.c b/source3/lib/server_prefork.c
index 5206c36..a241e24 100644
--- a/source3/lib/server_prefork.c
+++ b/source3/lib/server_prefork.c
@@ -19,6 +19,8 @@
 */
 
 #include "includes.h"
+#include "serverid.h"
+#include "messages.h"
 #include "system/time.h"
 #include "system/shmem.h"
 #include "system/filesys.h"
@@ -31,8 +33,6 @@ struct prefork_pool {
 	int listen_fd_size;
 	int *listen_fds;
 
-	int lock_fd;
-
 	prefork_main_fn_t *main_fn;
 	void *private_data;
 
@@ -83,17 +83,12 @@ bool prefork_create_pool(TALLOC_CTX *mem_ctx,
 	}
 	for (i = 0; i < listen_fd_size; i++) {
 		pfp->listen_fds[i] = listen_fds[i];
+		/* force sockets in non-blocking mode */
+		set_blocking(listen_fds[i], false);
 	}
 	pfp->main_fn = main_fn;
 	pfp->private_data = private_data;
 
-	pfp->lock_fd = create_unlink_tmp(NULL);
-	if (pfp->lock_fd == -1) {
-		DEBUG(1, ("Failed to create prefork lock fd!\n"));
-		talloc_free(pfp);
-		return false;
-	}
-
 	pfp->pool_size = max_children;
 	data_size = sizeof(struct pf_worker_data) * max_children;
 
@@ -118,12 +113,11 @@ bool prefork_create_pool(TALLOC_CTX *mem_ctx,
 
 		case 0: /* THE CHILD */
 
-			pfp->pool[i].status = PF_WORKER_IDLE;
+			pfp->pool[i].status = PF_WORKER_ALIVE;
 			ret = pfp->main_fn(ev_ctx, msg_ctx,
 					   &pfp->pool[i], i + 1,
 					   pfp->listen_fd_size,
 					   pfp->listen_fds,
-					   pfp->lock_fd,
 					   pfp->private_data);
 			exit(ret);
 
@@ -206,12 +200,11 @@ int prefork_add_children(struct tevent_context *ev_ctx,
 
 		case 0: /* THE CHILD */
 
-			pfp->pool[i].status = PF_WORKER_IDLE;
+			pfp->pool[i].status = PF_WORKER_ALIVE;
 			ret = pfp->main_fn(ev_ctx, msg_ctx,
 					   &pfp->pool[i], i + 1,
 					   pfp->listen_fd_size,
 					   pfp->listen_fds,
-					   pfp->lock_fd,
 					   pfp->private_data);
 
 			pfp->pool[i].status = PF_WORKER_EXITING;
@@ -237,8 +230,8 @@ struct prefork_oldest {
 /* sort in inverse order */
 static int prefork_sort_oldest(const void *ap, const void *bp)
 {
-	struct prefork_oldest *a = (struct prefork_oldest *)ap;
-	struct prefork_oldest *b = (struct prefork_oldest *)bp;
+	const struct prefork_oldest *a = (const struct prefork_oldest *)ap;
+	const struct prefork_oldest *b = (const struct prefork_oldest *)bp;
 
 	if (a->started == b->started) {
 		return 0;
@@ -249,9 +242,11 @@ static int prefork_sort_oldest(const void *ap, const void *bp)
 	return -1;
 }
 
-int prefork_retire_children(struct prefork_pool *pfp,
+int prefork_retire_children(struct messaging_context *msg_ctx,
+			    struct prefork_pool *pfp,
 			    int num_children, time_t age_limit)
 {
+	const DATA_BLOB ping = data_blob_null;
 	time_t now = time(NULL);
 	struct prefork_oldest *oldest;
 	int i, j;
@@ -263,7 +258,8 @@ int prefork_retire_children(struct prefork_pool *pfp,
 
 	for (i = 0; i < pfp->pool_size; i++) {
 		oldest[i].num = i;
-		if (pfp->pool[i].status == PF_WORKER_IDLE) {
+		if (pfp->pool[i].status == PF_WORKER_ALIVE ||
+		    pfp->pool[i].status == PF_WORKER_ACCEPTING) {
 			oldest[i].started = pfp->pool[i].started;
 		} else {
 			oldest[i].started = now;
@@ -275,12 +271,15 @@ int prefork_retire_children(struct prefork_pool *pfp,
 		prefork_sort_oldest);
 
 	for (i = 0, j = 0; i < pfp->pool_size && j < num_children; i++) {
-		if (pfp->pool[i].status == PF_WORKER_IDLE &&
-		    pfp->pool[i].started <= age_limit) {
+		if (((pfp->pool[i].status == PF_WORKER_ALIVE) &&
+		     (pfp->pool[i].num_clients < 1)) &&
+		    (pfp->pool[i].started <= age_limit)) {
 			/* tell the child it's time to give up */
 			DEBUG(5, ("Retiring pid %d!\n", pfp->pool[i].pid));
 			pfp->pool[i].cmds = PF_SRV_MSG_EXIT;
-			kill(pfp->pool[i].pid, SIGHUP);
+			messaging_send(msg_ctx,
+					pid_to_procid(pfp->pool[i].pid),
+					MSG_PREFORK_PARENT_EVENT, &ping);
 			j++;
 		}
 	}
@@ -288,7 +287,7 @@ int prefork_retire_children(struct prefork_pool *pfp,
 	return j;
 }
 
-int prefork_count_active_children(struct prefork_pool *pfp, int *total)
+int prefork_count_children(struct prefork_pool *pfp, int *active)
 {
 	int i, a, t;
 
@@ -301,15 +300,18 @@ int prefork_count_active_children(struct prefork_pool *pfp, int *total)
 
 		t++;
 
-		if (pfp->pool[i].num_clients == 0) {
+		if ((pfp->pool[i].status == PF_WORKER_EXITING) ||
+		    (pfp->pool[i].num_clients <= 0)) {
 			continue;
 		}
 
 		a++;
 	}
 
-	*total = t;
-	return a;
+	if (active) {
+		*active = a;
+	}
+	return t;
 }
 
 static void prefork_cleanup_loop(struct prefork_pool *pfp)
@@ -345,12 +347,39 @@ static void prefork_cleanup_loop(struct prefork_pool *pfp)
 
 }
 
+int prefork_count_allowed_connections(struct prefork_pool *pfp)


-- 
Samba Shared Repository


More information about the samba-cvs mailing list