]> git.ipfire.org Git - thirdparty/squid.git/blob - helpers/basic_auth/MSNT/allowusers.cc
SourceFormat Enforcement
[thirdparty/squid.git] / helpers / basic_auth / MSNT / allowusers.cc
1 /*
2 * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 /*
10 * allowusers.c
11 * (C) 2000 Antonino Iannella, Stellar-X Pty Ltd
12 * Released under GPL, see COPYING-2.0 for details.
13 *
14 * These routines are to allow users attempting to use the proxy which
15 * have been explicitly allowed by the system administrator.
16 * The code originated from denyusers.c.
17 */
18
19 #include "squid.h"
20 #include "msntauth.h"
21 #include "usersfile.h"
22
23 #include <cstdlib>
24 #include <cstring>
25 #include <unistd.h>
26 #include <sys/types.h>
27 #include <sys/param.h>
28
29 static usersfile AllowUsers;
30 static int init = 0;
31
32 /* shared */
33 char Allowuserpath[MAXPATHLEN]; /* MAXPATHLEN defined in param.h */
34
35 int
36 Read_allowusers(void)
37 {
38 if (!init) {
39 memset(&AllowUsers, '\0', sizeof(AllowUsers));
40 init = 1;
41 }
42 if (*Allowuserpath)
43 return Read_usersfile(Allowuserpath, &AllowUsers);
44 else
45 return 0;
46 }
47
48 int
49 Check_ifuserallowed(char *ConnectingUser)
50 {
51 return Check_userlist(&AllowUsers, ConnectingUser);
52 }
53
54 void
55 Check_forallowchange(void)
56 {
57 Check_forfilechange(&AllowUsers);
58 }
59