]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:libsmb: introduce smbsock_connect.h
authorStefan Metzmacher <metze@samba.org>
Wed, 9 Apr 2025 14:54:36 +0000 (16:54 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 18 Apr 2025 10:17:30 +0000 (10:17 +0000)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 files changed:
examples/fuse/smb2mount.c
examples/winexe/winexe.c
source3/client/client.c
source3/client/smbspool.c
source3/include/proto.h
source3/libsmb/cliconnect.c
source3/libsmb/libsmb_server.c
source3/libsmb/smbsock_connect.c
source3/libsmb/smbsock_connect.h [new file with mode: 0644]
source3/rpcclient/rpcclient.c
source3/torture/test_smbsock_any_connect.c
source3/utils/net_util.c
source3/winbindd/winbindd_cm.c

index 3cc45c813236652d7d85856133a5789a02d1e521..0c97f32846c0e26a19bb7061ba4219342b597a3c 100644 (file)
@@ -24,6 +24,7 @@
 #include "lib/param/param.h"
 #include "client.h"
 #include "libsmb/proto.h"
+#include "libsmb/smbsock_connect.h"
 #include "clifuse.h"
 
 static struct cli_state *connect_one(struct cli_credentials *creds,
index b09c57c1bf6edd8310d05f88a7b8fc282632b80a..a296572eaae42b5c4e32bfc3cb5525967c993af1 100644 (file)
@@ -32,6 +32,7 @@
 #include "librpc/gen_ndr/ndr_svcctl_c.h"
 #include "rpc_client/cli_pipe.h"
 #include "libcli/smb/smbXcli_base.h"
+#include "libsmb/smbsock_connect.h"
 #include "libcli/util/werror.h"
 #include "lib/async_req/async_sock.h"
 #include "lib/cmdline/cmdline.h"
index a1991c1cd8c9916185038812d80f68925bbb0aef..e448ded6b6e05cf02235363e380dc02f06105c50 100644 (file)
@@ -33,6 +33,7 @@
 #include "../libcli/security/security.h"
 #include "system/select.h"
 #include "libsmb/libsmb.h"
+#include "libsmb/smbsock_connect.h"
 #include "libsmb/clirap.h"
 #include "trans2.h"
 #include "libsmb/nmblib.h"
index f58217331ab0ba4294239c8865711feca619b168..56661b983368eeb9114e7398f49be567978784de 100644 (file)
@@ -27,6 +27,7 @@
 #include "system/passwd.h"
 #include "system/kerberos.h"
 #include "libsmb/libsmb.h"
+#include "libsmb/smbsock_connect.h"
 #include "lib/param/param.h"
 #include "lib/krb5_wrap/krb5_samba.h"
 
index 7cf2572e6eecee9288e597133ebefd82c7a874d5..e8dfb533b442157b482befd669e359ea8a852f9d 100644 (file)
@@ -649,53 +649,6 @@ NTSTATUS sessionid_traverse_read(int (*fn)(const char *key,
 struct AvahiPoll *tevent_avahi_poll(TALLOC_CTX *mem_ctx,
                                    struct tevent_context *ev);
 
-/* The following definitions come from libsmb/smbsock_connect.c */
-
-struct smb_transports smbsock_transports_from_port(uint16_t port);
-
-struct tevent_req *smbsock_connect_send(TALLOC_CTX *mem_ctx,
-                                       struct tevent_context *ev,
-                                       const struct sockaddr_storage *addr,
-                                       const struct smb_transports *transports,
-                                       const char *called_name,
-                                       int called_type,
-                                       const char *calling_name,
-                                       int calling_type)
-       NONNULL(2) NONNULL(3) NONNULL(4);
-
-NTSTATUS smbsock_connect_recv(struct tevent_req *req, int *sock,
-                             uint16_t *ret_port);
-NTSTATUS smbsock_connect(const struct sockaddr_storage *addr,
-                        const struct smb_transports *transports,
-                        const char *called_name, int called_type,
-                        const char *calling_name, int calling_type,
-                        int *pfd, uint16_t *ret_port, int sec_timeout)
-       NONNULL(1) NONNULL(2) NONNULL(7);
-
-struct tevent_req *smbsock_any_connect_send(TALLOC_CTX *mem_ctx,
-                                           struct tevent_context *ev,
-                                           const struct sockaddr_storage *addrs,
-                                           const char **called_names,
-                                           int *called_types,
-                                           const char **calling_names,
-                                           int *calling_types,
-                                           size_t num_addrs,
-                                           const struct smb_transports *transports)
-       NONNULL(2) NONNULL(3) NONNULL(9);
-NTSTATUS smbsock_any_connect_recv(struct tevent_req *req, int *pfd,
-                                 size_t *chosen_index, uint16_t *chosen_port);
-NTSTATUS smbsock_any_connect(const struct sockaddr_storage *addrs,
-                            const char **called_names,
-                            int *called_types,
-                            const char **calling_names,
-                            int *calling_types,
-                            size_t num_addrs,
-                            const struct smb_transports *transports,
-                            int sec_timeout,
-                            int *pfd, size_t *chosen_index,
-                            uint16_t *chosen_port)
-       NONNULL(1) NONNULL(7) NONNULL(9);
-
 /* The following definitions come from lib/util_wellknown.c  */
 
 bool sid_check_is_wellknown_domain(const struct dom_sid *sid, const char **name);
index a688982b7d961d5751a36f89a7209e3bac634f67..09b2240bde8265d5c3e833e84ed254e7601e082b 100644 (file)
@@ -31,6 +31,7 @@
 #include "../lib/util/tevent_ntstatus.h"
 #include "async_smb.h"
 #include "libsmb/nmblib.h"
+#include "libsmb/smbsock_connect.h"
 #include "librpc/ndr/libndr.h"
 #include "../libcli/smb/smbXcli_base.h"
 #include "../libcli/smb/smb_seal.h"
index 8044539d2137afbf90674a43dac948ed4b2c1d38..9a115caaf37a0a8265ec2bcd9648acede75b943a 100644 (file)
@@ -33,6 +33,7 @@
 #include "libcli/security/security.h"
 #include "libsmb/nmblib.h"
 #include "../libcli/smb/smbXcli_base.h"
+#include "libsmb/smbsock_connect.h"
 
 /*
  * Check a server for being alive and well.
index 0691a677cddf628a47364cd9f0e476f888f4cf92..91f7db1743a381162aaf616c6160369b397a9556 100644 (file)
@@ -25,6 +25,7 @@
 #include "async_smb.h"
 #include "../libcli/smb/read_smb.h"
 #include "libsmb/nmblib.h"
+#include "libsmb/smbsock_connect.h"
 
 struct cli_session_request_state {
        struct tevent_context *ev;
diff --git a/source3/libsmb/smbsock_connect.h b/source3/libsmb/smbsock_connect.h
new file mode 100644 (file)
index 0000000..1a0fbce
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Unix SMB/CIFS implementation.
+ *
+ * Copyright (C) Stefan Metzmacher 2025
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _LIBSMB_SMBSOCK_CONNECT_H_
+#define _LIBSMB_SMBSOCK_CONNECT_H_
+
+/* The following definitions come from libsmb/smbsock_connect.c */
+
+struct smb_transports smbsock_transports_from_port(uint16_t port);
+
+struct tevent_req *smbsock_connect_send(TALLOC_CTX *mem_ctx,
+                                       struct tevent_context *ev,
+                                       const struct sockaddr_storage *addr,
+                                       const struct smb_transports *transports,
+                                       const char *called_name,
+                                       int called_type,
+                                       const char *calling_name,
+                                       int calling_type)
+       NONNULL(2) NONNULL(3) NONNULL(4);
+NTSTATUS smbsock_connect_recv(struct tevent_req *req, int *sock,
+                             uint16_t *ret_port);
+NTSTATUS smbsock_connect(const struct sockaddr_storage *addr,
+                        const struct smb_transports *transports,
+                        const char *called_name, int called_type,
+                        const char *calling_name, int calling_type,
+                        int *pfd, uint16_t *ret_port, int sec_timeout)
+       NONNULL(1) NONNULL(2) NONNULL(7);
+
+struct tevent_req *smbsock_any_connect_send(TALLOC_CTX *mem_ctx,
+                                           struct tevent_context *ev,
+                                           const struct sockaddr_storage *addrs,
+                                           const char **called_names,
+                                           int *called_types,
+                                           const char **calling_names,
+                                           int *calling_types,
+                                           size_t num_addrs,
+                                           const struct smb_transports *transports)
+       NONNULL(2) NONNULL(3) NONNULL(9);
+NTSTATUS smbsock_any_connect_recv(struct tevent_req *req, int *pfd,
+                                 size_t *chosen_index, uint16_t *chosen_port);
+NTSTATUS smbsock_any_connect(const struct sockaddr_storage *addrs,
+                            const char **called_names,
+                            int *called_types,
+                            const char **calling_names,
+                            int *calling_types,
+                            size_t num_addrs,
+                            const struct smb_transports *transports,
+                            int sec_timeout,
+                            int *pfd, size_t *chosen_index,
+                            uint16_t *chosen_port)
+       NONNULL(1) NONNULL(7) NONNULL(9);
+
+#endif /* _LIBSMB_SMBSOCK_CONNECT_H_ */
index f558cc21d39e15fd27100a627b3fdfaa1eab865b..37b78b8ffef3165c6efeb9f4bf62baa6caf65597 100644 (file)
@@ -31,6 +31,7 @@
 #include "../libcli/security/security.h"
 #include "passdb.h"
 #include "libsmb/libsmb.h"
+#include "libsmb/smbsock_connect.h"
 #include "auth/gensec/gensec.h"
 #include "../libcli/smb/smbXcli_base.h"
 #include "messages.h"
index 8fbf0ac6f8af49326e58878967307814f350ec7c..98a0618b952ea5058296a7cc5466ae949f855d56 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 #include "includes.h"
+#include "libsmb/smbsock_connect.h"
 #include "torture/proto.h"
 
 bool run_smb_any_connect(int dummy)
index d637dd02777f696fd7e1635298c2d68d20ecbe30..f4f60ab71d4a5083930f638c3d07852e519c7a1c 100644 (file)
@@ -29,6 +29,7 @@
 #include "secrets.h"
 #include "../libcli/security/security.h"
 #include "libsmb/libsmb.h"
+#include "libsmb/smbsock_connect.h"
 #include "lib/param/param.h"
 #include "auth/gensec/gensec.h"
 #include "libcli/auth/netlogon_creds_cli.h"
index d0fa451e83a8884b6829b90c8157ab3245c11889..9452a8db7e08330366c11a31697d083619c0e166 100644 (file)
@@ -88,6 +88,7 @@
 #include "lib/util/string_wrappers.h"
 #include "lib/global_contexts.h"
 #include "librpc/gen_ndr/ndr_winbind_c.h"
+#include "libsmb/smbsock_connect.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_WINBIND