]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:libsmb: Introduce CLI_FULL_CONNECTION_IPC
authorAndreas Schneider <asn@samba.org>
Thu, 28 May 2020 15:22:12 +0000 (17:22 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 19 Aug 2020 16:22:41 +0000 (16:22 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
examples/winexe/winexe.c
source3/include/client.h
source3/libnet/libnet_join.c
source3/libsmb/cliconnect.c
source3/rpc_server/spoolss/srv_spoolss_nt.c
source3/rpcclient/cmd_spoolss.c
source3/rpcclient/rpcclient.c
source3/utils/mdfind.c
source3/utils/net_ads.c
source3/utils/net_util.c
source3/utils/netlookup.c

index fc6b15f8e52f1f2ca095cbcebacf7de243b85c01..bb9c27e2e6dcb266c2411bd40c0f80a4cbf3e8de 100644 (file)
@@ -1919,7 +1919,7 @@ int main(int argc, const char *argv[])
                "IPC$",
                "?????",
                options.credentials,
-               0,
+               CLI_FULL_CONNECTION_IPC,
                0);
 
        if (!NT_STATUS_IS_OK(status)) {
index 6a3b1b02ff37ee1d6ec1b907e04d20e545942a40..19a738900b760652436e08869046edc68d970332 100644 (file)
@@ -121,5 +121,6 @@ struct file_info {
 #define CLI_FULL_CONNECTION_FORCE_ASCII 0x0100
 #define CLI_FULL_CONNECTION_FORCE_SMB1 0x0400
 #define CLI_FULL_CONNECTION_DISABLE_SMB1 0x0800
+#define CLI_FULL_CONNECTION_IPC          0x1000
 
 #endif /* _CLIENT_H */
index 349386036065a05a200908082419362c650394cb..392e3eff74f295de9791202b7db51d5eb5dd7e39 100644 (file)
@@ -1068,7 +1068,7 @@ static NTSTATUS libnet_join_connect_dc_ipc(const char *dc,
        bool use_ccache = false;
        bool pw_nt_hash = false;
        struct cli_credentials *creds = NULL;
-       int flags = 0;
+       int flags = CLI_FULL_CONNECTION_IPC;
        NTSTATUS status;
 
        if (use_kerberos && pass) {
@@ -1684,7 +1684,7 @@ NTSTATUS libnet_join_ok(struct messaging_context *msg_ctx,
        struct netlogon_creds_CredentialState *creds = NULL;
        uint32_t netlogon_flags = 0;
        NTSTATUS status;
-       int flags = 0;
+       int flags = CLI_FULL_CONNECTION_IPC;
 
        if (!dc_name) {
                TALLOC_FREE(frame);
@@ -1734,7 +1734,7 @@ NTSTATUS libnet_join_ok(struct messaging_context *msg_ctx,
                                                   NULL, 0,
                                                   "IPC$", "IPC",
                                                   anon_creds,
-                                                  0,
+                                                  flags,
                                                   SMB_SIGNING_OFF);
        }
 
index 1fb1f0127b966d07c02e3c5b4bfe65679c699755..f20146378e30bd6dffd4a13eafdfdf280bb4ad5e 100644 (file)
@@ -2788,7 +2788,7 @@ static struct tevent_req *cli_start_connection_send(
        }
        state->ev = ev;
 
-       if (signing_state == SMB_SIGNING_IPC_DEFAULT) {
+       if (flags & CLI_FULL_CONNECTION_IPC) {
                state->min_protocol = lp_client_ipc_min_protocol();
                state->max_protocol = lp_client_ipc_max_protocol();
        } else {
@@ -3673,6 +3673,7 @@ struct cli_state *get_ipc_connect(char *server,
        uint32_t flags = CLI_FULL_CONNECTION_ANONYMOUS_FALLBACK;
 
        flags |= CLI_FULL_CONNECTION_FORCE_SMB1;
+       flags |= CLI_FULL_CONNECTION_IPC;
 
        nt_status = cli_full_connection_creds(&cli, NULL, server, server_ss, 0, "IPC$", "IPC",
                                        get_cmdline_auth_info_creds(user_info),
index 8b6a803a910b0bb1284493cbaece75ede6fe1d48..16e3ee485f0d19431ee5728a46a30e81afe05cf1 100644 (file)
@@ -2481,7 +2481,9 @@ static bool spoolss_connect_to_client(struct rpc_pipe_client **pp_pipe, struct c
        /* setup the connection */
        ret = cli_full_connection_creds( pp_cli, lp_netbios_name(), remote_machine,
                &rm_addr, 0, "IPC$", "IPC",
-               anon_creds, 0, SMB_SIGNING_OFF);
+               anon_creds,
+               CLI_FULL_CONNECTION_IPC,
+               SMB_SIGNING_OFF);
        TALLOC_FREE(anon_creds);
        if ( !NT_STATUS_IS_OK( ret ) ) {
                DEBUG(2,("spoolss_connect_to_client: connection to [%s] failed!\n",
index 88122eb296dfd6b42ca90ccdedeaf42fd888d05f..3de126f54cddd590dcd33fd2835dbeba20d29127 100644 (file)
@@ -3538,7 +3538,7 @@ static WERROR cmd_spoolss_printercmp(struct rpc_pipe_client *cli,
                                "IPC$", "IPC",
                                get_cmdline_auth_info_creds(
                                        popt_get_cmdline_auth_info()),
-                               0, /* flags */
+                               CLI_FULL_CONNECTION_IPC,
                                get_cmdline_auth_info_signing_state(
                                        popt_get_cmdline_auth_info()));
 
index 67a1066fc15e9068acf2a181b9fa2772ebbab28a..c86474d08f1801ee1d4d1d4c7c43279db554ba74 100644 (file)
@@ -1019,7 +1019,7 @@ out_free:
        static int              opt_port = 0;
        int result = 0;
        TALLOC_CTX *frame = talloc_stackframe();
-       uint32_t flags = 0;
+       uint32_t flags = CLI_FULL_CONNECTION_IPC;
        struct dcerpc_binding *binding = NULL;
        enum dcerpc_transport_t transport;
        uint32_t bflags = 0;
index 2f952c29b4f5e2523220e35f60767969dee80ae3..a3c879e75fb263686d7ed1c45dad3cf604405850 100644 (file)
@@ -70,7 +70,7 @@ int main(int argc, char **argv)
        const char *mds_query = NULL;
        struct cli_state *cli = NULL;
        char *basepath = NULL;
-       uint32_t flags = 0;
+       uint32_t flags = CLI_FULL_CONNECTION_IPC;
        int signing_state = SMB_SIGNING_IPC_DEFAULT;
        uint64_t *cnids = NULL;
        size_t ncnids;
index 8dd0baed4ceff95f583dd66ecabd252f2185a359..ce4810e3e649672da21746003b40f5cee3ea7922 100644 (file)
@@ -2519,7 +2519,8 @@ static int net_ads_printer_publish(struct net_context *c, int argc, const char *
        nt_status = cli_full_connection_creds(&cli, lp_netbios_name(), servername,
                                        &server_ss, 0,
                                        "IPC$", "IPC",
-                                       creds, 0,
+                                       creds,
+                                       CLI_FULL_CONNECTION_IPC,
                                        SMB_SIGNING_IPC_DEFAULT);
 
        if (NT_STATUS_IS_ERR(nt_status)) {
index c566ecc90005b8fd51a56810d4230b78bf3f7e35..d01b2d8c7717e77be3949ecd9187866bbb21926b 100644 (file)
@@ -110,6 +110,7 @@ NTSTATUS connect_to_service(struct net_context *c,
        NTSTATUS nt_status;
        enum smb_signing_setting signing_setting = SMB_SIGNING_DEFAULT;
        struct cli_credentials *creds = NULL;
+       int flags = 0;
 
        creds = net_context_creds(c, c);
        if (creds == NULL) {
@@ -119,12 +120,14 @@ NTSTATUS connect_to_service(struct net_context *c,
 
        if (strequal(service_type, "IPC")) {
                signing_setting = SMB_SIGNING_IPC_DEFAULT;
+               flags |= CLI_FULL_CONNECTION_IPC;
        }
 
        nt_status = cli_full_connection_creds(cli_ctx, NULL, server_name,
                                        server_ss, c->opt_port,
                                        service_name, service_type,
-                                       creds, 0,
+                                       creds,
+                                       flags,
                                        signing_setting);
        if (!NT_STATUS_IS_OK(nt_status)) {
                d_fprintf(stderr, _("Could not connect to server %s\n"),
@@ -195,7 +198,9 @@ NTSTATUS connect_to_ipc_anonymous(struct net_context *c,
        nt_status = cli_full_connection_creds(cli_ctx, c->opt_requester_name,
                                        server_name, server_ss, c->opt_port,
                                        "IPC$", "IPC",
-                                       anon_creds, 0, SMB_SIGNING_OFF);
+                                       anon_creds,
+                                       CLI_FULL_CONNECTION_IPC,
+                                       SMB_SIGNING_OFF);
 
        if (NT_STATUS_IS_OK(nt_status)) {
                return nt_status;
index 6cea2ee306c73014ab10f19bbb2a770a78a2860a..2241beb331f138fcbf7406e923dc616627f56df0 100644 (file)
@@ -98,7 +98,9 @@ static struct con_struct *create_cs(struct net_context *c,
        nt_status = cli_full_connection_creds(&cs->cli, lp_netbios_name(), lp_netbios_name(),
                                        &loopback_ss, 0,
                                        "IPC$", "IPC",
-                                       anon_creds, 0, SMB_SIGNING_OFF);
+                                       anon_creds,
+                                       CLI_FULL_CONNECTION_IPC,
+                                       SMB_SIGNING_OFF);
 
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(2,("create_cs: Connect failed. Error was %s\n", nt_errstr(nt_status)));