X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=pop.c;h=09af8a26dd6aa6d6b3549a8f5b6998a376cc58d4;hb=f65811dcdf69a5ac195d222fa406bbac9cde336d;hp=4e93caa5b19f37efbbbd315592578cc9348a0cde;hpb=8e59dc35c2ded6f600f4c9988d4cfad8e88beab4;p=cascardo%2Frnetproxy.git diff --git a/pop.c b/pop.c index 4e93caa..09af8a2 100644 --- a/pop.c +++ b/pop.c @@ -23,6 +23,7 @@ #include #include "nethook.h" #include "pop.h" +#include "usermap.h" typedef struct { @@ -82,14 +83,24 @@ 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); + gnet_conn_disconnect (hook->conn); + hook->close (hook); + 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 *