diff options
author | Volker Lendecke <vl@samba.org> | 2010-08-16 08:30:36 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2010-08-18 11:18:22 +0200 |
commit | 7b6835ec1da127713d0a412edcbe0a3c1bcc6192 (patch) | |
tree | 1153196e99503cd924beb8f1faa355647684b678 | |
parent | ac7b63384d3f8afdb768f95e7744380f4df07d76 (diff) | |
download | samba-7b6835ec1da127713d0a412edcbe0a3c1bcc6192.tar.gz samba-7b6835ec1da127713d0a412edcbe0a3c1bcc6192.tar.bz2 samba-7b6835ec1da127713d0a412edcbe0a3c1bcc6192.zip |
s3: Add smbd_server_connection->client_id
-rw-r--r-- | source3/include/smb.h | 5 | ||||
-rw-r--r-- | source3/smbd/globals.h | 1 | ||||
-rw-r--r-- | source3/smbd/server.c | 22 |
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) |