comparison extensions/app_radgw/rgwx_auth.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 ddbcd21af4e0
children 4cb8f63a0f67
comparison
equal deleted inserted replaced
525:ecfa089bd29a 526:6fe3e5cf9fb2
120 struct dict_object * User_Password; /* User-Password */ 120 struct dict_object * User_Password; /* User-Password */
121 121
122 } dict; /* cache of the dictionary objects we use */ 122 } dict; /* cache of the dictionary objects we use */
123 struct session_handler * sess_hdl; /* We store RADIUS request authenticator information in the session */ 123 struct session_handler * sess_hdl; /* We store RADIUS request authenticator information in the session */
124 char * confstr; 124 char * confstr;
125
126 int ignore_nai;
125 }; 127 };
126 128
127 /* Initialize the plugin */ 129 /* Initialize the plugin */
128 static int auth_conf_parse(char * conffile, struct rgwp_config ** state) 130 static int auth_conf_parse(char * confstr, struct rgwp_config ** state)
129 { 131 {
130 struct rgwp_config * new; 132 struct rgwp_config * new;
131 struct dict_object * app; 133 struct dict_object * app;
132 134
133 TRACE_ENTRY("%p %p", conffile, state); 135 TRACE_ENTRY("%p %p", confstr, state);
134 CHECK_PARAMS( state ); 136 CHECK_PARAMS( state );
135 137
136 CHECK_MALLOC( new = malloc(sizeof(struct rgwp_config)) ); 138 CHECK_MALLOC( new = malloc(sizeof(struct rgwp_config)) );
137 memset(new, 0, sizeof(struct rgwp_config)); 139 memset(new, 0, sizeof(struct rgwp_config));
138 140
139 CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, free ) ); 141 CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, free ) );
140 new->confstr = conffile; 142 new->confstr = confstr;
143
144 if (strstr(confstr, "nonai"))
145 new->ignore_nai = 1;
141 146
142 /* Resolve all dictionary objects we use */ 147 /* Resolve all dictionary objects we use */
143 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "ARAP-Password", &new->dict.ARAP_Password, ENOENT) ); 148 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "ARAP-Password", &new->dict.ARAP_Password, ENOENT) );
144 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "ARAP-Security", &new->dict.ARAP_Security, ENOENT) ); 149 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "ARAP-Security", &new->dict.ARAP_Security, ENOENT) );
145 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "ARAP-Security-Data", &new->dict.ARAP_Security_Data, ENOENT) ); 150 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "ARAP-Security-Data", &new->dict.ARAP_Security_Data, ENOENT) );
415 if (dr) { 420 if (dr) {
416 value.os.data = (unsigned char *)dr; 421 value.os.data = (unsigned char *)dr;
417 value.os.len = dr_len; 422 value.os.len = dr_len;
418 } else { 423 } else {
419 int i = 0; 424 int i = 0;
420 if (un) { 425 if (un && ! cs->ignore_nai) {
421 /* Is there an '@' in the user name? We don't care for decorated NAI here */ 426 /* Is there an '@' in the user name? We don't care for decorated NAI here */
422 for (i = un_len - 2; i > 0; i--) { 427 for (i = un_len - 2; i > 0; i--) {
423 if (un[i] == '@') { 428 if (un[i] == '@') {
424 i++; 429 i++;
425 break; 430 break;
"Welcome to our mercurial repository"