File: allowusers.c

package info (click to toggle)
squid3 3.0.PRE5-5%2Betch2
  • links: PTS
  • area: main
  • in suites: etch
  • size: 21,188 kB
  • ctags: 20,388
  • sloc: cpp: 119,851; ansic: 30,259; sh: 10,465; makefile: 3,289; perl: 1,267; awk: 84; xml: 58
file content (49 lines) | stat: -rw-r--r-- 978 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

/*
 * allowusers.c
 * (C) 2000 Antonino Iannella, Stellar-X Pty Ltd
 * Released under GPL, see COPYING-2.0 for details.
 * 
 * These routines are to allow users attempting to use the proxy which
 * have been explicitly allowed by the system administrator.
 * The code originated from denyusers.c.
 */

#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/param.h>
#include <string.h>
#include "usersfile.h"
#include "msntauth.h"

static usersfile AllowUsers;
static int init = 0;

/* shared */
char Allowuserpath[MAXPATHLEN];	/* MAXPATHLEN defined in param.h */

int
Read_allowusers(void)
{
    if (!init) {
	memset(&AllowUsers, '\0', sizeof(AllowUsers));
	init = 1;
    }
    if (*Allowuserpath)
	return Read_usersfile(Allowuserpath, &AllowUsers);
    else
	return 0;
}

int
Check_ifuserallowed(char *ConnectingUser)
{
    return Check_userlist(&AllowUsers, ConnectingUser);
}

void
Check_forallowchange(void)
{
    Check_forfilechange(&AllowUsers);
}