]> arthur.barton.de Git - ngircd.git/blobdiff - src/ngircd/irc-login.c
Check G-Line and K-Line lists after authenticating clients
[ngircd.git] / src / ngircd / irc-login.c
index edaefd61cfc119fbd26de3a26d55eb65bc0146d0..140d68e0dcbaf96013b7878572e749e1dfccdfcd 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2010 Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2011 Alexander Barton (alex@barton.de) and Contributors.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -27,6 +27,7 @@
 
 #include "ngircd.h"
 #include "conn-func.h"
+#include "class.h"
 #include "conf.h"
 #include "channel.h"
 #include "io.h"
@@ -959,6 +960,7 @@ Hello_User(CLIENT * Client)
        } else {
                /* Sub process */
                Log_Init_Subprocess("Auth");
+               Conn_CloseAllSockets(NONE);
                result = PAM_Authenticate(Client);
                if (write(pipefd[1], &result, sizeof(result)) != sizeof(result))
                        Log_Subprocess(LOG_ERR,
@@ -1009,6 +1011,7 @@ cb_Read_Auth_Result(int r_fd, UNUSED short events)
 
        /* Read result from pipe */
        len = Proc_Read(proc, &result, sizeof(result));
+       Proc_Close(proc);
        if (len == 0)
                return;
 
@@ -1059,6 +1062,12 @@ Reject_Client(CLIENT *Client)
 static bool
 Hello_User_PostAuth(CLIENT *Client)
 {
+       if (Class_IsMember(CLASS_GLINE, Client) ||
+           Class_IsMember(CLASS_KLINE, Client)) {
+               Reject_Client(Client);
+               return DISCONNECTED;
+       }
+
        Introduce_Client(NULL, Client, CLIENT_USER);
 
        if (!IRC_WriteStrClient