- add patch to initialize sasl callbacks unconditionally on autofs LDAP
lookup library load.
This commit is contained in:
parent
e6cf324f87
commit
beeac84550
126
autofs-5.0.2-init-cb-on-load.patch
Normal file
126
autofs-5.0.2-init-cb-on-load.patch
Normal file
@ -0,0 +1,126 @@
|
||||
diff -up autofs-5.0.2/include/lookup_ldap.h.init-cb-on-load autofs-5.0.2/include/lookup_ldap.h
|
||||
--- autofs-5.0.2/include/lookup_ldap.h.init-cb-on-load 2008-03-09 13:50:30.000000000 +0900
|
||||
+++ autofs-5.0.2/include/lookup_ldap.h 2008-03-09 13:52:52.000000000 +0900
|
||||
@@ -99,10 +99,12 @@ int unbind_ldap_connection(unsigned logo
|
||||
int authtype_requires_creds(const char *authtype);
|
||||
|
||||
/* cyrus-sasl.c */
|
||||
+int autofs_sasl_client_init(unsigned logopt);
|
||||
int autofs_sasl_init(unsigned logopt, LDAP *ldap, struct lookup_context *ctxt);
|
||||
int autofs_sasl_bind(unsigned logopt, LDAP *ldap, struct lookup_context *ctxt);
|
||||
void autofs_sasl_unbind(struct lookup_context *ctxt);
|
||||
-void autofs_sasl_done(struct lookup_context *ctxt);
|
||||
+void autofs_sasl_dispose(struct lookup_context *ctxt);
|
||||
+void autofs_sasl_done(void);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
diff -up autofs-5.0.2/modules/lookup_ldap.c.init-cb-on-load autofs-5.0.2/modules/lookup_ldap.c
|
||||
--- autofs-5.0.2/modules/lookup_ldap.c.init-cb-on-load 2008-03-09 13:50:30.000000000 +0900
|
||||
+++ autofs-5.0.2/modules/lookup_ldap.c 2008-03-09 13:58:47.000000000 +0900
|
||||
@@ -599,7 +599,7 @@ static LDAP *connect_to_server(unsigned
|
||||
|
||||
if (!do_bind(logopt, ldap, ctxt)) {
|
||||
unbind_ldap_connection(logopt, ldap, ctxt);
|
||||
- autofs_sasl_done(ctxt);
|
||||
+ autofs_sasl_dispose(ctxt);
|
||||
error(logopt, MODPREFIX "cannot bind to server");
|
||||
return NULL;
|
||||
}
|
||||
@@ -672,7 +672,7 @@ static LDAP *do_reconnect(unsigned logop
|
||||
list_add_tail(&this->list, ctxt->uri);
|
||||
|
||||
#ifdef WITH_SASL
|
||||
- autofs_sasl_done(ctxt);
|
||||
+ autofs_sasl_dispose(ctxt);
|
||||
#endif
|
||||
|
||||
/* Current server failed connect, try the rest */
|
||||
@@ -1330,6 +1330,13 @@ int lookup_init(const char *mapfmt, int
|
||||
free_context(ctxt);
|
||||
return 1;
|
||||
}
|
||||
+
|
||||
+ /* Init the sasl callbacks */
|
||||
+ if (!autofs_sasl_client_init(LOGOPT_NONE)) {
|
||||
+ error(LOGOPT_ANY, "failed to init sasl client");
|
||||
+ free_context(ctxt);
|
||||
+ return 1;
|
||||
+ }
|
||||
#endif
|
||||
|
||||
if (ctxt->server || !ctxt->uri) {
|
||||
@@ -2640,7 +2647,8 @@ int lookup_done(void *context)
|
||||
struct lookup_context *ctxt = (struct lookup_context *) context;
|
||||
int rv = close_parse(ctxt->parse);
|
||||
#ifdef WITH_SASL
|
||||
- autofs_sasl_done(ctxt);
|
||||
+ autofs_sasl_dispose(ctxt);
|
||||
+ autofs_sasl_done();
|
||||
#endif
|
||||
free_context(ctxt);
|
||||
return rv;
|
||||
diff -up autofs-5.0.2/modules/cyrus-sasl.c.init-cb-on-load autofs-5.0.2/modules/cyrus-sasl.c
|
||||
--- autofs-5.0.2/modules/cyrus-sasl.c.init-cb-on-load 2008-03-09 13:50:30.000000000 +0900
|
||||
+++ autofs-5.0.2/modules/cyrus-sasl.c 2008-03-09 13:56:59.000000000 +0900
|
||||
@@ -76,7 +76,6 @@ static const char *default_client = "aut
|
||||
static pthread_mutex_t krb5cc_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
static unsigned int krb5cc_in_use = 0;
|
||||
|
||||
-static unsigned int init_callbacks = 1;
|
||||
static int sasl_log_func(void *, int, const char *);
|
||||
static int getpass_func(sasl_conn_t *, void *, int, sasl_secret_t **);
|
||||
static int getuser_func(void *, int, const char **, unsigned *);
|
||||
@@ -878,13 +877,6 @@ autofs_sasl_init(unsigned logopt, LDAP *
|
||||
{
|
||||
sasl_conn_t *conn;
|
||||
|
||||
- /* Start up Cyrus SASL--only needs to be done once. */
|
||||
- if (init_callbacks && sasl_client_init(callbacks) != SASL_OK) {
|
||||
- error(logopt, "sasl_client_init failed");
|
||||
- return -1;
|
||||
- }
|
||||
- init_callbacks = 0;
|
||||
-
|
||||
sasl_auth_id = ctxt->user;
|
||||
sasl_auth_secret = ctxt->secret;
|
||||
|
||||
@@ -916,8 +908,7 @@ autofs_sasl_init(unsigned logopt, LDAP *
|
||||
* Destructor routine. This should be called when finished with an ldap
|
||||
* session.
|
||||
*/
|
||||
-void
|
||||
-autofs_sasl_done(struct lookup_context *ctxt)
|
||||
+void autofs_sasl_dispose(struct lookup_context *ctxt)
|
||||
{
|
||||
int status, ret;
|
||||
|
||||
@@ -953,3 +944,28 @@ autofs_sasl_done(struct lookup_context *
|
||||
ctxt->kinit_successful = 0;
|
||||
}
|
||||
}
|
||||
+
|
||||
+/*
|
||||
+ * Initialize the sasl callbacks, which increments the global
|
||||
+ * use counter.
|
||||
+ */
|
||||
+int autofs_sasl_client_init(unsigned logopt)
|
||||
+{
|
||||
+ /* Start up Cyrus SASL--only needs to be done at library load. */
|
||||
+ if (sasl_client_init(callbacks) != SASL_OK) {
|
||||
+ error(logopt, "sasl_client_init failed");
|
||||
+ return 0;
|
||||
+ }
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Decrement the library reference count and free resources if
|
||||
+ * we are the last to close the library.
|
||||
+ */
|
||||
+void autofs_sasl_done(void)
|
||||
+{
|
||||
+ sasl_done();
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
@ -4,7 +4,7 @@
|
||||
Summary: A tool for automatically mounting and unmounting filesystems
|
||||
Name: autofs
|
||||
Version: 5.0.3
|
||||
Release: 6
|
||||
Release: 7
|
||||
Epoch: 1
|
||||
License: GPL
|
||||
Group: System Environment/Daemons
|
||||
@ -22,6 +22,7 @@ Patch9: autofs-5.0.3-device-node-control.patch
|
||||
Patch10: autofs-5.0.3-active-restart.patch
|
||||
Patch11: autofs-5.0.3-device-node-and-active-restart-fixes.patch
|
||||
Patch12: autofs-5.0.3-make-is_mounted-use-dev-ioctl.patch
|
||||
Patch13: autofs-5.0.2-init-cb-on-load.patch
|
||||
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, libxml2-devel, cyrus-sasl-devel, openssl-devel module-init-tools util-linux nfs-utils e2fsprogs
|
||||
Conflicts: kernel < 2.6.17
|
||||
@ -75,6 +76,7 @@ echo %{version}-%{release} > .version
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
|
||||
%build
|
||||
#CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
|
||||
@ -127,6 +129,10 @@ fi
|
||||
%{_libdir}/autofs/
|
||||
|
||||
%changelog
|
||||
* Thu Mar 20 2008 Ian Kent <ikent@redhat.com> - 5.0.3-7
|
||||
- add patch to initialize sasl callbacks unconditionally on autofs
|
||||
LDAP lookup library load.
|
||||
|
||||
* Mon Feb 25 2008 Ian Kent <ikent@redhat.com> - 5.0.3-6
|
||||
- fix expire calling kernel more often than needed.
|
||||
- fix unlink of mount tree incorrectly causing autofs mount fail.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user