Author: milinda Date: Thu Jun 12 23:28:25 2008 New Revision: 667375 URL: http://svn.apache.org/viewvc?rev=667375&view=rev Log: Fixed null checking logic in kay manager.
Modified: webservices/rampart/trunk/c/src/omxmlsec/key_mgr.c webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c Modified: webservices/rampart/trunk/c/src/omxmlsec/key_mgr.c URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/key_mgr.c?rev=667375&r1=667374&r2=667375&view=diff ============================================================================== --- webservices/rampart/trunk/c/src/omxmlsec/key_mgr.c (original) +++ webservices/rampart/trunk/c/src/omxmlsec/key_mgr.c Thu Jun 12 23:28:25 2008 @@ -944,7 +944,12 @@ { AXIS2_PARAM_CHECK(env->error, ski, NULL); - return pkcs12_keystore_get_certificate_for_subject_key_id(key_mgr->key_store, env, ski); + if(key_mgr->key_store) + { + return pkcs12_keystore_get_certificate_for_subject_key_id(key_mgr->key_store, env, ski); + } + + return NULL; } AXIS2_EXTERN oxs_x509_cert_t * AXIS2_CALL @@ -957,7 +962,10 @@ AXIS2_PARAM_CHECK(env->error, issuer, NULL); AXIS2_PARAM_CHECK(env->error, serial, NULL) - return pkcs12_keystore_get_certificate_for_issuer_serial(key_mgr->key_store, env, issuer, serial); + if(key_mgr->key_store) + return pkcs12_keystore_get_certificate_for_issuer_serial(key_mgr->key_store, env, issuer, serial); + + return NULL; } Modified: webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c?rev=667375&r1=667374&r2=667375&view=diff ============================================================================== --- webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c (original) +++ webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c Thu Jun 12 23:28:25 2008 @@ -91,14 +91,14 @@ axis2_char_t *ski = NULL; oxs_key_mgr_t *key_mgr = NULL; - if(rampart_context_get_receiver_certificate_file(rampart_ctx, env)) + if((cert = rampart_context_get_receiver_certificate(rampart_ctx, env))) { /* In the client side, it is prefered to use certificate files instead * of key store, because one client normally interact with only one * service. To handle this scenario, if we found reciever certificate file * specified in rampart_context we directly call the get_reciever_certificate. */ - return rampart_context_get_receiver_certificate(rampart_ctx, env); + return cert; } key_id_element = axiom_node_get_data_element(key_id_node, env);