Browse Source

modules/ims_registrar_pcscf: Check if we subscribe to reg_info before processing notify - fix crash

Richard Good 9 years ago
parent
commit
a176c7f1e5
1 changed files with 7 additions and 0 deletions
  1. 7 0
      modules/ims_registrar_pcscf/notify.c

+ 7 - 0
modules/ims_registrar_pcscf/notify.c

@@ -79,6 +79,8 @@
 extern usrloc_api_t ul;
 extern time_t time_now;
 
+extern int subscribe_to_reginfo;
+
 int process_contact(udomain_t * _d, int expires, str contact_uri, int contact_state) {
     char bufport[5], *rest, *sep, *val, *port, *trans;
     pcontact_t* pcontact;
@@ -476,6 +478,11 @@ int reginfo_handle_notify(struct sip_msg* msg, char* domain, char* s2) {
     LM_DBG("Handling notify\n");
     str body;
     int result = 1;
+    
+    if(subscribe_to_reginfo != 1){
+        LM_ERR("Received a NOTIFY for reg-info but I have not SUBSCRIBED for them.  Ignoring");
+        return -1;
+    }
 
     /* If not done yet, parse the whole message now: */
     if (parse_headers(msg, HDR_EOH_F, 0) == -1) {