From cdd7a95bcc455ee20674b119d9e70f958fe79a58 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20R=C4=99korajski?= Date: Fri, 21 Oct 2011 12:46:43 +0000 Subject: [PATCH] - added passdss and ldapdb plugins - don't waste time trying to open plugins via .la files (from debian) Changed files: 0030-dont_use_la_files_for_opening_plugins.patch -> 1.1 cyrus-sasl.spec -> 1.215 --- ...ont_use_la_files_for_opening_plugins.patch | 134 ++++++++++++++++++ cyrus-sasl.spec | 45 +++++- 2 files changed, 176 insertions(+), 3 deletions(-) create mode 100644 0030-dont_use_la_files_for_opening_plugins.patch diff --git a/0030-dont_use_la_files_for_opening_plugins.patch b/0030-dont_use_la_files_for_opening_plugins.patch new file mode 100644 index 0000000..14a3224 --- /dev/null +++ b/0030-dont_use_la_files_for_opening_plugins.patch @@ -0,0 +1,134 @@ +--- a/lib/dlopen.c ++++ b/lib/dlopen.c +@@ -247,105 +247,6 @@ static int _sasl_plugin_load(char *plugi + return result; + } + +-/* this returns the file to actually open. +- * out should be a buffer of size PATH_MAX +- * and may be the same as in. */ +- +-/* We'll use a static buffer for speed unless someone complains */ +-#define MAX_LINE 2048 +- +-static int _parse_la(const char *prefix, const char *in, char *out) +-{ +- FILE *file; +- size_t length; +- char line[MAX_LINE]; +- char *ntmp = NULL; +- +- if(!in || !out || !prefix || out == in) return SASL_BADPARAM; +- +- /* Set this so we can detect failure */ +- *out = '\0'; +- +- length = strlen(in); +- +- if (strcmp(in + (length - strlen(LA_SUFFIX)), LA_SUFFIX)) { +- if(!strcmp(in + (length - strlen(SO_SUFFIX)),SO_SUFFIX)) { +- /* check for a .la file */ +- strcpy(line, prefix); +- strcat(line, in); +- length = strlen(line); +- *(line + (length - strlen(SO_SUFFIX))) = '\0'; +- strcat(line, LA_SUFFIX); +- file = fopen(line, "r"); +- if(file) { +- /* We'll get it on the .la open */ +- fclose(file); +- return SASL_FAIL; +- } +- } +- strcpy(out, prefix); +- strcat(out, in); +- return SASL_OK; +- } +- +- strcpy(line, prefix); +- strcat(line, in); +- +- file = fopen(line, "r"); +- if(!file) { +- _sasl_log(NULL, SASL_LOG_WARN, +- "unable to open LA file: %s", line); +- return SASL_FAIL; +- } +- +- while(!feof(file)) { +- if(!fgets(line, MAX_LINE, file)) break; +- if(line[strlen(line) - 1] != '\n') { +- _sasl_log(NULL, SASL_LOG_WARN, +- "LA file has too long of a line: %s", in); +- return SASL_BUFOVER; +- } +- if(line[0] == '\n' || line[0] == '#') continue; +- if(!strncmp(line, "dlname=", sizeof("dlname=") - 1)) { +- /* We found the line with the name in it */ +- char *end; +- char *start; +- size_t len; +- end = strrchr(line, '\''); +- if(!end) continue; +- start = &line[sizeof("dlname=")-1]; +- len = strlen(start); +- if(len > 3 && start[0] == '\'') { +- ntmp=&start[1]; +- *end='\0'; +- /* Do we have dlname="" ? */ +- if(ntmp == end) { +- _sasl_log(NULL, SASL_LOG_DEBUG, +- "dlname is empty in .la file: %s", in); +- return SASL_FAIL; +- } +- strcpy(out, prefix); +- strcat(out, ntmp); +- } +- break; +- } +- } +- if(ferror(file) || feof(file)) { +- _sasl_log(NULL, SASL_LOG_WARN, +- "Error reading .la: %s\n", in); +- fclose(file); +- return SASL_FAIL; +- } +- fclose(file); +- +- if(!(*out)) { +- _sasl_log(NULL, SASL_LOG_WARN, +- "Could not find a dlname line in .la file: %s", in); +- return SASL_FAIL; +- } +- +- return SASL_OK; +-} + #endif /* DO_DLOPEN */ + + /* loads a plugin library */ +@@ -499,18 +400,18 @@ int _sasl_load_plugins(const add_plugin_ + if (length + pos>=PATH_MAX) continue; /* too big */ + + if (strcmp(dir->d_name + (length - strlen(SO_SUFFIX)), +- SO_SUFFIX) +- && strcmp(dir->d_name + (length - strlen(LA_SUFFIX)), +- LA_SUFFIX)) ++ SO_SUFFIX)) + continue; + ++ /* We only use .so files for loading plugins */ ++ + memcpy(name,dir->d_name,length); + name[length]='\0'; + +- result = _parse_la(prefix, name, tmp); +- if(result != SASL_OK) +- continue; +- ++ /* Create full name with path */ ++ strncpy(tmp, prefix, PATH_MAX); ++ strncat(tmp, name, PATH_MAX); ++ + /* skip "lib" and cut off suffix -- + this only need be approximate */ + strcpy(plugname, name + 3); diff --git a/cyrus-sasl.spec b/cyrus-sasl.spec index dce68b2..06361aa 100644 --- a/cyrus-sasl.spec +++ b/cyrus-sasl.spec @@ -1,5 +1,3 @@ -# TODO: -# - add ldap plugin from openldap sources # # Conditional build: %bcond_without cryptedpw # if you keep crypted passwords in your *sql @@ -25,7 +23,7 @@ Summary(ru.UTF-8): Библиотека Cyrus SASL Summary(uk.UTF-8): Бібліотека Cyrus SASL Name: cyrus-sasl Version: 2.1.25 -Release: 4.9 +Release: 4.99 License: distributable Group: Libraries Source0: ftp://ftp.cyrusimap.org/cyrus-sasl/%{name}-%{version}.tar.gz @@ -57,6 +55,7 @@ Patch18: 0033-fix_segfault_in_GSSAPI.patch Patch19: 0034-fix_dovecot_authentication.patch Patch20: %{name}-auxprop.patch Patch21: %{name}-get_fqhostname.patch +Patch22: 0030-dont_use_la_files_for_opening_plugins.patch URL: http://asg.web.cmu.edu/sasl/ BuildRequires: autoconf >= 2.54 BuildRequires: automake >= 1:1.7 @@ -361,6 +360,34 @@ Cyrus SASL sasldb plugin. %description sasldb -l pl.UTF-8 Wtyczka sasldb do Cyrus SASL. +%package ldapdb +Summary: Cyrus SASL LDAPDB plugin +Summary(pl.UTF-8): Wtyczka LDAPDB do Cyrus SASL +Group: Libraries +Requires: %{name} = %{version}-%{release} + +%description ldapdb +Cyrus SASL ldapdb plugin. + +%description ldapdb -l pl.UTF-8 +Wtyczka ldapdb do Cyrus SASL. + +%package passdss +Summary: PASSDSS Cyrus SASL plugin +Summary(pl.UTF-8): Wtyczka PASSDSS do Cyrus SASL +Summary(pt_BR.UTF-8): Mecanismo SASL PASSDSS +Group: Libraries +Requires: %{name} = %{version}-%{release} + +%description passdss +This plugin implements the PASSDSS 3DES mechanism. + +%description passdss -l pl.UTF-8 +Wtyczka dodająca obsługę mechanizmu PASSDSS 3DES do Cyrus SASL. + +%description passdss -l pt_BR.UTF-8 +Este plugin implementa o mecanismo SASL PASSDSS 3DES. + %package scram Summary: SCRAM Cyrus SASL plugin Summary(pl.UTF-8): Wtyczka SCRAM do Cyrus SASL @@ -492,6 +519,7 @@ Wtyczka Nagiosa do sprawdzania działania saslauthd. %patch19 -p1 %patch20 -p1 %patch21 -p1 +%patch22 -p1 cd doc echo "cyrus-sasl complies with the following RFCs:" > rfc-compliance @@ -531,6 +559,7 @@ cd .. --enable-sample \ --enable-httpform \ --enable-sql \ + --enable-passdss \ %{?with_srp: --enable-srp} \ --enable-static \ --with-plugindir=%{_libdir}/sasl2 \ @@ -703,6 +732,16 @@ fi %defattr(644,root,root,755) %attr(755,root,root) %{_libdir}/sasl2/libsasldb.so* +%if %{with ldap} +%files ldapdb +%defattr(644,root,root,755) +%attr(755,root,root) %{_libdir}/sasl2/libldapdb.so* +%endif + +%files passdss +%defattr(644,root,root,755) +%attr(755,root,root) %{_libdir}/sasl2/libpassdss.so* + %files scram %defattr(644,root,root,755) %attr(755,root,root) %{_libdir}/sasl2/libscram.so* -- 2.44.0