about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-09-02 18:11:51 -0400
committerJune McEnroe <june@causal.agency>2021-09-02 18:12:17 -0400
commit404807039d3636a97a0337880c1339db6c8b6d1b (patch)
tree6334e6e06ea7528547c00037805ec3ca6ef612e6
parentOpenBSD: pledge(2) printCert code path separately (diff)
downloadpounce-404807039d3636a97a0337880c1339db6c8b6d1b.tar.gz
pounce-404807039d3636a97a0337880c1339db6c8b6d1b.zip
OpenBSD: pledge(2) the hashPass code path
-rw-r--r--bounce.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bounce.c b/bounce.c
index 2fe6589..d8e9b87 100644
--- a/bounce.c
+++ b/bounce.c
@@ -577,9 +577,11 @@ int main(int argc, char *argv[]) {
 
 #ifdef __OpenBSD__
 static void hashPass(void) {
+	int error = pledge("stdio tty", NULL);
+	if (error) err(EX_OSERR, "pledge");
 	char hash[_PASSWORD_LEN];
 	char *pass = getpass("Password: ");
-	int error = crypt_newhash(pass, "bcrypt,a", hash, sizeof(hash));
+	error = crypt_newhash(pass, "bcrypt,a", hash, sizeof(hash));
 	if (error) err(EX_OSERR, "crypt_newhash");
 	printf("%s\n", hash);
 }