File autofs-5.0.9-check-for-non-existent-negative-entries.patch of Package autofs.14028

From 6b2e474abe659e9294cdaa321a3aefca88b967d9 Mon Sep 17 00:00:00 2001
From: Ian Kent <raven@themaw.net>
Date: Tue, 8 Apr 2014 13:43:54 +0800
Subject: [PATCH] autofs-5.0.9 - check for non existent negative entries in
 lookup_ghost()
References: bsc#1087774
Git-commit: 6b2e474abe659e9294cdaa321a3aefca88b967d9

Map entries that have been created in the cache due to a negative lookup
but don't exist in the map source shouldn't have directories created.
In fact map entries that are negative shouldn't have directories created
at all since they should have neen created befor the entry became negative.

Acked-by: Jeff Mahoney <jeffm@suse.com>
---
 CHANGELOG       | 1 +
 daemon/lookup.c | 8 ++++++++
 2 files changed, 9 insertions(+)

[mkoutny: dropped CHANGELOG hunk]

diff --git a/daemon/lookup.c b/daemon/lookup.c
index 999be9d..9f96830 100644
--- a/daemon/lookup.c
+++ b/daemon/lookup.c
@@ -716,6 +716,14 @@ int lookup_ghost(struct autofs_point *ap, const char *root)
 		cache_readlock(mc);
 		me = cache_enumerate(mc, NULL);
 		while (me) {
+			/*
+			 * Map entries that have been created in the cache
+			 * due to a negative lookup shouldn't have directories
+			 * created if they haven't already been created.
+			 */
+			if (!me->mapent)
+				goto next;
+
 			if (!strcmp(me->key, "*"))
 				goto next;
 
-- 
2.13.6
openSUSE Build Service is sponsored by