我正在为HP unix框中的seibel服务器创建一个安全适配器的SO文件。 因为我们使用CURL从其他服务获取用户信息。
它可以独立执行。 即能够初始化SSL并访问其余服务(HTTPS)并获取数据。
但是当从siebel服务器运行时,它会崩溃服务器本身。 :(
出于测试目的,我创建了一个简单的test_curl.c程序 做初始化并清理。
test_curl.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h>
int testCurl()
{
CURL* tcurl;
tcurl = curl_easy_init(); // exactly crashes in this statement.
curl_easy_cleanup(tcurl);
curl_global_cleanup();
return 0;
}
siebel服务器中的安全适配器代码。
SEC_EXPORT SecurityErrCode SecurityLogin8 (const char* pUsername,
const char* pPassword,
const char** pParameters,
CSSSecurityUser** ppUser,
char** ppErrMessage)
{
FILE *fp = fopen("Sample_test_curl.log", "a");
fprintf(fp, "SecurityLogin8(): Started..\n");
int i=0;
// just a statement to check whether a call to curl works.
fflush(fp);
fprintf(fp, "SecurityLogin8(): before the call..\n");
fflush(fp);
i= testCurl();
fprintf(fp, "SecurityLogin8(): testcurl returned you a message :) - %d \n", i );
fprintf(fp, "SecurityLogin8(): Force failing the attempt \n");
return SecurityErrNoCredentials;
}
初始化时,Libcurl崩溃了。下面是崩溃转储
Process 7887, thread 0x0000000f
-
PROCESS CRASHED AFTER RECEIVING SIGNAL - 11!!
/usr/lib/hpux32/libcurl.so.6 +0x127800 = ENGINE_new +0x160 at 0xf3c4e800
/usr/lib/hpux32/libcurl.so.6 +0x1314a0 = engine_dynamic +0x20 at 0xf3c584a0
/usr/lib/hpux32/libcurl.so.6 +0x132020 = ENGINE_load_dynamic +0x20 at 0xf3c59020
/usr/lib/hpux32/libcurl.so.6 +0x12e910 = ENGINE_load_builtin_engines +0x20 at 0xf3c55910
/usr/lib/hpux32/libcurl.so.6 +0xcc180 = Curl_ossl_init +0x20 at 0xf3bf3180
/usr/lib/hpux32/libcurl.so.6 +0xf7e70 = Curl_ssl_init +0x70 at 0xf3c1ee70
/usr/lib/hpux32/libcurl.so.6 +0xe1210 = curl_global_init +0x110 at 0xf3c08210
/usr/lib/hpux32/libcurl.so.6 +0xe12c0 = curl_easy_init +0x50 at 0xf3c082c0
/opt/isv/siebel/siebsrvr/lib/libSiebel8SSO_2.so + 0x1860 = testCurl()+ 0x20 at 0xfd7e0860
这是make,我用来构建SO文件。
SRCDIR = Sample
TESTSRCDIR = testsrc
CRYPTCLISRCDIR = cryptcli
SDKSRCDIR = sdksrc
CCOMPILER = /opt/aCC/bin/aCC
# gcc opts -c -O0 -g3 -pedantic -Wall -ansi -v -fmessage-length=0
CPLUSPLUSCOMPILER = /opt/aCC/bin/aCC
COPTS = -c -AA -mt -g0 +d
COPTSDBG = -c -g0 +d -AA -mt
# g++ opts -c -O0 -g3 -pedantic -Wall -ansi -v -fmessage-length=0
CPLUSPLUSOPTS = -c -AA -mt -g0 +d
CPLUSPLUSOPTSDBG = -c -g0 +d -AA -mt
LINKOPTS = -b
LIB_C_SRC = test_curl.c
LIB_CPP_SRC = secutil.cpp secsamp.cpp test_samp.cpp
LIB_OBJS = test_curl.o secsamp.o secutil.o
LIBS = -L/opt/iexpress/curl/lib -lcurl -lssl -lcrypto
SSOLIBS = -L. -lSiebel8SSO
default:
@echo
@echo "Please specify a target. clean all lib test_sso test_hds sso_crypt tar"
@echo
test_curl.o: $(SRCDIR)/test_curl.c
$(CCOMPILER) $(COPTS) -o $@ $(SRCDIR)/test_curl.c
secutil.o: $(SRCDIR)/secutil.cpp
$(CPLUSPLUSCOMPILER) $(CPLUSPLUSOPTS) -o $@ $(SRCDIR)/secutil.cpp
secsamp.o: $(SRCDIR)/secsamp.cpp
$(CPLUSPLUSCOMPILER) $(CPLUSPLUSOPTS) -o $@ $(SRCDIR)/secsamp.cpp
test_samp.o: $(SRCDIR)/test_samp.cpp
$(CPLUSPLUSCOMPILER) $(CPLUSPLUSOPTS) -o $@ $(SRCDIR)/test_samp.cpp
lib: $(LIB_OBJS)
$(CPLUSPLUSCOMPILER) $(LINKOPTS) -o libSiebel8SSO.so $(LIBS) $(LIB_OBJS)
test_sec: test_samp.o
$(CPLUSPLUSCOMPILER) -o test_samp test_samp.o $(SSOLIBS)
all: lib test_sec
非常感谢任何评论/回答。 谢谢。