Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
add cyrus sasl
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Aug 6, 2018
1 parent daeb55d commit 4a6c222
Show file tree
Hide file tree
Showing 9 changed files with 1,174 additions and 0 deletions.
22 changes: 22 additions & 0 deletions mingw-w64-cyrus-sasl/02-exeext.patch
@@ -0,0 +1,22 @@


From: David Rothenberger <daveroth@acm.org>


---
m4/sasldb.m4 | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/m4/sasldb.m4 b/m4/sasldb.m4
index b28b087..85e769a 100644
--- a/m4/sasldb.m4
+++ b/m4/sasldb.m4
@@ -111,7 +111,7 @@ AC_MSG_RESULT($dblib)
SASL_DB_BACKEND="db_${dblib}.lo"
SASL_DB_BACKEND_STATIC="db_${dblib}.o allockey.o"
SASL_DB_BACKEND_STATIC_SRCS="\$(top_srcdir)/sasldb/db_${dblib}.c \$(top_srcdir)/sasldb/allockey.c"
-SASL_DB_UTILS="saslpasswd2 sasldblistusers2"
+SASL_DB_UTILS='saslpasswd2$(EXEEXT) sasldblistusers2$(EXEEXT)'
SASL_DB_MANS="saslpasswd2.8 sasldblistusers2.8"

case "$dblib" in
22 changes: 22 additions & 0 deletions mingw-w64-cyrus-sasl/03-fix-plugins.patch
@@ -0,0 +1,22 @@


From: David Rothenberger <daveroth@acm.org>


---
common/plugin_common.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/common/plugin_common.h b/common/plugin_common.h
index 0f75897..3e844c7 100644
--- a/common/plugin_common.h
+++ b/common/plugin_common.h
@@ -63,7 +63,7 @@
#include <saslutil.h>
#include <saslplug.h>

-#ifdef WIN32
+#if defined(WIN32) || defined(__CYGWIN__)
#define PLUG_API __declspec(dllexport)
#else
#define PLUG_API extern
51 changes: 51 additions & 0 deletions mingw-w64-cyrus-sasl/04-manpage-paths.patch
@@ -0,0 +1,51 @@


From: David Rothenberger <daveroth@acm.org>


---
saslauthd/LDAP_SASLAUTHD | 2 +-
saslauthd/saslauthd.8 | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/saslauthd/LDAP_SASLAUTHD b/saslauthd/LDAP_SASLAUTHD
index 86f24e5..eb321ec 100644
--- a/saslauthd/LDAP_SASLAUTHD
+++ b/saslauthd/LDAP_SASLAUTHD
@@ -36,7 +36,7 @@ make install
2. START SASLAUTHD WITH LDAP
----------------------------

-Create /usr/local/etc/saslauthd.conf and add the following (modify to fit your
+Create /etc/saslauthd.conf and add the following (modify to fit your
environment):
ldap_servers: ldap://10.1.1.15/ ldap://10.1.1.25/
ldap_bind_dn: cn=operator,ou=Profile,o=foo.com
diff --git a/saslauthd/saslauthd.8 b/saslauthd/saslauthd.8
index 843edb0..07b5358 100644
--- a/saslauthd/saslauthd.8
+++ b/saslauthd/saslauthd.8
@@ -156,10 +156,10 @@ AAUUTTHHEENNTTIICCAATTIIOONN MMEECCHHAANNIISSMMSS
ldap _(_A_l_l _p_l_a_t_f_o_r_m_s _t_h_a_t _s_u_p_p_o_r_t _O_p_e_n_L_D_A_P _2_._0 _o_r _h_i_g_h_e_r_)

Authenticate against an ldap server. The ldap configuration
- parameters are read from /usr/local/etc/saslauthd.conf. The
- location of this file can be changed with the -O parameter.
- See the LDAP_SASLAUTHD file included with the distribution for
- the list of available parameters.
+ parameters are read from /etc/saslauthd.conf. The location
+ of this file can be changed with the -O parameter. See the
+ LDAP_SASLAUTHD file included with the distribution for the
+ list of available parameters.

sia _(_D_i_g_i_t_a_l _U_N_I_X_)

@@ -181,7 +181,7 @@ NNOOTTEESS
FFIILLEESS
/var/run/saslauthd/mux The default communications socket.

- /usr/local/etc/saslauthd.conf
+ /etc/saslauthd.conf
The default configuration file for ldap support.

SSEEEE AALLSSOO
@@ -0,0 +1,154 @@
diff -urN a/sasldb/db_berkeley.c b/sasldb/db_berkeley.c
--- a/sasldb/db_berkeley.c 2014-08-12 22:40:34.277570400 +0100
+++ b/sasldb/db_berkeley.c 2014-08-12 22:40:35.109618000 +0100
@@ -358,7 +358,7 @@
return result;
}

-int _sasl_check_db(const sasl_utils_t *utils,
+LIBSASL_API int _sasl_check_db(const sasl_utils_t *utils,
sasl_conn_t *conn)
{
const char *path = SASL_DB_PATH;
@@ -412,7 +412,7 @@
DBC *cursor;
} berkleyhandle_t;

-sasldb_handle _sasldb_getkeyhandle(const sasl_utils_t *utils,
+LIBSASL_API sasldb_handle _sasldb_getkeyhandle(const sasl_utils_t *utils,
sasl_conn_t *conn)
{
int ret;
@@ -447,7 +447,7 @@
return (sasldb_handle)handle;
}

-int _sasldb_getnextkey(const sasl_utils_t *utils __attribute__((unused)),
+LIBSASL_API int _sasldb_getnextkey(const sasl_utils_t *utils __attribute__((unused)),
sasldb_handle handle, char *out,
const size_t max_out, size_t *out_len)
{
@@ -501,7 +501,7 @@
}


-int _sasldb_releasekeyhandle(const sasl_utils_t *utils,
+LIBSASL_API int _sasldb_releasekeyhandle(const sasl_utils_t *utils,
sasldb_handle handle)
{
berkleyhandle_t *dbh = (berkleyhandle_t *)handle;
diff -urN a/sasldb/db_gdbm.c b/sasldb/db_gdbm.c
--- a/sasldb/db_gdbm.c 2014-08-12 22:40:34.276570300 +0100
+++ b/sasldb/db_gdbm.c 2014-08-12 22:40:35.111618100 +0100
@@ -221,7 +221,7 @@
return result;
}

-int _sasl_check_db(const sasl_utils_t *utils,
+LIBSASL_API int _sasl_check_db(const sasl_utils_t *utils,
sasl_conn_t *conn)
{
const char *path = SASL_DB_PATH;
@@ -270,7 +270,7 @@
int first;
} handle_t;

-sasldb_handle _sasldb_getkeyhandle(const sasl_utils_t *utils,
+LIBSASL_API sasldb_handle _sasldb_getkeyhandle(const sasl_utils_t *utils,
sasl_conn_t *conn)
{
const char *path = SASL_DB_PATH;
@@ -316,7 +316,7 @@
return (sasldb_handle)handle;
}

-int _sasldb_getnextkey(const sasl_utils_t *utils __attribute__((unused)),
+LIBSASL_API int _sasldb_getnextkey(const sasl_utils_t *utils __attribute__((unused)),
sasldb_handle handle, char *out,
const size_t max_out, size_t *out_len)
{
@@ -346,7 +346,7 @@
return SASL_CONTINUE;
}

-int _sasldb_releasekeyhandle(const sasl_utils_t *utils,
+LIBSASL_API int _sasldb_releasekeyhandle(const sasl_utils_t *utils,
sasldb_handle handle)
{
handle_t *dbh = (handle_t *)handle;
diff -urN a/sasldb/db_ndbm.c b/sasldb/db_ndbm.c
--- a/sasldb/db_ndbm.c 2014-08-12 22:40:34.276570300 +0100
+++ b/sasldb/db_ndbm.c 2014-08-12 22:40:35.112618100 +0100
@@ -221,7 +221,7 @@
#define SUFLEN 5
#endif

-int _sasl_check_db(const sasl_utils_t *utils,
+LIBSASL_API int _sasl_check_db(const sasl_utils_t *utils,
sasl_conn_t *conn)
{
const char *path = SASL_DB_PATH;
@@ -294,7 +294,7 @@
int first;
} handle_t;

-sasldb_handle _sasldb_getkeyhandle(const sasl_utils_t *utils,
+LIBSASL_API sasldb_handle _sasldb_getkeyhandle(const sasl_utils_t *utils,
sasl_conn_t *conn)
{
const char *path = SASL_DB_PATH;
@@ -339,7 +339,7 @@
return (sasldb_handle)handle;
}

-int _sasldb_getnextkey(const sasl_utils_t *utils __attribute__((unused)),
+LIBSASL_API int _sasldb_getnextkey(const sasl_utils_t *utils __attribute__((unused)),
sasldb_handle handle, char *out,
const size_t max_out, size_t *out_len)
{
@@ -369,7 +369,7 @@
return SASL_CONTINUE;
}

-int _sasldb_releasekeyhandle(const sasl_utils_t *utils,
+LIBSASL_API int _sasldb_releasekeyhandle(const sasl_utils_t *utils,
sasldb_handle handle)
{
handle_t *dbh = (handle_t *)handle;
diff -urN a/sasldb/db_none.c b/sasldb/db_none.c
--- a/sasldb/db_none.c 2014-08-12 22:40:34.276570300 +0100
+++ b/sasldb/db_none.c 2014-08-12 22:40:35.114618300 +0100
@@ -73,21 +73,21 @@
return SASL_FAIL;
}

-int _sasl_check_db(const sasl_utils_t *utils,
+LIBSASL_API int _sasl_check_db(const sasl_utils_t *utils,
sasl_conn_t *conn)
{
if(conn) utils->seterror(conn, 0, "No Database Driver");
return SASL_FAIL;
}

-sasldb_handle _sasldb_getkeyhandle(const sasl_utils_t *utils,
+LIBSASL_API sasldb_handle _sasldb_getkeyhandle(const sasl_utils_t *utils,
sasl_conn_t *conn)
{
if(conn) utils->seterror(conn, 0, "No Database Driver");
return NULL;
}

-int _sasldb_getnextkey(const sasl_utils_t *utils __attribute__((unused)),
+LIBSASL_API int _sasldb_getnextkey(const sasl_utils_t *utils __attribute__((unused)),
sasldb_handle handle __attribute__((unused)),
char *out __attribute__((unused)),
const size_t max_out __attribute__((unused)),
@@ -96,7 +96,7 @@
return SASL_FAIL;
}

-int _sasldb_releasekeyhandle(const sasl_utils_t *utils __attribute__((unused)),
+LIBSASL_API int _sasldb_releasekeyhandle(const sasl_utils_t *utils __attribute__((unused)),
sasldb_handle handle __attribute__((unused)))
{
return SASL_FAIL;
@@ -0,0 +1,33 @@
--- cyrus-sasl-2.1.27/plugins/Makefile.am.orig 2018-01-31 10:41:15.840628900 +0300
+++ cyrus-sasl-2.1.27/plugins/Makefile.am 2018-01-31 10:41:35.009709100 +0300
@@ -49,7 +49,7 @@
# CURRENT:REVISION:AGE
plugin_version = 3:0:0

-AM_CPPFLAGS=-I$(top_srcdir)/include -I$(top_srcdir)/lib -I$(top_srcdir)/sasldb -I$(top_srcdir)/common -I$(top_builddir)/include
+AM_CPPFLAGS=-DLIBSASL_EXPORTS=1 -I$(top_srcdir)/include -I$(top_srcdir)/lib -I$(top_srcdir)/sasldb -I$(top_srcdir)/common -I$(top_builddir)/include
AM_LDFLAGS = -module -export-dynamic -rpath $(plugindir) -version-info $(plugin_version) -no-undefined

if BUILD_LIBOBJ
--- cyrus-sasl-2.1.27/sasldb/Makefile.am.orig 2018-01-31 10:41:57.392403300 +0300
+++ cyrus-sasl-2.1.27/sasldb/Makefile.am 2018-01-31 10:42:05.300229200 +0300
@@ -44,7 +44,7 @@
# Note that this doesn't necessaraly follow the libsasl2 verison info
sasl_version = 1:25:0

-AM_CPPFLAGS=-fPIC -I$(top_srcdir)/include -I$(top_builddir)/include @SASL_DB_INC@
+AM_CPPFLAGS=-DLIBSASL_EXPORTS=1 -fPIC -I$(top_srcdir)/include -I$(top_builddir)/include @SASL_DB_INC@

extra_common_sources = db_none.c db_lmdb.c db_ndbm.c db_gdbm.c db_berkeley.c

--- cyrus-sasl-2.1.27/utils/Makefile.am.orig 2018-01-31 10:42:21.006694100 +0300
+++ cyrus-sasl-2.1.27/utils/Makefile.am 2018-01-31 10:42:52.234410200 +0300
@@ -89,7 +89,7 @@
libsfsasl2_la_LIBADD = sfsasl.lo
libsfsasl2_la_LDFLAGS = -version-info 1:0:0 -export-dynamic -rpath $(libdir)

-AM_CPPFLAGS=-I$(top_srcdir)/include -I$(top_builddir)/include @SASL_DB_INC@
+AM_CPPFLAGS=-DLIBSASL_EXPORTS=1 -I$(top_srcdir)/include -I$(top_builddir)/include @SASL_DB_INC@
EXTRA_DIST = saslpasswd2.8 sasldblistusers2.8 pluginviewer.8 sfsasl.h sfsasl.c smtptest.c testsuite.c pluginviewer.c NTMakefile

sfsasl.lo: sfsasl.c
@@ -0,0 +1,13 @@
diff -urN a/configure.ac b/configure.ac
--- a/configure.ac 2014-08-12 22:40:36.914721200 +0100
+++ b/configure.ac 2014-08-12 22:40:37.473753200 +0100
@@ -1042,6 +1042,9 @@
darwin*)
AC_ARG_ENABLE(macos-framework, [ --disable-macos-framework disable building and installing replacement SASL2 Framework for MacOS X-provided SASL Framework [[no]]],building_for_macosx=no,building_for_macosx=yes)
;;
+ mingw*)
+AC_DEFINE(WIN32_LEAN_AND_MEAN, 1, [Define to 1, avoids handle_t redefinition.])
+ ;;
esac
AM_CONDITIONAL(MACOSX, test "$building_for_macosx" = yes)

12 changes: 12 additions & 0 deletions mingw-w64-cyrus-sasl/17-MinGW-w64-define-S_IRUSR-and-S_IWUSR.patch
@@ -0,0 +1,12 @@
diff -urN cyrus-sasl-2.1.26.orig/configure.ac cyrus-sasl-2.1.26/configure.ac
--- cyrus-sasl-2.1.26.orig/configure.ac 2014-08-12 22:58:37.785543500 +0100
+++ cyrus-sasl-2.1.26/configure.ac 2014-08-12 23:01:36.330755700 +0100
@@ -1044,6 +1044,8 @@
;;
mingw*)
AC_DEFINE(WIN32_LEAN_AND_MEAN, 1, [Define to 1, avoids handle_t redefinition.])
+AC_DEFINE(S_IRUSR, _S_IREAD, [Define to _S_IREAD for MinGW-w64])
+AC_DEFINE(S_IWUSR, _S_IWRITE, [Define to _S_IWRITE for MinGW-w64])
;;
esac
AM_CONDITIONAL(MACOSX, test "$building_for_macosx" = yes)

0 comments on commit 4a6c222

Please sign in to comment.