]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Add better handling of time values when the times aren't defined. Fix formatting...
authorWilliam King <william.king@quentustech.com>
Mon, 10 Sep 2012 15:59:38 +0000 (08:59 -0700)
committerWilliam King <william.king@quentustech.com>
Mon, 10 Sep 2012 16:00:00 +0000 (09:00 -0700)
src/mod/xml_int/mod_xml_radius/mod_radius.diff [new file with mode: 0644]
src/mod/xml_int/mod_xml_radius/mod_xml_radius.c
src/mod/xml_int/mod_xml_radius/xml_radius.conf.xml

diff --git a/src/mod/xml_int/mod_xml_radius/mod_radius.diff b/src/mod/xml_int/mod_xml_radius/mod_radius.diff
new file mode 100644 (file)
index 0000000..f32d39e
--- /dev/null
@@ -0,0 +1,59 @@
+diff --git src/mod/xml_int/mod_xml_radius/mod_xml_radius.c src/mod/xml_int/mod_xml_radius/mod_xml_radius.c
+index 0707388..e9e6e2a 100644
+--- src/mod/xml_int/mod_xml_radius/mod_xml_radius.c
++++ src/mod/xml_int/mod_xml_radius/mod_xml_radius.c
+@@ -367,6 +367,10 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
+                                       switch_time_t time = profile->times->created;
+                                       switch_time_exp_t tm;
+                                       
++                                      if ( !time ) {
++                                              goto err;
++                                      }
++                                      
+                                       switch_time_exp_lt(&tm, time);
+                                       av_value = switch_mprintf("%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
+                                                                                         tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
+@@ -381,6 +385,10 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
+                                       switch_caller_profile_t *profile = switch_channel_get_caller_profile(channel);
+                                       switch_time_t time = profile->times->answered;
+                                       switch_time_exp_t tm;
++
++                                      if ( !time ) {
++                                              goto err;
++                                      }
+                                       
+                                       switch_time_exp_lt(&tm, time);
+                                       
+@@ -397,6 +405,10 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
+                                       switch_caller_profile_t *profile = switch_channel_get_caller_profile(channel);
+                                       switch_time_t time = profile->times->hungup;
+                                       switch_time_exp_t tm;
++
++                                      if ( !time ) {
++                                              goto err;
++                                      }
+                                       
+                                       switch_time_exp_lt(&tm, time);
+                                       
+diff --git src/mod/xml_int/mod_xml_radius/xml_radius.conf.xml src/mod/xml_int/mod_xml_radius/xml_radius.conf.xml
+index eb3070c..6349d05 100644
+--- src/mod/xml_int/mod_xml_radius/xml_radius.conf.xml
++++ src/mod/xml_int/mod_xml_radius/xml_radius.conf.xml
+@@ -22,7 +22,7 @@
+       <param vendor="Cisco" name="Cisco-AVPair" variable="ip" format="src-gw-ip=%s"/>
+       <param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_user" format="src-gw-name=%s"/>
+       <param vendor="Cisco" name="h323-conf-id" variable="Core-UUID" format="%s"/>
+-      <param vendor="Cisco" name="Cisco-AVPair" variable="ip" format="number"/>
++      <param vendor="Cisco" name="Cisco-AVPair" variable="ip" format="request-type=number"/>
+       <param name="Called-Station-Id" variable="sip_to_user" format="%s"/>
+       <param name="Calling-Station-Id" variable="sip_from_user" format="%s"/>
+       <param name="User-Name" variable="sip_from_user" format="%s"/>
+@@ -48,7 +48,7 @@
+       <param name="seqfile" value="/var/run/radius.seq"/>
+     </connection>
+     <fields>
+-      <param vendor="Cisco" name="Cisco-AVPair" variable="ip" format="user"/>
++      <param vendor="Cisco" name="Cisco-AVPair" variable="ip" format="request-type=user"/>
+       <param vendor="Cisco" name="Cisco-AVPair" variable="ip" format="src-gw-ip=%s"/>
+       <param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_user" format="src-gw-name=%s"/>
+       <param name="User-Name" variable="sip_from_user" format="%s"/>
index 0707388374757a90b673b33a3f8666339d503a1d..e9e6e2ac82f54eb12caab8ce276c0a08c6b812aa 100644 (file)
@@ -367,6 +367,10 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
                                        switch_time_t time = profile->times->created;
                                        switch_time_exp_t tm;
                                        
+                                       if ( !time ) {
+                                               goto err;
+                                       }
+                                       
                                        switch_time_exp_lt(&tm, time);
                                        av_value = switch_mprintf("%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
                                                                                          tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
@@ -381,6 +385,10 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
                                        switch_caller_profile_t *profile = switch_channel_get_caller_profile(channel);
                                        switch_time_t time = profile->times->answered;
                                        switch_time_exp_t tm;
+
+                                       if ( !time ) {
+                                               goto err;
+                                       }
                                        
                                        switch_time_exp_lt(&tm, time);
                                        
@@ -397,6 +405,10 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
                                        switch_caller_profile_t *profile = switch_channel_get_caller_profile(channel);
                                        switch_time_t time = profile->times->hungup;
                                        switch_time_exp_t tm;
+
+                                       if ( !time ) {
+                                               goto err;
+                                       }
                                        
                                        switch_time_exp_lt(&tm, time);
                                        
index eb3070c929e47531a7436fe1550665d2f22b4e30..6349d052103e9a572878f73485634a59a500c2eb 100644 (file)
@@ -22,7 +22,7 @@
       <param vendor="Cisco" name="Cisco-AVPair" variable="ip" format="src-gw-ip=%s"/>
       <param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_user" format="src-gw-name=%s"/>
       <param vendor="Cisco" name="h323-conf-id" variable="Core-UUID" format="%s"/>
-      <param vendor="Cisco" name="Cisco-AVPair" variable="ip" format="number"/>
+      <param vendor="Cisco" name="Cisco-AVPair" variable="ip" format="request-type=number"/>
       <param name="Called-Station-Id" variable="sip_to_user" format="%s"/>
       <param name="Calling-Station-Id" variable="sip_from_user" format="%s"/>
       <param name="User-Name" variable="sip_from_user" format="%s"/>
@@ -48,7 +48,7 @@
       <param name="seqfile" value="/var/run/radius.seq"/>
     </connection>
     <fields>
-      <param vendor="Cisco" name="Cisco-AVPair" variable="ip" format="user"/>
+      <param vendor="Cisco" name="Cisco-AVPair" variable="ip" format="request-type=user"/>
       <param vendor="Cisco" name="Cisco-AVPair" variable="ip" format="src-gw-ip=%s"/>
       <param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_user" format="src-gw-name=%s"/>
       <param name="User-Name" variable="sip_from_user" format="%s"/>