open_socket_out is always used with SOCK_STREAM, remove argument "type"
authorVolker Lendecke <vl@samba.org>
Sat, 3 Jan 2009 17:16:08 +0000 (18:16 +0100)
committerVolker Lendecke <vl@samba.org>
Sat, 3 Jan 2009 18:22:06 +0000 (19:22 +0100)
source3/include/proto.h
source3/lib/util_sock.c
source3/libads/krb5_setpw.c
source3/libsmb/cliconnect.c
source3/modules/vfs_smb_traffic_analyzer.c
source3/rpc_client/cli_pipe.c
source3/utils/smbfilter.c

index be34bb0e6599cbf80c69d33b490898a4460f55cb..42d1f52fe1b355554fef01a87e27dcc9f511368c 100644 (file)
@@ -1457,8 +1457,7 @@ int open_socket_in(int type,
                int dlevel,
                const struct sockaddr_storage *psock,
                bool rebind);
-int open_socket_out(int type,
-               const struct sockaddr_storage *pss,
+int open_socket_out(const struct sockaddr_storage *pss,
                uint16_t port,
                int timeout);
 bool open_any_socket_out(struct sockaddr_storage *addrs, int num_addrs,
index d23758ad6a22bb46b7bb55ff4e0137941155e3e3..a8c3b3031d79ed8051cc83435fbd4506dacc66da 100644 (file)
@@ -952,10 +952,8 @@ int open_socket_in(int type,
  Create an outgoing socket. timeout is in milliseconds.
 **************************************************************************/
 
-int open_socket_out(int type,
-               const struct sockaddr_storage *pss,
-               uint16_t port,
-               int timeout)
+int open_socket_out(const struct sockaddr_storage *pss,        uint16_t port,
+                   int timeout)
 {
        char addr[INET6_ADDRSTRLEN];
        struct sockaddr_storage sock_out = *pss;
@@ -964,16 +962,12 @@ int open_socket_out(int type,
        int increment = 10;
 
        /* create a socket to write to */
-       res = socket(pss->ss_family, type, 0);
+       res = socket(pss->ss_family, SOCK_STREAM, 0);
        if (res == -1) {
                 DEBUG(0,("socket error (%s)\n", strerror(errno)));
                return -1;
        }
 
-       if (type != SOCK_STREAM) {
-               return res;
-       }
-
 #if defined(HAVE_IPV6)
        if (pss->ss_family == AF_INET6) {
                struct sockaddr_in6 *psa6 = (struct sockaddr_in6 *)&sock_out;
index 5032ffd14cc3fe1d8b879b90e9248f2a564fdf34..e164a55b389b2c6c8e99acf1d8cb23ee8d922a0c 100644 (file)
@@ -428,7 +428,7 @@ static ADS_STATUS do_krb5_kpasswd_request(krb5_context context,
 
                } else {
 
-                       sock = open_socket_out(SOCK_STREAM, &addr, DEFAULT_KPASSWD_PORT, 
+                       sock = open_socket_out(&addr, DEFAULT_KPASSWD_PORT,
                                               LONG_CONNECT_TIMEOUT);
                }
 
index 5892bdc85928834ce9613c702259c6f374ea3bc0..44899e3b1a37776cf67605e03d6f58721dd44f95 100644 (file)
@@ -1499,10 +1499,8 @@ bool cli_session_request(struct cli_state *cli,
                putip((char *)&dest_ip,cli->inbuf+4);
                in_addr_to_sockaddr_storage(&cli->dest_ss, dest_ip);
 
-               cli->fd = open_socket_out(SOCK_STREAM,
-                               &cli->dest_ss,
-                               port,
-                               LONG_CONNECT_TIMEOUT);
+               cli->fd = open_socket_out(&cli->dest_ss, port,
+                                         LONG_CONNECT_TIMEOUT);
                if (cli->fd == -1)
                        return False;
 
@@ -1589,11 +1587,11 @@ NTSTATUS cli_connect(struct cli_state *cli,
                } else {
                        /* try 445 first, then 139 */
                        uint16_t port = cli->port?cli->port:445;
-                       cli->fd = open_socket_out(SOCK_STREAM, &cli->dest_ss,
-                                                 port, cli->timeout);
+                       cli->fd = open_socket_out(&cli->dest_ss, port,
+                                                 cli->timeout);
                        if (cli->fd == -1 && cli->port == 0) {
                                port = 139;
-                               cli->fd = open_socket_out(SOCK_STREAM, &cli->dest_ss,
+                               cli->fd = open_socket_out(&cli->dest_ss,
                                                          port, cli->timeout);
                        }
                        if (cli->fd != -1) {
index 63cc904bed1779cd57ef0b8bdae8a81584820ceb..fe292e5ce8fd8c55fb6a08481d93c97ed8f83623 100644 (file)
@@ -86,7 +86,7 @@ static int smb_traffic_analyzer_connect_inet_socket(vfs_handle_struct *handle,
                ZERO_STRUCT(ss);
                memcpy(&ss, res->ai_addr, res->ai_addrlen);
 
-               sockfd = open_socket_out(SOCK_STREAM, &ss, port, 10000);
+               sockfd = open_socket_out(&ss, port, 10000);
                if (sockfd != -1) {
                        break;
                }
index a2d334230dd34df8c86e4c69f93114c167a31554..45eab503fe749a1a11b5ae32c0d419c79d424018 100644 (file)
@@ -2618,7 +2618,7 @@ static NTSTATUS rpc_pipe_open_tcp_port(TALLOC_CTX *mem_ctx, const char *host,
                goto fail;
        }
 
-       result->trans.sock.fd = open_socket_out(SOCK_STREAM, &addr, port, 60);
+       result->trans.sock.fd = open_socket_out(&addr, port, 60);
        if (result->trans.sock.fd == -1) {
                status = map_nt_error_from_unix(errno);
                goto fail;
index 1e22a402013491fa7e3851173b1059b93b1b1490..e7b71bd5db280540052412e7a0eefb39df15e897 100644 (file)
@@ -144,7 +144,7 @@ static void filter_child(int c, struct sockaddr_storage *dest_ss)
        int s;
 
        /* we have a connection from a new client, now connect to the server */
-       s = open_socket_out(SOCK_STREAM, dest_ss, 445, LONG_CONNECT_TIMEOUT);
+       s = open_socket_out(dest_ss, 445, LONG_CONNECT_TIMEOUT);
 
        if (s == -1) {
                char addr[INET6_ADDRSTRLEN];