| 125 | } |
| 126 | |
| 127 | static int init_auth(void) |
| 128 | { |
| 129 | const int mysql_reconnect_val = 1; |
| 130 | |
| 131 | db_conn = mysql_init(NULL); |
| 132 | mysql_options(db_conn, MYSQL_OPT_RECONNECT, &mysql_reconnect_val); |
| 133 | |
| 134 | /* Connect to database */ |
| 135 | if (!mysql_real_connect(db_conn, db_host, |
| 136 | db_user, db_pass, db_db, 0, NULL, 0)) { |
| 137 | fd_log_error("[AUTH] failed to connect to MySQL: %s", mysql_error(db_conn)); |
| 138 | return errno; |
| 139 | } else { |
| 140 | fd_log_debug("[AUTH] connected to MySQL"); |
| 141 | } |
| 142 | |
| 143 | return 0; |
| 144 | } |
| 145 | |
| 146 | static FILE *get_acc_log(void) |
| 147 | { |