Changeset 403:26aafbbc1640 in freeDiameter
- Timestamp:
- Jul 8, 2010, 2:24:19 PM (14 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 39 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/acl_wl/aw_tree.c
r258 r403 88 88 { 89 89 int i, l, prev_offset; 90 char * c;91 90 92 91 TRACE_ENTRY("%p %p", name, result); -
extensions/app_acct/acct_conf.y
r284 r403 59 59 int yyparse(char * conffile); 60 60 61 /* The Lex parser prototype */ 62 int acct_conflex(YYSTYPE *lvalp, YYLTYPE *llocp); 63 61 64 /* the global configuration */ 62 65 struct acct_conf * acct_config = NULL; … … 89 92 } 90 93 94 if (!TRACE_BOOL(FULL)) 95 return 0; 96 91 97 struct fd_list * li; 92 if (!TRACE_BOOL(FULL))93 return;94 98 95 99 fd_log_debug("[app_acct] Configuration dump:\n"); … … 110 114 } 111 115 fd_log_debug("[app_acct] Complete.\n"); 116 return 0; 112 117 } 113 118 -
extensions/app_acct/acct_db.c
r292 r403 64 64 size_t sql_allocd = 0; /* The malloc'd size of the buffer */ 65 65 size_t sql_offset = 0; /* The actual data already written in this buffer */ 66 size_t p;67 66 int idx = 0; 68 67 PGresult * res; -
extensions/app_acct/app_acct.c
r286 r403 48 48 static int acct_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act) 49 49 { 50 struct msg_hdr *hdr = NULL;51 50 struct msg * m; 52 51 struct avp * a = NULL; 53 52 struct avp_hdr * art=NULL, *arn=NULL; /* We keep a pointer on the Accounting-Record-{Type, Number} AVPs from the query */ 54 char * s;55 53 struct acct_record_list rl; 56 54 -
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 */ -
extensions/rt_default/rtd_rules.c
r258 r403 307 307 } 308 308 309 /* Search in list (targets or rules) the next matching item for string str(len). Returned in next_match, or *next_match == NULL if no more match. Re-enter with same next_match for the next one. */309 /* Search in list (targets or rules) the next matching item for octet string str(len). Returned in next_match, or *next_match == NULL if no more match. Re-enter with same next_match for the next one. */ 310 310 static int get_next_match(struct fd_list * list, char * str, size_t len, struct fd_list ** next_match) 311 311 { … … 577 577 r = NULL; 578 578 do { 579 CHECK_FCT ( get_next_match( &target->rules[j], parsed_msg_avp[j].avp->os.data, parsed_msg_avp[j].avp->os.len, (void *)&r) );579 CHECK_FCT ( get_next_match( &target->rules[j], (char *) /* is this cast safe? */ parsed_msg_avp[j].avp->os.data, parsed_msg_avp[j].avp->os.len, (void *)&r) ); 580 580 if (!r) 581 581 break; -
extensions/test_app/ta_cli.c
r258 r403 168 168 CHECK_FCT_DO( fd_sess_getsid ( sess, &sid ), goto out ); 169 169 CHECK_FCT_DO( fd_msg_avp_new ( ta_sess_id, 0, &avp ), goto out ); 170 val.os.data = sid;170 val.os.data = (uint8_t *)sid; 171 171 val.os.len = strlen(sid); 172 172 CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out ); -
extensions/test_app/ta_serv.c
r258 r403 57 57 struct msg *ans, *qry; 58 58 struct avp * a; 59 union avp_value val;60 59 61 60 TRACE_ENTRY("%p %p %p %p", msg, avp, sess, act); … … 66 65 /* Value of Origin-Host */ 67 66 fprintf(stderr, "ECHO Test-Request received from "); 68 CHECK_FCT _DO( fd_msg_search_avp ( *msg, ta_origin_host, &a), return);67 CHECK_FCT( fd_msg_search_avp ( *msg, ta_origin_host, &a) ); 69 68 if (a) { 70 69 struct avp_hdr * hdr; 71 CHECK_FCT _DO( fd_msg_avp_hdr( a, &hdr ), return);70 CHECK_FCT( fd_msg_avp_hdr( a, &hdr ) ); 72 71 fprintf(stderr, "'%.*s'", hdr->avp_value->os.len, hdr->avp_value->os.data); 73 72 } else { -
freeDiameter/cnxctx.c
r402 r403 162 162 #else /* DISABLE_SCTP */ 163 163 struct cnxctx * cnx = NULL; 164 sSS dummy;165 sSA * sa = (sSA *) &dummy;166 164 167 165 TRACE_ENTRY("%hu %p", port, ep_list); … … 224 222 socklen_t ss_len = sizeof(ss); 225 223 int cli_sock = 0; 226 struct fd_endpoint * ep;227 224 228 225 TRACE_ENTRY("%p", serv); … … 988 985 int fd_tls_verify_credentials(gnutls_session_t session, struct cnxctx * conn, int verbose) 989 986 { 990 int ret, i; 987 int i; 988 unsigned int gtret; 991 989 const gnutls_datum_t *cert_list; 992 990 unsigned int cert_list_size; … … 1018 1016 fd_log_debug("\t - TLS/IA session\n"); 1019 1017 break; 1020 1021 1022 #ifdef ENABLE_SRP1023 case GNUTLS_CRD_SRP:1024 fd_log_debug("\t - SRP session with username %s\n",1025 gnutls_srp_server_get_username (session));1026 break;1027 #endif1028 1018 1029 1019 case GNUTLS_CRD_PSK: … … 1049 1039 gnutls_dh_get_prime_bits (session)); 1050 1040 } 1041 break; 1042 1043 case GNUTLS_CRD_SRP: 1044 fd_log_debug("\t - SRP session with username %s\n", 1045 gnutls_srp_server_get_username (session)); 1046 break; 1047 1048 default: 1049 fd_log_debug("\t - Different type of credentials for the session (%d).\n", cred); 1050 break; 1051 1051 1052 } 1052 1053 … … 1073 1074 1074 1075 /* First, use built-in verification */ 1075 CHECK_GNUTLS_DO( gnutls_certificate_verify_peers2 (session, & ret), return EINVAL );1076 if ( ret) {1076 CHECK_GNUTLS_DO( gnutls_certificate_verify_peers2 (session, >ret), return EINVAL ); 1077 if (gtret) { 1077 1078 if (TRACE_BOOL(INFO)) { 1078 1079 fd_log_debug("TLS: Remote certificate invalid on socket %d (Remote: '%s')(Connection: '%s') :\n", conn->cc_socket, conn->cc_remid, conn->cc_id); 1079 if ( ret & GNUTLS_CERT_INVALID)1080 if (gtret & GNUTLS_CERT_INVALID) 1080 1081 fd_log_debug(" - The certificate is not trusted (unknown CA? expired?)\n"); 1081 if ( ret & GNUTLS_CERT_REVOKED)1082 if (gtret & GNUTLS_CERT_REVOKED) 1082 1083 fd_log_debug(" - The certificate has been revoked.\n"); 1083 if ( ret & GNUTLS_CERT_SIGNER_NOT_FOUND)1084 if (gtret & GNUTLS_CERT_SIGNER_NOT_FOUND) 1084 1085 fd_log_debug(" - The certificate hasn't got a known issuer.\n"); 1085 if ( ret & GNUTLS_CERT_SIGNER_NOT_CA)1086 if (gtret & GNUTLS_CERT_SIGNER_NOT_CA) 1086 1087 fd_log_debug(" - The certificate signer is not a CA, or uses version 1, or 3 without basic constraints.\n"); 1087 if ( ret & GNUTLS_CERT_INSECURE_ALGORITHM)1088 if (gtret & GNUTLS_CERT_INSECURE_ALGORITHM) 1088 1089 fd_log_debug(" - The certificate signature uses a weak algorithm.\n"); 1089 1090 } -
freeDiameter/cnxctx.h
r378 r403 109 109 int fd_sctp_get_remote_ep(int sock, struct fd_list * list); 110 110 int fd_sctp_get_str_info( int sock, uint16_t *in, uint16_t *out, sSS *primary ); 111 int fd_sctp_sendstr(int sock, uint16_t strid, uint8_t * buf, size_t len, int * cc_closing);112 int fd_sctp_recvmeta(int sock, uint16_t * strid, uint8_t ** buf, size_t * len, int *event, int * cc_closing);111 int fd_sctp_sendstr(int sock, uint16_t strid, uint8_t * buf, size_t len, uint32_t * cc_closing); 112 int fd_sctp_recvmeta(int sock, uint16_t * strid, uint8_t ** buf, size_t * len, int *event, uint32_t * cc_closing); 113 113 114 114 /* TLS over SCTP (multi-stream) */ … … 137 137 #endif /* DISABLE_SCTP */ 138 138 139 /* UDP */140 int fd_cnx_get_local_eps(struct fd_list * list);141 139 142 140 #endif /* _CNXCTX_H */ -
freeDiameter/config.c
r309 r403 97 97 fd_log_debug(" Local endpoints ........ : Default (use all available)\n"); 98 98 } else { 99 struct fd_list * li = fd_g_config->cnf_endpoints.next;100 99 fd_log_debug(" Local endpoints ........ : \n"); 101 100 fd_ep_dump( 29, &fd_g_config->cnf_endpoints ); -
freeDiameter/fD.h
r378 r403 327 327 int fd_cnx_getTLS(struct cnxctx * conn); 328 328 int fd_cnx_getcred(struct cnxctx * conn, const gnutls_datum_t **cert_list, unsigned int *cert_list_size); 329 int fd_cnx_get_local_eps(struct fd_list * list); 329 330 int fd_cnx_getremoteeps(struct cnxctx * conn, struct fd_list * eps); 330 331 char * fd_cnx_getremoteid(struct cnxctx * conn); -
freeDiameter/p_ce.c
r378 r403 309 309 310 310 /* We check that the value matches what we know, otherwise disconnect the peer */ 311 if (strncasecmp(hdr->avp_value->os.data, peer->p_hdr.info.pi_diamid, hdr->avp_value->os.len)) { 311 /* here also, using strcasecmp on (supposed) UTF8 data might be bad idea... to be improved */ 312 if (strncasecmp((char *)hdr->avp_value->os.data, peer->p_hdr.info.pi_diamid, hdr->avp_value->os.len)) { 312 313 TRACE_DEBUG(INFO, "Received a message with Origin-Host set to '%.*s' while expecting '%s'\n", 313 314 hdr->avp_value->os.len, hdr->avp_value->os.data, peer->p_hdr.info.pi_diamid); -
freeDiameter/p_dp.c
r258 r403 48 48 int delay = peer->p_hdr.info.config.pic_tctimer ?: fd_g_config->cnf_timer_tc; 49 49 50 CHECK_FCT _DO( fd_msg_search_avp ( *msg, fd_dict_avp_DC, &dc ), return);50 CHECK_FCT( fd_msg_search_avp ( *msg, fd_dict_avp_DC, &dc )); 51 51 if (dc) { 52 52 /* Check the value is consistent with the saved one */ 53 53 struct avp_hdr * hdr; 54 CHECK_FCT _DO( fd_msg_avp_hdr( dc, &hdr ), return);54 CHECK_FCT( fd_msg_avp_hdr( dc, &hdr ) ); 55 55 if (hdr->avp_value == NULL) { 56 56 /* This is a sanity check */ -
freeDiameter/p_psm.c
r378 r403 689 689 CHECK_FCT_DO( fd_p_ce_process_receiver(peer), goto psm_end ); 690 690 goto psm_loop; 691 692 default: 693 ASSERT(0); /* implementation problem, we did not foresee this case? */ 691 694 } 692 695 } -
freeDiameter/peers.c
r391 r403 224 224 { 225 225 struct fd_peer *p; 226 void * t;227 226 228 227 TRACE_ENTRY("%p", ptr); … … 429 428 for (li = fd_g_peers.next; li != &fd_g_peers; li = li->next) { 430 429 peer = (struct fd_peer *)li; 431 int cmp = strncasecmp( avp_hdr->avp_value->os.data, peer->p_hdr.info.pi_diamid, avp_hdr->avp_value->os.len ); 430 /* It is probably unwise to use strcasecmp on UTF8 data... To be improved! */ 431 int cmp = strncasecmp( (char *)avp_hdr->avp_value->os.data, peer->p_hdr.info.pi_diamid, avp_hdr->avp_value->os.len ); 432 432 if (cmp > 0) 433 433 continue; -
freeDiameter/routing_dispatch.c
r258 r403 269 269 if (dh 270 270 && (dh->os.len == strlen(peer->p_hdr.info.pi_diamid)) 271 && (strncasecmp(peer->p_hdr.info.pi_diamid, dh->os.data, dh->os.len) == 0)) { 271 /* Here again we use strncasecmp on UTF8 data... This should probably be changed. */ 272 && (strncasecmp(peer->p_hdr.info.pi_diamid, (char *)dh->os.data, dh->os.len) == 0)) { 272 273 /* The candidate is the Destination-Host */ 273 274 c->score += FD_SCORE_FINALDEST; … … 275 276 if (dr && peer->p_hdr.info.runtime.pir_realm 276 277 && (dr->os.len == strlen(peer->p_hdr.info.runtime.pir_realm)) 277 && (strncasecmp(peer->p_hdr.info.runtime.pir_realm, dr->os.data, dr->os.len) == 0)) { 278 /* Yet another case where we use strncasecmp on UTF8 data... Hmmm :-( */ 279 && (strncasecmp(peer->p_hdr.info.runtime.pir_realm, (char *)dr->os.data, dr->os.len) == 0)) { 278 280 /* The candidate's realm matchs the Destination-Realm */ 279 281 c->score += FD_SCORE_REALM; … … 355 357 static int process_decorated_NAI(union avp_value * un, union avp_value * dr) 356 358 { 357 int i,at_idx = 0, sep_idx = 0;359 int at_idx = 0, sep_idx = 0; 358 360 unsigned char * old_un; 359 361 TRACE_ENTRY("%p %p", un, dr); … … 365 367 /* Search the positions of the first '!' and the '@' in the string */ 366 368 nai_get_indexes(un, &sep_idx, &at_idx); 367 CHECK_PARAMS( 0 < sep_idx < at_idx < un->os.len);369 CHECK_PARAMS( (0 < sep_idx) && (sep_idx < at_idx) && (at_idx < un->os.len)); 368 370 369 371 /* Create the new User-Name value */ -
freeDiameter/sctp.c
r378 r403 997 997 998 998 /* Send a buffer over a specified stream */ 999 int fd_sctp_sendstr(int sock, uint16_t strid, uint8_t * buf, size_t len, int * cc_status)999 int fd_sctp_sendstr(int sock, uint16_t strid, uint8_t * buf, size_t len, uint32_t * cc_status) 1000 1000 { 1001 1001 struct msghdr mhdr; … … 1054 1054 1055 1055 /* Receive the next data from the socket, or next notification */ 1056 int fd_sctp_recvmeta(int sock, uint16_t * strid, uint8_t ** buf, size_t * len, int *event, int * cc_status)1056 int fd_sctp_recvmeta(int sock, uint16_t * strid, uint8_t ** buf, size_t * len, int *event, uint32_t * cc_status) 1057 1057 { 1058 1058 ssize_t ret = 0; -
freeDiameter/sctps.c
r401 r403 620 620 /* End all TLS sessions, in series (not as efficient as paralel, but simpler) */ 621 621 for (i = 1; i < conn->cc_sctp_para.pairs; i++) { 622 if ( !conn->cc_status & CC_STATUS_ERROR) {622 if ( ! (conn->cc_status & CC_STATUS_ERROR)) { 623 623 CHECK_GNUTLS_DO( gnutls_bye(conn->cc_sctps_data.array[i].session, GNUTLS_SHUT_WR), fd_cnx_markerror(conn) ); 624 624 } -
freeDiameter/tests/testappacct.c
r355 r403 89 89 { 90 90 extern PGconn *conn; /* in acct_db.c */ 91 extern int fd_ext_init(int major, int minor, char * conffile); /* defined in include's extension.h */ 92 extern void fd_ext_fini(void); /* defined in the extension itself */ 91 93 struct msg * msg; 92 94 char * sess_bkp; 93 struct dict_object * session_id = NULL;94 95 95 96 /* First, initialize the daemon modules */ -
freeDiameter/tests/testcnx.c
r393 r403 531 531 int main(int argc, char *argv[]) 532 532 { 533 gnutls_datum_t ca = { ca_data, sizeof(ca_data) };534 gnutls_datum_t server_cert = { server_cert_data, sizeof(server_cert_data) };535 gnutls_datum_t server_priv = { server_priv_data, sizeof(server_priv_data) };536 gnutls_datum_t client_cert = { client_cert_data, sizeof(client_cert_data) };537 gnutls_datum_t client_priv = { client_priv_data, sizeof(client_priv_data) };538 gnutls_datum_t expired_cert = { expired_cert_data, sizeof(expired_cert_data) };539 gnutls_datum_t expired_priv = { expired_priv_data, sizeof(expired_priv_data) };540 gnutls_datum_t notrust_ca = { notrust_ca_data, sizeof(notrust_ca_data) };541 gnutls_datum_t notrust_cert = { notrust_cert_data, sizeof(notrust_cert_data) };542 gnutls_datum_t notrust_priv = { notrust_priv_data, sizeof(notrust_priv_data) };533 gnutls_datum_t ca = { (uint8_t *)ca_data, sizeof(ca_data) }; 534 gnutls_datum_t server_cert = { (uint8_t *)server_cert_data, sizeof(server_cert_data) }; 535 gnutls_datum_t server_priv = { (uint8_t *)server_priv_data, sizeof(server_priv_data) }; 536 gnutls_datum_t client_cert = { (uint8_t *)client_cert_data, sizeof(client_cert_data) }; 537 gnutls_datum_t client_priv = { (uint8_t *)client_priv_data, sizeof(client_priv_data) }; 538 gnutls_datum_t expired_cert = { (uint8_t *)expired_cert_data, sizeof(expired_cert_data) }; 539 gnutls_datum_t expired_priv = { (uint8_t *)expired_priv_data, sizeof(expired_priv_data) }; 540 gnutls_datum_t notrust_ca = { (uint8_t *)notrust_ca_data, sizeof(notrust_ca_data) }; 541 gnutls_datum_t notrust_cert = { (uint8_t *)notrust_cert_data, sizeof(notrust_cert_data) }; 542 gnutls_datum_t notrust_priv = { (uint8_t *)notrust_priv_data, sizeof(notrust_priv_data) }; 543 543 544 544 struct cnxctx * listener; … … 635 635 /* Create the instance */ 636 636 CHECK( 0, fd_msg_avp_new ( model, 0, &oh ) ); 637 value.os.data = "Client.side";638 value.os.len = strlen( value.os.data);637 value.os.data = (uint8_t *)"Client.side"; 638 value.os.len = strlen((char *)value.os.data); 639 639 CHECK( 0, fd_msg_avp_setvalue ( oh, &value ) ); 640 640 … … 1385 1385 const gnutls_datum_t *cert_list; 1386 1386 unsigned int cert_list_size; 1387 struct fd_list local, remote;1388 1387 struct fifo * myfifo = NULL; 1389 1388 struct timespec now; … … 1502 1501 const gnutls_datum_t *cert_list; 1503 1502 unsigned int cert_list_size; 1504 struct fd_list local, remote;1505 1503 struct fifo * myfifo = NULL; 1506 1504 struct timespec now; -
freeDiameter/tests/testdict.c
r10 r403 55 55 /* Test creating and searching all types of objects */ 56 56 { 57 enum dict_object_type type;58 57 struct dict_object * obj1 = NULL; 59 58 struct dict_object * obj2 = NULL; -
freeDiameter/tests/testmesg.c
r114 r403 1021 1021 struct dict_object * cmd_model = NULL; 1022 1022 struct msg * msg = NULL; 1023 struct dict_object * avp_model = NULL;1024 1023 struct avp * avp = NULL; 1025 1024 union avp_value value; 1026 1025 struct avp * avpi = NULL; 1027 struct avp * avpch = NULL;1028 1026 struct avp_hdr * avpdata = NULL; 1029 1027 struct msg_hdr * msgdata = NULL; -
freeDiameter/tests/tests.h
r297 r403 42 42 #define _TESTS_H 43 43 44 #include "libfD.h" 44 45 #include "fD.h" 45 46 -
freeDiameter/tests/testsess.c
r340 r403 236 236 struct mystate * ms[6], *tms; 237 237 int freed[6]; 238 int i;239 238 struct timespec timeout; 240 239 -
include/freeDiameter/freeDiameter.h
r336 r403 704 704 int fd_ep_filter( struct fd_list * list, uint32_t flags ); 705 705 int fd_ep_filter_family( struct fd_list * list, int af ); 706 int fd_ep_filter_list( struct fd_list * list, struct fd_list * exclude_list ); 706 707 int fd_ep_clearflags( struct fd_list * list, uint32_t flags ); 707 708 void fd_ep_dump_one( char * prefix, struct fd_endpoint * ep, char * suffix ); -
libfreeDiameter/rt_data.c
r258 r403 223 223 fd_rtd_candidate_del(rtd, sentto, 0); 224 224 if (origin) 225 fd_rtd_candidate_del(rtd, origin, originsz);225 fd_rtd_candidate_del(rtd, (char *)origin, originsz); 226 226 227 227 /* Done! */ -
libfreeDiameter/sessions.c
r340 r403 297 297 for (li_st = sess->states.next; li_st != &sess->states; li_st = li_st->next) { 298 298 struct state * st = (struct state *)(li_st->o); 299 char * sid_cpy;300 299 /* The list is ordered */ 301 300 if (st->hdl->id < del->id) … … 334 333 char * sid = NULL; 335 334 size_t sidlen; 336 uint32_t hash;337 335 struct session * sess; 338 336 struct fd_list * li;
Note: See TracChangeset
for help on using the changeset viewer.