aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--captain/crypt.F90 (renamed from captain/crypt.f90)10
-rw-r--r--captain/levitating-captain.prj6
2 files changed, 12 insertions, 4 deletions
diff --git a/captain/crypt.f90 b/captain/crypt.F90
index c19efdc..4bc1956 100644
--- a/captain/crypt.f90
+++ b/captain/crypt.F90
@@ -8,7 +8,8 @@ implicit none
type(c_ptr), value::setting
type(c_ptr)::crypt_c
end function crypt_c
-
+
+#ifdef HAS_CRYPT_GENSALT
function crypt_gensalt_c(prefix, count, rbytes, nrbytes) bind(c, name="crypt_gensalt")
use iso_c_binding
type(c_ptr), value::prefix
@@ -17,6 +18,8 @@ implicit none
integer(kind=c_int), value::nrbytes
type(c_ptr)::crypt_gensalt_c
end function crypt_gensalt_c
+#endif
+
end interface
contains
@@ -45,8 +48,13 @@ contains
hash => null()
! Build the salt
+#ifdef HAS_CRYPT_GENSALT
prefix = "$2b$"//c_null_char
c_salt_ptr = crypt_gensalt_c(c_loc(prefix), int(16,kind=c_long), c_null_ptr, 0)
+#else
+ prefix = "$1$"//c_null_char
+ c_salt_ptr = c_loc(prefix)
+#endif
allocate(c_phrase(len_trim(phrase)+1))
do i = 1,len_trim(phrase)
diff --git a/captain/levitating-captain.prj b/captain/levitating-captain.prj
index 078cccb..9eda195 100644
--- a/captain/levitating-captain.prj
+++ b/captain/levitating-captain.prj
@@ -105,7 +105,7 @@
"filename":"config.f90",
"enabled":"1"
},{
- "filename":"crypt.f90",
+ "filename":"crypt.F90",
"enabled":"1"
},{
"filename":"db.f90",
@@ -160,7 +160,7 @@
"Name":"levitating-captain (levitating-captain)",
"Options":{
"Compiler Options":{
- "Fortran Flags":"-DGNU",
+ "Fortran Flags":"-DGNU -DHAS_CRYPT_GENSALT",
"Link Flags":"-lsqlite3 -lssl -lcrypt",
"C Flags":""
},
@@ -213,4 +213,4 @@
"Link LAPACK":0
}
}
-} \ No newline at end of file
+}