7e1b55
From 161d5844eb1214e60c636bdb73713c6a43f1e75c Mon Sep 17 00:00:00 2001
7e1b55
From: =?UTF-8?q?Fran=C3=A7ois=20Cami?= <fcami@redhat.com>
7e1b55
Date: Mon, 19 Jul 2021 15:59:01 +0200
7e1b55
Subject: [PATCH] ipatests: smbclient "-k" => "--use-kerberos=desired"
7e1b55
MIME-Version: 1.0
7e1b55
Content-Type: text/plain; charset=UTF-8
7e1b55
Content-Transfer-Encoding: 8bit
7e1b55
7e1b55
Change documentation:
7e1b55
https://download.samba.org/pub/samba/rc/samba-4.15.0rc1.WHATSNEW.txt
7e1b55
7e1b55
As of Samba 4.15rc1, smbclient does not accept "-k" anymore.
7e1b55
The "-k|--kerberos" option ("Try to authenticate with kerberos.")
7e1b55
has been replaced with "--use-kerberos=required|desired|off".
7e1b55
7e1b55
Fixes: https://pagure.io/freeipa/issue/8926
7e1b55
Signed-off-by: François Cami <fcami@redhat.com>
7e1b55
Reviewed-By: Michal Polovka <mpolovka@redhat.com>
7e1b55
Reviewed-By: Michal Polovka <mpolovka@redhat.com>
7e1b55
---
7e1b55
 ipatests/test_integration/test_smb.py | 23 +++++++++++++++++++++--
7e1b55
 1 file changed, 21 insertions(+), 2 deletions(-)
7e1b55
7e1b55
diff --git a/ipatests/test_integration/test_smb.py b/ipatests/test_integration/test_smb.py
7e1b55
index 399ad6209..b2b7ce2e4 100644
7e1b55
--- a/ipatests/test_integration/test_smb.py
7e1b55
+++ b/ipatests/test_integration/test_smb.py
7e1b55
@@ -166,9 +166,28 @@ class TestSMB(IntegrationTest):
7e1b55
                 encoding='utf-8')
7e1b55
             assert file_contents_at_server == test_string
7e1b55
 
7e1b55
-            # check access using smbclient utility
7e1b55
+            # Detect whether smbclient uses -k or --use-kerberos=required
7e1b55
+            # https://pagure.io/freeipa/issue/8926
7e1b55
+            # then check access using smbclient.
7e1b55
             res = run_smb_client(
7e1b55
-                ['smbclient', '-k', share['unc'], '-c', 'dir'])
7e1b55
+                [
7e1b55
+                    "smbclient",
7e1b55
+                    "-h",
7e1b55
+                ], raiseonerr=False
7e1b55
+            )
7e1b55
+            if "[-k|--kerberos]" in res.stderr_text:
7e1b55
+                smbclient_krb5_knob = "-k"
7e1b55
+            else:
7e1b55
+                smbclient_krb5_knob = "--use-kerberos=desired"
7e1b55
+            res = run_smb_client(
7e1b55
+                [
7e1b55
+                    "smbclient",
7e1b55
+                    smbclient_krb5_knob,
7e1b55
+                    share["unc"],
7e1b55
+                    "-c",
7e1b55
+                    "dir",
7e1b55
+                ]
7e1b55
+            )
7e1b55
             assert test_dir in res.stdout_text
7e1b55
 
7e1b55
             # check file and dir removal from client side
7e1b55
-- 
7e1b55
2.31.1
7e1b55