simplified call to expire cookies

This commit is contained in:
Nikos Mavrogiannopoulos
2013-02-04 22:17:33 +01:00
parent 1222fcf803
commit 013cc82993
4 changed files with 6 additions and 7 deletions

View File

@@ -33,7 +33,7 @@
#include <gdbm.h> #include <gdbm.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <vpn.h> #include <main.h>
#include <cookies.h> #include <cookies.h>
/* All the functions return zero on success and a negative value on error */ /* All the functions return zero on success and a negative value on error */
@@ -104,7 +104,7 @@ finish:
return ret; return ret;
} }
void expire_cookies(const struct cfg_st *cfg) void expire_cookies(main_server_st* s)
{ {
GDBM_FILE dbf; GDBM_FILE dbf;
datum key; datum key;
@@ -113,7 +113,7 @@ int deleted = 0;
struct stored_cookie_st sc; struct stored_cookie_st sc;
time_t now = time(0); time_t now = time(0);
dbf = gdbm_open((char*)cfg->cookie_db, 0, GDBM_WRITER, 0, NULL); dbf = gdbm_open((char*)s->config->cookie_db, 0, GDBM_WRITER, 0, NULL);
if (dbf == NULL) if (dbf == NULL)
return; return;

View File

@@ -1,7 +1,7 @@
#ifndef COOKIES_H #ifndef COOKIES_H
#define COOKIES_H #define COOKIES_H
#include <vpn.h> #include <main.h>
struct __attribute__ ((__packed__)) stored_cookie_st { struct __attribute__ ((__packed__)) stored_cookie_st {
char username[MAX_USERNAME_SIZE]; char username[MAX_USERNAME_SIZE];
@@ -11,7 +11,7 @@ struct __attribute__ ((__packed__)) stored_cookie_st {
int store_cookie(const struct cfg_st *, const void* cookie, unsigned cookie_size, int store_cookie(const struct cfg_st *, const void* cookie, unsigned cookie_size,
const struct stored_cookie_st* sc); const struct stored_cookie_st* sc);
void expire_cookies(const struct cfg_st *cfg); void expire_cookies(main_server_st* s);
int retrieve_cookie(const struct cfg_st *, const void* cookie, unsigned cookie_size, int retrieve_cookie(const struct cfg_st *, const void* cookie, unsigned cookie_size,
struct stored_cookie_st* sc); struct stored_cookie_st* sc);

View File

@@ -8,7 +8,6 @@
#include <unistd.h> #include <unistd.h>
#include <net/if.h> #include <net/if.h>
#include <vpn.h> #include <vpn.h>
#include <cookies.h>
#include <tlslib.h> #include <tlslib.h>
typedef enum { typedef enum {

View File

@@ -600,7 +600,7 @@ fork_failed:
syslog(LOG_INFO, "Performing maintainance"); syslog(LOG_INFO, "Performing maintainance");
clear_lists(&s); clear_lists(&s);
expire_cookies(&config); expire_cookies(&s);
expire_tls_sessions(&s); expire_tls_sessions(&s);
exit(0); exit(0);