Changeset 403:26aafbbc1640 in freeDiameter for extensions/app_radgw
- Timestamp:
- Jul 8, 2010, 2:24:19 PM (14 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- extensions/app_radgw
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/app_radgw/md5.c
r254 r403 7 7 */ 8 8 #include "rgw_common.h" 9 /* Forward declaration: */10 void md5_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac);11 9 /*********************************************************************************/ 12 10 -
extensions/app_radgw/md5.h
r254 r403 4 4 * It is redistributed under the terms of the BSD license, as allowed 5 5 * by the original copyright reproduced bellow. 6 * The file has not been modified, except for this notice.7 6 */ 7 8 8 /*********************************************************************************/ 9 9 … … 41 41 #endif /* CONFIG_CRYPTO_INTERNAL */ 42 42 43 /* Forward declaration: */ 44 void md5_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac); 45 43 46 #endif /* MD5_H */ -
extensions/app_radgw/rgw.h
r356 r403 102 102 int rgw_clients_check_dup(struct rgw_radius_msg_meta **msg, struct rgw_client *cli); 103 103 int rgw_clients_check_origin(struct rgw_radius_msg_meta *msg, struct rgw_client *cli); 104 int rgw_clients_get_origin(struct rgw_client *cli, char **fqdn, char **realm);105 char * rgw_clients_id(struct rgw_client *cli);106 104 int rgw_client_finish_send(struct radius_msg ** msg, struct rgw_radius_msg_meta * req, struct rgw_client * cli); 107 105 void rgw_clients_dispose(struct rgw_client ** ref); -
extensions/app_radgw/rgw_clients.c
r395 r403 189 189 static int client_search(struct rgw_client ** res, struct sockaddr * ip_port ) 190 190 { 191 int ret = 0;192 191 int cmp; 193 192 struct fd_list *ref = NULL; … … 301 300 for (idx = 0; idx < msg->radius.attr_used; idx++) { 302 301 struct radius_attr_hdr * attr = (struct radius_attr_hdr *)(msg->radius.buf + msg->radius.attr_pos[idx]); 303 unsigned char * attr_val = (unsigned char *)(attr + 1);304 302 size_t attr_len = attr->length - sizeof(struct radius_attr_hdr); 305 303 -
extensions/app_radgw/rgw_common.h
r356 r403 56 56 /* This structure points to a RADIUS client description, the definition is not known to plugins */ 57 57 struct rgw_client; 58 /* This function is required to be able to translate user paswords */ 59 int rgw_clients_getkey(struct rgw_client * cli, unsigned char **key, size_t *key_len); 58 59 int rgw_clients_getkey(struct rgw_client * cli, unsigned char **key, size_t *key_len); 60 char * rgw_clients_id(struct rgw_client *cli); 61 int rgw_clients_get_origin(struct rgw_client *cli, char **fqdn, char **realm); 60 62 61 63 /* Each plugin must provide the following structure. */ -
extensions/app_radgw/rgw_conf.l
r258 r403 136 136 } 137 137 138 if ( port = strchr(work, '[')) {138 if ((port = strchr(work, '[')) != NULL) { 139 139 *port = '\0'; 140 140 port++; -
extensions/app_radgw/rgw_plugins.c
r356 r403 173 173 { 174 174 struct plg_descr * new; 175 int ret = 0;176 175 177 176 TRACE_ENTRY("%p %p %d %p %zi", plgfile, conffile, type, codes_array, codes_sz); -
extensions/app_radgw/rgw_worker.c
r385 r403 63 63 static void * work_th(void * arg) 64 64 { 65 char thname[10];66 67 65 TRACE_ENTRY("%p", arg); 68 66 -
extensions/app_radgw/rgwx_acct.c
r376 r403 301 301 const char * prefix = "Diameter/"; 302 302 size_t pref_len; 303 char* si = NULL;303 uint8_t * si = NULL; 304 304 size_t si_len = 0; 305 char* un = NULL;305 uint8_t * un = NULL; 306 306 size_t un_len = 0; 307 307 … … 357 357 if ((attr_len > pref_len ) && ! strncmp((char *)v, prefix, pref_len)) { 358 358 int i; 359 si = (char *)v + pref_len;359 si = v + pref_len; 360 360 si_len = attr_len - pref_len; 361 361 TRACE_DEBUG(ANNOYING, "Found Class attribute with '%s' prefix (attr #%d), SI:'%.*s'.", prefix, idx, si_len, si); … … 369 369 case RADIUS_ATTR_USER_NAME: 370 370 if (attr_len) { 371 un = (char *)v;371 un = v; 372 372 un_len = attr_len; 373 373 TRACE_DEBUG(ANNOYING, "Found a User-Name attribute: '%.*s'", un_len, un); … … 471 471 if (idx == 0) { 472 472 /* Not found in the User-Name => we use the local domain of this gateway */ 473 value.os.data = fd_g_config->cnf_diamrlm;473 value.os.data = (uint8_t *)fd_g_config->cnf_diamrlm; 474 474 value.os.len = fd_g_config->cnf_diamrlm_len; 475 475 } else { … … 482 482 /* Create the Session-Id AVP if needed */ 483 483 if (!*session) { 484 CHECK_FCT( fd_sess_fromsid ( si, si_len, session, NULL) );484 CHECK_FCT( fd_sess_fromsid ( (char *)/* cast should be removed later */si, si_len, session, NULL) ); 485 485 486 486 TRACE_DEBUG(FULL, "[auth.rgwx] Translating new accounting message for session '%.*s'...", si_len, si); -
extensions/app_radgw/rgwx_auth.c
r388 r403 236 236 const char * prefix = "Diameter/"; 237 237 size_t pref_len; 238 char* dh = NULL;238 uint8_t * dh = NULL; 239 239 size_t dh_len = 0; 240 char* dr = NULL;240 uint8_t * dr = NULL; 241 241 size_t dr_len = 0; 242 char* si = NULL;242 uint8_t * si = NULL; 243 243 size_t si_len = 0; 244 char* un = NULL;244 uint8_t * un = NULL; 245 245 size_t un_len = 0; 246 uint32_t status_type;247 246 size_t nattr_used = 0; 248 247 struct avp ** avp_tun = NULL, *avp = NULL; … … 316 315 for (idx = 0; idx < rad_req->attr_used; idx++) { 317 316 struct radius_attr_hdr * attr = (struct radius_attr_hdr *)(rad_req->buf + rad_req->attr_pos[idx]); 318 char * attr_val = (char*)(attr + 1);317 uint8_t * attr_val = (uint8_t *)(attr + 1); 319 318 size_t attr_len = attr->length - sizeof(struct radius_attr_hdr); 320 319 … … 343 342 case RADIUS_ATTR_STATE: 344 343 if ((attr_len > pref_len + 5 /* for the '/'s and non empty strings */ ) 345 && ! strncmp(attr_val, prefix, pref_len)) { /* should we make it strncasecmp? */344 && ! memcmp(attr_val, prefix, pref_len)) { 346 345 int i, start; 347 346 … … 376 375 377 376 case RADIUS_ATTR_USER_NAME: 378 TRACE_DEBUG(ANNOYING, "Found a User-Name attribute: '%.*s'", attr_len, attr_len ? attr_val : "");377 TRACE_DEBUG(ANNOYING, "Found a User-Name attribute: '%.*s'", attr_len, attr_len ? (char *)attr_val : ""); 379 378 un = attr_val; 380 379 un_len = attr_len; … … 430 429 if (i <= 0) { 431 430 /* Not found in the User-Name => we use the local domain of this gateway */ 432 value.os.data = fd_g_config->cnf_diamrlm;431 value.os.data = (uint8_t *)fd_g_config->cnf_diamrlm; 433 432 value.os.len = fd_g_config->cnf_diamrlm_len; 434 433 } else { … … 455 454 if (si_len) { 456 455 /* We already have the Session-Id, just use it */ 457 CHECK_FCT( fd_sess_fromsid ( si, si_len, session, NULL) );456 CHECK_FCT( fd_sess_fromsid ( (char *) /* this cast will be removed later */ si, si_len, session, NULL) ); 458 457 } else { 459 458 /* Create a new Session-Id string */ … … 544 543 if (got_empty_eap) { 545 544 value.os.len = 0; 546 value.os.data = "";545 value.os.data = (uint8_t *)""; 547 546 } else { 548 547 CHECK_MALLOC( value.os.data = radius_msg_get_eap(rad_req, &value.os.len) ); … … 1066 1065 struct avp *avp, *next, *avp_x, *avp_y, *asid, *aoh; 1067 1066 struct avp_hdr *ahdr, *sid, *oh; 1068 char buf[254]; /* to store some attributes values (with final '\0') */ 1067 uint8_t buf[254]; /* to store some attributes values (with final '\0') */ 1068 size_t sz; 1069 1069 int ta_set = 0; 1070 1070 int no_str = 0; /* indicate if an STR is required for this server */ … … 1189 1189 /* Now, save the session-id and eventually server info in a STATE or CLASS attribute */ 1190 1190 if ((*rad_fw)->hdr->code == RADIUS_CODE_ACCESS_CHALLENGE) { 1191 if (sizeof(buf) < snprintf(buf, sizeof(buf), "Diameter/%.*s/%.*s/%.*s",1192 oh->avp_value->os.len, oh->avp_value->os.data,1193 ahdr->avp_value->os.len, ahdr->avp_value->os.data,1194 sid->avp_value->os.len, sid->avp_value->os.data)) {1191 if (sizeof(buf) < (sz = snprintf((char *)buf, sizeof(buf), "Diameter/%.*s/%.*s/%.*s", 1192 oh->avp_value->os.len, (char *)oh->avp_value->os.data, 1193 ahdr->avp_value->os.len, (char *)ahdr->avp_value->os.data, 1194 sid->avp_value->os.len, (char *)sid->avp_value->os.data))) { 1195 1195 TRACE_DEBUG(INFO, "Data truncated in State attribute: %s", buf); 1196 1196 } 1197 CONV2RAD_STR(RADIUS_ATTR_STATE, buf, s trlen(buf), 0);1197 CONV2RAD_STR(RADIUS_ATTR_STATE, buf, sz, 0); 1198 1198 } 1199 1199 1200 1200 if ((*rad_fw)->hdr->code == RADIUS_CODE_ACCESS_ACCEPT) { 1201 1201 /* Add the Session-Id */ 1202 if (sizeof(buf) < snprintf(buf, sizeof(buf), "Diameter/%.*s",1203 sid->avp_value->os.len, sid->avp_value->os.data)) {1202 if (sizeof(buf) < (sz = snprintf((char *)buf, sizeof(buf), "Diameter/%.*s", 1203 sid->avp_value->os.len, sid->avp_value->os.data))) { 1204 1204 TRACE_DEBUG(INFO, "Data truncated in Class attribute: %s", buf); 1205 1205 } 1206 CONV2RAD_STR(RADIUS_ATTR_CLASS, buf, s trlen(buf), 0);1206 CONV2RAD_STR(RADIUS_ATTR_CLASS, buf, sz, 0); 1207 1207 } 1208 1208 … … 1587 1587 CHECK_FCT( fd_msg_avp_hdr ( inavp, &ahdr ) ); 1588 1588 1589 if ( ahdr->avp_flags & AVP_FLAG_VENDOR == 0) {1589 if ( ! (ahdr->avp_flags & AVP_FLAG_VENDOR)) { 1590 1590 switch (ahdr->avp_code) { 1591 1591 case DIAM_ATTR_TUNNEL_TYPE: … … 1634 1634 size_t pos; 1635 1635 int i; 1636 size_t buflen;1637 1636 uint8_t * secret; /* S */ 1638 1637 size_t secret_len; … … 1653 1652 1654 1653 /* The plain text string P */ 1655 CHECK_PARAM (ahdr->avp_value->os.len < 240);1654 CHECK_PARAMS(ahdr->avp_value->os.len < 240); 1656 1655 buf[3] = ahdr->avp_value->os.len; 1657 1656 memcpy(&buf[4], ahdr->avp_value->os.data, ahdr->avp_value->os.len); … … 1817 1816 /* Add the auth-application-id required for STR, or 0 if no STR is required */ 1818 1817 CHECK_FCT( fd_msg_hdr( *diam_ans, &hdr ) ); 1819 if (sizeof(buf) < snprintf(buf, sizeof(buf), CLASS_AAI_PREFIX "%u",1820 no_str ? 0 : hdr->msg_appl)) {1818 if (sizeof(buf) < (sz = snprintf((char *)buf, sizeof(buf), CLASS_AAI_PREFIX "%u", 1819 no_str ? 0 : hdr->msg_appl))) { 1821 1820 TRACE_DEBUG(INFO, "Data truncated in Class attribute: %s", buf); 1822 1821 } 1823 CONV2RAD_STR(RADIUS_ATTR_CLASS, buf, s trlen(buf), 0);1822 CONV2RAD_STR(RADIUS_ATTR_CLASS, buf, sz, 0); 1824 1823 } 1825 1824 -
extensions/app_radgw/rgwx_echodrop.c
r356 r403 240 240 static int ed_diam_ans( struct rgwp_config * cs, struct session * session, struct msg ** diam_ans, struct radius_msg ** rad_fw, struct rgw_client * cli, int * stateful ) 241 241 { 242 int ret;243 242 struct fd_list * list = NULL; 244 243 … … 265 264 while (! FD_IS_LIST_EMPTY(list) ) { 266 265 struct ed_saved_attribute * esa = (struct ed_saved_attribute *)(list->next); 267 struct radius_attr_hdr * rc;268 266 269 267 fd_list_unlink(&esa->chain); -
extensions/app_radgw/rgwx_echodrop.y
r270 r403 53 53 #include "rgwx_echodrop.h" 54 54 #include "rgwx_echodrop.tab.h" /* bison is not smart enough to define the YYLTYPE before including this code, so... */ 55 56 57 /* Forward declaration */ 58 int yyparse(char * conffile, struct rgwp_config *cs); 59 60 /* The Lex parser prototype */ 61 int rgwx_echodroplex(YYSTYPE *lvalp, YYLTYPE *llocp); 62 55 63 56 64 /* Parse the configuration file */
Note: See TracChangeset
for help on using the changeset viewer.