Blob Blame History Raw
From 161d5844eb1214e60c636bdb73713c6a43f1e75c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Cami?= <fcami@redhat.com>
Date: Mon, 19 Jul 2021 15:59:01 +0200
Subject: [PATCH] ipatests: smbclient "-k" => "--use-kerberos=desired"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Change documentation:
https://download.samba.org/pub/samba/rc/samba-4.15.0rc1.WHATSNEW.txt

As of Samba 4.15rc1, smbclient does not accept "-k" anymore.
The "-k|--kerberos" option ("Try to authenticate with kerberos.")
has been replaced with "--use-kerberos=required|desired|off".

Fixes: https://pagure.io/freeipa/issue/8926
Signed-off-by: François Cami <fcami@redhat.com>
Reviewed-By: Michal Polovka <mpolovka@redhat.com>
Reviewed-By: Michal Polovka <mpolovka@redhat.com>
---
 ipatests/test_integration/test_smb.py | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/ipatests/test_integration/test_smb.py b/ipatests/test_integration/test_smb.py
index 399ad6209..b2b7ce2e4 100644
--- a/ipatests/test_integration/test_smb.py
+++ b/ipatests/test_integration/test_smb.py
@@ -166,9 +166,28 @@ class TestSMB(IntegrationTest):
                 encoding='utf-8')
             assert file_contents_at_server == test_string
 
-            # check access using smbclient utility
+            # Detect whether smbclient uses -k or --use-kerberos=required
+            # https://pagure.io/freeipa/issue/8926
+            # then check access using smbclient.
             res = run_smb_client(
-                ['smbclient', '-k', share['unc'], '-c', 'dir'])
+                [
+                    "smbclient",
+                    "-h",
+                ], raiseonerr=False
+            )
+            if "[-k|--kerberos]" in res.stderr_text:
+                smbclient_krb5_knob = "-k"
+            else:
+                smbclient_krb5_knob = "--use-kerberos=desired"
+            res = run_smb_client(
+                [
+                    "smbclient",
+                    smbclient_krb5_knob,
+                    share["unc"],
+                    "-c",
+                    "dir",
+                ]
+            )
             assert test_dir in res.stdout_text
 
             # check file and dir removal from client side
-- 
2.31.1