Mercurial > hg > freeDiameter
comparison extensions/app_radgw/rgwx_acct.c @ 526:6fe3e5cf9fb2
Added a flag to disable NAI routing in RADIUS/Diameter gw
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Wed, 01 Sep 2010 16:21:15 +0900 |
parents | 9493b8d8a35f |
children | 825a2992e3b9 |
comparison
equal
deleted
inserted
replaced
525:ecfa089bd29a | 526:6fe3e5cf9fb2 |
---|---|
147 | 147 |
148 struct dict_object * Session_Termination_Request;/* STR */ | 148 struct dict_object * Session_Termination_Request;/* STR */ |
149 } dict; /* cache of the dictionary objects we use */ | 149 } dict; /* cache of the dictionary objects we use */ |
150 struct session_handler * sess_hdl; /* We store RADIUS request authenticator information in the session */ | 150 struct session_handler * sess_hdl; /* We store RADIUS request authenticator information in the session */ |
151 char * confstr; | 151 char * confstr; |
152 | |
153 int ignore_nai; | |
152 }; | 154 }; |
153 | 155 |
154 /* The state we store in the session */ | 156 /* The state we store in the session */ |
155 struct sess_state { | 157 struct sess_state { |
156 application_id_t auth_appl; /* Auth-Application-Id used for this session, if available (stored in a Class attribute) */ | 158 application_id_t auth_appl; /* Auth-Application-Id used for this session, if available (stored in a Class attribute) */ |
170 CHECK_MALLOC( new = malloc(sizeof(struct rgwp_config)) ); | 172 CHECK_MALLOC( new = malloc(sizeof(struct rgwp_config)) ); |
171 memset(new, 0, sizeof(struct rgwp_config)); | 173 memset(new, 0, sizeof(struct rgwp_config)); |
172 | 174 |
173 CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, free ) ); | 175 CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, free ) ); |
174 new->confstr = conffile; | 176 new->confstr = conffile; |
177 | |
178 if (strstr(conffile, "nonai")) | |
179 new->ignore_nai = 1; | |
175 | 180 |
176 /* Resolve all dictionary objects we use */ | 181 /* Resolve all dictionary objects we use */ |
177 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Accounting-Record-Number", &new->dict.Accounting_Record_Number, ENOENT) ); | 182 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Accounting-Record-Number", &new->dict.Accounting_Record_Number, ENOENT) ); |
178 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Accounting-Record-Type", &new->dict.Accounting_Record_Type, ENOENT) ); | 183 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Accounting-Record-Type", &new->dict.Accounting_Record_Type, ENOENT) ); |
179 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Acct-Application-Id", &new->dict.Acct_Application_Id, ENOENT) ); | 184 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Acct-Application-Id", &new->dict.Acct_Application_Id, ENOENT) ); |
458 } | 463 } |
459 | 464 |
460 /* Add the Destination-Realm */ | 465 /* Add the Destination-Realm */ |
461 CHECK_FCT( fd_msg_avp_new ( cs->dict.Destination_Realm, 0, &avp ) ); | 466 CHECK_FCT( fd_msg_avp_new ( cs->dict.Destination_Realm, 0, &avp ) ); |
462 idx = 0; | 467 idx = 0; |
463 if (un) { | 468 if (un && ! cs->ignore_nai) { |
464 /* Is there an '@' in the user name? We don't care for decorated NAI here */ | 469 /* Is there an '@' in the user name? We don't care for decorated NAI here */ |
465 for (idx = un_len - 2; idx > 0; idx--) { | 470 for (idx = un_len - 2; idx > 0; idx--) { |
466 if (un[idx] == '@') { | 471 if (un[idx] == '@') { |
467 idx++; | 472 idx++; |
468 break; | 473 break; |