summary refs log tree commit diff
path: root/bounce.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-08-27 18:23:58 -0400
committerJune McEnroe <june@causal.agency>2020-08-27 18:23:58 -0400
commit76f1d0775b52e7a8a1c322214836cde530117512 (patch)
tree5b0850d4cb7eabaa2c927e02c3bb4055d5237c47 /bounce.c
parentRemove rc scripts (diff)
downloadpounce-76f1d0775b52e7a8a1c322214836cde530117512.tar.gz
pounce-76f1d0775b52e7a8a1c322214836cde530117512.zip
Add support for OpenBSD
Diffstat (limited to '')
-rw-r--r--bounce.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/bounce.c b/bounce.c
index 95e3711..924a01b 100644
--- a/bounce.c
+++ b/bounce.c
@@ -64,6 +64,15 @@
 
 bool verbose;
 
+#ifdef __OpenBSD__
+static void hashPass(void) {
+	char hash[_PASSWORD_LEN];
+	char *pass = getpass("Password: ");
+	int error = crypt_newhash(pass, "bcrypt,a", hash, sizeof(hash));
+	if (error) err(EX_OSERR, "crypt_newhash");
+	printf("%s\n", hash);
+}
+#else
 static void hashPass(void) {
 	byte rand[12];
 	int error = getentropy(rand, sizeof(rand));
@@ -75,6 +84,7 @@ static void hashPass(void) {
 	char *pass = getpass("Password: ");
 	printf("%s\n", crypt(pass, salt));
 }
+#endif
 
 static void genReq(const char *path) {
 	const char *name = strrchr(path, '/');