Mercurial > hg > waaad
changeset 278:db74ce92d203
Fix broken sanity check
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Fri, 19 Dec 2008 15:24:52 +0900 |
parents | bad2424e6d0f |
children | 3c1b2f974e14 |
files | waaad/peer-cer_cea.c |
diffstat | 1 files changed, 78 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/waaad/peer-cer_cea.c Fri Dec 19 15:07:17 2008 +0900 +++ b/waaad/peer-cer_cea.c Fri Dec 19 15:24:52 2008 +0900 @@ -389,16 +389,16 @@ goto next; } - if (avpdata->avp_data == NULL) { - /* Ignore if the data is not set -- this is more like a sanity check */ - TRACE_DEBUG(FULL, "Ignored an AVP with unset value in CER"); - msg_dump_one(FULL, avp); - ASSERT(0); /* To check if this really happens, and understand why... */ - goto next; - } - switch (avpdata->avp_code) { case AC_ORIGIN_HOST: /* Origin-Host */ + if (avpdata->avp_data == NULL) { + /* Ignore if the data is not set -- this is more like a sanity check */ + TRACE_DEBUG(FULL, "Ignored an AVP with unset value in CER"); + msg_dump_one(FULL, avp); + ASSERT(0); /* To check if this really happens, and understand why... */ + goto next; + } + /* Copy the value into peer->p_diamid, as a lowercase string */ free(peer->p_diamid); CHECK_MALLOC( peer->p_diamid = (char *) malloc( avpdata->avp_data->os.len + 1 ) ); @@ -409,6 +409,13 @@ break; case AC_ORIGIN_REALM: /* Origin-Realm */ + if (avpdata->avp_data == NULL) { + /* Ignore if the data is not set -- this is more like a sanity check */ + TRACE_DEBUG(FULL, "Ignored an AVP with unset value in CER"); + msg_dump_one(FULL, avp); + ASSERT(0); /* To check if this really happens, and understand why... */ + goto next; + } /* Copy the value into peer->p_realm, as a lowercase string */ free(peer->p_realm); CHECK_MALLOC( peer->p_realm = (char *) malloc( avpdata->avp_data->os.len + 1 ) ); @@ -419,6 +426,13 @@ break; case AC_HOST_IP_ADDRESS: /* Host-IP-Address */ + if (avpdata->avp_data == NULL) { + /* Ignore if the data is not set -- this is more like a sanity check */ + TRACE_DEBUG(FULL, "Ignored an AVP with unset value in CER"); + msg_dump_one(FULL, avp); + ASSERT(0); /* To check if this really happens, and understand why... */ + goto next; + } if (peer->p_peeraddr_sz == 0) { CHECK_MALLOC( peer->p_peeraddr = (sSS *) malloc( sizeof(sSS) ) ); } else { @@ -436,10 +450,24 @@ case AC_VENDOR_ID: /* Vendor-Id */ + if (avpdata->avp_data == NULL) { + /* Ignore if the data is not set -- this is more like a sanity check */ + TRACE_DEBUG(FULL, "Ignored an AVP with unset value in CER"); + msg_dump_one(FULL, avp); + ASSERT(0); /* To check if this really happens, and understand why... */ + goto next; + } peer->p_vendor = avpdata->avp_data->u32; break; case AC_PRODUCT_NAME: /* Product-Name */ + if (avpdata->avp_data == NULL) { + /* Ignore if the data is not set -- this is more like a sanity check */ + TRACE_DEBUG(FULL, "Ignored an AVP with unset value in CER"); + msg_dump_one(FULL, avp); + ASSERT(0); /* To check if this really happens, and understand why... */ + goto next; + } free(peer->p_prodname); CHECK_MALLOC( peer->p_prodname = (char *) malloc( avpdata->avp_data->os.len + 1 ) ); @@ -448,10 +476,24 @@ break; case AC_ORIGIN_STATE_ID: /* Origin-State-Id */ + if (avpdata->avp_data == NULL) { + /* Ignore if the data is not set -- this is more like a sanity check */ + TRACE_DEBUG(FULL, "Ignored an AVP with unset value in CER"); + msg_dump_one(FULL, avp); + ASSERT(0); /* To check if this really happens, and understand why... */ + goto next; + } peer->p_orstate = avpdata->avp_data->u32; break; case AC_SUPPORTED_VENDOR_ID: /* Supported-Vendor-Id */ + if (avpdata->avp_data == NULL) { + /* Ignore if the data is not set -- this is more like a sanity check */ + TRACE_DEBUG(FULL, "Ignored an AVP with unset value in CER"); + msg_dump_one(FULL, avp); + ASSERT(0); /* To check if this really happens, and understand why... */ + goto next; + } TRACE_DEBUG(FULL, "Info: The remote peer claims support for (a subset of) vendor %d features...", avpdata->avp_data->u32); break; @@ -510,18 +552,46 @@ break; case AC_AUTH_APPLICATION_ID: /* Auth-Application-Id */ + if (avpdata->avp_data == NULL) { + /* Ignore if the data is not set -- this is more like a sanity check */ + TRACE_DEBUG(FULL, "Ignored an AVP with unset value in CER"); + msg_dump_one(FULL, avp); + ASSERT(0); /* To check if this really happens, and understand why... */ + goto next; + } CHECK_FCT( _peer_struct_appl_add(peer, avpdata->avp_data->u32, 0, APP_TYPE_AUTH) ); break; case AC_ACCT_APPLICATION_ID: /* Acct-Application-Id */ + if (avpdata->avp_data == NULL) { + /* Ignore if the data is not set -- this is more like a sanity check */ + TRACE_DEBUG(FULL, "Ignored an AVP with unset value in CER"); + msg_dump_one(FULL, avp); + ASSERT(0); /* To check if this really happens, and understand why... */ + goto next; + } CHECK_FCT( _peer_struct_appl_add(peer, avpdata->avp_data->u32, 0, APP_TYPE_ACCT) ); break; case AC_INBAND_SECURITY_ID: /* Inband-Security-Id */ + if (avpdata->avp_data == NULL) { + /* Ignore if the data is not set -- this is more like a sanity check */ + TRACE_DEBUG(FULL, "Ignored an AVP with unset value in CER"); + msg_dump_one(FULL, avp); + ASSERT(0); /* To check if this really happens, and understand why... */ + goto next; + } CHECK_FCT( _peer_struct_secid_add(peer, avpdata->avp_data->u32) ); break; case AC_FIRMWARE_REVISION: /* Firmware-Revision */ + if (avpdata->avp_data == NULL) { + /* Ignore if the data is not set -- this is more like a sanity check */ + TRACE_DEBUG(FULL, "Ignored an AVP with unset value in CER"); + msg_dump_one(FULL, avp); + ASSERT(0); /* To check if this really happens, and understand why... */ + goto next; + } peer->p_firmrev = avpdata->avp_data->u32; break;