2 #include "acl/FilledChecklist.h"
3 #include "client_side.h"
4 #include "comm/Connection.h"
5 #include "comm/forward.h"
7 #include "HttpRequest.h"
8 #include "SquidConfig.h"
10 #include "auth/AclProxyAuth.h"
11 #include "auth/UserRequest.h"
14 CBDATA_CLASS_INIT(ACLFilledChecklist
);
16 ACLFilledChecklist::ACLFilledChecklist() :
22 auth_user_request (NULL
),
33 destinationDomainChecked_(false),
34 sourceDomainChecked_(false)
42 ACLFilledChecklist::~ACLFilledChecklist()
44 assert (!asyncInProgress());
46 safe_free(dst_rdns
); // created by xstrdup().
49 cbdataReferenceDone(extacl_entry
);
51 HTTPMSGUNLOCK(request
);
55 cbdataReferenceDone(conn_
);
58 cbdataReferenceDone(sslErrors
);
61 debugs(28, 4, HERE
<< "ACLFilledChecklist destroyed " << this);
65 ACLFilledChecklist::conn() const
71 ACLFilledChecklist::conn(ConnStateData
*aConn
)
75 assert (conn() == NULL
);
76 conn_
= cbdataReference(aConn
);
80 ACLFilledChecklist::fd() const
82 return (conn_
!= NULL
&& conn_
->clientConnection
!= NULL
) ? conn_
->clientConnection
->fd
: fd_
;
86 ACLFilledChecklist::fd(int aDescriptor
)
88 assert(!conn() || conn()->clientConnection
== NULL
|| conn()->clientConnection
->fd
== aDescriptor
);
93 ACLFilledChecklist::destinationDomainChecked() const
95 return destinationDomainChecked_
;
99 ACLFilledChecklist::markDestinationDomainChecked()
101 assert (!finished() && !destinationDomainChecked());
102 destinationDomainChecked_
= true;
106 ACLFilledChecklist::sourceDomainChecked() const
108 return sourceDomainChecked_
;
112 ACLFilledChecklist::markSourceDomainChecked()
114 assert (!finished() && !sourceDomainChecked());
115 sourceDomainChecked_
= true;
119 * There are two common ACLFilledChecklist lifecycles paths:
121 * A) Using aclCheckFast(): The caller creates an ACLFilledChecklist object
122 * on stack and calls aclCheckFast().
124 * B) Using aclNBCheck() and callbacks: The caller allocates an
125 * ACLFilledChecklist object (via operator new) and passes it to
126 * aclNBCheck(). Control eventually passes to ACLChecklist::checkCallback(),
127 * which will invoke the callback function as requested by the
128 * original caller of aclNBCheck(). This callback function must
129 * *not* delete the list. After the callback function returns,
130 * checkCallback() will delete the list (i.e., self).
132 ACLFilledChecklist::ACLFilledChecklist(const acl_access
*A
, HttpRequest
*http_request
, const char *ident
):
138 auth_user_request(NULL
),
141 snmp_community(NULL
),
149 destinationDomainChecked_(false),
150 sourceDomainChecked_(false)
157 // cbdataReferenceDone() is in either fastCheck() or the destructor
159 accessList
= cbdataReference(A
);
161 if (http_request
!= NULL
) {
162 request
= http_request
;
163 HTTPMSGLOCK(request
);
164 #if FOLLOW_X_FORWARDED_FOR
165 if (Config
.onoff
.acl_uses_indirect_client
)
166 src_addr
= request
->indirect_client_addr
;
168 #endif /* FOLLOW_X_FORWARDED_FOR */
169 src_addr
= request
->client_addr
;
170 my_addr
= request
->my_addr
;
172 if (request
->clientConnectionManager
.valid())
173 conn(request
->clientConnectionManager
.get());
178 xstrncpy(rfc931
, ident
, USER_IDENT_SZ
);