[Freeswitch-dev] Minor log cleanup in sofia_reg.c

Beeton, Carolyn (Carolyn) cbeeton at avaya.com
Thu Nov 11 08:13:10 PST 2010


Here's a patch for a minor log cleanup in sofia_reg.c.   The "forbidden" variable is never set, so the logs keep showing a "challenge" being sent instead of "forbidden", when a registration is rejected.
 
diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c
index 67641ae..61bb4aa 100644
--- a/src/mod/endpoints/mod_sofia/sofia_reg.c
+++ b/src/mod/endpoints/mod_sofia/sofia_reg.c
@@ -816,7 +816,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
        char contact_str[1024] = "";
        int nat_hack = 0;
        uint8_t multi_reg = 0, multi_reg_contact = 0, avoid_multi_reg = 0;
-       uint8_t stale = 0, forbidden = 0;
+       uint8_t stale = 0;
        auth_res_t auth_res;
        long exptime = 300;
        switch_event_t *event;
@@ -1115,7 +1115,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
 
                if (auth_res != AUTH_OK && !stale) {
                        if (profile->debug) {
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send %s for [%s@%s]\n", forbidden ? "forbidden" : "challenge", to_user, to_host);
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send %s for [%s@%s]\n", (auth_res == AUTH_FORBIDDEN) ? "forbidden" : "challenge", to_user, to_host);
                        }
                        if (auth_res == AUTH_FORBIDDEN) {
                                nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());


More information about the FreeSWITCH-dev mailing list