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,
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)));
-}
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;
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;
}
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;
}
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);
/* 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 */