summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-08-16 08:30:36 +0200
committerVolker Lendecke <vl@samba.org>2010-08-18 11:18:22 +0200
commit7b6835ec1da127713d0a412edcbe0a3c1bcc6192 (patch)
tree1153196e99503cd924beb8f1faa355647684b678 /source3/smbd
parentac7b63384d3f8afdb768f95e7744380f4df07d76 (diff)
downloadsamba-7b6835ec1da127713d0a412edcbe0a3c1bcc6192.tar.gz
samba-7b6835ec1da127713d0a412edcbe0a3c1bcc6192.tar.bz2
samba-7b6835ec1da127713d0a412edcbe0a3c1bcc6192.zip
s3: Add smbd_server_connection->client_id
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/globals.h1
-rw-r--r--source3/smbd/server.c22
2 files changed, 22 insertions, 1 deletions
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index cf23509060..e4f4b79058 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -458,6 +458,7 @@ struct pending_auth_data;
struct smbd_server_connection {
int sock;
+ struct client_address client_id;
const struct tsocket_address *local_address;
const struct tsocket_address *remote_address;
struct messaging_context *msg_ctx;
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 8cb2f23e12..0f43022dd8 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -59,8 +59,28 @@ int smbd_server_fd(void)
static void smbd_set_server_fd(int fd)
{
- smbd_server_conn->sock = fd;
+ struct smbd_server_connection *sconn = smbd_server_conn;
+ const char *name;
+
server_fd = fd;
+
+ sconn->sock = fd;
+
+ /*
+ * Initialize sconn->client_id: If we can't find the client's
+ * name, default to its address.
+ */
+
+ client_addr(fd, sconn->client_id.addr, sizeof(sconn->client_id.addr));
+
+ name = client_name(sconn->sock);
+ if (strcmp(name, "UNKNOWN") != 0) {
+ name = talloc_strdup(sconn, name);
+ } else {
+ name = NULL;
+ }
+ sconn->client_id.name =
+ (name != NULL) ? name : sconn->client_id.addr;
}
struct event_context *smbd_event_context(void)