2 #include "acl/FilledChecklist.h"
3 #include "client_side.h"
4 #include "comm/Connection.h"
5 #include "comm/forward.h"
7 #include "HttpRequest.h"
9 #include "auth/UserRequest.h"
10 #include "auth/AclProxyAuth.h"
13 CBDATA_CLASS_INIT(ACLFilledChecklist
);
16 ACLFilledChecklist::operator new (size_t size
)
18 assert (size
== sizeof(ACLFilledChecklist
));
19 CBDATA_INIT_TYPE(ACLFilledChecklist
);
20 ACLFilledChecklist
*result
= cbdataAlloc(ACLFilledChecklist
);
25 ACLFilledChecklist::operator delete (void *address
)
27 ACLFilledChecklist
*t
= static_cast<ACLFilledChecklist
*>(address
);
31 ACLFilledChecklist::ACLFilledChecklist() :
37 auth_user_request (NULL
),
48 destinationDomainChecked_(false),
49 sourceDomainChecked_(false)
57 ACLFilledChecklist::~ACLFilledChecklist()
59 assert (!asyncInProgress());
61 safe_free(dst_rdns
); // created by xstrdup().
64 cbdataReferenceDone(extacl_entry
);
66 HTTPMSGUNLOCK(request
);
70 cbdataReferenceDone(conn_
);
73 cbdataReferenceDone(sslErrors
);
76 debugs(28, 4, HERE
<< "ACLFilledChecklist destroyed " << this);
80 ACLFilledChecklist::conn() const
86 ACLFilledChecklist::conn(ConnStateData
*aConn
)
88 assert (conn() == NULL
);
89 conn_
= cbdataReference(aConn
);
93 ACLFilledChecklist::fd() const
95 return (conn_
!= NULL
&& conn_
->clientConnection
!= NULL
) ? conn_
->clientConnection
->fd
: fd_
;
99 ACLFilledChecklist::fd(int aDescriptor
)
101 assert(!conn() || conn()->clientConnection
== NULL
|| conn()->clientConnection
->fd
== aDescriptor
);
106 ACLFilledChecklist::destinationDomainChecked() const
108 return destinationDomainChecked_
;
112 ACLFilledChecklist::markDestinationDomainChecked()
114 assert (!finished() && !destinationDomainChecked());
115 destinationDomainChecked_
= true;
119 ACLFilledChecklist::sourceDomainChecked() const
121 return sourceDomainChecked_
;
125 ACLFilledChecklist::markSourceDomainChecked()
127 assert (!finished() && !sourceDomainChecked());
128 sourceDomainChecked_
= true;
132 * There are two common ACLFilledChecklist lifecycles paths:
134 * A) Using aclCheckFast(): The caller creates an ACLFilledChecklist object
135 * on stack and calls aclCheckFast().
137 * B) Using aclNBCheck() and callbacks: The caller allocates an
138 * ACLFilledChecklist object (via operator new) and passes it to
139 * aclNBCheck(). Control eventually passes to ACLChecklist::checkCallback(),
140 * which will invoke the callback function as requested by the
141 * original caller of aclNBCheck(). This callback function must
142 * *not* delete the list. After the callback function returns,
143 * checkCallback() will delete the list (i.e., self).
145 ACLFilledChecklist::ACLFilledChecklist(const acl_access
*A
, HttpRequest
*http_request
, const char *ident
):
151 auth_user_request(NULL
),
154 snmp_community(NULL
),
162 destinationDomainChecked_(false),
163 sourceDomainChecked_(false)
170 // cbdataReferenceDone() is in either fastCheck() or the destructor
172 accessList
= cbdataReference(A
);
174 if (http_request
!= NULL
) {
175 request
= HTTPMSGLOCK(http_request
);
176 #if FOLLOW_X_FORWARDED_FOR
177 if (Config
.onoff
.acl_uses_indirect_client
)
178 src_addr
= request
->indirect_client_addr
;
180 #endif /* FOLLOW_X_FORWARDED_FOR */
181 src_addr
= request
->client_addr
;
182 my_addr
= request
->my_addr
;
187 xstrncpy(rfc931
, ident
, USER_IDENT_SZ
);