Navigation


Changeset 403:26aafbbc1640 in freeDiameter


Ignore:
Timestamp:
Jul 8, 2010, 2:24:19 PM (14 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Cleanup all compilation warnings in base code for 32 bit arch

Files:
39 edited

Legend:

Unmodified
Added
Removed
  • extensions/acl_wl/aw_tree.c

    r258 r403  
    8888{
    8989        int i, l, prev_offset;
    90         char * c;
    9190       
    9291        TRACE_ENTRY("%p %p", name, result);
  • extensions/app_acct/acct_conf.y

    r284 r403  
    5959int yyparse(char * conffile);
    6060
     61/* The Lex parser prototype */
     62int acct_conflex(YYSTYPE *lvalp, YYLTYPE *llocp);
     63
    6164/* the global configuration */
    6265struct acct_conf * acct_config = NULL;
     
    8992        }
    9093
     94        if (!TRACE_BOOL(FULL))
     95                return 0;
     96       
    9197        struct fd_list * li;
    92         if (!TRACE_BOOL(FULL))
    93                 return;
    9498               
    9599        fd_log_debug("[app_acct] Configuration dump:\n");
     
    110114        }
    111115        fd_log_debug("[app_acct] Complete.\n");
     116        return 0;
    112117}
    113118
  • extensions/app_acct/acct_db.c

    r292 r403  
    6464        size_t sql_allocd = 0; /* The malloc'd size of the buffer */
    6565        size_t sql_offset = 0; /* The actual data already written in this buffer */
    66         size_t p;
    6766        int idx = 0;
    6867        PGresult * res;
  • extensions/app_acct/app_acct.c

    r286 r403  
    4848static int acct_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act)
    4949{
    50         struct msg_hdr *hdr = NULL;
    5150        struct msg * m;
    5251        struct avp * a = NULL;
    5352        struct avp_hdr * art=NULL, *arn=NULL; /* We keep a pointer on the Accounting-Record-{Type, Number} AVPs from the query */
    54         char * s;
    5553        struct acct_record_list rl;
    5654       
  • extensions/app_radgw/md5.c

    r254 r403  
    77 */
    88#include "rgw_common.h"
    9 /* Forward declaration: */
    10 void md5_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac);
    119/*********************************************************************************/
    1210
  • extensions/app_radgw/md5.h

    r254 r403  
    44 * It is redistributed under the terms of the BSD license, as allowed
    55 * by the original copyright reproduced bellow.
    6  *  The file has not been modified, except for this notice.
    76 */
     7
    88/*********************************************************************************/
    99
     
    4141#endif /* CONFIG_CRYPTO_INTERNAL */
    4242
     43 /* Forward declaration: */
     44void md5_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac);
     45
    4346#endif /* MD5_H */
  • extensions/app_radgw/rgw.h

    r356 r403  
    102102int rgw_clients_check_dup(struct rgw_radius_msg_meta **msg, struct rgw_client *cli);
    103103int 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);
    106104int rgw_client_finish_send(struct radius_msg ** msg, struct rgw_radius_msg_meta * req, struct rgw_client * cli);
    107105void rgw_clients_dispose(struct rgw_client ** ref);
  • extensions/app_radgw/rgw_clients.c

    r395 r403  
    189189static int client_search(struct rgw_client ** res, struct sockaddr * ip_port )
    190190{
    191         int ret = 0;
    192191        int cmp;
    193192        struct fd_list *ref = NULL;
     
    301300        for (idx = 0; idx < msg->radius.attr_used; idx++) {
    302301                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);
    304302                size_t attr_len = attr->length - sizeof(struct radius_attr_hdr);
    305303               
  • extensions/app_radgw/rgw_common.h

    r356 r403  
    5656/* This structure points to a RADIUS client description, the definition is not known to plugins */
    5757struct 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
     59int    rgw_clients_getkey(struct rgw_client * cli, unsigned char **key, size_t *key_len);
     60char * rgw_clients_id(struct rgw_client *cli);
     61int    rgw_clients_get_origin(struct rgw_client *cli, char **fqdn, char **realm);
    6062
    6163/* Each plugin must provide the following structure. */
  • extensions/app_radgw/rgw_conf.l

    r258 r403  
    136136                                }
    137137                               
    138                                 if (port = strchr(work, '[')) {
     138                                if ((port = strchr(work, '[')) != NULL) {
    139139                                        *port = '\0';
    140140                                        port++;
  • extensions/app_radgw/rgw_plugins.c

    r356 r403  
    173173{
    174174        struct plg_descr * new;
    175         int ret = 0;
    176175       
    177176        TRACE_ENTRY("%p %p %d %p %zi", plgfile, conffile, type, codes_array, codes_sz);
  • extensions/app_radgw/rgw_worker.c

    r385 r403  
    6363static void * work_th(void * arg)
    6464{
    65         char thname[10];
    66        
    6765        TRACE_ENTRY("%p", arg);
    6866       
  • extensions/app_radgw/rgwx_acct.c

    r376 r403  
    301301        const char * prefix = "Diameter/";
    302302        size_t pref_len;
    303         char * si = NULL;
     303        uint8_t * si = NULL;
    304304        size_t si_len = 0;
    305         char * un = NULL;
     305        uint8_t * un = NULL;
    306306        size_t un_len = 0;
    307307       
     
    357357                                if ((attr_len > pref_len ) && ! strncmp((char *)v, prefix, pref_len)) {
    358358                                        int i;
    359                                         si = (char *)v + pref_len;
     359                                        si = v + pref_len;
    360360                                        si_len = attr_len - pref_len;
    361361                                        TRACE_DEBUG(ANNOYING, "Found Class attribute with '%s' prefix (attr #%d), SI:'%.*s'.", prefix, idx, si_len, si);
     
    369369                        case RADIUS_ATTR_USER_NAME:
    370370                                if (attr_len) {
    371                                         un = (char *)v;
     371                                        un = v;
    372372                                        un_len = attr_len;
    373373                                        TRACE_DEBUG(ANNOYING, "Found a User-Name attribute: '%.*s'", un_len, un);
     
    471471        if (idx == 0) {
    472472                /* 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;
    474474                value.os.len  = fd_g_config->cnf_diamrlm_len;
    475475        } else {
     
    482482        /* Create the Session-Id AVP if needed */
    483483        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) );
    485485               
    486486                TRACE_DEBUG(FULL, "[auth.rgwx] Translating new accounting message for session '%.*s'...", si_len, si);
  • extensions/app_radgw/rgwx_auth.c

    r388 r403  
    236236        const char * prefix = "Diameter/";
    237237        size_t pref_len;
    238         char * dh = NULL;
     238        uint8_t * dh = NULL;
    239239        size_t dh_len = 0;
    240         char * dr = NULL;
     240        uint8_t * dr = NULL;
    241241        size_t dr_len = 0;
    242         char * si = NULL;
     242        uint8_t * si = NULL;
    243243        size_t si_len = 0;
    244         char * un = NULL;
     244        uint8_t * un = NULL;
    245245        size_t un_len = 0;
    246         uint32_t status_type;
    247246        size_t nattr_used = 0;
    248247        struct avp ** avp_tun = NULL, *avp = NULL;
     
    316315        for (idx = 0; idx < rad_req->attr_used; idx++) {
    317316                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);
    319318                size_t attr_len = attr->length - sizeof(struct radius_attr_hdr);
    320319               
     
    343342                        case RADIUS_ATTR_STATE:
    344343                                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)) {
    346345                                        int i, start;
    347346
     
    376375               
    377376                        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 : "");
    379378                                un = attr_val;
    380379                                un_len = attr_len;
     
    430429                if (i <= 0) {
    431430                        /* 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;
    433432                        value.os.len  = fd_g_config->cnf_diamrlm_len;
    434433                } else {
     
    455454                if (si_len) {
    456455                        /* 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) );
    458457                } else {
    459458                        /* Create a new Session-Id string */
     
    544543                if (got_empty_eap) {
    545544                        value.os.len = 0;
    546                         value.os.data = "";
     545                        value.os.data = (uint8_t *)"";
    547546                } else {
    548547                        CHECK_MALLOC( value.os.data = radius_msg_get_eap(rad_req, &value.os.len) );
     
    10661065        struct avp *avp, *next, *avp_x, *avp_y, *asid, *aoh;
    10671066        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;
    10691069        int ta_set = 0;
    10701070        int no_str = 0; /* indicate if an STR is required for this server */
     
    11891189        /* Now, save the session-id and eventually server info in a STATE or CLASS attribute */
    11901190        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))) {
    11951195                        TRACE_DEBUG(INFO, "Data truncated in State attribute: %s", buf);
    11961196                }
    1197                 CONV2RAD_STR(RADIUS_ATTR_STATE, buf, strlen(buf), 0);
     1197                CONV2RAD_STR(RADIUS_ATTR_STATE, buf, sz, 0);
    11981198        }
    11991199
    12001200        if ((*rad_fw)->hdr->code == RADIUS_CODE_ACCESS_ACCEPT) {
    12011201                /* 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))) {
    12041204                        TRACE_DEBUG(INFO, "Data truncated in Class attribute: %s", buf);
    12051205                }
    1206                 CONV2RAD_STR(RADIUS_ATTR_CLASS, buf, strlen(buf), 0);
     1206                CONV2RAD_STR(RADIUS_ATTR_CLASS, buf, sz, 0);
    12071207        }
    12081208       
     
    15871587                                                        CHECK_FCT( fd_msg_avp_hdr ( inavp, &ahdr ) );
    15881588                                                       
    1589                                                         if (ahdr->avp_flags & AVP_FLAG_VENDOR == 0) {
     1589                                                        if ( ! (ahdr->avp_flags & AVP_FLAG_VENDOR)) {
    15901590                                                                switch (ahdr->avp_code) {
    15911591                                                                        case DIAM_ATTR_TUNNEL_TYPE:
     
    16341634                                                                                        size_t pos;
    16351635                                                                                        int i;
    1636                                                                                         size_t buflen;
    16371636                                                                                        uint8_t * secret;       /* S */
    16381637                                                                                        size_t secret_len;
     
    16531652                                                                                       
    16541653                                                                                        /* The plain text string P */
    1655                                                                                         CHECK_PARAM(ahdr->avp_value->os.len < 240);
     1654                                                                                        CHECK_PARAMS(ahdr->avp_value->os.len < 240);
    16561655                                                                                        buf[3] = ahdr->avp_value->os.len;
    16571656                                                                                        memcpy(&buf[4], ahdr->avp_value->os.data, ahdr->avp_value->os.len);
     
    18171816                /* Add the auth-application-id required for STR, or 0 if no STR is required */
    18181817                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))) {
    18211820                        TRACE_DEBUG(INFO, "Data truncated in Class attribute: %s", buf);
    18221821                }
    1823                 CONV2RAD_STR(RADIUS_ATTR_CLASS, buf, strlen(buf), 0);
     1822                CONV2RAD_STR(RADIUS_ATTR_CLASS, buf, sz, 0);
    18241823        }
    18251824       
  • extensions/app_radgw/rgwx_echodrop.c

    r356 r403  
    240240static 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 )
    241241{
    242         int ret;
    243242        struct fd_list * list = NULL;
    244243       
     
    265264        while (! FD_IS_LIST_EMPTY(list) ) {
    266265                struct ed_saved_attribute * esa = (struct ed_saved_attribute *)(list->next);
    267                 struct radius_attr_hdr * rc;
    268266               
    269267                fd_list_unlink(&esa->chain);
  • extensions/app_radgw/rgwx_echodrop.y

    r270 r403  
    5353#include "rgwx_echodrop.h"
    5454#include "rgwx_echodrop.tab.h"  /* bison is not smart enough to define the YYLTYPE before including this code, so... */
     55
     56
     57/* Forward declaration */
     58int yyparse(char * conffile, struct rgwp_config *cs);
     59
     60/* The Lex parser prototype */
     61int rgwx_echodroplex(YYSTYPE *lvalp, YYLTYPE *llocp);
     62
    5563
    5664/* Parse the configuration file */
  • extensions/rt_default/rtd_rules.c

    r258 r403  
    307307}
    308308
    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. */
    310310static int get_next_match(struct fd_list * list, char * str, size_t len, struct fd_list ** next_match)
    311311{
     
    577577                                                r = NULL;
    578578                                                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) );
    580580                                                        if (!r)
    581581                                                                break;
  • extensions/test_app/ta_cli.c

    r258 r403  
    168168                CHECK_FCT_DO( fd_sess_getsid ( sess, &sid ), goto out );
    169169                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;
    171171                val.os.len  = strlen(sid);
    172172                CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out );
  • extensions/test_app/ta_serv.c

    r258 r403  
    5757        struct msg *ans, *qry;
    5858        struct avp * a;
    59         union avp_value val;
    6059       
    6160        TRACE_ENTRY("%p %p %p %p", msg, avp, sess, act);
     
    6665        /* Value of Origin-Host */
    6766        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) );
    6968        if (a) {
    7069                struct avp_hdr * hdr;
    71                 CHECK_FCT_DO( fd_msg_avp_hdr( a, &hdr ), return );
     70                CHECK_FCT( fd_msg_avp_hdr( a, &hdr ) );
    7271                fprintf(stderr, "'%.*s'", hdr->avp_value->os.len, hdr->avp_value->os.data);
    7372        } else {
  • freeDiameter/cnxctx.c

    r402 r403  
    162162#else /* DISABLE_SCTP */
    163163        struct cnxctx * cnx = NULL;
    164         sSS dummy;
    165         sSA * sa = (sSA *) &dummy;
    166164
    167165        TRACE_ENTRY("%hu %p", port, ep_list);
     
    224222        socklen_t ss_len = sizeof(ss);
    225223        int cli_sock = 0;
    226         struct fd_endpoint * ep;
    227224
    228225        TRACE_ENTRY("%p", serv);
     
    988985int fd_tls_verify_credentials(gnutls_session_t session, struct cnxctx * conn, int verbose)
    989986{
    990         int ret, i;
     987        int i;
     988        unsigned int gtret;
    991989        const gnutls_datum_t *cert_list;
    992990        unsigned int cert_list_size;
     
    10181016                                fd_log_debug("\t - TLS/IA session\n");
    10191017                                break;
    1020 
    1021 
    1022                         #ifdef ENABLE_SRP
    1023                         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                         #endif
    10281018
    10291019                        case GNUTLS_CRD_PSK:
     
    10491039                                                gnutls_dh_get_prime_bits (session));
    10501040                                }
     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
    10511052                }
    10521053
     
    10731074       
    10741075        /* 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, &gtret), return EINVAL );
     1077        if (gtret) {
    10771078                if (TRACE_BOOL(INFO)) {
    10781079                        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)
    10801081                                fd_log_debug(" - The certificate is not trusted (unknown CA? expired?)\n");
    1081                         if (ret & GNUTLS_CERT_REVOKED)
     1082                        if (gtret & GNUTLS_CERT_REVOKED)
    10821083                                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)
    10841085                                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)
    10861087                                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)
    10881089                                fd_log_debug(" - The certificate signature uses a weak algorithm.\n");
    10891090                }
  • freeDiameter/cnxctx.h

    r378 r403  
    109109int fd_sctp_get_remote_ep(int sock, struct fd_list * list);
    110110int 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);
     111int fd_sctp_sendstr(int sock, uint16_t strid, uint8_t * buf, size_t len, uint32_t * cc_closing);
     112int fd_sctp_recvmeta(int sock, uint16_t * strid, uint8_t ** buf, size_t * len, int *event, uint32_t * cc_closing);
    113113
    114114/* TLS over SCTP (multi-stream) */
     
    137137#endif /* DISABLE_SCTP */
    138138
    139 /* UDP */
    140 int fd_cnx_get_local_eps(struct fd_list * list);
    141139
    142140#endif /* _CNXCTX_H */
  • freeDiameter/config.c

    r309 r403  
    9797                fd_log_debug("  Local endpoints ........ : Default (use all available)\n");
    9898        } else {
    99                 struct fd_list * li = fd_g_config->cnf_endpoints.next;
    10099                fd_log_debug("  Local endpoints ........ : \n");
    101100                fd_ep_dump( 29, &fd_g_config->cnf_endpoints );
  • freeDiameter/fD.h

    r378 r403  
    327327int             fd_cnx_getTLS(struct cnxctx * conn);
    328328int             fd_cnx_getcred(struct cnxctx * conn, const gnutls_datum_t **cert_list, unsigned int *cert_list_size);
     329int             fd_cnx_get_local_eps(struct fd_list * list);
    329330int             fd_cnx_getremoteeps(struct cnxctx * conn, struct fd_list * eps);
    330331char *          fd_cnx_getremoteid(struct cnxctx * conn);
  • freeDiameter/p_ce.c

    r378 r403  
    309309                               
    310310                                /* 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)) {
    312313                                        TRACE_DEBUG(INFO, "Received a message with Origin-Host set to '%.*s' while expecting '%s'\n",
    313314                                                        hdr->avp_value->os.len, hdr->avp_value->os.data, peer->p_hdr.info.pi_diamid);
  • freeDiameter/p_dp.c

    r258 r403  
    4848                int delay = peer->p_hdr.info.config.pic_tctimer ?: fd_g_config->cnf_timer_tc;
    4949               
    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 ));
    5151                if (dc) {
    5252                        /* Check the value is consistent with the saved one */
    5353                        struct avp_hdr * hdr;
    54                         CHECK_FCT_DO(  fd_msg_avp_hdr( dc, &hdr ), return  );
     54                        CHECK_FCT(  fd_msg_avp_hdr( dc, &hdr )  );
    5555                        if (hdr->avp_value == NULL) {
    5656                                /* This is a sanity check */
  • freeDiameter/p_psm.c

    r378 r403  
    689689                                CHECK_FCT_DO( fd_p_ce_process_receiver(peer), goto psm_end );
    690690                                goto psm_loop;
     691                       
     692                        default:
     693                                ASSERT(0); /* implementation problem, we did not foresee this case? */
    691694                }
    692695        }
  • freeDiameter/peers.c

    r391 r403  
    224224{
    225225        struct fd_peer *p;
    226         void * t;
    227226       
    228227        TRACE_ENTRY("%p", ptr);
     
    429428        for (li = fd_g_peers.next; li != &fd_g_peers; li = li->next) {
    430429                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 );
    432432                if (cmp > 0)
    433433                        continue;
  • freeDiameter/routing_dispatch.c

    r258 r403  
    269269                        if (dh
    270270                                && (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)) {
    272273                                /* The candidate is the Destination-Host */
    273274                                c->score += FD_SCORE_FINALDEST;
     
    275276                                if (dr  && peer->p_hdr.info.runtime.pir_realm
    276277                                        && (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)) {
    278280                                        /* The candidate's realm matchs the Destination-Realm */
    279281                                        c->score += FD_SCORE_REALM;
     
    355357static int process_decorated_NAI(union avp_value * un, union avp_value * dr)
    356358{
    357         int i, at_idx = 0, sep_idx = 0;
     359        int at_idx = 0, sep_idx = 0;
    358360        unsigned char * old_un;
    359361        TRACE_ENTRY("%p %p", un, dr);
     
    365367        /* Search the positions of the first '!' and the '@' in the string */
    366368        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));
    368370       
    369371        /* Create the new User-Name value */
  • freeDiameter/sctp.c

    r378 r403  
    997997
    998998/* 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)
     999int fd_sctp_sendstr(int sock, uint16_t strid, uint8_t * buf, size_t len, uint32_t * cc_status)
    10001000{
    10011001        struct msghdr mhdr;
     
    10541054
    10551055/* 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)
     1056int fd_sctp_recvmeta(int sock, uint16_t * strid, uint8_t ** buf, size_t * len, int *event, uint32_t * cc_status)
    10571057{
    10581058        ssize_t                  ret = 0;
  • freeDiameter/sctps.c

    r401 r403  
    620620        /* End all TLS sessions, in series (not as efficient as paralel, but simpler) */
    621621        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)) {
    623623                        CHECK_GNUTLS_DO( gnutls_bye(conn->cc_sctps_data.array[i].session, GNUTLS_SHUT_WR), fd_cnx_markerror(conn) );
    624624                }
  • freeDiameter/tests/testappacct.c

    r355 r403  
    8989{
    9090        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 */
    9193        struct msg * msg;
    9294        char * sess_bkp;
    93         struct dict_object * session_id = NULL;
    9495       
    9596        /* First, initialize the daemon modules */
  • freeDiameter/tests/testcnx.c

    r393 r403  
    531531int main(int argc, char *argv[])
    532532{
    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) };
    543543       
    544544        struct cnxctx * listener;
     
    635635                /* Create the instance */
    636636                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);
    639639                CHECK( 0, fd_msg_avp_setvalue ( oh, &value ) );
    640640               
     
    13851385                const gnutls_datum_t *cert_list;
    13861386                unsigned int cert_list_size;
    1387                 struct fd_list local, remote;
    13881387                struct fifo * myfifo = NULL;
    13891388                struct timespec now;
     
    15021501                const gnutls_datum_t *cert_list;
    15031502                unsigned int cert_list_size;
    1504                 struct fd_list local, remote;
    15051503                struct fifo * myfifo = NULL;
    15061504                struct timespec now;
  • freeDiameter/tests/testdict.c

    r10 r403  
    5555        /* Test creating and searching all types of objects */
    5656        {
    57                 enum dict_object_type type;
    5857                struct dict_object * obj1 = NULL;
    5958                struct dict_object * obj2 = NULL;
  • freeDiameter/tests/testmesg.c

    r114 r403  
    10211021                        struct dict_object * cmd_model = NULL;
    10221022                        struct msg         * msg = NULL;
    1023                         struct dict_object * avp_model = NULL;
    10241023                        struct avp         * avp = NULL;
    10251024                        union avp_value      value;
    10261025                        struct avp         * avpi = NULL;
    1027                         struct avp         * avpch = NULL;
    10281026                        struct avp_hdr     * avpdata = NULL;
    10291027                        struct msg_hdr     * msgdata = NULL;
  • freeDiameter/tests/tests.h

    r297 r403  
    4242#define _TESTS_H
    4343
     44#include "libfD.h"
    4445#include "fD.h"
    4546
  • freeDiameter/tests/testsess.c

    r340 r403  
    236236                struct mystate * ms[6], *tms;
    237237                int freed[6];
    238                 int i;
    239238                struct timespec timeout;
    240239               
  • include/freeDiameter/freeDiameter.h

    r336 r403  
    704704int fd_ep_filter( struct fd_list * list, uint32_t flags );
    705705int fd_ep_filter_family( struct fd_list * list, int af );
     706int fd_ep_filter_list( struct fd_list * list, struct fd_list * exclude_list );
    706707int fd_ep_clearflags( struct fd_list * list, uint32_t flags );
    707708void fd_ep_dump_one( char * prefix, struct fd_endpoint * ep, char * suffix );
  • libfreeDiameter/rt_data.c

    r258 r403  
    223223        fd_rtd_candidate_del(rtd, sentto, 0);
    224224        if (origin)
    225                 fd_rtd_candidate_del(rtd, origin, originsz);
     225                fd_rtd_candidate_del(rtd, (char *)origin, originsz);
    226226       
    227227        /* Done! */
  • libfreeDiameter/sessions.c

    r340 r403  
    297297                        for (li_st = sess->states.next; li_st != &sess->states; li_st = li_st->next) {
    298298                                struct state * st = (struct state *)(li_st->o);
    299                                 char * sid_cpy;
    300299                                /* The list is ordered */
    301300                                if (st->hdl->id < del->id)
     
    334333        char * sid = NULL;
    335334        size_t sidlen;
    336         uint32_t hash;
    337335        struct session * sess;
    338336        struct fd_list * li;
Note: See TracChangeset for help on using the changeset viewer.