]> git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/ExtUser.cc
f2a15f68bcb2afac39b5de816a10c90082b9f104
[thirdparty/squid.git] / src / acl / ExtUser.cc
1 /*
2 * Copyright (C) 1996-2017 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 #include "http/Stream.h"
21
22 ACLExtUser::~ACLExtUser()
23 {
24 delete data;
25 }
26
27 ACLExtUser::ACLExtUser(ACLData<char const *> *newData, char const *newType) : data (newData), type_ (newType) {}
28
29 ACLExtUser::ACLExtUser (ACLExtUser const &old) : data (old.data->clone()), type_ (old.type_)
30 {}
31
32 ACLExtUser &
33 ACLExtUser::operator= (ACLExtUser const &rhs)
34 {
35 data = rhs.data->clone();
36 type_ = rhs.type_;
37 return *this;
38 }
39
40 char const *
41 ACLExtUser::typeString() const
42 {
43 return type_;
44 }
45
46 void
47 ACLExtUser::parseFlags()
48 {
49 ParseFlags(Acl::NoOptions(), data->supportedFlags());
50 }
51
52 void
53 ACLExtUser::parse()
54 {
55 data->parse();
56 }
57
58 int
59 ACLExtUser::match(ACLChecklist *cl)
60 {
61 ACLFilledChecklist *checklist = Filled(cl);
62 if (checklist->request->extacl_user.size()) {
63 return data->match(checklist->request->extacl_user.termedBuf());
64 } else {
65 return -1;
66 }
67 }
68
69 SBufList
70 ACLExtUser::dump() const
71 {
72 return data->dump();
73 }
74
75 bool
76 ACLExtUser::empty () const
77 {
78 return data->empty();
79 }
80
81 ACL *
82 ACLExtUser::clone() const
83 {
84 return new ACLExtUser(*this);
85 }
86
87 #endif /* USE_AUTH */
88