Line data Source code
1 : /* 2 : Unix SMB/CIFS implementation. 3 : Test the smb_any_connect functionality 4 : Copyright (C) Volker Lendecke 2010 5 : 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. 10 : 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. 15 : 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/>. 18 : */ 19 : 20 : #include "includes.h" 21 : #include "torture/proto.h" 22 : 23 0 : bool run_smb_any_connect(int dummy) 24 : { 25 0 : int fd; 26 0 : NTSTATUS status; 27 0 : struct sockaddr_storage addrs[5]; 28 0 : size_t chosen_index; 29 0 : uint16_t port; 30 : 31 0 : interpret_string_addr(&addrs[0], "192.168.99.5", 0); 32 0 : interpret_string_addr(&addrs[1], "192.168.99.6", 0); 33 0 : interpret_string_addr(&addrs[2], "192.168.99.7", 0); 34 0 : interpret_string_addr(&addrs[3], "192.168.99.8", 0); 35 0 : interpret_string_addr(&addrs[4], "192.168.99.9", 0); 36 : 37 0 : status = smbsock_any_connect(addrs, NULL, NULL, NULL, NULL, 38 : ARRAY_SIZE(addrs), 0, 0, 39 : &fd, &chosen_index, &port); 40 : 41 0 : d_printf("smbsock_any_connect returned %s (fd %d)\n", 42 0 : nt_errstr(status), NT_STATUS_IS_OK(status) ? fd : -1); 43 0 : if (NT_STATUS_IS_OK(status)) { 44 0 : close(fd); 45 : } 46 0 : return true; 47 : }