diff options
| author | David Sommerseth <dazo@users.sourceforge.net> | 2008-11-29 23:56:09 +0100 |
|---|---|---|
| committer | David Sommerseth <dazo@users.sourceforge.net> | 2008-11-29 23:56:09 +0100 |
| commit | bd0257855f980b9460b19cf9ac0dbc6a8b971a85 (patch) | |
| tree | 3b074c189592a34d7fede768633f77fa54980632 /database/sqlite | |
| parent | 732ed6d747b49a0d794114ee660e76102ecd9f95 (diff) | |
| parent | c40b257f9e4657d0bffde2237073d2b8f3181f34 (diff) | |
| download | eurephia-bd0257855f980b9460b19cf9ac0dbc6a8b971a85.tar.gz eurephia-bd0257855f980b9460b19cf9ac0dbc6a8b971a85.tar.xz eurephia-bd0257855f980b9460b19cf9ac0dbc6a8b971a85.zip | |
Merge branch 'master' into eurephiadm
Diffstat (limited to 'database/sqlite')
| -rw-r--r-- | database/sqlite/edb-sqlite.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/database/sqlite/edb-sqlite.c b/database/sqlite/edb-sqlite.c index 270b3eb..c7729e5 100644 --- a/database/sqlite/edb-sqlite.c +++ b/database/sqlite/edb-sqlite.c @@ -52,14 +52,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} }; @@ -368,7 +369,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)); @@ -426,7 +428,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 ) { |
