]> git.pld-linux.org Git - packages/autofs.git/blob - autofs-5.0.2-reread-config-on-hup.patch
e581f32ce89c478a0aa90c360508f95c0e93bd04
[packages/autofs.git] / autofs-5.0.2-reread-config-on-hup.patch
1 diff --git a/CHANGELOG b/CHANGELOG
2 index a2a782d..9a2a8c1 100644
3 --- a/CHANGELOG
4 +++ b/CHANGELOG
5 @@ -26,6 +26,7 @@
6  - fix LDAP schema discovery.
7  - add SEARCH_BASE configuration option.
8  - work around segv at exit due to libxml2 tsd usage.
9 +- re-read config on HUP signal.
10  
11  18/06/2007 autofs-5.0.2
12  -----------------------
13 diff --git a/daemon/automount.c b/daemon/automount.c
14 index e9cae4e..3d6a703 100644
15 --- a/daemon/automount.c
16 +++ b/daemon/automount.c
17 @@ -986,6 +986,8 @@ static void *do_read_master(void *arg)
18         if (status)
19                 fatal(status);
20  
21 +       defaults_read_config();
22 +
23         status = master_read_master(master, age, readall);
24  
25         master->reading = 0;
26 diff --git a/lib/master.c b/lib/master.c
27 index da05bb6..637ce04 100644
28 --- a/lib/master.c
29 +++ b/lib/master.c
30 @@ -1169,6 +1169,10 @@ int master_mount_mounts(struct master *master, time_t age, int readall)
31                         continue;
32                 }
33  
34 +               master_source_writelock(this);
35 +               lookup_close_lookup(ap);
36 +               master_source_unlock(this);
37 +
38                 cache_readlock(nc);
39                 ne = cache_lookup_distinct(nc, this->path);
40                 if (ne && this->age > ne->age) {
41 diff --git a/modules/cyrus-sasl.c b/modules/cyrus-sasl.c
42 index 8821f84..9aac792 100644
43 --- a/modules/cyrus-sasl.c
44 +++ b/modules/cyrus-sasl.c
45 @@ -528,6 +528,7 @@ sasl_do_kinit(struct lookup_context *ctxt)
46         return 0;
47  
48  out_cleanup_unparse:
49 +       krb5cc_in_use--;
50         krb5_free_unparsed_name(ctxt->krb5ctxt, tgs_name);
51  out_cleanup_cc:
52         status = pthread_mutex_lock(&krb5cc_mutex);
53 diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
54 index 49a9a9b..2baf8b8 100644
55 --- a/modules/lookup_ldap.c
56 +++ b/modules/lookup_ldap.c
57 @@ -174,7 +174,7 @@ LDAP *init_ldap_connection(struct lookup_context *ctxt)
58  static int get_query_dn(LDAP *ldap, struct lookup_context *ctxt, const char *class, const char *key)
59  {
60         char buf[PARSE_MAX_BUF];
61 -       char *query, *dn;
62 +       char *query, *dn, *qdn;
63         LDAPMessage *result = NULL, *e;
64         struct ldap_searchdn *sdns = NULL;
65         char *attrs[2];
66 @@ -225,15 +225,18 @@ static int get_query_dn(LDAP *ldap, struct lookup_context *ctxt, const char *cla
67  
68         if (!ctxt->base) {
69                 sdns = defaults_get_searchdns();
70 -               if (sdns)
71 +               if (sdns) {
72 +                       if (ctxt->sdns)
73 +                               defaults_free_searchdns(ctxt->sdns);
74                         ctxt->sdns = sdns;
75 +               }
76         }
77  
78 -       if (!sdns)
79 +       if (!ctxt->sdns)
80                 rv = ldap_search_s(ldap, ctxt->base,
81                                    scope, query, attrs, 0, &result);
82         else {
83 -               struct ldap_searchdn *this = sdns;
84 +               struct ldap_searchdn *this = ctxt->sdns;
85  
86                 debug(LOGOPT_NONE, MODPREFIX
87                               "check search base list");
88 @@ -269,7 +272,6 @@ static int get_query_dn(LDAP *ldap, struct lookup_context *ctxt, const char *cla
89         if (e) {
90                 dn = ldap_get_dn(ldap, e);
91                 debug(LOGOPT_NONE, MODPREFIX "query dn %s", dn);
92 -               ldap_msgfree(result);
93         } else {
94                 debug(LOGOPT_NONE,
95                       MODPREFIX "query succeeded, no matches for %s",
96 @@ -278,7 +280,16 @@ static int get_query_dn(LDAP *ldap, struct lookup_context *ctxt, const char *cla
97                 return 0;
98         }
99  
100 -       ctxt->qdn = dn;
101 +       qdn = strdup(dn);
102 +       ldap_memfree(dn);
103 +       ldap_msgfree(result);
104 +       if (!qdn)
105 +               return 0;
106 +
107 +       if (ctxt->qdn)
108 +               free(ctxt->qdn);
109 +
110 +       ctxt->qdn = qdn;
111  
112         return 1;
113  }
114 @@ -1018,7 +1029,7 @@ static void free_context(struct lookup_context *ctxt)
115         if (ctxt->mapname)
116                 free(ctxt->mapname);
117         if (ctxt->qdn)
118 -               ldap_memfree(ctxt->qdn);
119 +               free(ctxt->qdn);
120         if (ctxt->server)
121                 free(ctxt->server);
122         if (ctxt->cur_host)
123 @@ -1600,14 +1611,14 @@ static int lookup_one(struct autofs_point *ap,
124         }
125         query[ql] = '\0';
126  
127 -       debug(ap->logopt,
128 -             MODPREFIX "searching for \"%s\" under \"%s\"", query, ctxt->qdn);
129 -
130         /* Initialize the LDAP context. */
131         ldap = do_connect(ctxt);
132         if (!ldap)
133                 return CHE_FAIL;
134  
135 +       debug(ap->logopt,
136 +             MODPREFIX "searching for \"%s\" under \"%s\"", query, ctxt->qdn);
137 +
138         rv = ldap_search_s(ldap, ctxt->qdn, scope, query, attrs, 0, &result);
139  
140         if ((rv != LDAP_SUCCESS) || !result) {
This page took 0.037536 seconds and 2 git commands to generate.