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