]> granicus.if.org Git - sudo/commitdiff
Do not return -1 on error from the display functions; the call expects
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 4 Sep 2010 12:33:45 +0000 (08:33 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 4 Sep 2010 12:33:45 +0000 (08:33 -0400)
a return value >= 0.

--HG--
branch : 1.7

ldap.c
parse.c

diff --git a/ldap.c b/ldap.c
index a8dfe81c26f5b3fd675dd0a3a824fcf500d306a9..90ac8c2487a8007c6428a022cc10fa8bbbef146f 100644 (file)
--- a/ldap.c
+++ b/ldap.c
@@ -1233,7 +1233,7 @@ sudo_ldap_display_defaults(nss, pw, lbuf)
     int rc, count = 0;
 
     if (ld == NULL)
-       return(-1);
+       goto done;
 
     for (base = ldap_conf.base; base != NULL; base = base->next) {
        result = NULL;
@@ -1257,6 +1257,7 @@ sudo_ldap_display_defaults(nss, pw, lbuf)
        if (result)
            ldap_msgfree(result);
     }
+done:
     return(count);
 }
 
@@ -1446,7 +1447,7 @@ sudo_ldap_display_privs(nss, pw, lbuf)
     int rc, do_netgr, count = 0;
 
     if (ld == NULL)
-       return(-1);
+       goto done;
 
     /*
      * Okay - time to search for anything that matches this user
@@ -1488,6 +1489,7 @@ sudo_ldap_display_privs(nss, pw, lbuf)
        }
        efree(filt);
     }
+done:
     return(count);
 }
 
diff --git a/parse.c b/parse.c
index 245219e469b738369c867c551845c2628b52c061..97aba79ccaa4e1f3815a9fe14e2d8239e73c6e30 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -429,7 +429,7 @@ sudo_file_display_privs(nss, pw, lbuf)
     int nfound = 0;
 
     if (nss->handle == NULL)
-       return(-1);
+       goto done;
 
     tq_foreach_fwd(&userspecs, us) {
        if (userlist_matches(pw, &us->users) != ALLOW)
@@ -440,6 +440,7 @@ sudo_file_display_privs(nss, pw, lbuf)
        else
            nfound += sudo_file_display_priv_short(pw, us, lbuf);
     }
+done:
     return(nfound);
 }
 
@@ -457,7 +458,7 @@ sudo_file_display_defaults(nss, pw, lbuf)
     int nfound = 0;
 
     if (nss->handle == NULL)
-       return(-1);
+       goto done;
 
     if (lbuf->len == 0 || isspace((unsigned char)lbuf->buf[lbuf->len - 1]))
        prefix = "    ";
@@ -493,7 +494,7 @@ sudo_file_display_defaults(nss, pw, lbuf)
        prefix = ", ";
        nfound++;
     }
-
+done:
     return(nfound);
 }
 
@@ -594,7 +595,7 @@ sudo_file_display_cmnd(nss, pw)
     int host_match, runas_match, cmnd_match;
 
     if (nss->handle == NULL)
-       return(rval);
+       goto done;
 
     match = NULL;
     tq_foreach_rev(&userspecs, us) {
@@ -625,6 +626,7 @@ sudo_file_display_cmnd(nss, pw)
            user_args ? user_args : "");
        rval = 0;
     }
+done:
     return(rval);
 }