diff options
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/globals.c | 29 | ||||
-rw-r--r-- | source3/smbd/server.c | 29 |
2 files changed, 29 insertions, 29 deletions
diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c index 8e6f46fe5c..6f7f200b01 100644 --- a/source3/smbd/globals.c +++ b/source3/smbd/globals.c @@ -160,3 +160,32 @@ void smbd_init_globals(void) smbd_server_conn->smb1.echo_handler.trusted_fd = -1; smbd_server_conn->smb1.echo_handler.socket_lock_fd = -1; } + +void smbd_set_server_fd(int fd) +{ + struct smbd_server_connection *sconn = smbd_server_conn; + char addr[INET6_ADDRSTRLEN]; + const char *name; + + 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; + + sub_set_socket_ids(sconn->client_id.addr, sconn->client_id.name, + client_socket_addr(sconn->sock, addr, + sizeof(addr))); +} diff --git a/source3/smbd/server.c b/source3/smbd/server.c index a4857756a1..29acf8d221 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -51,35 +51,6 @@ extern void start_spoolssd(struct event_context *ev_ctx, extern int dcelogin_atmost_once; #endif /* WITH_DFS */ -static void smbd_set_server_fd(int fd) -{ - struct smbd_server_connection *sconn = smbd_server_conn; - char addr[INET6_ADDRSTRLEN]; - const char *name; - - 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; - - sub_set_socket_ids(sconn->client_id.addr, sconn->client_id.name, - client_socket_addr(sconn->sock, addr, - sizeof(addr))); -} - struct event_context *smbd_event_context(void) { return server_event_context(); |