aboutsummaryrefslogtreecommitdiff
path: root/captain
diff options
context:
space:
mode:
Diffstat (limited to 'captain')
-rw-r--r--captain/crypt.F90 (renamed from captain/crypt.f90)10
-rw-r--r--captain/db.f902
-rw-r--r--captain/example/levitating.xinetd20
-rw-r--r--captain/levitating-captain.prj6
-rw-r--r--captain/templates/redirect.html1
5 files changed, 24 insertions, 15 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/db.f90 b/captain/db.f90
index 7ee0515..389e19e 100644
--- a/captain/db.f90
+++ b/captain/db.f90
@@ -1716,7 +1716,7 @@ contains
session_expired_db = .true.
! Statement should return the count of sessions that _has not_ expired!
- if(stmt%prepare(db, "SELECT COUNT(*) FROM sessions WHERE accessed > datetime('now', '-30 minutes') AND session=?") &
+ if(stmt%prepare(db, "SELECT COUNT(*) FROM sessions WHERE accessed > datetime('now', '-1 day') AND session=?") &
== SQLITE_OK) &
then
diff --git a/captain/example/levitating.xinetd b/captain/example/levitating.xinetd
index 3c78286..16eb0a1 100644
--- a/captain/example/levitating.xinetd
+++ b/captain/example/levitating.xinetd
@@ -3,14 +3,14 @@
service gemini
{
- type = UNLISTED
- port = 1965
- socket_type = stream
- protocol = tcp
- wait = no
- user = jeff
- disable = no
- only_from = 127.0.0.1
- server = /home/jeff/Workspace/levitating/captain/levitating-captain
- server_args = -g -c /home/jeff/Workspace/levitating/captain/example/levitating.conf
+ type = UNLISTED
+ port = 1965
+ socket_type = stream
+ protocol = tcp
+ wait = no
+ user = pi
+ disable = no
+ server = /home/jeff/Workspace/levitating/captain/levitating-captain
+ server_args = -g -c /home/jeff/Workspace/levitating/captain/example/levitating.conf
+ instances = 30
}
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
+}
diff --git a/captain/templates/redirect.html b/captain/templates/redirect.html
index dec695f..d3b09ab 100644
--- a/captain/templates/redirect.html
+++ b/captain/templates/redirect.html
@@ -6,5 +6,6 @@
<title>Command Received</title>
</head>
<body>
+ <p><a href='{{ base_url }}/{{ destination }}'>Head on over to your destination!</a></p>
</body>
</html>