Blame SOURCES/autofs-5.1.1-move-check_nss_result-to-nsswitch_c.patch

4d476f
autofs-5.1.1 - move check_nss_result() to nsswitchr.c
4d476f
4d476f
From: Ian Kent <raven@themaw.net>
4d476f
4d476f
The check_nss_result() function will be needed by the multi-map lookup
4d476f
module so move it to the nss library module.
4d476f
4d476f
Signed-off-by: Ian Kent <raven@themaw.net>
4d476f
---
4d476f
 daemon/lookup.c    |   45 ---------------------------------------------
4d476f
 include/nsswitch.h |    1 +
4d476f
 lib/nsswitch.c     |   45 +++++++++++++++++++++++++++++++++++++++++++++
4d476f
 3 files changed, 46 insertions(+), 45 deletions(-)
4d476f
4d476f
diff --git a/daemon/lookup.c b/daemon/lookup.c
4d476f
index 62071df..53455a1 100644
4d476f
--- a/daemon/lookup.c
4d476f
+++ b/daemon/lookup.c
4d476f
@@ -25,51 +25,6 @@
4d476f
 #include "automount.h"
4d476f
 #include "nsswitch.h"
4d476f
 
4d476f
-static int check_nss_result(struct nss_source *this, enum nsswitch_status result)
4d476f
-{
4d476f
-	enum nsswitch_status status;
4d476f
-	struct nss_action a;
4d476f
-
4d476f
-	/* Check if we have negated actions */
4d476f
-	for (status = 0; status < NSS_STATUS_MAX; status++) {
4d476f
-		a = this->action[status];
4d476f
-		if (a.action == NSS_ACTION_UNKNOWN)
4d476f
-			continue;
4d476f
-
4d476f
-		if (a.negated && result != status) {
4d476f
-			if (a.action == NSS_ACTION_RETURN) {
4d476f
-				if (result == NSS_STATUS_SUCCESS)
4d476f
-					return 1;
4d476f
-				else
4d476f
-					return 0;
4d476f
-			}
4d476f
-		}
4d476f
-	}
4d476f
-
4d476f
-	a = this->action[result];
4d476f
-
4d476f
-	/* Check if we have other actions for this status */
4d476f
-	switch (result) {
4d476f
-	case NSS_STATUS_SUCCESS:
4d476f
-		if (a.action == NSS_ACTION_CONTINUE)
4d476f
-			break;
4d476f
-		return 1;
4d476f
-
4d476f
-	case NSS_STATUS_NOTFOUND:
4d476f
-	case NSS_STATUS_UNAVAIL:
4d476f
-	case NSS_STATUS_TRYAGAIN:
4d476f
-		if (a.action == NSS_ACTION_RETURN) {
4d476f
-			return 0;
4d476f
-		}
4d476f
-		break;
4d476f
-
4d476f
-	default:
4d476f
-		break;
4d476f
-	}
4d476f
-
4d476f
-	return -1;
4d476f
-}
4d476f
-
4d476f
 static void nsslist_cleanup(void *arg)
4d476f
 {
4d476f
 	struct list_head *nsslist = (struct list_head *) arg;
4d476f
diff --git a/include/nsswitch.h b/include/nsswitch.h
4d476f
index 2b445a9..d3e4027 100644
4d476f
--- a/include/nsswitch.h
4d476f
+++ b/include/nsswitch.h
4d476f
@@ -56,6 +56,7 @@ struct nss_source {
4d476f
 }; 
4d476f
 
4d476f
 int set_action(struct nss_action *a, char *status, char *action, int negated);
4d476f
+int check_nss_result(struct nss_source *this, enum nsswitch_status result);
4d476f
 struct nss_source *add_source(struct list_head *head, char *source);
4d476f
 int free_sources(struct list_head *list);
4d476f
 
4d476f
diff --git a/lib/nsswitch.c b/lib/nsswitch.c
4d476f
index c6163a7..74c7525 100644
4d476f
--- a/lib/nsswitch.c
4d476f
+++ b/lib/nsswitch.c
4d476f
@@ -55,6 +55,51 @@ int set_action(struct nss_action *act, char *status, char *action, int negated)
4d476f
 	return 1;
4d476f
 }
4d476f
 
4d476f
+int check_nss_result(struct nss_source *this, enum nsswitch_status result)
4d476f
+{
4d476f
+	enum nsswitch_status status;
4d476f
+	struct nss_action a;
4d476f
+
4d476f
+	/* Check if we have negated actions */
4d476f
+	for (status = 0; status < NSS_STATUS_MAX; status++) {
4d476f
+		a = this->action[status];
4d476f
+		if (a.action == NSS_ACTION_UNKNOWN)
4d476f
+			continue;
4d476f
+
4d476f
+		if (a.negated && result != status) {
4d476f
+			if (a.action == NSS_ACTION_RETURN) {
4d476f
+				if (result == NSS_STATUS_SUCCESS)
4d476f
+					return 1;
4d476f
+				else
4d476f
+					return 0;
4d476f
+			}
4d476f
+		}
4d476f
+	}
4d476f
+
4d476f
+	a = this->action[result];
4d476f
+
4d476f
+	/* Check if we have other actions for this status */
4d476f
+	switch (result) {
4d476f
+	case NSS_STATUS_SUCCESS:
4d476f
+		if (a.action == NSS_ACTION_CONTINUE)
4d476f
+			break;
4d476f
+		return 1;
4d476f
+
4d476f
+	case NSS_STATUS_NOTFOUND:
4d476f
+	case NSS_STATUS_UNAVAIL:
4d476f
+	case NSS_STATUS_TRYAGAIN:
4d476f
+		if (a.action == NSS_ACTION_RETURN) {
4d476f
+			return 0;
4d476f
+		}
4d476f
+		break;
4d476f
+
4d476f
+	default:
4d476f
+		break;
4d476f
+	}
4d476f
+
4d476f
+	return -1;
4d476f
+}
4d476f
+
4d476f
 struct nss_source *add_source(struct list_head *head, char *source)
4d476f
 {
4d476f
 	struct nss_source *s;