]> git.ipfire.org Git - thirdparty/squid.git/blame - helpers/external_acl/unix_group/check_group.c
Prep for 3.1.0.17
[thirdparty/squid.git] / helpers / external_acl / unix_group / check_group.c
CommitLineData
6328cedc 1/*
262a0e14 2 * $Id$
6328cedc 3 *
4 * This is a helper for the external ACL interface for Squid Cache
5 * Copyright (C) 2002 Rodrigo Albani de Campos (rodrigo@geekbunker.org)
26ac0430 6 *
6328cedc 7 * It reads STDIN looking for a username that matches a specified group
26ac0430 8 * Returns `OK' if the user belongs to the group or `ERR' otherwise, as
6328cedc 9 * described on http://devel.squid-cache.org/external_acl/config.html
10 * To compile this program, use:
11 *
12 * gcc -o check_group check_group.c
13 *
14 * Author: Rodrigo Albani de Campos
15 * E-Mail: rodrigo@geekbunker.org
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 2 of the License, or
20 * (at your option) any later version.
21 *
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
30 *
31 * Change Log:
1958420a 32 * Revision 1.7 2004/08/15 00:29:33 hno
33 * helper protocol changed to URL-escaped strings in Squid-3.0
34 *
6328cedc 35 * Revision 1.6 2002/08/12 15:48:32 hno
36 * imported strwordtok from Squid, added man page, some minor fixes
37 *
38 * Revision 1.5 2002/07/27 14:26:49 rcampos
39 * allow groups to be sent on stdin
40 *
41 * Revision 1.4 2002/04/17 01:58:48 camposr
42 * minor corrections in the getopt
43 *
44 * Revision 1.3 2002/04/17 01:43:17 camposr
45 * ready for action
46 *
47 * Revision 1.2 2002/04/17 01:32:16 camposr
48 * all main routines ready
49 *
50 * Revision 1.1 2002/04/16 05:02:32 camposr
51 * Initial revision
52 *
53 */
54
1fa9b1a7 55#include "rfc1738.h"
7483aded 56#include "util.h"
57
6328cedc 58#include <stdio.h>
59#include <stdlib.h>
60#include <string.h>
61#include <sys/types.h>
62#include <grp.h>
63#include <unistd.h>
64#include <pwd.h>
65#include <ctype.h>
66
6328cedc 67#define BUFSIZE 8192 /* the stdin buffer size */
68#define MAX_GROUP 10 /* maximum number of groups specified
26ac0430 69* on the command line */
6328cedc 70
26ac0430 71/*
6328cedc 72