commit b34126e279dc0553bfbc4e6de836427697b51866
parent 8b0dbe931ca515bf8876f9186a3e40aeb16d5ac4
Author: Naveen Narayanan <zerous@nocebo.space>
Date:   Mon, 27 Sep 2021 22:07:10 +0200
Remove attacker from list if login successful
Diffstat:
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git a/main.c b/main.c
@@ -99,6 +99,15 @@ main(int argc, char **argv)
 			ban(a);
 		}
 
+		if (islogin(statmsg)) {
+			printf("login detected\n");
+			SLIST_FOREACH(a, &head, attackers)
+				if (!strcmp(a->ip, ip)) {
+					printf("attacker deleted\n");
+					SLIST_REMOVE(&head, a, attacker, attackers);
+				}
+		}
+
 		if (c == EOF)
 			break;
 	}