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

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