diff 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
line wrap: on
line diff
--- a/extensions/app_radgw/rgwx_acct.c	Wed Sep 01 14:41:33 2010 +0900
+++ b/extensions/app_radgw/rgwx_acct.c	Wed Sep 01 16:21:15 2010 +0900
@@ -149,6 +149,8 @@
 	} dict; /* cache of the dictionary objects we use */
 	struct session_handler * sess_hdl; /* We store RADIUS request authenticator information in the session */
 	char * confstr;
+	
+	int ignore_nai;
 };
 
 /* The state we store in the session */
@@ -173,6 +175,9 @@
 	CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, free ) );
 	new->confstr = conffile;
 	
+	if (strstr(conffile, "nonai"))
+		new->ignore_nai = 1;
+	
 	/* Resolve all dictionary objects we use */
 	CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Accounting-Record-Number", &new->dict.Accounting_Record_Number, ENOENT) );
 	CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Accounting-Record-Type", &new->dict.Accounting_Record_Type, ENOENT) );
@@ -460,7 +465,7 @@
 	/* Add the Destination-Realm */
 	CHECK_FCT( fd_msg_avp_new ( cs->dict.Destination_Realm, 0, &avp ) );
 	idx = 0;
-	if (un) {
+	if (un && ! cs->ignore_nai) {
 		/* Is there an '@' in the user name? We don't care for decorated NAI here */
 		for (idx = un_len - 2; idx > 0; idx--) {
 			if (un[idx] == '@') {
"Welcome to our mercurial repository"