summaryrefslogtreecommitdiff
path: root/source4/smbd/service_stream.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-03-09 17:48:41 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:56:49 -0500
commit651ca6553edadb2b97339fd3c112fdb6ef6c08bc (patch)
tree240f124aa3dcf08304c7f4bed6c2e0bd22ed83ed /source4/smbd/service_stream.c
parent60823d1878563c398373ff2c761dd91a588af3b5 (diff)
downloadsamba-651ca6553edadb2b97339fd3c112fdb6ef6c08bc.tar.gz
samba-651ca6553edadb2b97339fd3c112fdb6ef6c08bc.tar.bz2
samba-651ca6553edadb2b97339fd3c112fdb6ef6c08bc.zip
r14079: I just found the setproctitle library from alt linux:-)
- add set_title hook to the process models - use setproctitle library in process_model standard if available - the the title for the task servers and on connections metze (This used to be commit 526f20bbecc9bbd607595637c15fc4001d3f0c70)
Diffstat (limited to 'source4/smbd/service_stream.c')
-rw-r--r--source4/smbd/service_stream.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/source4/smbd/service_stream.c b/source4/smbd/service_stream.c
index 13cb570e0c..59e87304d3 100644
--- a/source4/smbd/service_stream.c
+++ b/source4/smbd/service_stream.c
@@ -25,6 +25,7 @@
#include "process_model.h"
#include "lib/events/events.h"
#include "lib/socket/socket.h"
+#include "smbd/service.h"
#include "smbd/service_stream.h"
#include "lib/messaging/irpc.h"
@@ -143,6 +144,7 @@ static void stream_new_connection(struct event_context *ev,
{
struct stream_socket *stream_socket = talloc_get_type(private, struct stream_socket);
struct stream_connection *srv_conn;
+ struct socket_address *c, *s;
srv_conn = talloc_zero(ev, struct stream_connection);
if (!srv_conn) {
@@ -174,6 +176,21 @@ static void stream_new_connection(struct event_context *ev,
return;
}
+ c = socket_get_peer_addr(sock, ev);
+ s = socket_get_my_addr(sock, ev);
+ if (s && c) {
+ const char *title;
+ title = talloc_asprintf(s, "conn[%s] c[%s:%u] s[%s:%u] server_id[%d]",
+ stream_socket->ops->name,
+ c->addr, c->port, s->addr, s->port,
+ server_id);
+ if (title) {
+ stream_connection_set_title(srv_conn, title);
+ }
+ }
+ talloc_free(c);
+ talloc_free(s);
+
/* call the server specific accept code */
stream_socket->ops->accept_connection(srv_conn);
}
@@ -271,3 +288,11 @@ NTSTATUS stream_setup_socket(struct event_context *event_context,
return NT_STATUS_OK;
}
+
+/*
+ setup a connection title
+*/
+void stream_connection_set_title(struct stream_connection *conn, const char *title)
+{
+ conn->model_ops->set_title(conn->event.ctx, title);
+}