]> git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/ExtUser.cc
Boilerplate: update copyright blurbs on src/
[thirdparty/squid.git] / src / acl / ExtUser.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 /* DEBUG: section 28 Access Control */
10
11 #include "squid.h"
12
13 #if USE_AUTH
14
15 #include "acl/ExtUser.h"
16 #include "acl/FilledChecklist.h"
17 #include "acl/RegexData.h"
18 #include "acl/UserData.h"
19 #include "client_side.h"
20
21 ACLExtUser::~ACLExtUser()
22 {
23 delete data;
24 }
25
26 ACLExtUser::ACLExtUser(ACLData<char const *> *newData, char const *newType) : data (newData), type_ (newType) {}
27
28 ACLExtUser::ACLExtUser (ACLExtUser const &old) : data (old.data->clone()), type_ (old.type_)
29 {}
30
31 ACLExtUser &
32 ACLExtUser::operator= (ACLExtUser const &rhs)
33 {
34 data = rhs.data->clone();
35 type_ = rhs.type_;
36 return *this;
37 }
38
39 char const *
40 ACLExtUser::typeString() const
41 {
42 return type_;
43 }
44
45 void
46 ACLExtUser::parse()
47 {
48 debugs(28, 3, "aclParseUserList: current is null. Creating");
49 data = new ACLUserData;
50 data->parse();
51 }
52
53 int
54 ACLExtUser::match(ACLChecklist *cl)
55 {
56 ACLFilledChecklist *checklist = Filled(cl);
57 if (checklist->request->extacl_user.size()) {
58 return data->match(checklist->request->extacl_user.termedBuf());
59 } else {
60 return -1;
61 }
62 }
63
64 SBufList
65 ACLExtUser::dump() const
66 {
67 return data->dump();
68 }
69
70 bool
71 ACLExtUser::empty () const
72 {
73 return data->empty();
74 }
75
76 ACL *
77 ACLExtUser::clone() const
78 {
79 return new ACLExtUser(*this);
80 }
81
82 #endif /* USE_AUTH */