#include "includes.h"
#include "lib/events/events.h"
#include "lib/tdb/include/tdb.h"
-#include "dlinklist.h"
#include "smb_server/smb_server.h"
-#include "system/filesys.h"
+#include "lib/socket/socket.h"
-/* For sepecifiying event context to GSSAPI below */
+/* For specifiying event context to GSSAPI below */
+#include "system/kerberos.h"
#include "heimdal/lib/gssapi/gssapi_locl.h"
+#include "passdb/secrets.h"
+
+#ifdef HAVE_SETPROCTITLE
+#include <setproctitle.h>
+#define SETPROCTITLE(x) setproctitle x
+#else
+#define SETPROCTITLE(x)
+#endif
+
/*
called when the process model is selected
*/
struct socket_context *sock2;
pid_t pid;
struct event_context *ev2;
+ struct socket_address *c, *s;
/* accept an incoming connection. */
status = socket_accept(sock, &sock2);
return;
}
+ pid = getpid();
+
/* This is now the child code. We need a completely new event_context to work with */
ev2 = event_context_init(NULL);
/* Ensure that the forked children do not expose identical random streams */
set_need_random_reseed();
+ /* setup the process title */
+ c = socket_get_peer_addr(sock2, ev2);
+ s = socket_get_my_addr(sock2, ev2);
+ if (s && c) {
+ SETPROCTITLE(("conn c[%s:%u] s[%s:%u] server_id[%d]",
+ c->addr, c->port, s->addr, s->port, pid));
+ }
+ talloc_free(c);
+ talloc_free(s);
+
/* setup this new connection */
- new_conn(ev2, sock2, getpid(), private);
+ new_conn(ev2, sock2, pid, private);
/* we can't return to the top level here, as that event context is gone,
so we now process events in the new event context until there are no
return;
}
+ pid = getpid();
+
/* This is now the child code. We need a completely new event_context to work with */
ev2 = event_context_init(NULL);
/* Ensure that the forked children do not expose identical random streams */
set_need_random_reseed();
+ SETPROCTITLE(("task server_id[%d]", pid));
+
/* setup this new connection */
- new_task(ev2, getpid(), private);
+ new_task(ev2, pid, private);
/* we can't return to the top level here, as that event context is gone,
so we now process events in the new event context until there are no
exit(0);
}
+/* called to set a title of a task or connection */
+static void standard_set_title(struct event_context *ev, const char *title)
+{
+ if (title) {
+ SETPROCTITLE(("%s", title));
+ } else {
+ SETPROCTITLE((NULL));
+ }
+}
static const struct model_ops standard_ops = {
.name = "standard",
.accept_connection = standard_accept_connection,
.new_task = standard_new_task,
.terminate = standard_terminate,
+ .set_title = standard_set_title,
};
/*