517a82c5b6
Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
23 lines
610 B
C
23 lines
610 B
C
/* vi: set sw=4 ts=4: */
|
|
/*
|
|
* /etc/securetty checking.
|
|
*
|
|
* Licensed under GPLv2, see file LICENSE in this source tree.
|
|
*/
|
|
#include "libbb.h"
|
|
|
|
int FAST_FUNC check_securetty(const char *short_tty)
|
|
{
|
|
char *buf = (char*)"/etc/securetty"; /* any non-NULL is ok */
|
|
parser_t *parser = config_open2("/etc/securetty", fopen_for_read);
|
|
while (config_read(parser, &buf, 1, 1, "# \t", PARSE_NORMAL)) {
|
|
if (strcmp(buf, short_tty) == 0)
|
|
break;
|
|
buf = NULL;
|
|
}
|
|
config_close(parser);
|
|
/* buf != NULL here if config file was not found, empty
|
|
* or line was found which equals short_tty */
|
|
return buf != NULL;
|
|
}
|