]> granicus.if.org Git - sudo/commitdiff
Add macro to test if the tag changed to improve readability.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 10 Apr 2005 21:44:27 +0000 (21:44 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 10 Apr 2005 21:44:27 +0000 (21:44 +0000)
parse.c

diff --git a/parse.c b/parse.c
index b92dd4bd528464ed8419dfa2b11152f1be04e324..b44bec5a014e2ae835ce67f627f61de240437bec 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -200,6 +200,8 @@ sudoers_lookup(pwflag)
     return(validated);
 }
 
+#define        TAG_CHANGED(t)  (cs->tags.t != UNSPEC && cs->tags.t != tags.t)
+
 /*
  * Print out privileges for the specified user.
  */
@@ -252,15 +254,15 @@ display_privs(pw)
                    }
                    print_priv(") ");
                }
-               if (cs->tags.monitor != UNSPEC && cs->tags.monitor != tags.monitor) {
+               if (TAG_CHANGED(monitor)) {
                    print_priv(cs->tags.monitor ? "MONITOR: " : "NOMONITOR: ");
                    tags.monitor = cs->tags.monitor;
                }
-               if (cs->tags.noexec != UNSPEC && cs->tags.noexec != tags.noexec) {
+               if (TAG_CHANGED(noexec)) {
                    print_priv(cs->tags.monitor ? "EXEC: " : "NOEXEC: ");
                    tags.noexec = cs->tags.noexec;
                }
-               if (cs->tags.nopasswd != UNSPEC && cs->tags.nopasswd != tags.nopasswd) {
+               if (TAG_CHANGED(nopasswd)) {
                    print_priv(cs->tags.monitor ? "PASSWD: " : "NOPASSWD: ");
                    tags.nopasswd = cs->tags.nopasswd;
                }