|
|
516ab0 |
autofs-5.1.1 - fix return handling in sss lookup module
|
|
|
516ab0 |
|
|
|
516ab0 |
From: Ian Kent <raven@themaw.net>
|
|
|
516ab0 |
|
|
|
516ab0 |
In the sss lookup module some of the calls don't distinguish between
|
|
|
516ab0 |
no entry found and service unavailable.
|
|
|
516ab0 |
|
|
|
516ab0 |
If service unavailable gets returned from a master map read it results
|
|
|
516ab0 |
in autofs not updating the mounts. A notfound return doesn't because it
|
|
|
516ab0 |
indicates the map doesn't exist so updating the mounts isn't a problem
|
|
|
516ab0 |
as it can be when the source is unavailable.
|
|
|
516ab0 |
|
|
|
516ab0 |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
516ab0 |
---
|
|
|
516ab0 |
CHANGELOG | 1 +
|
|
|
516ab0 |
modules/lookup_sss.c | 24 +++++++++++++++++-------
|
|
|
516ab0 |
2 files changed, 18 insertions(+), 7 deletions(-)
|
|
|
516ab0 |
|
|
|
516ab0 |
--- autofs-5.0.7.orig/CHANGELOG
|
|
|
516ab0 |
+++ autofs-5.0.7/CHANGELOG
|
|
|
516ab0 |
@@ -171,6 +171,7 @@
|
|
|
516ab0 |
- fix mount as you go offset selection.
|
|
|
516ab0 |
- init qdn before use in get_query_dn().
|
|
|
516ab0 |
- fix left mount count return from umount_multi_triggers().
|
|
|
516ab0 |
+- fix return handling in sss lookup module.
|
|
|
516ab0 |
|
|
|
516ab0 |
25/07/2012 autofs-5.0.7
|
|
|
516ab0 |
=======================
|
|
|
516ab0 |
--- autofs-5.0.7.orig/modules/lookup_sss.c
|
|
|
516ab0 |
+++ autofs-5.0.7/modules/lookup_sss.c
|
|
|
516ab0 |
@@ -148,9 +148,8 @@ static int setautomntent(unsigned int lo
|
|
|
516ab0 |
error(logopt, MODPREFIX "setautomntent: %s", estr);
|
|
|
516ab0 |
if (*sss_ctxt)
|
|
|
516ab0 |
free(*sss_ctxt);
|
|
|
516ab0 |
- return 0;
|
|
|
516ab0 |
}
|
|
|
516ab0 |
- return 1;
|
|
|
516ab0 |
+ return ret;
|
|
|
516ab0 |
}
|
|
|
516ab0 |
|
|
|
516ab0 |
static int endautomntent(unsigned int logopt,
|
|
|
516ab0 |
@@ -161,9 +160,8 @@ static int endautomntent(unsigned int lo
|
|
|
516ab0 |
char buf[MAX_ERR_BUF];
|
|
|
516ab0 |
char *estr = strerror_r(ret, buf, MAX_ERR_BUF);
|
|
|
516ab0 |
error(logopt, MODPREFIX "endautomntent: %s", estr);
|
|
|
516ab0 |
- return 0;
|
|
|
516ab0 |
}
|
|
|
516ab0 |
- return 1;
|
|
|
516ab0 |
+ return ret;
|
|
|
516ab0 |
}
|
|
|
516ab0 |
|
|
|
516ab0 |
int lookup_read_master(struct master *master, time_t age, void *context)
|
|
|
516ab0 |
@@ -180,8 +178,12 @@ int lookup_read_master(struct master *ma
|
|
|
516ab0 |
char *value = NULL;
|
|
|
516ab0 |
int count, ret;
|
|
|
516ab0 |
|
|
|
516ab0 |
- if (!setautomntent(logopt, ctxt, ctxt->mapname, &sss_ctxt))
|
|
|
516ab0 |
+ ret = setautomntent(logopt, ctxt, ctxt->mapname, &sss_ctxt);
|
|
|
516ab0 |
+ if (ret) {
|
|
|
516ab0 |
+ if (ret == ENOENT)
|
|
|
516ab0 |
+ return NSS_STATUS_NOTFOUND;
|
|
|
516ab0 |
return NSS_STATUS_UNAVAIL;
|
|
|
516ab0 |
+ }
|
|
|
516ab0 |
|
|
|
516ab0 |
count = 0;
|
|
|
516ab0 |
while (1) {
|
|
|
516ab0 |
@@ -280,8 +282,12 @@ int lookup_read_map(struct autofs_point
|
|
|
516ab0 |
return NSS_STATUS_SUCCESS;
|
|
|
516ab0 |
}
|
|
|
516ab0 |
|
|
|
516ab0 |
- if (!setautomntent(ap->logopt, ctxt, ctxt->mapname, &sss_ctxt))
|
|
|
516ab0 |
+ ret = setautomntent(ap->logopt, ctxt, ctxt->mapname, &sss_ctxt);
|
|
|
516ab0 |
+ if (ret) {
|
|
|
516ab0 |
+ if (ret == ENOENT)
|
|
|
516ab0 |
+ return NSS_STATUS_NOTFOUND;
|
|
|
516ab0 |
return NSS_STATUS_UNAVAIL;
|
|
|
516ab0 |
+ }
|
|
|
516ab0 |
|
|
|
516ab0 |
count = 0;
|
|
|
516ab0 |
while (1) {
|
|
|
516ab0 |
@@ -386,8 +392,12 @@ static int lookup_one(struct autofs_poin
|
|
|
516ab0 |
|
|
|
516ab0 |
mc = source->mc;
|
|
|
516ab0 |
|
|
|
516ab0 |
- if (!setautomntent(ap->logopt, ctxt, ctxt->mapname, &sss_ctxt))
|
|
|
516ab0 |
+ ret = setautomntent(ap->logopt, ctxt, ctxt->mapname, &sss_ctxt);
|
|
|
516ab0 |
+ if (ret) {
|
|
|
516ab0 |
+ if (ret == ENOENT)
|
|
|
516ab0 |
+ return NSS_STATUS_NOTFOUND;
|
|
|
516ab0 |
return NSS_STATUS_UNAVAIL;
|
|
|
516ab0 |
+ }
|
|
|
516ab0 |
|
|
|
516ab0 |
ret = ctxt->getautomntbyname_r(qKey, &value, sss_ctxt);
|
|
|
516ab0 |
if (ret && ret != ENOENT) {
|