]> granicus.if.org Git - sudo/commitdiff
Avoid printing empty "Runas and Command-specific defaults for user"
authorTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 14 Feb 2011 16:29:25 +0000 (11:29 -0500)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 14 Feb 2011 16:29:25 +0000 (11:29 -0500)
line.

--HG--
branch : 1.7

sudo_nss.c

index 6bda69abb01e1c280540fa9094693dae04da82bf..96303202ed5eb61325461def47f7f7141004c1a3 100644 (file)
@@ -248,7 +248,7 @@ display_privs(snl, pw)
 {
     struct sudo_nss *nss;
     struct lbuf defs, privs;
-    int count;
+    int count, olen;
 
     /* Reset group vector so group matching works correctly. */
     reset_groups(pw);
@@ -269,6 +269,7 @@ display_privs(snl, pw)
        defs.len = 0;
 
     /* Display Runas and Cmnd-specific defaults from all sources. */
+    olen = defs.len;
     lbuf_append(&defs, "Runas and Command-specific defaults for ", pw->pw_name,
        ":\n", NULL);
     count = 0;
@@ -277,6 +278,8 @@ display_privs(snl, pw)
     }
     if (count)
        lbuf_append(&defs, "\n\n", NULL);
+    else
+       defs.len = olen;
 
     /* Display privileges from all sources. */
     lbuf_append(&privs, "User ", pw->pw_name,