summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2011-08-16 17:34:30 -0400
committerSimo Sorce <idra@samba.org>2011-08-21 09:05:06 -0400
commit98d2bf052e214580a3ca3146b10688c9e1c7bc78 (patch)
tree32ab055bd85096babe95eaa6ea978a8e40b69737 /source3
parent72746498a4b532e0a30a955dd1b3b854d2de0c59 (diff)
downloadsamba-98d2bf052e214580a3ca3146b10688c9e1c7bc78.tar.gz
samba-98d2bf052e214580a3ca3146b10688c9e1c7bc78.tar.bz2
samba-98d2bf052e214580a3ca3146b10688c9e1c7bc78.zip
s3-lsasd: Send a message to the parent when we accept a connection
Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Simo Sorce <idra@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_server/lsasd.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/source3/rpc_server/lsasd.c b/source3/rpc_server/lsasd.c
index c53eb5f379..c6c3dc21b0 100644
--- a/source3/rpc_server/lsasd.c
+++ b/source3/rpc_server/lsasd.c
@@ -40,6 +40,7 @@
#define DAEMON_NAME "lsasd"
#define LSASD_MAX_SOCKETS 64
+static struct server_id parent_id;
static struct prefork_pool *lsasd_pool = NULL;
static int lsasd_child_id = 0;
@@ -394,6 +395,7 @@ static void lsasd_handle_client(struct tevent_req *req)
{
struct lsasd_children_data *data;
struct lsasd_new_client *client;
+ const DATA_BLOB ping = data_blob_null;
int rc;
int sd;
TALLOC_CTX *tmp_ctx;
@@ -423,6 +425,10 @@ static void lsasd_handle_client(struct tevent_req *req)
goto done;
}
+ /* Warn parent that our status changed */
+ messaging_send(data->msg_ctx, parent_id,
+ MSG_PREFORK_CHILD_EVENT, &ping);
+
DEBUG(2, ("LSASD preforked child %d got client connection!\n",
(int)(data->pf->pid)));
@@ -481,6 +487,20 @@ done:
* MAIN
*/
+static void child_ping(struct messaging_context *msg_ctx,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id server_id,
+ DATA_BLOB *data)
+{
+ struct tevent_context *ev_ctx;
+
+ ev_ctx = talloc_get_type_abort(private_data, struct tevent_context);
+
+ DEBUG(10, ("Got message that a child changed status.\n"));
+ pfh_manage_pool(ev_ctx, msg_ctx, &pf_lsasd_cfg, lsasd_pool);
+}
+
static bool lsasd_schedule_check(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx,
struct timeval current_time);
@@ -767,6 +787,9 @@ void start_lsasd(struct tevent_context *ev_ctx,
/* child */
close_low_fds(false);
+ /* save the parent process id so the children can use it later */
+ parent_id = procid_self();
+
status = reinit_after_fork(msg_ctx,
ev_ctx,
procid_self(), true);
@@ -814,6 +837,8 @@ void start_lsasd(struct tevent_context *ev_ctx,
ev_ctx,
MSG_SMB_CONF_UPDATED,
lsasd_smb_conf_updated);
+ messaging_register(msg_ctx, ev_ctx,
+ MSG_PREFORK_CHILD_EVENT, child_ping);
status = rpc_lsarpc_init(NULL);
if (!NT_STATUS_IS_OK(status)) {