popproxy_SOURCES = popproxy.c log.c log.h nethook.c nethook.h \
proto_detect.c proto_detect.h jabber.c jabber.h jabber_server.c \
iksemel_extra.c iksemel_extra.h null.c null.h ssl.c ssl.h \
- ssl_server.c pop.c pop.h
+ ssl_server.c pop.c pop.h usermap.c usermap.h
sysconf_DATA = popproxy.conf
#include <string.h>
#include "nethook.h"
#include "pop.h"
+#include "usermap.h"
typedef struct
{
{
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);
+ 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 *
--- /dev/null
+/*
+** Copyright (C) 2006 Thadeu Lima de Souza Cascardo <cascardo@minaslivre.org>
+** Copyright (C) 2009 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
+**
+** 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
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+*/
+
+#include <string.h>
+#include "usermap.h"
+
+int
+usermap_perm (char *user)
+{
+ return ACCESS_DENY;
+}
--- /dev/null
+/*
+** Copyright (C) 2006 Thadeu Lima de Souza Cascardo <cascardo@minaslivre.org>
+** Copyright (C) 2009 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
+**
+** 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
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+*/
+
+#ifndef POPPROXY_USERMAP_H
+#define POPPROXY_USERMAP_H
+
+enum
+{
+ ACCESS_ALLOW,
+ ACCESS_DENY
+};
+
+int usermap_perm (char *);
+
+#endif