summaryrefslogtreecommitdiff
path: root/lib/gnutls_session.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2001-01-11 11:40:46 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2001-01-11 11:40:46 +0000
commit4136be371aa30706e6390fd6a94ef9a1b5271ee6 (patch)
tree3e042eaac309fce253cdc775bd3703ff8569eace /lib/gnutls_session.c
parent1c75aebb022ab287f911b9e16014a6cc96601446 (diff)
downloadgnutls-4136be371aa30706e6390fd6a94ef9a1b5271ee6.tar.gz
added server side session resuming (using gdbm)
Diffstat (limited to 'lib/gnutls_session.c')
-rw-r--r--lib/gnutls_session.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/gnutls_session.c b/lib/gnutls_session.c
index 16388fba9a..9fe4c92f5d 100644
--- a/lib/gnutls_session.c
+++ b/lib/gnutls_session.c
@@ -20,6 +20,7 @@
#include <defines.h>
#include "gnutls_int.h"
#include "gnutls_errors.h"
+#include "debug.h"
/* Returns all session parameters - in order to support resuming.
* The client should call this - and keep the returned session - if he wants to resume his
@@ -65,7 +66,10 @@ int gnutls_set_current_session( GNUTLS_STATE state, void* session, int session_s
return GNUTLS_E_UNIMPLEMENTED_FEATURE;
}
- memcpy( &state->gnutls_internals.resumed_security_parameters, session, sizeof(SecurityParameters));
-
+ if ( time(0) - ((SecurityParameters*)session)->timestamp <= state->gnutls_internals.expire_time) {
+ memcpy( &state->gnutls_internals.resumed_security_parameters, session, sizeof(SecurityParameters));
+ } else {
+ return GNUTLS_E_EXPIRED;
+ }
return 0;
}