summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2011-03-14 14:50:09 +0100
committerSimo Sorce <idra@samba.org>2011-03-23 17:19:22 +0100
commitd6a1469f4350fa24204e11bb9aee0e33f8d21c34 (patch)
tree20dec775d4230a2d87c42529e37257725237736e /source3/rpc_server
parentde775244a97b011fa34e52987a76ff81a5d36fb0 (diff)
downloadsamba-d6a1469f4350fa24204e11bb9aee0e33f8d21c34.tar.gz
s3-epmd: Cleanup endpoint mapper correctly.
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/epmd.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/source3/rpc_server/epmd.c b/source3/rpc_server/epmd.c
index 159c04c485c..0b5d671775b 100644
--- a/source3/rpc_server/epmd.c
+++ b/source3/rpc_server/epmd.c
@@ -25,6 +25,7 @@
#include "../librpc/gen_ndr/messaging.h"
#include "../librpc/gen_ndr/srv_epmapper.h"
#include "rpc_server/rpc_server.h"
+#include "rpc_server/epmapper/srv_epmapper.h"
#define DAEMON_NAME "epmd"
@@ -141,6 +142,8 @@ static void epmd_sig_term_handler(struct tevent_context *ev,
void *siginfo,
void *private_data)
{
+ rpc_epmapper_shutdown();
+
exit_server_cleanly("termination signal");
}
@@ -186,14 +189,25 @@ static void epmd_setup_sig_hup_handler(struct tevent_context *ev_ctx,
}
}
+static bool epmapper_shutdown_cb(void *ptr) {
+ srv_epmapper_cleanup();
+
+ return true;
+}
+
void start_epmd(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx)
{
+ struct rpc_srv_callbacks epmapper_cb;
NTSTATUS status;
pid_t pid;
bool ok;
int rc;
+ epmapper_cb.init = NULL;
+ epmapper_cb.shutdown = epmapper_shutdown_cb;
+ epmapper_cb.private_data = NULL;
+
DEBUG(1, ("Forking Endpoint Mapper Daemon\n"));
pid = sys_fork();
@@ -239,7 +253,7 @@ void start_epmd(struct tevent_context *ev_ctx,
MSG_SMB_CONF_UPDATED,
epmd_smb_conf_updated);
- status = rpc_epmapper_init(NULL);
+ status = rpc_epmapper_init(&epmapper_cb);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("Failed to register epmd rpc inteface! (%s)\n",
nt_errstr(status)));