17 #include <sys/ioctl.h>
35 char log_buf0[160], host_buf[64], line_buf[160];
47 for (loop = 0; loop < 2; loop++) {
52 bannedfile = fopen(
buf,
"r");
53 if (bannedfile == NULL) {
63 bannedfile = fopen(
buf,
"r");
64 if (bannedfile == NULL) {
72 while (fgets(line_buf, 160, bannedfile) != NULL) {
73 char *log_buf = log_buf0;
79 if (*line_buf ==
'#' || *line_buf ==
'\n')
82 indexpos = strrchr(line_buf,
'@');
83 if (indexpos == NULL) {
89 num1 = indexpos-line_buf;
90 strncpy(log_buf, line_buf, num1);
94 strncpy(host_buf, indexpos+1,
sizeof(host_buf)-1);
95 host_buf[
sizeof(host_buf)-1] =
'\0';
99 while (!isspace(*indexpos)) {
104 if (*log_buf ==
'~') {
116 else if (login != NULL && strcmp(login, log_buf) == 0)
120 if (*host_buf ==
'*') {
125 }
else if (strstr(host, host_buf) != NULL) {
130 }
else if (strcmp(host, host_buf) == 0) {
142 return(!inverse_ban);