s3/smbd: make smbd_add_connection() working with socket fd
authorRalph Boehme <slow@samba.org>
Mon, 3 Oct 2016 08:27:27 +0000 (01:27 -0700)
committerStefan Metzmacher <metze@samba.org>
Fri, 1 Jun 2018 12:35:16 +0000 (14:35 +0200)
source3/smbd/process.c

index 936b5351de7cf6b917677c8d618cca9085355841..e1c23577128c17075618a07edd570d7443092321 100644 (file)
@@ -3722,6 +3722,7 @@ NTSTATUS smbd_add_connection(struct smbXsrv_client *client, int sock_fd,
        set_socket_options(sock_fd, "SO_KEEPALIVE");
        set_socket_options(sock_fd, lp_socket_options());
 
+       if (0){
        sa_socklen = sizeof(ss_clnt);
        ret = getpeername(sock_fd, sa_clnt, &sa_socklen);
        if (ret != 0) {
@@ -3776,6 +3777,8 @@ NTSTATUS smbd_add_connection(struct smbXsrv_client *client, int sock_fd,
        } else {
                remaddr = "0.0.0.0";
        }
+       }
+       remaddr = "0.0.0.0";
 
        /*
         * Before the first packet, check the global hosts allow/ hosts deny
@@ -3783,7 +3786,7 @@ NTSTATUS smbd_add_connection(struct smbXsrv_client *client, int sock_fd,
         * client. This prevents attacks on our parsing code from hosts not in
         * the hosts allow list.
         */
-
+       if (0){
        ret = get_remote_hostname(remote_address,
                                  &p, talloc_tos());
        if (ret < 0) {
@@ -3797,10 +3800,13 @@ NTSTATUS smbd_add_connection(struct smbXsrv_client *client, int sock_fd,
        if (strequal(rhost, "UNKNOWN")) {
                rhost = remaddr;
        }
-
+       }
+       tsocket_address_inet_from_strings(xconn, "ip", "127.0.0.1", 5445, &local_address);
+       tsocket_address_inet_from_strings(xconn, "ip", "127.0.0.1", 5445, &remote_address);
        xconn->local_address = local_address;
        xconn->remote_address = remote_address;
-       xconn->remote_hostname = talloc_strdup(xconn, rhost);
+//     xconn->remote_hostname = talloc_strdup(xconn, rhost);
+       xconn->remote_hostname = talloc_strdup(xconn, "");
        if (xconn->remote_hostname == NULL) {
                return NT_STATUS_NO_MEMORY;
        }