summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuigi Rizzo <rizzo@icir.org>2006-10-22 21:08:07 +0000
committerLuigi Rizzo <rizzo@icir.org>2006-10-22 21:08:07 +0000
commitdc83868813c12b011b16e500ef20dde2ac9de0ea (patch)
tree9308427d8debb98619259e6f0bcec02568e3bc51
parente7c0a0524a8742cb40ce47cfff3e56bb7b2ce16f (diff)
more streamlining of check_user_full
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45915 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--channels/chan_sip.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index d5ba111da..ccb63fef2 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -8867,7 +8867,7 @@ static enum check_auth_result check_user_full(struct sip_pvt *p, struct sip_requ
char *of;
char rpid_num[50];
const char *rpid;
- enum check_auth_result res = AUTH_SUCCESSFUL;
+ enum check_auth_result res;
char *t;
char calleridname[50];
int debug=sip_debug_test_addr(sin);
@@ -9033,7 +9033,11 @@ static enum check_auth_result check_user_full(struct sip_pvt *p, struct sip_requ
*/
peer = find_peer(NULL, &p->recv, 1);
- if (peer) {
+ if (!peer) {
+ if (debug)
+ ast_verbose("Found no matching peer or user for '%s:%d'\n", ast_inet_ntoa(p->recv.sin_addr), ntohs(p->recv.sin_port));
+
+ } else {
/* Set Frame packetization */
if (p->rtp) {
ast_rtp_codec_setpref(p->rtp, &peer->prefs);
@@ -9133,19 +9137,17 @@ static enum check_auth_result check_user_full(struct sip_pvt *p, struct sip_requ
p->t38.jointcapability &= p->t38.peercapability;
}
ASTOBJ_UNREF(peer, sip_destroy_peer);
- } else {
- if (debug)
- ast_verbose("Found no matching peer or user for '%s:%d'\n", ast_inet_ntoa(p->recv.sin_addr), ntohs(p->recv.sin_port));
-
- /* do we allow guests? */
- if (!global_allowguest) {
- if (global_alwaysauthreject)
- res = AUTH_FAKE_AUTH; /* reject with fake authorization request */
- else
- res = AUTH_SECRET_FAILED; /* we don't want any guests, authentication will fail */
- }
+ return res;
}
+ /* Finally, apply the guest policy */
+ if (global_allowguest)
+ res = AUTH_SUCCESSFUL;
+ else if (global_alwaysauthreject)
+ res = AUTH_FAKE_AUTH; /* reject with fake authorization request */
+ else
+ res = AUTH_SECRET_FAILED; /* we don't want any guests, authentication will fail */
+
return res;
}