cifs-utils/0004-cifs-utils-work-around-missing-krb5_free_string-in-H.patch
volcanodragon e43741c045 sync some patches
(cherry picked from commit 25c5d27a3a8da1eaa972656018ac908f0adc4f69)
2023-06-09 10:59:45 +08:00

56 lines
1.7 KiB
Diff

From 5e5aa507f4c4954ed537a7dfc75cf69915727757 Mon Sep 17 00:00:00 2001
From: atheik <atteh.mailbox@gmail.com>
Date: Sat, 5 Mar 2022 00:24:49 +0200
Subject: [PATCH] cifs-utils: work around missing krb5_free_string in Heimdal
The krb5_free_string function is not present in Heimdal and instead
krb5_xfree should be used for freeing the string allocation done by
krb5_cc_get_full_name. Heimdal documentation does specify that
krb5_xfree should be used here and krb5_unparse_name is freed with
just free.
Signed-off-by: atheik <atteh.mailbox@gmail.com>
---
cifs.upcall.c | 8 ++++++++
configure.ac | 5 +++++
2 files changed, 13 insertions(+)
diff --git a/cifs.upcall.c b/cifs.upcall.c
index 7a8c374..bf4eb5d 100644
--- a/cifs.upcall.c
+++ b/cifs.upcall.c
@@ -190,6 +190,14 @@ static void krb5_free_unparsed_name(krb5_context context, char *val)
}
#endif
+#if !defined(HAVE_KRB5_FREE_STRING) /* Heimdal */
+static void krb5_free_string(krb5_context context, char *val)
+{
+ (void)context;
+ krb5_xfree(val);
+}
+#endif
+
#if !defined(HAVE_KRB5_AUTH_CON_GETSENDSUBKEY) /* Heimdal */
static krb5_error_code
krb5_auth_con_getsendsubkey(krb5_context context,
diff --git a/configure.ac b/configure.ac
index 19fb3d0..2b1aae6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -256,6 +256,11 @@ if test $enable_cifsupcall != "no"; then
AC_CHECK_FUNCS([krb5_auth_con_setaddrs krb5_auth_con_set_req_cksumtype])
fi
+# determine how to free a string allocated by a krb5 function
+if test $enable_cifsupcall != "no"; then
+ AC_CHECK_FUNCS([krb5_free_string])
+fi
+
if test $enable_systemd != "no"; then
AC_DEFINE(ENABLE_SYSTEMD, 1, [Enable systemd specific behavior for mount.cifs])
fi
--
2.33.0