int
http_access_verify(http_connection_t *hc, int mask)
{
+ int res = -1;
+
http_access_verify_ticket(hc);
+ if (hc->hc_access)
+ res = access_verify2(hc->hc_access, mask);
- if (hc->hc_access == NULL) {
+ if (res) {
+ access_destroy(hc->hc_access);
hc->hc_access = access_get(hc->hc_username, hc->hc_password,
(struct sockaddr *)hc->hc_peer);
- if (hc->hc_access == NULL)
- return -1;
+ if (hc->hc_access)
+ res = access_verify2(hc->hc_access, mask);
}
- return access_verify2(hc->hc_access, mask);
+ return res;
}
/**
if (ticket)
http_access_verify_ticket(hc);
- if (hc->hc_access == NULL) {
+ if (hc->hc_access)
+ res = access_verify2(hc->hc_access, mask);
+
+ if (res) {
+ access_destroy(hc->hc_access);
hc->hc_access = access_get(hc->hc_username, hc->hc_password,
(struct sockaddr *)hc->hc_peer);
- if (hc->hc_access == NULL)
- return -1;
+ if (hc->hc_access)
+ res = access_verify2(hc->hc_access, mask);
}
- if (access_verify2(hc->hc_access, mask))
- return -1;
+ if (!channel_access(ch, hc->hc_access, 0))
+ res = -1;
- if (channel_access(ch, hc->hc_access, 0))
- res = 0;
return res;
}