summaryrefslogtreecommitdiff
path: root/source3
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
parentac7b63384d3f8afdb768f95e7744380f4df07d76 (diff)
downloadsamba-7b6835ec1da127713d0a412edcbe0a3c1bcc6192.tar.gz
samba-7b6835ec1da127713d0a412edcbe0a3c1bcc6192.tar.bz2
samba-7b6835ec1da127713d0a412edcbe0a3c1bcc6192.zip
s3: Add smbd_server_connection->client_id
Diffstat (limited to 'source3')
-rw-r--r--source3/include/smb.h5
-rw-r--r--source3/smbd/globals.h1
-rw-r--r--source3/smbd/server.c22
3 files changed, 27 insertions, 1 deletions
diff --git a/source3/include/smb.h b/source3/include/smb.h
index de104a51eb..31ef910a70 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -407,6 +407,11 @@ typedef struct files_struct {
#include "ntquotas.h"
#include "sysquotas.h"
+struct client_address {
+ char addr[INET6_ADDRSTRLEN];
+ const char *name;
+};
+
struct vuid_cache_entry {
struct auth_serversupplied_info *server_info;
uint16_t vuid;
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)