]>
Commit | Line | Data |
---|---|---|
5b95b903 AJ |
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 | */ | |
94439e4e | 8 | |
9 | /* | |
10 | * allowusers.c | |
11 | * (C) 2000 Antonino Iannella, Stellar-X Pty Ltd | |
12 | * Released under GPL, see COPYING-2.0 for details. | |
26ac0430 | 13 | * |
94439e4e | 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 | ||
5b95b903 | 19 | #include "squid.h" |
074d6a40 AJ |
20 | #include "msntauth.h" |
21 | #include "usersfile.h" | |
22 | ||
23 | #include <cstdlib> | |
24 | #include <cstring> | |
94439e4e | 25 | #include <unistd.h> |
eb073b3b | 26 | #include <sys/types.h> |
94439e4e | 27 | #include <sys/param.h> |
28 | ||
eb073b3b | 29 | static usersfile AllowUsers; |
30 | static int init = 0; | |
94439e4e | 31 | |
eb073b3b | 32 | /* shared */ |
f53969cc | 33 | char Allowuserpath[MAXPATHLEN]; /* MAXPATHLEN defined in param.h */ |
94439e4e | 34 | |
94439e4e | 35 | int |
eb073b3b | 36 | Read_allowusers(void) |
94439e4e | 37 | { |
eb073b3b | 38 | if (!init) { |
26ac0430 AJ |
39 | memset(&AllowUsers, '\0', sizeof(AllowUsers)); |
40 | init = 1; | |
94439e4e | 41 | } |
811c6e76 | 42 | if (*Allowuserpath) |
26ac0430 | 43 | return Read_usersfile(Allowuserpath, &AllowUsers); |
811c6e76 | 44 | else |
26ac0430 | 45 | return 0; |
94439e4e | 46 | } |
47 | ||
94439e4e | 48 | int |
49 | Check_ifuserallowed(char *ConnectingUser) | |
50 | { | |
eb073b3b | 51 | return Check_userlist(&AllowUsers, ConnectingUser); |
94439e4e | 52 | } |
53 | ||
94439e4e | 54 | void |
eb073b3b | 55 | Check_forallowchange(void) |
94439e4e | 56 | { |
eb073b3b | 57 | Check_forfilechange(&AllowUsers); |
94439e4e | 58 | } |
f53969cc | 59 |