aboutsummaryrefslogtreecommitdiff
path: root/consent.c
diff options
context:
space:
mode:
Diffstat (limited to 'consent.c')
-rw-r--r--consent.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/consent.c b/consent.c
index c2ab677..61710b0 100644
--- a/consent.c
+++ b/consent.c
@@ -14,21 +14,22 @@ int main_consent(int secure) {
} else {
printf("\033[r\033[H\033[J");
}
- printf("Program %s (process %d: '%s'), is requesting your authorization.\n",
- "/TODO",
+ printf("Program %s from user %d (process %d: '%s'), is asking for authorization.\n",
+ a_env.exe,
+ a_env.usr,
a_env.pid,
"todo");
switch (a_env.mode) {
case mode_consent: {
- printf("Do you consent '%s'? (Y / N) ", a_env.prompt);
+ printf("Consent '%s'? (Y / N) ", a_env.prompt);
char buf[5];
if (read(STDIN_FILENO, buf, sizeof(buf) - 1) < 0) {
int r = errno;
LOGFV("read: %m", r);
- printf("Cannot read your response: %m. Press any key to return.\n",
- errno);
- fgetc(stdin);
if (secure) {
+ printf("Cannot read response: %m. Press any key to return.\n",
+ errno);
+ fgetc(stdin);
printf("\033[r\033[H\033[J");
}
return r;
@@ -41,22 +42,21 @@ int main_consent(int secure) {
break;
}
case mode_password: {
- printf("Enter your password for '%s'. "
+ printf("Enter password for '%s'. "
"The program will know your password.\n"
"Password: ", a_env.prompt);
char buf[10];
- if (read(STDIN_FILENO, buf, sizeof(buf) - 1) < 0) {
+ if (!fgets(buf, sizeof(buf) - 1, stdin)) {
int r = errno;
LOGFV("read: %m", r);
- printf("Cannot read your response: %m. Press any key to return.\n",
- errno);
- fgetc(stdin);
if (secure) {
+ printf("Cannot read your response: %m. Press any key to return.\n",
+ errno);
+ fgetc(stdin);
printf("\033[r\033[H\033[J");
}
return r;
}
- buf[sizeof(buf) - 1] = '\0';
dprintf(p_env.out, "%s", buf);
break;
}