s3:netapi: Remove use_ccache from 'struct libnetapi_ctx'
authorAndreas Schneider <asn@samba.org>
Thu, 18 Mar 2021 12:39:54 +0000 (13:39 +0100)
committerGünther Deschner <gd@samba.org>
Wed, 24 Mar 2021 00:55:32 +0000 (00:55 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
source3/lib/netapi/cm.c
source3/lib/netapi/netapi.c
source3/lib/netapi/netapi_private.h

index 58fc1fb57cd088ea5f430598768701e3631c7fec..29b35af7d3d8ae3d2e77d307550ce3cbf3156641 100644 (file)
@@ -25,6 +25,7 @@
 #include "libsmb/libsmb.h"
 #include "rpc_client/cli_pipe.h"
 #include "../libcli/smb/smbXcli_base.h"
+#include "auth/gensec/gensec.h"
 
 /********************************************************************
 ********************************************************************/
@@ -76,6 +77,7 @@ static WERROR libnetapi_open_ipc_connection(struct libnetapi_ctx *ctx,
        const char *password = NULL;
        NET_API_STATUS rc;
        enum credentials_use_kerberos krb5_state;
+       uint32_t gensec_features;
 
        if (!ctx || !pp || !server_name) {
                return WERR_INVALID_PARAMETER;
@@ -107,6 +109,7 @@ static WERROR libnetapi_open_ipc_connection(struct libnetapi_ctx *ctx,
        }
 
        krb5_state = cli_credentials_get_kerberos_state(ctx->creds);
+       gensec_features = cli_credentials_get_gensec_features(ctx->creds);
 
        set_cmdline_auth_info_signing_state_raw(auth_info, SMB_SIGNING_IPC_DEFAULT);
        set_cmdline_auth_info_use_kerberos(auth_info, krb5_state == CRED_USE_KERBEROS_REQUIRED);
@@ -123,7 +126,7 @@ static WERROR libnetapi_open_ipc_connection(struct libnetapi_ctx *ctx,
                set_cmdline_auth_info_fallback_after_kerberos(auth_info, true);
        }
 
-       if (ctx->use_ccache) {
+       if (gensec_features & GENSEC_FEATURE_NTLM_CCACHE) {
                set_cmdline_auth_info_use_ccache(auth_info, true);
        }
        creds = get_cmdline_auth_info_creds(auth_info);
index 14567d04536bf74482bdea1b73008e22ca43f793..dfb11fdc9513723f67bc136c507636737e54f2ae 100644 (file)
@@ -333,8 +333,6 @@ NET_API_STATUS libnetapi_set_use_ccache(struct libnetapi_ctx *ctx)
 {
        uint32_t gensec_features;
 
-       ctx->use_ccache = true;
-
        gensec_features = cli_credentials_get_gensec_features(ctx->creds);
        gensec_features |= GENSEC_FEATURE_NTLM_CCACHE;
        cli_credentials_set_gensec_features(ctx->creds, gensec_features);
index 3f725c29f89d02d50d5fbbafa7a978e052c04b15..0f8975140071bf462b2935304e39306075545c1a 100644 (file)
@@ -57,7 +57,6 @@ struct libnetapi_private_ctx {
 struct libnetapi_ctx {
        char *debuglevel;
        char *error_string;
-       int use_ccache;
        int disable_policy_handle_cache;
 
        struct cli_credentials *creds;