@@ -32,21 +32,23 @@ int database_check(const struct su_context *ctx)
32
32
if ((fp = fopen (filename , "r" ))) {
33
33
LOGD ("Found file %s" , filename );
34
34
35
- fgets (allow , sizeof (allow ), fp );
36
- last = strlen (allow ) - 1 ;
37
- if (last >= 0 )
38
- allow [last ] = 0 ;
35
+ while ( fgets (allow , sizeof (allow ), fp )) {
36
+ last = strlen (allow ) - 1 ;
37
+ if (last >= 0 )
38
+ allow [last ] = 0 ;
39
39
40
- char cmd [ARG_MAX ];
41
- fgets (cmd , sizeof (cmd ), fp );
42
- /* skip trailing '\n' */
43
- last = strlen (cmd ) - 1 ;
44
- if (last >= 0 )
45
- cmd [last ] = 0 ;
40
+ char cmd [ARG_MAX ];
41
+ fgets (cmd , sizeof (cmd ), fp );
42
+ /* skip trailing '\n' */
43
+ last = strlen (cmd ) - 1 ;
44
+ if (last >= 0 )
45
+ cmd [last ] = 0 ;
46
46
47
- LOGD ("Comparing '%s' to '%s'" , cmd , get_command (& ctx -> to ));
48
- if (strcmp (cmd , get_command (& ctx -> to )) != 0 ) {
49
- strcpy (allow , "prompt" );
47
+ LOGD ("Comparing '%s' to '%s'" , cmd , get_command (& ctx -> to ));
48
+ if (strcmp (cmd , get_command (& ctx -> to )) == 0 )
49
+ break ;
50
+ else
51
+ strcpy (allow , "prompt" );
50
52
}
51
53
fclose (fp );
52
54
} else if ((fp = fopen (REQUESTOR_STORED_DEFAULT , "r" ))) {
0 commit comments