]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:utils: s3:utils: Correctly wire winbind ccache support for smbget
authorAndreas Schneider <asn@samba.org>
Mon, 3 Apr 2023 06:14:30 +0000 (08:14 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 5 Apr 2023 01:06:29 +0000 (01:06 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/utils/smbget.c

index e8d6936a24c960a127985bae326d05f9f592bbee..20580fd3572e7ae02785b490d714a61197536851 100644 (file)
@@ -22,6 +22,7 @@
 #include "libsmbclient.h"
 #include "cmdline_contexts.h"
 #include "auth/credentials/credentials.h"
+#include "auth/gensec/gensec.h"
 
 static int columns = 0;
 
@@ -864,6 +865,8 @@ int main(int argc, char **argv)
        enum credentials_use_kerberos use_kerberos = CRED_USE_KERBEROS_DESIRED;
        smbc_smb_encrypt_level encrypt_level = SMBC_ENCRYPTLEVEL_DEFAULT;
        bool is_nt_hash = false;
+       uint32_t gensec_features;
+       bool use_wbccache = false;
        SMBCCTX *smb_ctx = NULL;
 
        smb_init_locale();
@@ -988,6 +991,11 @@ int main(int argc, char **argv)
        is_nt_hash = cli_credentials_is_password_nt_hash(creds);
        smbc_setOptionUseNTHash(smb_ctx, is_nt_hash);
 
+       /* Check if we should use the winbind ccache */
+       gensec_features = cli_credentials_get_gensec_features(creds);
+       use_wbccache = (gensec_features & GENSEC_FEATURE_NTLM_CCACHE);
+       smbc_setOptionUseCCache(smb_ctx, use_wbccache);
+
        columns = get_num_cols();
 
        total_start_time = time_mono(NULL);