]> git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/ExtUser.cc
merge from trunk r14444
[thirdparty/squid.git] / src / acl / ExtUser.cc
1 /*
2 * Copyright (C) 1996-2015 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 data->parse();
49 }
50
51 int
52 ACLExtUser::match(ACLChecklist *cl)
53 {
54 ACLFilledChecklist *checklist = Filled(cl);
55 if (checklist->request->extacl_user.size()) {
56 return data->match(checklist->request->extacl_user.termedBuf());
57 } else {
58 return -1;
59 }
60 }
61
62 SBufList
63 ACLExtUser::dump() const
64 {
65 return data->dump();
66 }
67
68 bool
69 ACLExtUser::empty () const
70 {
71 return data->empty();
72 }
73
74 ACL *
75 ACLExtUser::clone() const
76 {
77 return new ACLExtUser(*this);
78 }
79
80 #endif /* USE_AUTH */
81