fix db read, forgot to exec query

This commit is contained in:
Pliable Pixels 2019-05-08 12:06:37 -04:00
parent 04c3bebef9
commit 3c6d0131ff
1 changed files with 6 additions and 1 deletions

View File

@ -172,7 +172,12 @@ User *zmLoadTokenUser (std::string jwt_token_str, bool use_remote_addr ) {
char sql[ZM_SQL_MED_BUFSIZ] = ""; char sql[ZM_SQL_MED_BUFSIZ] = "";
snprintf(sql, sizeof(sql), snprintf(sql, sizeof(sql),
"SELECT Id, Username, Enabled, Stream+0, Events+0, Control+0, Monitors+0, System+0, MonitorIds" "SELECT Id, Username, Enabled, Stream+0, Events+0, Control+0, Monitors+0, System+0, MonitorIds"
" FROM Users where Username = '%s' and Enabled = 1", username.c_str() ); " FROM Users WHERE Username = '%s' and Enabled = 1", username.c_str() );
if ( mysql_query(&dbconn, sql) ) {
Error("Can't run query: %s", mysql_error(&dbconn));
exit(mysql_errno(&dbconn));
}
MYSQL_RES *result = mysql_store_result(&dbconn); MYSQL_RES *result = mysql_store_result(&dbconn);
if ( !result ) { if ( !result ) {