diff options
author | Jeffrey Armstrong <jeff@approximatrix.com> | 2024-05-01 15:50:43 -0400 |
---|---|---|
committer | Jeffrey Armstrong <jeff@approximatrix.com> | 2024-05-01 15:50:43 -0400 |
commit | 9c92aab52131d7968c336cbec7ca723ad399910d (patch) | |
tree | 39d06b5f744a0dac8a29e77373fbe8ef7c5778b0 | |
parent | 9068d576f38399b820100b7f89518800fc3e8f94 (diff) | |
download | levitating-9c92aab52131d7968c336cbec7ca723ad399910d.tar.gz levitating-9c92aab52131d7968c336cbec7ca723ad399910d.zip |
Crypt module now has a c preprocessor flag to enable and disable crypt_gensalt call, which isn't on some debian systems.
-rw-r--r-- | captain/crypt.F90 (renamed from captain/crypt.f90) | 10 | ||||
-rw-r--r-- | captain/levitating-captain.prj | 6 |
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 +} |