diff -up autofs-5.0.1/modules/cyrus-sasl.c.reread-config-on-hup autofs-5.0.1/modules/cyrus-sasl.c --- autofs-5.0.1/modules/cyrus-sasl.c.reread-config-on-hup 2007-10-18 20:53:44.000000000 +0800 +++ autofs-5.0.1/modules/cyrus-sasl.c 2007-10-18 20:53:58.000000000 +0800 @@ -528,6 +528,7 @@ sasl_do_kinit(struct lookup_context *ctx return 0; out_cleanup_unparse: + krb5cc_in_use--; krb5_free_unparsed_name(ctxt->krb5ctxt, tgs_name); out_cleanup_cc: status = pthread_mutex_lock(&krb5cc_mutex); diff -up autofs-5.0.1/modules/lookup_ldap.c.reread-config-on-hup autofs-5.0.1/modules/lookup_ldap.c --- autofs-5.0.1/modules/lookup_ldap.c.reread-config-on-hup 2007-10-18 20:53:44.000000000 +0800 +++ autofs-5.0.1/modules/lookup_ldap.c 2007-10-18 20:53:58.000000000 +0800 @@ -174,7 +174,7 @@ LDAP *init_ldap_connection(struct lookup static int get_query_dn(LDAP *ldap, struct lookup_context *ctxt, const char *class, const char *key) { char buf[PARSE_MAX_BUF]; - char *query, *dn; + char *query, *dn, *qdn; LDAPMessage *result = NULL, *e; struct ldap_searchdn *sdns = NULL; char *attrs[2]; @@ -225,15 +225,18 @@ static int get_query_dn(LDAP *ldap, stru if (!ctxt->base) { sdns = defaults_get_searchdns(); - if (sdns) + if (sdns) { + if (ctxt->sdns) + defaults_free_searchdns(ctxt->sdns); ctxt->sdns = sdns; + } } - if (!sdns) + if (!ctxt->sdns) rv = ldap_search_s(ldap, ctxt->base, scope, query, attrs, 0, &result); else { - struct ldap_searchdn *this = sdns; + struct ldap_searchdn *this = ctxt->sdns; debug(LOGOPT_NONE, MODPREFIX "check search base list"); @@ -269,7 +272,6 @@ static int get_query_dn(LDAP *ldap, stru if (e) { dn = ldap_get_dn(ldap, e); debug(LOGOPT_NONE, MODPREFIX "query dn %s", dn); - ldap_msgfree(result); } else { debug(LOGOPT_NONE, MODPREFIX "query succeeded, no matches for %s", @@ -278,7 +280,16 @@ static int get_query_dn(LDAP *ldap, stru return 0; } - ctxt->qdn = dn; + qdn = strdup(dn); + ldap_memfree(dn); + ldap_msgfree(result); + if (!qdn) + return 0; + + if (ctxt->qdn) + free(ctxt->qdn); + + ctxt->qdn = qdn; return 1; } @@ -1018,7 +1029,7 @@ static void free_context(struct lookup_c if (ctxt->mapname) free(ctxt->mapname); if (ctxt->qdn) - ldap_memfree(ctxt->qdn); + free(ctxt->qdn); if (ctxt->server) free(ctxt->server); if (ctxt->cur_host) @@ -1600,14 +1611,14 @@ static int lookup_one(struct autofs_poin } query[ql] = '\0'; - debug(ap->logopt, - MODPREFIX "searching for \"%s\" under \"%s\"", query, ctxt->qdn); - /* Initialize the LDAP context. */ ldap = do_connect(ctxt); if (!ldap) return CHE_FAIL; + debug(ap->logopt, + MODPREFIX "searching for \"%s\" under \"%s\"", query, ctxt->qdn); + rv = ldap_search_s(ldap, ctxt->qdn, scope, query, attrs, 0, &result); if ((rv != LDAP_SUCCESS) || !result) { diff -up autofs-5.0.1/daemon/automount.c.reread-config-on-hup autofs-5.0.1/daemon/automount.c --- autofs-5.0.1/daemon/automount.c.reread-config-on-hup 2007-10-18 20:53:44.000000000 +0800 +++ autofs-5.0.1/daemon/automount.c 2007-10-18 20:53:58.000000000 +0800 @@ -963,6 +963,8 @@ static void *do_read_master(void *arg) if (status) fatal(status); + defaults_read_config(); + status = master_read_master(master, age, readall); master->reading = 0; diff -up autofs-5.0.1/lib/master.c.reread-config-on-hup autofs-5.0.1/lib/master.c --- autofs-5.0.1/lib/master.c.reread-config-on-hup 2007-10-18 20:53:44.000000000 +0800 +++ autofs-5.0.1/lib/master.c 2007-10-18 20:53:58.000000000 +0800 @@ -1169,6 +1169,10 @@ int master_mount_mounts(struct master *m continue; } + master_source_writelock(this); + lookup_close_lookup(ap); + master_source_unlock(this); + cache_readlock(nc); ne = cache_lookup_distinct(nc, this->path); if (ne && this->age > ne->age) {