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

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