WHATSNEW: Add release notes for Samba 4.0.11.
[Samba.git] / source3 / torture / test_smbsock_any_connect.c
bloba964e0fd831f5f3f95456fbb5340d575e92cc5f6
1 /*
2 Unix SMB/CIFS implementation.
3 Test the smb_any_connect functionality
4 Copyright (C) Volker Lendecke 2010
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "includes.h"
21 #include "torture/proto.h"
23 bool run_smb_any_connect(int dummy)
25 int fd;
26 NTSTATUS status;
27 struct sockaddr_storage addrs[5];
28 size_t chosen_index;
29 uint16_t port;
31 interpret_string_addr(&addrs[0], "192.168.99.5", 0);
32 interpret_string_addr(&addrs[1], "192.168.99.6", 0);
33 interpret_string_addr(&addrs[2], "192.168.99.7", 0);
34 interpret_string_addr(&addrs[3], "192.168.99.8", 0);
35 interpret_string_addr(&addrs[4], "192.168.99.9", 0);
37 status = smbsock_any_connect(addrs, NULL, NULL, NULL, NULL,
38 ARRAY_SIZE(addrs), 0, 0,
39 &fd, &chosen_index, &port);
41 d_printf("smbsock_any_connect returned %s (fd %d)\n",
42 nt_errstr(status), NT_STATUS_IS_OK(status) ? fd : -1);
43 if (NT_STATUS_IS_OK(status)) {
44 close(fd);
46 return true;