summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/proto.h1
-rw-r--r--source3/smbd/globals.c29
-rw-r--r--source3/smbd/server.c13
3 files changed, 6 insertions, 37 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 9e6cfc1c08..91905d3cbc 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1819,7 +1819,6 @@ void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
NTSTATUS can_delete_directory(struct connection_struct *conn,
const char *dirname);
bool change_to_root_user(void);
-void smbd_set_server_fd(int fd);
void contend_level2_oplocks_begin(files_struct *fsp,
enum level2_contention_type type);
void contend_level2_oplocks_end(files_struct *fsp,
diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c
index 2736fa69d0..fe743a6965 100644
--- a/source3/smbd/globals.c
+++ b/source3/smbd/globals.c
@@ -176,32 +176,3 @@ 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 03d971b9b4..3f656ac541 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -371,6 +371,7 @@ static void smbd_accept_connection(struct tevent_context *ev,
uint16_t flags,
void *private_data)
{
+ struct smbd_server_connection *sconn = smbd_server_conn;
struct smbd_open_socket *s = talloc_get_type_abort(private_data,
struct smbd_open_socket);
struct sockaddr_storage addr;
@@ -380,8 +381,7 @@ static void smbd_accept_connection(struct tevent_context *ev,
uint64_t unique_id;
fd = accept(s->fd, (struct sockaddr *)(void *)&addr,&in_addrlen);
- smbd_set_server_fd(fd);
-
+ sconn->sock = fd;
if (fd == -1 && errno == EINTR)
return;
@@ -392,14 +392,14 @@ static void smbd_accept_connection(struct tevent_context *ev,
}
if (s->parent->interactive) {
- smbd_process(smbd_server_conn);
+ smbd_process(sconn);
exit_server_cleanly("end of interactive mode");
return;
}
if (!allowable_number_of_smbd_processes()) {
close(fd);
- smbd_set_server_fd(-1);
+ sconn->sock = -1;
return;
}
@@ -489,8 +489,7 @@ static void smbd_accept_connection(struct tevent_context *ev,
getpeername failure if we reopen the logs
and use %I in the filename.
*/
-
- smbd_set_server_fd(-1);
+ sconn->sock = -1;
if (pid != 0) {
add_child_pid(pid);
@@ -1252,7 +1251,7 @@ extern void build_options(bool screen);
/* Started from inetd. fd 0 is the socket. */
/* We will abort gracefully when the client or remote system
goes away */
- smbd_set_server_fd(dup(0));
+ smbd_server_conn->sock = dup(0);
/* close our standard file descriptors */
close_low_fds(False); /* Don't close stderr */