diff options
author | Ilya Basin | 2021-12-06 20:54:33 +0300 |
---|---|---|
committer | Ilya Basin | 2021-12-06 20:54:33 +0300 |
commit | 0e518548497f5e61c438d68d0c48b15adf4b2bc1 (patch) | |
tree | c7b4efc9e48b8f5a6818bdb0fb75f00e429d24f3 /19-paths-relocation.patch | |
download | aur-0e518548497f5e61c438d68d0c48b15adf4b2bc1.tar.gz |
root
Diffstat (limited to '19-paths-relocation.patch')
-rw-r--r-- | 19-paths-relocation.patch | 147 |
1 files changed, 147 insertions, 0 deletions
diff --git a/19-paths-relocation.patch b/19-paths-relocation.patch new file mode 100644 index 000000000000..207e2880b6e1 --- /dev/null +++ b/19-paths-relocation.patch @@ -0,0 +1,147 @@ +diff -Naur cyrus-sasl-2.1.26-orig/m4/varexpand.m4 cyrus-sasl-2.1.26/m4/varexpand.m4 +--- cyrus-sasl-2.1.26-orig/m4/varexpand.m4 1970-01-01 03:00:00.000000000 +0300 ++++ cyrus-sasl-2.1.26/m4/varexpand.m4 2014-12-16 00:22:11.487600000 +0300 +@@ -0,0 +1,8 @@ ++AC_DEFUN([FULL_EXPAND_VARIABLE], [ ++ $1=$2 ++ $1=`( ++ test "x$prefix" = xNONE && prefix="$ac_default_prefix" ++ test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" ++ eval echo \""[$]$1"\" ++ )` ++]) +diff -Naur cyrus-sasl-2.1.26-orig/configure.ac cyrus-sasl-2.1.26/configure.ac +--- cyrus-sasl-2.1.26-orig/configure.ac 2014-12-15 23:10:23.125400000 +0300 ++++ cyrus-sasl-2.1.26/configure.ac 2014-12-16 00:23:05.167200000 +0300 +@@ -1102,6 +1102,8 @@ + configdir=$withval, + configdir='${plugindir}:${sysconfdir}/sasl2') + AC_SUBST(configdir) ++FULL_EXPAND_VARIABLE(sasl_bindir, "$bindir") ++AC_DEFINE_UNQUOTED(BINDIR, "$sasl_bindir", [Runtime executables location]) + + dnl look for rc4 libraries. we accept the CMU one or one from openSSL + AC_ARG_WITH(rc4, [ --with-rc4 use internal rc4 routines [[yes]] ], +diff -Naur cyrus-sasl-2.1.26-orig/include/sasl.h cyrus-sasl-2.1.26/include/sasl.h +--- cyrus-sasl-2.1.26-orig/include/sasl.h 2014-12-15 23:10:22.454600000 +0300 ++++ cyrus-sasl-2.1.26/include/sasl.h 2014-12-15 23:43:10.374600000 +0300 +@@ -669,6 +669,8 @@ + #define SASL_PATH_TYPE_PLUGIN 0 + #define SASL_PATH_TYPE_CONFIG 1 + ++LIBSASL_API char * sasl_path_relocation(const char *from, const char *to); ++LIBSASL_API char * sasl_pathlist_relocation(const char *from_path, const char *to_path_list); + /* a simpler way to set plugin path or configuration file path + * without the need to set sasl_getpath_t callback. + * +diff -Naur cyrus-sasl-2.1.26-orig/lib/common.c cyrus-sasl-2.1.26/lib/common.c +--- cyrus-sasl-2.1.26-orig/lib/common.c 2014-12-15 23:10:22.953800000 +0300 ++++ cyrus-sasl-2.1.26/lib/common.c 2014-12-15 23:46:29.514400000 +0300 +@@ -59,6 +59,7 @@ + #include <saslutil.h> + #include <saslplug.h> + #include "saslint.h" ++#include "pathtools.h" + + #ifdef HAVE_UNISTD_H + #include <unistd.h> +@@ -64,6 +64,45 @@ + #include <unistd.h> + #endif + ++char * ++sasl_path_relocation(const char *from, const char *to) ++{ ++#if defined(__MINGW32__) ++ char exe_path[PATH_MAX]; ++ get_executable_path (NULL, &exe_path[0], sizeof(exe_path)/sizeof(exe_path[0])); ++ if (strrchr (exe_path, '/') != NULL) ++ { ++ strrchr (exe_path, '/')[1] = '\0'; ++ } ++ char * rel_to_datadir = get_relative_path (from, to); ++ strcat (exe_path, rel_to_datadir); ++ simplify_path (&exe_path[0]); ++ return malloc_copy_string(exe_path); ++#else ++ return malloc_copy_string(to); ++#endif ++} ++ ++char * ++sasl_pathlist_relocation(const char *from_path, const char *to_path_list) ++{ ++#if defined(__MINGW32__) ++ static char stored_path[PATH_MAX]; ++ static int stored = 0; ++ if (stored == 0) ++ { ++ char const * relocated = get_relocated_path_list(from_path, to_path_list); ++ strncpy (stored_path, relocated, PATH_MAX); ++ stored_path[PATH_MAX-1] = '\0'; ++ free ((void *)relocated); ++ stored = 1; ++ } ++ return stored_path; ++#else ++ return (to_path_list); ++#endif ++} ++ + static const char *implementation_string = "Cyrus SASL"; + + #define VSTR0(maj, min, step) #maj "." #min "." #step +@@ -1585,9 +1625,13 @@ + + #if defined(WIN32) + /* NB: On Windows platforms this value is always allocated */ ++# ifdef __MINGW32__ ++ default_plugin_path = sasl_path_relocation(BINDIR, PLUGINDIR); ++# else + default_plugin_path = _sasl_get_default_win_path(context, + SASL_PLUGIN_PATH_ATTR, + PLUGINDIR); ++# endif + #else + /* NB: On Unix platforms this value is never allocated */ + path = _sasl_get_default_unix_path(context, +@@ -1640,9 +1684,13 @@ + + #if defined(WIN32) + /* NB: On Windows platforms this value is always allocated */ ++# ifdef __MINGW32__ ++ default_conf_path = sasl_pathlist_relocation(BINDIR, CONFIGDIR); ++# else + default_conf_path = _sasl_get_default_win_path(context, + SASL_CONF_PATH_ATTR, + CONFIGDIR); ++# endif + #else + /* NB: On Unix platforms this value is never allocated */ + path = _sasl_get_default_unix_path(context, +diff -Naur cyrus-sasl-2.1.26-orig/lib/Makefile.am cyrus-sasl-2.1.26/lib/Makefile.am +--- cyrus-sasl-2.1.26-orig/lib/Makefile.am 2014-12-15 23:10:23.094200000 +0300 ++++ cyrus-sasl-2.1.26/lib/Makefile.am 2014-12-15 23:24:10.600800000 +0300 +@@ -62,8 +62,8 @@ + DLOPEN_C = dlopen.c + endif + +-common_headers = saslint.h +-common_sources = auxprop.c canonusr.c checkpw.c client.c common.c config.c external.c md5.c saslutil.c server.c seterror.c $(DLOPEN_C) ++common_headers = saslint.h pathtools.h ++common_sources = auxprop.c canonusr.c checkpw.c client.c common.c config.c external.c md5.c pathtools.c saslutil.c server.c seterror.c $(DLOPEN_C) + + LTLIBOBJS = @LTLIBOBJS@ + LIB_DOOR= @LIB_DOOR@ +diff -Naur cyrus-sasl-2.1.26-orig/utils/pluginviewer.c cyrus-sasl-2.1.26/utils/pluginviewer.c +--- cyrus-sasl-2.1.26-orig/utils/pluginviewer.c 2014-12-15 23:10:22.407800000 +0300 ++++ cyrus-sasl-2.1.26/utils/pluginviewer.c 2014-12-15 23:45:36.037600000 +0300 +@@ -197,7 +197,7 @@ + if (searchpath) { + *path = searchpath; + } else { +- *path = PLUGINDIR; ++ *path = sasl_path_relocation(BINDIR, PLUGINDIR); + } + + return SASL_OK; |