File tree Expand file tree Collapse file tree 1 file changed +15
-14
lines changed Expand file tree Collapse file tree 1 file changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -236,6 +236,17 @@ check_user_token_mysql(const char *mysql_server,
236
236
return retval ;
237
237
}
238
238
239
+ /* we need to close the connection before the return */
240
+ if (mysql_stmt_close (stmt ))
241
+ {
242
+ if (verbose )
243
+ D (debug_file , "mysql_stmt_close() failed %s" , mysql_stmt_error (stmt ));
244
+ return retval ;
245
+ }
246
+
247
+ mysql_close (con );
248
+ mysql_library_end ();
249
+
239
250
while (!mysql_stmt_fetch (stmt ))
240
251
{
241
252
if (bind [0 ].is_null_value )
@@ -247,37 +258,27 @@ check_user_token_mysql(const char *mysql_server,
247
258
if (otp_id != NULL ){
248
259
if (int_data )
249
260
{
250
- return AUTH_FOUND ;
261
+ return AUTH_FOUND ; /* User and token verified */
251
262
}
252
263
else
253
264
{
254
- return AUTH_NOT_FOUND ;
265
+ return AUTH_NOT_FOUND ; /* User ok but bad token */
255
266
}
256
267
}
257
268
else if (otp_id == NULL )
258
269
{
259
270
if (int_data )
260
271
{
261
- return AUTH_NOT_FOUND ;
272
+ return AUTH_NOT_FOUND ; /* We found at least one line for the user */
262
273
}
263
274
else
264
275
{
265
- return AUTH_NO_TOKENS ;
276
+ return AUTH_NO_TOKENS ; /* We not found at least any line for the user */
266
277
}
267
278
}
268
279
}
269
280
}
270
281
271
- if (mysql_stmt_close (stmt ))
272
- {
273
- if (verbose )
274
- D (debug_file , "mysql_stmt_close() failed %s" , mysql_stmt_error (stmt ));
275
- return retval ;
276
- }
277
-
278
- mysql_close (con );
279
- mysql_library_end ();
280
-
281
282
return retval ;
282
283
}
283
284
#endif
You can’t perform that action at this time.
0 commit comments