From 5cd7a46f0902b7a2fd3351ce3e069d8336d4e4d7 Mon Sep 17 00:00:00 2001 From: Ren RenJuan Date: Thu, 9 Jan 2014 01:35:37 +0000 Subject: [PATCH] * --- .cproject | 116 +++++++++++++++++++----------- ACTK1_0/Makefile | 46 ++++++------ ACTK1_0/common/init.hpp | 2 +- ACTK1_0/session/TLSContext.cpp | 34 ++++----- ACTK1_0/session/TLSSocket.cpp | 2 +- AusRegEPPTK/session/TLSSocket.cpp | 2 +- 6 files changed, 116 insertions(+), 86 deletions(-) diff --git a/.cproject b/.cproject index 87234e2..b63fa6f 100644 --- a/.cproject +++ b/.cproject @@ -55,25 +55,8 @@ - - make - - ACTK - true - true - true - - - make - - clean - true - true - true - make - clean true true @@ -81,7 +64,6 @@ make - all true true @@ -89,14 +71,61 @@ make + tests true true true + + make + + libACTK1_0.so + true + true + true + + + make + clean + true + true + true + + + make + + tests + true + true + true + + + make + + dirs + true + true + true + + + make + + dclean + true + true + true + + + make + + all + true + true + true + make - clean true true @@ -104,36 +133,13 @@ make - cliever true true true - - make - all - true - true - true - - - make - tests - true - true - true - - - make - clean - true - true - true - make - cliever true true @@ -141,6 +147,7 @@ make + clean true true @@ -148,11 +155,36 @@ make + distclean true true true + + make + + all + true + true + true + + + make + + tests + true + true + true + + + make + + clean + true + true + true + diff --git a/ACTK1_0/Makefile b/ACTK1_0/Makefile index 75ffc57..1e55609 100644 --- a/ACTK1_0/Makefile +++ b/ACTK1_0/Makefile @@ -1,25 +1,31 @@ ################################################## # Makefile for building lib and main test routine# ################################################## -# operating system +LOCATION=authoring + SYSTEM = $(shell uname -s) CXX = g++ CC = gcc -#SHARED_CXXFLAGS += -O2 -SHARED_CXXFLAGS += -g +#PRODORDEV += -O2 +PRODORDEV += -ggdb3 -CXXFLAGS = $(SHARED_CXXFLAGS) -Wall -Wpointer-arith -Wcast-qual -D_REENTRANT -fPIC -CPPFLAGS = -fPIC -D_GNU_SOURCE -CXXFLAGS += -D_GNU_SOURCE -O0 +CXXFLAGS = $(PRODORDEV) -Wall -Wpointer-arith -Wcast-qual -D_REENTRANT -fPIC +CPPFLAGS = -fPIC -D_GNU_SOURCE +CXXFLAGS += -D_GNU_SOURCE -O0 -#XERCES_HOME = /usr/local/xerces-c-src_2_7_0 -#XERCES_LIB_DIR = ${XERCES_HOME}/lib -#XERCES_LIB = xerces-c2_7_0 - -#XALAN_HOME = /usr/local/xalan-c_1_10_0 -#XALAN_LIB_DIR = $(XALAN_HOME)/lib +ifeq ($(LOCATION),authoring) +XALAN_LIB_DIR = /usr/lib/x86_64-linux-gnu/ +endif +ifeq ($(LOCATION),production) +XALAN_LIB_DIR = /usr/lib/ +endif +XALAN_LIB = xalan-c +XALAN_INC_DIR = /usr/include/xalanc +XERCES_LIB_DIR = /usr/lib/ +XERCES_LIB = xerces-c +XERCES_INC_DIR = /usr/include/xercesc/ include xml-deps.mk @@ -48,7 +54,7 @@ test_execs = $(subst .o,,$(test_objs)) calc_deps = \ $(CC) -MT '$(build_obj_dir)/$(basename $(notdir $@)).o $@' -MF $@ -MM $(CPPFLAGS) $(INCLUDE_DIR) $< -all: dirs $(objs) $(BUILD_LIB_DIR)/libACTK1_3_2.so +all: dirs $(objs) $(BUILD_LIB_DIR)/libACTK1_0.so %.d: %.c $(calc_deps) @@ -78,8 +84,8 @@ $(BUILD_OBJ_DIR)/%.o: %.c $(CC) $(CPPFLAGS) -c -o $@ $(INCLUDE_DIR) $< -LDFLAGS_TESTS = -L$(BUILD_LIB_DIR) -lACTK1_3_2 \ - -L$(XALAN_LIB_DIR) -lxalan-c -lxalanMsg\ +LDFLAGS_TESTS = -L$(BUILD_LIB_DIR) -lACTK1_0 \ + -L$(XALAN_LIB_DIR) -lxalan-c -lxalanMsg -licuuc -licudata \ -L$(XERCES_LIB_DIR) -lxerces-c \ -lssl \ -lrt @@ -90,7 +96,7 @@ $(BUILD_OBJ_DIR)/%: $(BUILD_OBJ_DIR)/%.o .PHONY: doc clean dclean ####### Build rules -#libACTK1_3_2.a: $(OBJECTS) +#libAusreg_EPP_toolkit.a: $(OBJECTS) # $(LIB_ARCHIVER) $(LIB_FLAGS) $(BUILD_LIB_DIR)/$@ $^ @@ -103,15 +109,15 @@ dirs: -mkdir -p $(BUILD_LIB_DIR) -mkdir -p $(BUILD_OBJ_DIR) -libACTK1_3_2.so: -$(BUILD_LIB_DIR)/libACTK1_3_2.so: $(objs) - $(CXX) $(LDFLAGS) $(SHARED_CXXFLAGS) -shared $^ -o $@ +libACTK1_0.so: +$(BUILD_LIB_DIR)/libACTK1_0.so: $(objs) + $(CXX) $(LDFLAGS) $(PRODORDEV) -shared $^ -o $@ doc: doxygen etc/Doxyfile clean: - $(RM) $(objs) $(BUILD_LIB_DIR)/libACTK1_3_2.so *~ + $(RM) $(objs) $(BUILD_LIB_DIR)/libACTK1_0.so *~ $(RM) -r $(BUILD_OBJ_DIR) $(RM) -r $(BUILD_LIB_DIR) diff --git a/ACTK1_0/common/init.hpp b/ACTK1_0/common/init.hpp index aaef8c6..d62d096 100644 --- a/ACTK1_0/common/init.hpp +++ b/ACTK1_0/common/init.hpp @@ -3,6 +3,6 @@ #include -void init(const std::string& system_props_file); +void init(const std::string &system_props_file); #endif diff --git a/ACTK1_0/session/TLSContext.cpp b/ACTK1_0/session/TLSContext.cpp index 517c4d6..de5cf85 100644 --- a/ACTK1_0/session/TLSContext.cpp +++ b/ACTK1_0/session/TLSContext.cpp @@ -8,14 +8,6 @@ #include #include -#if (PRODUCTION==1) -#define sslCast -#define sslUncast -#else -#define sslCast const -#define sslUncast (SSL_CTX *) -#endif - using namespace std; namespace { @@ -41,36 +33,36 @@ TLSContext::TLSContext(const string& private_key_file, SSL_load_error_strings(); SSL_library_init(); - sslCast SSL_METHOD *meth = TLSv1_client_method(); + SSL_METHOD *meth = TLSv1_client_method(); if (meth == NULL) throw SSLException("Error initialising SSL method"); // SSL Context - sslCast SSL_CTX *local_ctx = SSL_CTX_new(meth); + SSL_CTX *local_ctx = SSL_CTX_new(meth); if (local_ctx == NULL) { throw SSLException ("Error initialising SSL context"); } // SSL Ciphers - int i = SSL_CTX_set_cipher_list( sslUncast local_ctx, "TLSv1"); + int i = SSL_CTX_set_cipher_list( local_ctx, "TLSv1"); if (i == -1) { - SSL_CTX_free( sslUncast local_ctx); + SSL_CTX_free( local_ctx); throw SSLException( "There was a problem initialising the SSL cipher list"); } - SSL_CTX_set_default_passwd_cb_userdata( sslUncast local_ctx, + SSL_CTX_set_default_passwd_cb_userdata( local_ctx, static_cast(const_cast(password.c_str()))); - SSL_CTX_set_default_passwd_cb( sslUncast local_ctx, getPassword); + SSL_CTX_set_default_passwd_cb( local_ctx, getPassword); - i = SSL_CTX_use_PrivateKey_file( sslUncast local_ctx, + i = SSL_CTX_use_PrivateKey_file( local_ctx, private_key_file.c_str(), SSL_FILETYPE_PEM); if (i == -1) { - SSL_CTX_free( sslUncast local_ctx); + SSL_CTX_free( local_ctx); throw SSLException( "There was a problem initialising SSL the private key '" + private_key_file + "'"); @@ -78,23 +70,23 @@ TLSContext::TLSContext(const string& private_key_file, // Load the public certificate for our key. // Replace with - i = SSL_CTX_use_certificate_chain_file( sslUncast local_ctx, cert_file.c_str()); + i = SSL_CTX_use_certificate_chain_file( local_ctx, cert_file.c_str()); if (i == -1) { - SSL_CTX_free( sslUncast local_ctx); + SSL_CTX_free( local_ctx); throw SSLException("Error loading cert_file '" + cert_file + "'"); } // Load the CA certificate(s) - i = SSL_CTX_load_verify_locations ( sslUncast local_ctx, ca_file.c_str(), NULL); + i = SSL_CTX_load_verify_locations ( local_ctx, ca_file.c_str(), NULL); if (i == -1) { - SSL_CTX_free( sslUncast local_ctx); + SSL_CTX_free( local_ctx); throw EPPException ("Could not load CA file '" + ca_file +"'"); } - ctx = sslUncast local_ctx; + ctx = local_ctx; } diff --git a/ACTK1_0/session/TLSSocket.cpp b/ACTK1_0/session/TLSSocket.cpp index 0349cca..8856327 100644 --- a/ACTK1_0/session/TLSSocket.cpp +++ b/ACTK1_0/session/TLSSocket.cpp @@ -40,7 +40,7 @@ TLSSocket::TLSSocket(SSL_CTX* ctx, int sock, const string& host, if ((ret = SSL_get_verify_result(ssl)) != X509_V_OK) { - SSLException e("Certificate verify failed", ssl, ret); + SSLException e("Certificate Verify failed", ssl, ret); SSL_shutdown(ssl); throw e; } diff --git a/AusRegEPPTK/session/TLSSocket.cpp b/AusRegEPPTK/session/TLSSocket.cpp index 0349cca..8856327 100644 --- a/AusRegEPPTK/session/TLSSocket.cpp +++ b/AusRegEPPTK/session/TLSSocket.cpp @@ -40,7 +40,7 @@ TLSSocket::TLSSocket(SSL_CTX* ctx, int sock, const string& host, if ((ret = SSL_get_verify_result(ssl)) != X509_V_OK) { - SSLException e("Certificate verify failed", ssl, ret); + SSLException e("Certificate Verify failed", ssl, ret); SSL_shutdown(ssl); throw e; }