Remove unneeded server name information in ssl status.
[cascardo/rnetproxy.git] / pop.c
diff --git a/pop.c b/pop.c
index 4e93caa..0477815 100644 (file)
--- a/pop.c
+++ b/pop.c
 **  
 */
 
-#include <gnet.h>
 #include <glib.h>
 #include <string.h>
 #include "nethook.h"
 #include "pop.h"
+#include "usermap.h"
 
 typedef struct
 {
@@ -82,14 +82,23 @@ pop_read (net_hook_t *hook, gchar *buffer, size_t len)
 {
   pop_t *pop = hook->data;
   g_string_append_len (pop->buffer, buffer, len);
-  hook->data = pop->orig_data;
   while (pop_getline (pop) == 0)
     {
       if (pop_check_user (pop) == 0)
-        g_message ("User is trying to authenticate as %s.", pop->user);
+        {
+          g_message ("User is trying to authenticate as %s.", pop->user);
+          if (usermap_perm (pop->user) == ACCESS_DENY)
+            {
+              g_message ("Denying access to user %s.", pop->user);
+              pop_destroy (hook);
+              hc_conn_close (hook->conn);
+              return;
+            }
+        }
+      hook->data = pop->orig_data;
       pop->orig_read (hook, pop->line->str, pop->line->len);
+      hook->data = pop;
     }
-  hook->data = pop;
 }
 
 net_hook_t *