else if (!ast_strlen_zero(r->nonce)) {
char digest[1024];
- /* We have auth data to reuse, build a digest header! */
+ /* We have auth data to reuse, build a digest header.
+ * Note, this is not always useful because some parties do not
+ * like nonces to be reused (for good reasons!) so they will
+ * challenge us anyways.
+ */
if (sipdebug)
ast_debug(1, " >>> Re-using Auth data for %s@%s\n", r->username, r->hostname);
ast_string_field_set(p, realm, r->realm);
/* Handle authentication */
res = check_user_full(p, req, SIP_SUBSCRIBE, e, 0, sin, &authpeer);
/* if an authentication response was sent, we are done here */
- if (res == AUTH_CHALLENGE_SENT)
+ if (res == AUTH_CHALLENGE_SENT) /* authpeer = NULL here */
return 0;
if (res < 0) {
if (res == AUTH_FAKE_AUTH) {
return 0;
}
+ /* At this point, authpeer cannot be NULL. Remember we hold a reference,
+ * so we must release it when done.
+ * XXX must remove all the checks for authpeer == NULL.
+ */
+
/* Check if this user/peer is allowed to subscribe at all */
if (!ast_test_flag(&p->flags[1], SIP_PAGE2_ALLOWSUBSCRIBE)) {
transmit_response(p, "403 Forbidden (policy)", req);