debug_return_int(nfound);
}
+/*
+ * Returns the number of matching privileges or -1 on error.
+ */
int
sudo_file_display_privs(struct sudo_nss *nss, struct passwd *pw,
struct sudo_lbuf *lbuf)
debug_return_int(nfound);
}
+/*
+ * Returns 0 if the command is allowed, 1 if not or -1 on error.
+ */
int
sudo_file_display_cmnd(struct sudo_nss *nss, struct passwd *pw)
{
/*
* Print out privileges for the specified user.
- * We only get here if the user is allowed to run something.
+ * Returns true if the user is allowed to run commands, false if not
+ * or -1 on error.
*/
-bool
+int
display_privs(struct sudo_nss_list *snl, struct passwd *pw)
{
struct sudo_nss *nss;
sudo_lbuf_destroy(&defs);
sudo_lbuf_destroy(&privs);
- debug_return_bool(true); /* XXX */
+ debug_return_int(count > 0);
}
/*
* Check user_cmnd against sudoers and print the matching entry if the
* command is allowed.
- * Returns true if the command is allowed, else false.
+ * Returns true if the command is allowed, false if not or -1 on error.
*/
-bool
+int
display_cmnd(struct sudo_nss_list *snl, struct passwd *pw)
{
struct sudo_nss *nss;
debug_decl(display_cmnd, SUDOERS_DEBUG_NSS)
+ /* XXX - display_cmnd return value is backwards */
TAILQ_FOREACH(nss, snl, entries) {
if (nss->display_cmnd(nss, pw) == 0)
- debug_return_bool(true);
+ debug_return_int(true);
}
- debug_return_bool(false);
+ debug_return_int(false);
}
/*
- * Copyright (c) 2007-2011, 2013 Todd C. Miller <Todd.Miller@courtesan.com>
+ * Copyright (c) 2007-2011, 2013-2015 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
char *sudo_getepw(const struct passwd *);
/* sudo_nss.c */
-bool display_privs(struct sudo_nss_list *, struct passwd *);
-bool display_cmnd(struct sudo_nss_list *, struct passwd *);
+int display_privs(struct sudo_nss_list *, struct passwd *);
+int display_cmnd(struct sudo_nss_list *, struct passwd *);
/* pwutil.c */
__dso_public struct group *sudo_getgrgid(gid_t);