Change user db table name to users, change mac column name to ether

Clean up
This commit is contained in:
Soner Tari 2019-03-02 03:44:14 +03:00
parent c37bcc6de1
commit 1f451aa04d
3 changed files with 3 additions and 5 deletions

3
main.c
View File

@ -631,8 +631,7 @@ main(int argc, char *argv[])
sqlite3_close(opts->userdb);
exit(EXIT_FAILURE);
}
// @todo Change mac column to ether
if (sqlite3_prepare_v2(opts->userdb, "UPDATE ip2user SET atime = ?1 WHERE ip = ?2 AND user = ?3 AND mac = ?4", 200, &opts->update_user_atime, NULL)) {
if (sqlite3_prepare_v2(opts->userdb, "UPDATE users SET atime = ?1 WHERE ip = ?2 AND user = ?3 AND ether = ?4", 200, &opts->update_user_atime, NULL)) {
fprintf(stderr, "Error preparing update_user_atime sql stmt: %s\n", sqlite3_errmsg(opts->userdb));
sqlite3_close(opts->userdb);
exit(EXIT_FAILURE);

View File

@ -279,7 +279,6 @@ struct pxy_conn_ctx {
unsigned int identify_user_count;
char *user;
char *ether;
unsigned int ether_count;
unsigned int redirected : 1;
#ifdef HAVE_LOCAL_PROCINFO

View File

@ -422,8 +422,8 @@ pxy_thrmgr_run(pxy_thrmgr_ctx_t *ctx)
ctx->thr[idx]->timeout_count = 0;
ctx->thr[idx]->thrmgr = ctx;
if (ctx->opts->user_auth && sqlite3_prepare_v2(ctx->opts->userdb, "SELECT user,mac,atime FROM ip2user WHERE ip = ?1", 100, &ctx->thr[idx]->get_user, NULL)) {
log_err_level_printf(LOG_CRIT, "Error preparing get_user_sql_stmt: %s\n", sqlite3_errmsg(ctx->opts->userdb));
if (ctx->opts->user_auth && sqlite3_prepare_v2(ctx->opts->userdb, "SELECT user,ether,atime FROM users WHERE ip = ?1", 100, &ctx->thr[idx]->get_user, NULL)) {
log_err_level_printf(LOG_CRIT, "Error preparing get_user sql stmt: %s\n", sqlite3_errmsg(ctx->opts->userdb));
goto leave;
}
}