1
autofs-5.0.5 - more code analysis corrections (and fix a typo in an init script)
3
From: Jeff Moyer <jmoyer@redhat.com>
5
- fix an obvious type in Redhat init script.
6
- don't call ldap_msgfree when result pointer is null.
7
- check return of ldap_parse_result as pointers will be invalid on fail.
8
- get rid of a bogus assignment in defaults_free_searchdns.
9
- get rid of unused optlen variable in parse_sun.c.
10
- check return status of stat(2) in do_mount_direct().
11
- get rid of unused name variable in master_add_map_source().
12
- check return from ops->askumount() in expire_cleanup().
13
- in mount_autofs.c:mount_mount(), don't increment val since we never
15
- in autofs_sasl_dispose() ctxt must always be valid or we would have
16
a much bigger problem.
17
- in st_start_handler() and alarm_start_handler() it is possible for
18
pthread_attr_destroy() to be called with a NULL pointer.
19
- we could end up with a non-null result pointer after a failed call to
20
ldap_search_s(), well maybe, so check for it anyway.
22
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
26
daemon/direct.c | 2 +-
27
daemon/state.c | 5 +++--
30
lib/master.c | 6 +-----
31
modules/cyrus-sasl.c | 2 +-
32
modules/lookup_ldap.c | 13 +++++++++++--
33
modules/mount_autofs.c | 2 +-
34
modules/parse_sun.c | 3 +--
35
redhat/autofs.init.in | 2 +-
36
11 files changed, 23 insertions(+), 17 deletions(-)
39
diff --git a/CHANGELOG b/CHANGELOG
40
index 23351c8..b9b1602 100644
44
- add mount wait timeout parameter.
45
- special case cifs escapes.
46
- fix compile fail with when LDAP is excluded.
47
+- more code analysis corrections (and fix a typo in an init script).
49
03/09/2009 autofs-5.0.5
50
-----------------------
51
diff --git a/daemon/direct.c b/daemon/direct.c
52
index 0c78627..9b4e57b 100644
55
@@ -1245,7 +1245,7 @@ static void *do_mount_direct(void *arg)
58
status = stat(mt.name, &st);
59
- if (!S_ISDIR(st.st_mode) || st.st_dev != mt.dev) {
60
+ if (status != 0 || !S_ISDIR(st.st_mode) || st.st_dev != mt.dev) {
62
"direct trigger not valid or already mounted %s",
64
diff --git a/daemon/state.c b/daemon/state.c
65
index 71af46a..27bc6de 100644
68
@@ -160,7 +160,7 @@ void expire_cleanup(void *arg)
69
* been signaled to shutdown.
71
rv = ops->askumount(ap->logopt, ap->ioctlfd, &idle);
72
- if (!idle && !ap->shutdown) {
73
+ if (!rv && !idle && !ap->shutdown) {
76
alarm_add(ap, ap->exp_runfreq);
77
@@ -1198,7 +1198,8 @@ int st_start_handler(void)
79
status = pthread_create(&thid, pattrs, st_queue_handler, NULL);
81
- pthread_attr_destroy(pattrs);
83
+ pthread_attr_destroy(pattrs);
87
diff --git a/lib/alarm.c b/lib/alarm.c
88
index 46df38a..f403d8f 100755
91
@@ -239,7 +239,8 @@ int alarm_start_handler(void)
93
status = pthread_create(&thid, pattrs, alarm_handler, NULL);
95
- pthread_attr_destroy(pattrs);
97
+ pthread_attr_destroy(pattrs);
101
diff --git a/lib/defaults.c b/lib/defaults.c
102
index 2204b18..cb8354d 100644
105
@@ -534,7 +534,6 @@ void defaults_free_searchdns(struct ldap_searchdn *sdn)
106
struct ldap_searchdn *this = sdn;
107
struct ldap_searchdn *next;
113
diff --git a/lib/master.c b/lib/master.c
114
index e43f835..8455f40 100644
117
@@ -152,7 +152,7 @@ master_add_map_source(struct master_mapent *entry,
119
struct map_source *source;
120
char *ntype, *nformat;
121
- const char **tmpargv, *name = NULL;
122
+ const char **tmpargv;
124
source = malloc(sizeof(struct map_source));
126
@@ -188,10 +188,6 @@ master_add_map_source(struct master_mapent *entry,
128
source->argv = tmpargv;
130
- /* Can be NULL for "hosts" map */
134
master_source_writelock(entry);
137
diff --git a/modules/cyrus-sasl.c b/modules/cyrus-sasl.c
138
index 828143e..92e2226 100644
139
--- a/modules/cyrus-sasl.c
140
+++ b/modules/cyrus-sasl.c
141
@@ -911,7 +911,7 @@ void autofs_sasl_dispose(struct lookup_context *ctxt)
145
- if (ctxt && ctxt->sasl_conn) {
146
+ if (ctxt->sasl_conn) {
147
sasl_dispose(&ctxt->sasl_conn);
148
ctxt->sasl_conn = NULL;
150
diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
151
index f1fb9ce..d8bd169 100644
152
--- a/modules/lookup_ldap.c
153
+++ b/modules/lookup_ldap.c
154
@@ -389,13 +389,16 @@ static int get_query_dn(unsigned logopt, LDAP *ldap, struct lookup_context *ctxt
156
MODPREFIX "query failed for search dn %s: %s",
157
this->basedn, ldap_err2string(rv));
159
+ ldap_msgfree(result);
168
- ldap_msgfree(result);
170
MODPREFIX "failed to find query dn under search base dns");
172
@@ -1954,6 +1957,12 @@ do_paged:
176
+ if (rv != LDAP_SUCCESS) {
178
+ MODPREFIX "ldap_parse_result failed with %d", rv);
183
* Parse the page control returned to get the cookie and
184
* determine whether there are more pages.
185
@@ -1970,8 +1979,8 @@ do_paged:
186
if (returnedControls)
187
ldap_controls_free(returnedControls);
190
ldap_control_free(pageControl);
195
diff --git a/modules/mount_autofs.c b/modules/mount_autofs.c
196
index afb1859..2a5d860 100644
197
--- a/modules/mount_autofs.c
198
+++ b/modules/mount_autofs.c
199
@@ -119,7 +119,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name,
200
else if (strncmp(cp, "timeout=", 8) == 0) {
201
char *val = strchr(cp, '=');
205
int ret = sscanf(cp, "timeout=%u", &tout);
208
diff --git a/modules/parse_sun.c b/modules/parse_sun.c
209
index db36ae2..921daf4 100644
210
--- a/modules/parse_sun.c
211
+++ b/modules/parse_sun.c
212
@@ -1334,7 +1334,7 @@ int parse_mount(struct autofs_point *ap, const char *name,
213
char *pmapent, *options;
215
int mapent_len, rv = 0;
216
- int optlen, cur_state;
218
int slashify = ctxt->slashify_colons;
219
unsigned int append_options;
221
@@ -1389,7 +1389,6 @@ int parse_mount(struct autofs_point *ap, const char *name,
222
logerr(MODPREFIX "strdup: %s", estr);
225
- optlen = strlen(options);
227
p = skipspace(pmapent);
229
diff --git a/redhat/autofs.init.in b/redhat/autofs.init.in
230
index fded1d8..806302b 100644
231
--- a/redhat/autofs.init.in
232
+++ b/redhat/autofs.init.in
233
@@ -172,7 +172,7 @@ case "$1" in
237
- echo $"Usage: $0 {start|forcestart|stop|status|restart|orcerestart|reload|condrestart}"
238
+ echo $"Usage: $0 {start|forcestart|stop|status|restart|forcerestart|reload|condrestart}"