summaryrefslogtreecommitdiffstats
path: root/database/sqlite
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2008-11-29 23:54:32 +0100
committerDavid Sommerseth <dazo@users.sourceforge.net>2008-11-29 23:54:32 +0100
commitc40b257f9e4657d0bffde2237073d2b8f3181f34 (patch)
tree45ccd5aa1d1c7354f6c21af9351e2d3a353f5860 /database/sqlite
parent622fb9169d5c554d5f5c8ca42e978f133be5bb45 (diff)
downloadeurephia-c40b257f9e4657d0bffde2237073d2b8f3181f34.tar.gz
eurephia-c40b257f9e4657d0bffde2237073d2b8f3181f34.tar.xz
eurephia-c40b257f9e4657d0bffde2237073d2b8f3181f34.zip
BUGFIX: Use hard coded default values when checking against openvpn_attempts if config parameters is not set
Diffstat (limited to 'database/sqlite')
-rw-r--r--database/sqlite/edb-sqlite.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/database/sqlite/edb-sqlite.c b/database/sqlite/edb-sqlite.c
index bcbf3ec..80a014d 100644
--- a/database/sqlite/edb-sqlite.c
+++ b/database/sqlite/edb-sqlite.c
@@ -48,14 +48,15 @@ typedef struct {
char *colname;
char *allow_cfg;
char *descr;
+ char *default_value;
} eDBattempt_types_t;
static const eDBattempt_types_t eDBattempt_types[] = {
{NULL, NULL, NULL},
- {"remoteip\0", "allow_ipaddr_attempts\0", "IP Address\0"},
- {"digest\0", "allow_cert_attempts\0", "Certificate\0"},
- {"username\0", "allow_username_attempts\0", "Username\0"},
+ {"remoteip\0", "allow_ipaddr_attempts\0", "IP Address\0", "10\0"},
+ {"digest\0", "allow_cert_attempts\0", "Certificate\0", "5\0"},
+ {"username\0", "allow_username_attempts\0", "Username\0", "5\0"},
{NULL, NULL, NULL}
};
@@ -363,7 +364,8 @@ int eDBblacklist_check(eurephiaCTX *ctx, const int type, const char *val)
// attempt limit, blacklist it
atpr = sqlite_query(ctx,
"SELECT atpid, attempts >= %q FROM openvpn_attempts WHERE %s = '%q'",
- eGet_value(ctx->dbc->config, eDBattempt_types[type].allow_cfg),
+ defaultValue(eGet_value(ctx->dbc->config, eDBattempt_types[type].allow_cfg),
+ eDBattempt_types[type].default_value),
eDBattempt_types[type].colname, val);
if( atpr != NULL ) {
atpid = strdup_nullsafe(sqlite_get_value(atpr, 0, 0));
@@ -421,7 +423,8 @@ void eDBregister_attempt(eurephiaCTX *ctx, int type, int mode, const char *value
" FROM openvpn_attempts "
" LEFT JOIN openvpn_blacklist USING(%s)"
" WHERE %s = '%q'",
- eGet_value(ctx->dbc->config, eDBattempt_types[type].allow_cfg),
+ defaultValue(eGet_value(ctx->dbc->config, eDBattempt_types[type].allow_cfg),
+ eDBattempt_types[type].default_value),
eDBattempt_types[type].colname,
eDBattempt_types[type].colname, value);
if( res == NULL ) {