15 #include <sys/ioctl.h>
18 #include <sys/ptyio.h>
41 char log_buf0[160], host_buf[64], line_buf[160];
53 for (loop = 0; loop < 2; loop++) {
59 bannedfile = fopen(buf,
"r");
60 if (bannedfile == NULL) {
70 bannedfile = fopen(buf,
"r");
71 if (bannedfile == NULL) {
79 while (fgets(line_buf, 160, bannedfile) != NULL) {
80 char *log_buf = log_buf0;
86 if (*line_buf ==
'#' || *line_buf ==
'\n')
89 indexpos = strrchr(line_buf,
'@');
90 if (indexpos == NULL) {
96 num1 = indexpos-line_buf;
97 strncpy(log_buf, line_buf, num1);
101 strncpy(host_buf, indexpos+1,
sizeof(host_buf)-1);
102 host_buf[
sizeof(host_buf)-1] =
'\0';
106 while (!isspace(*indexpos)) {
111 if (*log_buf ==
'~') {
123 else if (login != NULL && strcmp(login, log_buf) == 0)
127 if (*host_buf ==
'*') {
132 }
else if (strstr(host, host_buf) != NULL) {
137 }
else if (strcmp(host, host_buf) == 0) {
149 return(!inverse_ban);
int snprintf(char *dest, int max, const char *format,...)
int checkbanned(const char *login, const char *host)
void LOG(LogLevel logLevel, const char *format,...)