summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2021-02-01 12:40:22 -0500
committerJakob Kaivo <jkk@ung.org>2021-02-01 12:40:22 -0500
commit7e2116e5b07bd2a065bc9b8f1cbc63f57e41e285 (patch)
tree200a10cbdaf2afc165f0064fc19863fdc9ccfc76
parent17372f6493abb2eac71e937b85ec5514b14b1454 (diff)
clean up output
-rw-r--r--check/check.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/check/check.c b/check/check.c
index a776053..e95637a 100644
--- a/check/check.c
+++ b/check/check.c
@@ -27,8 +27,9 @@ void fatal(int include_errno, char *fmt, ...)
exit(EXIT_FAILURE);
}
-static int authorize(const char *user)
+static int authenticate(const char *user)
{
+ printf("need to authenticate\n");
(void)user;
return 1;
}
@@ -39,7 +40,6 @@ static char *get_username(void)
if (pwd == NULL) {
fatal(1, "unable to determine user name");
}
- printf("checking for user %s\n", pwd->pw_name);
return pwd->pw_name;
}
@@ -49,7 +49,6 @@ static char *get_groupname(void)
if (grp == NULL) {
fatal(1, "unable to determine group name");
}
- printf("checking for group %s\n", grp->gr_name);
return grp->gr_name;
}
@@ -59,7 +58,6 @@ static char *get_command(int argc, char *argv[])
fatal(1, "missing operands");
}
- printf("checking command %s\n", argv[1]);
return argv[1];
}
@@ -73,13 +71,12 @@ int main(int argc, char *argv[])
char *group = get_groupname();
switch (get_permission(user, group, cmd)) {
- case NEED_AUTH:
- if (authorize(user) != 0) {
- fatal(0, "bad authorization");
+ case AUTHENTICATE:
+ if (authenticate(user) != 0) {
+ fatal(0, "bad authentication");
}
/* FALLTHRU */
- case NO_AUTH:
- puts("granted");
+ case AUTHORIZED:
return 0;
case DENIED: