Module: sip-router
Branch: master
Commit: 355490abd8c6e82a45cb96338ceca938c99ed744
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=355490a…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Tue May 28 15:43:27 2013 +0200
misc_radius: handle IPv4 returned attributes
- populate attributes for negative replies when common_response is set
- patch by Victor V. Kustov
---
modules/misc_radius/functions.c | 30 +++++++++++++++++-------------
1 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/modules/misc_radius/functions.c b/modules/misc_radius/functions.c
index 7a2468b..4292999 100644
--- a/modules/misc_radius/functions.c
+++ b/modules/misc_radius/functions.c
@@ -192,21 +192,23 @@ static void generate_avps(struct attr *attrs, VALUE_PAIR* received)
}
/* Macro to add extra attribute */
-#define ADD_EXTRA_AVPAIR(_attrs, _attr, _val, _len) \
- do { \
- if ((_len) != 0) { \
- if ((_len) == -1) { \
- if (_attrs[_attr].t != PW_TYPE_INTEGER) { \
- LM_ERR("attribute %d is not of type integer\n", \
- _attrs[_attr].v); \
- goto error; \
- } \
- } \
+#define ADD_EXTRA_AVPAIR(_attrs, _attr, _val, _len) \
+ do { \
+ if ((_len) != 0) { \
+ if ((_len) == -1) { \
+ if (_attrs[_attr].t != PW_TYPE_INTEGER) { \
+ if (_attrs[_attr].t != PW_TYPE_IPADDR) { \
+ LM_ERR("attribute %d is not of type integer or ipaddr\n", \
+ _attrs[_attr].v); \
+ goto error; \
+ } \
+ } \
+ } \
if (!rc_avpair_add( rh, &send, _attrs[_attr].v, _val, _len, 0)) { \
LM_ERR("failed to add %s, %d\n", _attrs[_attr].n, _attr); \
- goto error; \
- } \
- } \
+ goto error; \
+ } \
+ } \
}while(0)
@@ -274,6 +276,7 @@ int radius_load_caller_avps(struct sip_msg* _m, char* _caller, char*
_s2)
return 1;
} else {
rc_avpair_free(send);
+ if (common_response) generate_avps_rad(received);
rc_avpair_free(received);
#ifdef REJECT_RC
if (res == REJECT_RC) {
@@ -359,6 +362,7 @@ int radius_load_callee_avps(struct sip_msg* _m, char* _callee, char*
_s2)
return 1;
} else {
rc_avpair_free(send);
+ if (common_response) generate_avps_rad(received);
rc_avpair_free(received);
#ifdef REJECT_RC
if (res == REJECT_RC) {