# HG changeset patch # User Sebastien Decugis # Date 1283325675 -32400 # Node ID 6fe3e5cf9fb232bce2a00fe165f271fcd86bb72c # Parent ecfa089bd29a44ed480e35f2e8781f78cd74eabf Added a flag to disable NAI routing in RADIUS/Diameter gw diff -r ecfa089bd29a -r 6fe3e5cf9fb2 doc/app_radgw.conf.sample --- a/doc/app_radgw.conf.sample Wed Sep 01 14:41:33 2010 +0900 +++ b/doc/app_radgw.conf.sample Wed Sep 01 16:21:15 2010 +0900 @@ -40,10 +40,13 @@ # an error is logged if some RADIUS attributes of the message have not been handled. RGWX = "extensions/echodrop.rgwx" : "echodrop.rgwx.conf"; # See echodrop.rgwx.conf.sample file -RGWX = "extensions/auth.rgwx" : auth; +RGWX = "extensions/auth.rgwx" : auth; RGWX = "extensions/acct.rgwx" : acct; # RGWX = "extensions/debug.rgwx"; # Uncomment to see the result of the translation plugins. +# For some extensions (auth, acct), a false configuration file name +# can be passed to specify flags, such as "nonai" to ignore NAI-based routing. + ################## # RADIUS Clients # ################## diff -r ecfa089bd29a -r 6fe3e5cf9fb2 extensions/app_radgw/rgwx_acct.c --- 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] == '@') { diff -r ecfa089bd29a -r 6fe3e5cf9fb2 extensions/app_radgw/rgwx_auth.c --- a/extensions/app_radgw/rgwx_auth.c Wed Sep 01 14:41:33 2010 +0900 +++ b/extensions/app_radgw/rgwx_auth.c Wed Sep 01 16:21:15 2010 +0900 @@ -122,22 +122,27 @@ } 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; }; /* Initialize the plugin */ -static int auth_conf_parse(char * conffile, struct rgwp_config ** state) +static int auth_conf_parse(char * confstr, struct rgwp_config ** state) { struct rgwp_config * new; struct dict_object * app; - TRACE_ENTRY("%p %p", conffile, state); + TRACE_ENTRY("%p %p", confstr, state); CHECK_PARAMS( state ); CHECK_MALLOC( new = malloc(sizeof(struct rgwp_config)) ); memset(new, 0, sizeof(struct rgwp_config)); CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, free ) ); - new->confstr = conffile; + new->confstr = confstr; + + if (strstr(confstr, "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, "ARAP-Password", &new->dict.ARAP_Password, ENOENT) ); @@ -417,7 +422,7 @@ value.os.len = dr_len; } else { int i = 0; - if (un) { + if (un && ! cs->ignore_nai) { /* Is there an '@' in the user name? We don't care for decorated NAI here */ for (i = un_len - 2; i > 0; i--) { if (un[i] == '@') { diff -r ecfa089bd29a -r 6fe3e5cf9fb2 extensions/rt_ereg/rtereg.c --- a/extensions/rt_ereg/rtereg.c Wed Sep 01 14:41:33 2010 +0900 +++ b/extensions/rt_ereg/rtereg.c Wed Sep 01 16:21:15 2010 +0900 @@ -60,6 +60,8 @@ int err = 0; struct fd_list * c; + TRACE_DEBUG(ANNOYING, "Attempt pattern matching of '%.*s' with rule '%s'", len, value, r->pattern); + #ifdef HAVE_REG_STARTEND { regmatch_t pmatch[1];