2 ** Copyright (C) 2006 Thadeu Lima de Souza Cascardo <cascardo@minaslivre.org>
3 ** Copyright (C) 2009 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
5 ** This program is free software; you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation; either version 2 of the License, or
8 ** (at your option) any later version.
10 ** This program is distributed in the hope that it will be useful,
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ** GNU General Public License for more details.
15 ** You should have received a copy of the GNU General Public License
16 ** along with this program; if not, write to the Free Software
17 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 usage (char *programname)
36 fprintf (stderr, "%s {allow | deny} {add | del | list} [user]\n",
42 main (int argc, char **argv)
51 if (!strcmp (argv[1], "deny"))
52 db = "/var/lib/popproxy/deny.db";
53 else if (!strcmp (argv[1], "allow"))
54 db = "/var/lib/popproxy/allow.db";
57 if (!strcmp (argv[2], "add"))
59 else if (!strcmp (argv[2], "del"))
61 else if (!strcmp (argv[2], "list"))
65 if ((action == ACTION_ADD || action == ACTION_DEL) && argc < 4)
68 dp = dpopen (db, DP_OWRITER | DP_OCREAT, 0);
71 fprintf (stderr, "Could not create database.\n");
77 dpput (dp, username, -1, "", -1, DP_DOVER);
80 dpout (dp, username, -1);
83 fprintf (stderr, "Action not implemented.\n");
87 fprintf (stderr, "Action unrecognized.\n");