From 3d3fab7a53e300e426240e61eebc6a9a9599f6be Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Wed, 4 Nov 2009 17:27:57 +0000 Subject: [PATCH] Working with c-ares >= 1.5.0 too. Other portability issues. --- org.glite.security.gss/Makefile | 6 +++--- org.glite.security.gss/interface/glite_gss.h | 1 + org.glite.security.gss/src/glite_gss.c | 8 +++++++- org.glite.security.gss/test/test_gss.cpp | 2 ++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/org.glite.security.gss/Makefile b/org.glite.security.gss/Makefile index 579674f..2d0edec 100644 --- a/org.glite.security.gss/Makefile +++ b/org.glite.security.gss/Makefile @@ -39,7 +39,6 @@ CFLAGS:= ${DEBUG} \ -DVERSION=\"${version}\" \ -I. -I${top_srcdir}/interface \ -I${stagedir}/include \ - -I${cares_prefix}/include \ ${COVERAGE_FLAGS} -D_GNU_SOURCE -DDATAGRID_EXTENSION LDFLAGS:=${COVERAGE_FLAGS} @@ -60,6 +59,7 @@ GLOBUS_THR_LIBS:= -L${globus_prefix}/lib \ -lglobus_common_${thrflavour} \ -lglobus_gssapi_gsi_${thrflavour} +ARES_INC:=-I${cares_prefix}/include ARES_LIBS:=-L${cares_prefix}/lib -lcares EX_LIBS:= ${GLOBUS_LIBS} ${ARES_LIBS} @@ -132,10 +132,10 @@ clean: rm -rf *.o *.lo *.a *.la .libs test_gss %.o: %.c - ${COMPILE} ${GLOBUS_INC} -o $@ -c $< + ${COMPILE} ${GLOBUS_INC} ${ARES_INC} -o $@ -c $< %.thr.o: %.c - ${COMPILE} ${GLOBUS_THR_INC} -o $@ -c $< + ${COMPILE} ${GLOBUS_THR_INC} ${ARES_INC} -o $@ -c $< test_gss.o: %.o: %.cpp ${CXX} -c ${CFLAGS} ${GLOBUS_INC} ${TEST_INC} -Wno-error $< diff --git a/org.glite.security.gss/interface/glite_gss.h b/org.glite.security.gss/interface/glite_gss.h index 4a41cfa..e3cf418 100644 --- a/org.glite.security.gss/interface/glite_gss.h +++ b/org.glite.security.gss/interface/glite_gss.h @@ -7,6 +7,7 @@ extern "C" { #endif +#include #include enum { diff --git a/org.glite.security.gss/src/glite_gss.c b/org.glite.security.gss/src/glite_gss.c index 5474767..0cb7d9c 100644 --- a/org.glite.security.gss/src/glite_gss.c +++ b/org.glite.security.gss/src/glite_gss.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -54,7 +55,12 @@ static int decrement_timeout(struct timeval *timeout, struct timeval before, str } /* ares callback handler for ares_gethostbyname() */ -static void callback_handler(void *arg, int status, struct hostent *h) { +#if ARES_VERSION >= 0x010500 +static void callback_handler(void *arg, int status, int timeouts, struct hostent *h) +#else +static void callback_handler(void *arg, int status, struct hostent *h) +#endif +{ struct asyn_result *arp = (struct asyn_result *) arg; switch (status) { diff --git a/org.glite.security.gss/test/test_gss.cpp b/org.glite.security.gss/test/test_gss.cpp index 4fa2845..6e8c87e 100644 --- a/org.glite.security.gss/test/test_gss.cpp +++ b/org.glite.security.gss/test/test_gss.cpp @@ -77,6 +77,7 @@ void GSSTest::setUp(void) { timeout.tv_sec = to ? atoi(to) : 10 ; timeout.tv_usec = 0; + my_cred = NULL; key_file = cred_file = getenv("X509_USER_PROXY"); CPPUNIT_ASSERT_MESSAGE("credential file", cred_file); @@ -87,6 +88,7 @@ void GSSTest::setUp(void) { sock = socket(PF_INET,SOCK_STREAM,0); CPPUNIT_ASSERT_MESSAGE("socket()", sock >= 0); + memset(&a, 0, sizeof a); a.sin_family = AF_INET; a.sin_port = 0; a.sin_addr.s_addr = INADDR_ANY; -- 1.8.2.3