]> granicus.if.org Git - sudo/commitdiff
Add #ifdef PURITY
authorTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 31 Mar 2008 15:24:28 +0000 (15:24 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 31 Mar 2008 15:24:28 +0000 (15:24 +0000)
pwutil.c

index f8ddac83940467f67a8e2bb84f1071e3bbe2ef8f..6fb49b59397795dcf8b6477da2e33fc482f59d23 100644 (file)
--- a/pwutil.c
+++ b/pwutil.c
@@ -370,7 +370,7 @@ sudo_setpwent()
        pwcache_byname = rbcreate(cmp_pwnam);
 }
 
-#ifdef notyet
+#ifdef PURIFY
 static void pw_free    __P((void *));
 
 void
@@ -398,13 +398,16 @@ pw_free(v)
     }
     efree(pw);
 }
-#endif
+#endif /* PURIFY */
 
 void
 sudo_endpwent()
 {
     endpwent();
     sudo_endspent();
+#ifdef PURIFY
+    sudo_freepwcache();
+#endif
 }
 
 /*
@@ -567,23 +570,26 @@ sudo_setgrent()
        grcache_byname = rbcreate(cmp_grnam);
 }
 
-#if 0
+#ifdef PURIFY
 void
 sudo_freegrcache()
 {
-    if (free_cache && grcache_bygid != NULL) {
+    if (grcache_bygid != NULL) {
        rbdestroy(grcache_bygid, free);
        grcache_bygid = NULL;
     }
-    if (free_cache && grcache_byname != NULL) {
+    if (grcache_byname != NULL) {
        rbdestroy(grcache_byname, NULL);
        grcache_byname = NULL;
     }
 }
-#endif
+#endif /* PURIFY */
 
 void
 sudo_endgrent()
 {
     endgrent();
+#ifdef PURIFY
+    sudo_freegrcache();
+#endif
 }