From 31853a004d8f6eac68de41d3e3e936a49521e1b1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ji=C5=99=C3=AD=20=C5=A0kr=C3=A1bal?= Date: Mon, 21 Feb 2005 07:59:58 +0000 Subject: [PATCH] - make it use org.glite.security.gsoap_plugin module --- org.glite.lb.server/Makefile | 105 ++++++-------- org.glite.lb.server/examples/ws_getversion.c | 12 +- org.glite.lb.server/examples/ws_jobstat.c | 11 +- org.glite.lb.server/examples/ws_query_ex.c | 10 +- org.glite.lb.server/interface/ws_plugin.h | 8 -- org.glite.lb.server/project/version.properties | 2 +- org.glite.lb.server/src/bkserverd.c | 74 ++++++---- org.glite.lb.server/src/stored_master.c | 2 +- org.glite.lb.server/src/ws_plugin.c | 191 ------------------------- org.glite.lb.server/src/ws_query.c | 7 +- 10 files changed, 129 insertions(+), 293 deletions(-) delete mode 100644 org.glite.lb.server/interface/ws_plugin.h delete mode 100644 org.glite.lb.server/src/ws_plugin.c diff --git a/org.glite.lb.server/Makefile b/org.glite.lb.server/Makefile index e514caf..11a110c 100644 --- a/org.glite.lb.server/Makefile +++ b/org.glite.lb.server/Makefile @@ -31,8 +31,6 @@ else STDSOAP2C= endif -CC=gcc - GSOAP_FILES_PREFIX:= bk_ws_ YACC=bison -y @@ -47,17 +45,10 @@ TEST_INC:=-I${cppunit}/include SUFFIXES = .T DEBUG:=-g -O0 -Wall -# not yet -# -I${voms}/include \ -# -I${gacl}/include \ -# -I/usr/include/libxml2 GRIDSITE_CFLAGS = `xml2-config --cflags` GRIDSITE_LIBS = -lgridsite_globus `xml2-config --libs` -# -DNO_VOMS -DNO_GACL to be removed when voms/gridsite are available -#CFLAGS:= -DNO_VOMS -DNO_GACL - CFLAGS:= \ ${WS_CFLAGS} ${DEBUG} \ -DVERSION=\"${version}\" \ @@ -108,47 +99,54 @@ EXT_LIBS:= -L${ares_prefix}/lib -lares \ -lvomsc${vomsflavour} \ ${GLOBUS_LIBS} -GSOAP_LIBS:= -L${gsoap_prefix}/lib -lgsoap - SRVBONES_LIB:= -L${stagedir}/lib -lglite_lb_server_bones +COMMON_LIBS:= -L${stagedir}/lib -lglite_lb_common_${nothrflavour} -lglite_security_gss_${nothrflavour} -COMMON_LIB:= -L${stagedir}/lib -lglite_lb_common_${nothrflavour} - -LB_PROXY_COMMON_LIB:= -L${stagedir}/lib -lglite_lb_common_${nothrflavour} - -ifeq ($(GLITE_LB_SERVER_WITH_WS),yes) - SERVER_SOAP_OBJS:=${GSOAP_FILES_PREFIX}C.o ${GSOAP_FILES_PREFIX}Server.o \ - ws_plugin.o ws_query.o ws_fault.o ws_typeref.o - SERVER_WS_LIBS=${GSOAP_LIBS} -else - SERVER_SOAP_OBJS= - SERVER_WS_LIBS= -endif - -LB_PROXY_OBJS:= lbproxy.o il_lbproxy.o get_events.o index.o jobstat.o seqcode.o \ - jobstat_supp.o write2rgma.o lbs_db.o lb_html.o lb_http.o lb_proto.o \ - lb_xml_parse.o lb_xml_parse_V21.o \ - lock.o openserver.o query.o userjobs.o db_store.o request.o store.o \ - stored_master.o srv_purge.o server_state.o dump.o lb_authz.o load.o \ - notification.o il_notification.o notif_match.o - -SERVER_OBJS:= bkserverd.o il_lbproxy.o get_events.o index.o jobstat.o jobstat_supp.o \ +BKSERVER_BASE_OBJS:= \ + bkserverd.o il_lbproxy.o get_events.o index.o jobstat.o jobstat_supp.o \ seqcode.o write2rgma.o lbs_db.o lb_html.o lb_http.o lb_proto.o lb_xml_parse.o \ lb_xml_parse_V21.o \ lock.o openserver.o query.o userjobs.o db_store.o request.o store.o \ stored_master.o srv_purge.o server_state.o dump.o lb_authz.o load.o \ notification.o il_notification.o notif_match.o stats.o +ifeq ($(GLITE_LB_SERVER_WITH_WS),yes) + BKSERVER_OBJS:= \ + ${BKSERVER_BASE_OBJS} \ + ${GSOAP_FILES_PREFIX}C.o ${GSOAP_FILES_PREFIX}Server.o \ + ws_query.o ws_fault.o ws_typeref.o + + BKSERVER_LIBS= \ + ${EXT_LIBS} \ + ${SRVBONES_LIB} \ + -lglite_lb_common_${nothrflavour} \ + -L${gsoap_prefix}/lib -lgsoap \ + -lglite_security_gsoap_plugin_${nothrflavour} +else + BKSERVER_LIBS= \ + ${EXT_LIBS} \ + ${SRVBONES_LIB} \ + -lglite_lb_common_${nothrflavour} \ + -lglite_security_gss_${nothrflavour} +endif + INDEX_OBJS:= index.o index_parse.o jobstat_supp.o lbs_db.o openserver.o \ jobstat.o query.o lock.o get_events.o write2rgma.o index_lex.o \ lb_authz.o store.o bkindex.o -WS_CLIENT_OBJS:= stdsoap2_patched.o test_ws_plugin.o $(GSOAP_FILES_PREFIX)C.o $(GSOAP_FILES_PREFIX)Client.o ws_fault.o ws_typeref.o -WS_CLIENT_LIBS:= -L${stagedir}/lib -lglite_lb_client_${nothrflavour} +INDEX_LIBS:= ${EXT_LIBS} ${SRVBONES_LIB} ${COMMON_LIBS} + +WS_CLIENT_OBJS:= $(GSOAP_FILES_PREFIX)C.o $(GSOAP_FILES_PREFIX)Client.o ws_fault.o ws_typeref.o +WS_CLIENT_LIBS:= -L${stagedir}/lib \ + ${EXT_LIBS} \ + -lglite_lb_client_${nothrflavour} \ + -lglite_lb_common_${nothrflavour} \ + -L${gsoap_prefix}/lib -lgsoap \ + -lglite_security_gsoap_plugin_${nothrflavour} -HDRS=index.h ws_plugin.h lb_authz.h lbs_db.h store.h +HDRS=index.h lb_authz.h lbs_db.h store.h -LIB_OBJS_PS:=test_ws_plugin.o ws_fault.o lb_authz.o lbs_db.o +LIB_OBJS_PS:=ws_fault.o lb_authz.o lbs_db.o L_LIB_OBJS_PS:=${LIB_OBJS_PS:.o=.lo} LIB_OBJS_BK:=lb_authz.o lbs_db.o query.o jobstat.o lb_xml_parse.o \ il_notification.o notif_match.o il_lbproxy.o lock.o \ @@ -160,18 +158,15 @@ LT_LIB_PS:=libglite_lb_server_misc_ps_${nothrflavour}.la STATIC_LIB_BK:=libglite_lb_server_misc_bk_${nothrflavour}.a LT_LIB_BK:=libglite_lb_server_misc_bk_${nothrflavour}.la -glite_lb_proxy: ${LB_PROXY_OBJS} - ${LINK} -o $@ ${LB_PROXY_OBJS} ${COMMON_LIB} ${SRVBONES_LIB} ${EXT_LIBS} - -glite_lb_bkserverd: ${SERVER_OBJS} ${SERVER_SOAP_OBJS} - ${LINK} -o $@ ${SERVER_OBJS} ${SERVER_SOAP_OBJS} ${COMMON_LIB} ${SRVBONES_LIB} ${EXT_LIBS} ${SERVER_WS_LIBS} +glite_lb_bkserverd: LoggingAndBookkeeping.nsmap ${BKSERVER_OBJS} + ${LINK} -o $@ ${BKSERVER_OBJS} ${BKSERVER_LIBS} glite_lb_bkindex: ${INDEX_OBJS} - ${LINK} -o $@ ${INDEX_OBJS} ${COMMON_LIB} ${EXT_LIBS} + ${LINK} -o $@ ${INDEX_OBJS} ${INDEX_LIBS} default all: compile -compile: glite_lb_bkserverd glite_lb_bkindex glite_lb_proxy ${LT_LIB_PS} ${LT_LIB_BK} +compile: glite_lb_bkserverd glite_lb_bkindex ${LT_LIB_PS} ${LT_LIB_BK} check: compile test.xml test.query -echo check.query not complete yet @@ -179,7 +174,7 @@ check: compile test.xml test.query test_coverage: -mkdir coverage cd coverage && $(MAKE) -f ../Makefile top_srcdir=../../ COVERAGE_FLAGS="-fprofile-arcs -ftest-coverage" check - cd coverage && for i in `echo ${INDEX_OBJS} ${SERVER_OBJS} | tr ' ' '\012' | sort -u`; do gcov $$i ; done + cd coverage && for i in `echo ${INDEX_OBJS} ${BKSERVER_OBJS} | tr ' ' '\012' | sort -u`; do gcov $$i ; done lb_xml_parse.c: lb_xml_parse.c.T rm -f $@ @@ -197,43 +192,37 @@ test.xml: test_xml test_xml: test_xml.cpp ${CXX} -c ${CFLAGS} ${TEST_INC} $< - ${LINKXX} -o $@ test_xml.o lb_xml_parse.o ${COMMON_LIB} ${TEST_LIBS} ${EXT_LIBS} + ${LINKXX} -o $@ test_xml.o lb_xml_parse.o ${COMMON_LIBS} ${TEST_LIBS} ${EXT_LIBS} test.query: test_query_events ./test_query_events -query_events_objs:=`echo ${SERVER_OBJS} | sed 's/lbs_db\.o//;s/bkserverd\.o//'` +query_events_objs:=`echo ${BKSERVER_BASE_OBJS} | sed 's/lbs_db\.o//;s/bkserverd\.o//'` test_query_events: test_query_events.o ${LINKXX} -o $@ test_query_events.o ${query_events_objs} \ - ${TEST_LIBS} ${COMMON_LIB} ${EXT_LIBS} + ${TEST_LIBS} ${COMMON_LIBS} ${EXT_LIBS} test.soapconv: test_soap_conv ./test_soap_conv test_soap_conv: test_soap_conv.cpp ${WS_CLIENT_OBJS} ${CXX} -c ${CFLAGS} ${TEST_INC} $< - ${LINKXX} -o $@ test_soap_conv.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ${COMMON_LIB} ${TEST_LIBS} + ${LINKXX} -o $@ test_soap_conv.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ${TEST_LIBS} examples: ws_getversion ws_jobstat ws_query_ex ws_getversion: ws_getversion.o ${WS_CLIENT_OBJS} - ${LINK} -o $@ ws_getversion.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ${EXT_LIBS} + ${LINK} -o $@ ws_getversion.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ws_jobstat: ws_jobstat.o ${WS_CLIENT_OBJS} - ${LINK} -o $@ ws_jobstat.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ${EXT_LIBS} + ${LINK} -o $@ ws_jobstat.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ws_query_ex: ws_query_ex.o ${WS_CLIENT_OBJS} - ${LINK} -o $@ ws_query_ex.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ${EXT_LIBS} + ${LINK} -o $@ ws_query_ex.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ws_query_ext: ws_query_ext.o ${WS_CLIENT_OBJS} - ${LINK} -o $@ ws_query_ext.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ${EXT_LIBS} - -stdsoap2_patched.o: - ${CC} ${CFLAGS} -c -o $@ ${STDSOAP2C} - -test_ws_plugin.o: ws_plugin.c - ${COMPILE} ${CFLAGS} -DPLUGIN_TEST -c -o $@ ${top_srcdir}/src/ws_plugin.c + ${LINK} -o $@ ws_query_ext.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ${LT_LIB_PS}: ${LIB_OBJS_PS} ${LINK} -o $@ ${L_LIB_OBJS_PS} diff --git a/org.glite.lb.server/examples/ws_getversion.c b/org.glite.lb.server/examples/ws_getversion.c index 89bea11..01d90f7 100644 --- a/org.glite.lb.server/examples/ws_getversion.c +++ b/org.glite.lb.server/examples/ws_getversion.c @@ -1,11 +1,13 @@ #include #include +#include "glite/security/glite_gsplugin.h" #include "glite/lb/consumer.h" -#include "ws_plugin.h" #include "bk_ws_H.h" +#include "LoggingAndBookkeeping.nsmap" + static struct option opts[] = { {"help", 0, NULL, 'h'}, {"server", 1, NULL, 'm'}, @@ -24,6 +26,7 @@ static void printstat(edg_wll_JobStat stat, int level); int main(int argc,char** argv) { edg_wll_Context ctx; + glite_gsplugin_Context gsplugin_ctx; struct soap *mydlo = soap_new(); struct edgwll2__GetVersionResponse out; int opt, err; @@ -42,13 +45,16 @@ int main(int argc,char** argv) } edg_wll_InitContext(&ctx); - - if ( soap_register_plugin_arg(mydlo, edg_wll_ws_plugin, (void *)ctx) ) + glite_gsplugin_init_context(&gsplugin_ctx); + + if ( soap_register_plugin_arg(mydlo, glite_gsplugin, (void *)gsplugin_ctx) ) { soap_print_fault(mydlo, stderr); return 1; } + glite_gsplugin_set_udata(mydlo, gsplugin_ctx); + switch (err = soap_call_edgwll2__GetVersion(mydlo, server, "", &out)) { case SOAP_OK: printf("Server version: %s\n", out.version); break; diff --git a/org.glite.lb.server/examples/ws_jobstat.c b/org.glite.lb.server/examples/ws_jobstat.c index 0b64399..ea1e9cf 100644 --- a/org.glite.lb.server/examples/ws_jobstat.c +++ b/org.glite.lb.server/examples/ws_jobstat.c @@ -1,11 +1,13 @@ #include #include +#include "glite/security/glite_gsplugin.h" #include "glite/lb/consumer.h" -#include "ws_plugin.h" #include "bk_ws_H.h" +#include "LoggingAndBookkeeping.nsmap" + static struct option opts[] = { {"help", 0, NULL, 'h'}, {"server", 1, NULL, 'm'}, @@ -26,6 +28,7 @@ static void printstat(edg_wll_JobStat stat, int level); int main(int argc,char** argv) { edg_wll_Context ctx; + glite_gsplugin_Context gsplugin_ctx; struct soap *mydlo = soap_new(); struct edgwll2__JobStatusResponse out; int opt, err; @@ -53,13 +56,17 @@ int main(int argc,char** argv) } edg_wll_InitContext(&ctx); + glite_gsplugin_init_context(&gsplugin_ctx); - if ( soap_register_plugin_arg(mydlo, edg_wll_ws_plugin, (void *)ctx) ) + if ( soap_register_plugin_arg(mydlo, glite_gsplugin, (void *)gsplugin_ctx) ) { soap_print_fault(mydlo, stderr); return 1; } + glite_gsplugin_set_udata(mydlo, ctx); + + switch (err = soap_call_edgwll2__JobStatus(mydlo, server, "", jobid,0,&out)) { case SOAP_OK: diff --git a/org.glite.lb.server/examples/ws_query_ex.c b/org.glite.lb.server/examples/ws_query_ex.c index a08fe33..05b829f 100644 --- a/org.glite.lb.server/examples/ws_query_ex.c +++ b/org.glite.lb.server/examples/ws_query_ex.c @@ -1,13 +1,15 @@ #include #include +#include "glite/security/glite_gsplugin.h" #include "glite/lb/consumer.h" -#include "ws_plugin.h" #include "bk_ws_H.h" #include "ws_typeref.h" +#include "LoggingAndBookkeeping.nsmap" + static struct option opts[] = { {"help", 0, NULL, 'h'}, @@ -27,6 +29,7 @@ static void printstat(edg_wll_JobStat stat, int level); int main(int argc,char** argv) { edg_wll_Context ctx; + glite_gsplugin_Context gsplugin_ctx; edg_wll_QueryRec **conditions = NULL; struct soap *soap = soap_new(); struct edgwll__QueryConditions *jconds = NULL; @@ -48,13 +51,16 @@ int main(int argc,char** argv) } edg_wll_InitContext(&ctx); + glite_gsplugin_init_context(&gsplugin_ctx); - if ( soap_register_plugin_arg(soap, edg_wll_ws_plugin, (void *)ctx) ) + if ( soap_register_plugin_arg(soap, glite_gsplugin, (void *)gsplugin_ctx) ) { soap_print_fault(soap, stderr); return 1; } + glite_gsplugin_set_udata(soap, ctx); + conditions = (edg_wll_QueryRec **)calloc(3,sizeof(edg_wll_QueryRec *)); conditions[0] = (edg_wll_QueryRec *)calloc(2,sizeof(edg_wll_QueryRec)); diff --git a/org.glite.lb.server/interface/ws_plugin.h b/org.glite.lb.server/interface/ws_plugin.h deleted file mode 100644 index 9b691be..0000000 --- a/org.glite.lb.server/interface/ws_plugin.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __EDG_WORKLOAD_LOGGING_LBSERVER_WS_PLUGIN_H__ -#define __EDG_WORKLOAD_LOGGING_LBSERVER_WS_PLUGIN_H__ - -#define PLUGIN_ID "GLITE_WS_PLUGIN" - -int edg_wll_ws_plugin(struct soap *, struct soap_plugin *, void *); - -#endif /* __EDG_WORKLOAD_LOGGING_LBSERVER_WS_PLUGIN_H__ */ diff --git a/org.glite.lb.server/project/version.properties b/org.glite.lb.server/project/version.properties index 15b0a90..d7815c3 100644 --- a/org.glite.lb.server/project/version.properties +++ b/org.glite.lb.server/project/version.properties @@ -1,4 +1,4 @@ #Wed Jan 12 04:18:30 CET 2005 -module.version=1.1.1 +module.version=1.2.0 module.build=146 module.age=1 diff --git a/org.glite.lb.server/src/bkserverd.c b/org.glite.lb.server/src/bkserverd.c index 820f3f2..3ccd051 100644 --- a/org.glite.lb.server/src/bkserverd.c +++ b/org.glite.lb.server/src/bkserverd.c @@ -29,16 +29,18 @@ #ifdef GLITE_LB_SERVER_WITH_WS #include +#include "glite/security/glite_gsplugin.h" + int soap_serve(struct soap*); #endif /* GLITE_LB_SERVER_WITH_WS */ +#include "glite/security/glite_gss.h" #include "glite/lb/srvbones.h" #include "glite/lb/consumer.h" #include "glite/lb/purge.h" #include "glite/lb/context.h" #include "glite/lb/mini_http.h" #include "glite/lb/context-int.h" -#include "glite/lb/lb_gss.h" #include "lb_http.h" #include "lb_proto.h" @@ -46,10 +48,11 @@ int soap_serve(struct soap*); #include "lbs_db.h" #include "lb_authz.h" #include "il_notification.h" +#include "stats.h" #ifdef GLITE_LB_SERVER_WITH_WS -#include "ws_plugin.h" -#endif /* GLITE_LB_SERVER_WITH_WS */ +#include "LoggingAndBookkeeping.nsmap" +#endif /* GLITE_LB_SERVER_WITH_WS */ extern int edg_wll_StoreProto(edg_wll_Context ctx); extern edg_wll_ErrorCode edg_wll_Open(edg_wll_Context ctx, char *cs); @@ -863,30 +866,49 @@ int bk_handle_connection(int conn, struct timeval client_start, void *data) int bk_handle_ws_connection(int conn, struct timeval client_start, void *data) { struct clnt_data_t *cdata = (struct clnt_data_t *) data; - struct soap *soap; - int rv; + struct soap *soap = NULL; + glite_gsplugin_Context gsplugin_ctx; + int rv = 0; - if ( !(soap = soap_new()) ) - { - fprintf(stderr, "Couldn't create soap environment"); + if ( glite_gsplugin_init_context(&gsplugin_ctx) ) { + fprintf(stderr, "Couldn't create gSOAP plugin context"); return -1; } - if ( (rv = bk_handle_connection(conn, client_start, data)) ) - { - soap_destroy(soap); - return rv; + if ( !(soap = soap_new()) ) { + fprintf(stderr, "Couldn't create soap environment"); + goto err; } + soap_init2(soap, SOAP_IO_KEEPALIVE, SOAP_IO_KEEPALIVE); + if ( soap_set_namespaces(soap, namespaces) ) { + soap_done(soap); + perror("Couldn't set soap namespaces"); + goto err; + } + if ( soap_register_plugin_arg(soap, glite_gsplugin, gsplugin_ctx) ) { + soap_done(soap); + perror("Couldn't set soap namespaces"); + goto err; + } + if ( (rv = bk_handle_connection(conn, client_start, data)) ) { + soap_done(soap); + goto err; + } + gsplugin_ctx->connection = &cdata->ctx->connPool[cdata->ctx->connToUse].gss; + gsplugin_ctx->timeout = cdata->ctx->p_tmp_timeout; + gsplugin_ctx->cred = mycred; cdata->soap = soap; - soap_init(soap); - soap_set_namespaces(soap, namespaces); - soap_register_plugin_arg(soap, edg_wll_ws_plugin, cdata->ctx); - return 0; + +err: + if ( gsplugin_ctx ) glite_gsplugin_free_context(gsplugin_ctx); + if ( soap ) soap_destroy(soap); + + return rv? : -1; } #endif /* GLITE_LB_SERVER_WITH_WS */ @@ -1018,15 +1040,9 @@ int bk_accept_ws(int conn, void *cdata) { struct soap *soap = ((struct clnt_data_t *) cdata)->soap; edg_wll_Context ctx = ((struct clnt_data_t *) cdata)->ctx; + glite_gsplugin_Context gsplugin_ctx; - /* XXX: Is it neccessary? - * - * BEWARE: gSoap is trying to handle this connection -> closes the - * socket after then query is served (or something like that :) - * - soap->socket = conn; - */ if ( soap_serve(soap) ) { char *errt, *errd; @@ -1046,6 +1062,10 @@ int bk_accept_ws(int conn, void *cdata) edg_wll_gss_close(&ctx->connPool[ctx->connToUse].gss, NULL); edg_wll_FreeContext(ctx); ctx = NULL; + gsplugin_ctx = glite_gsplugin_get_context(soap); + gsplugin_ctx->cred = GSS_C_NO_CREDENTIAL; + gsplugin_ctx->connection = NULL; + glite_gsplugin_free_context(gsplugin_ctx); free(errt); free(errd); dprintf(("[%d] Connection closed\n", getpid())); /* @@ -1103,13 +1123,19 @@ int bk_clnt_disconnect(int conn, void *cdata) #ifdef GLITE_LB_SERVER_WITH_WS int bk_ws_clnt_disconnect(int conn, void *cdata) { - int rv; + struct soap *soap = ((struct clnt_data_t *) cdata)->soap; + glite_gsplugin_Context gsplugin_ctx; + int rv; + gsplugin_ctx = glite_gsplugin_get_context(soap); + gsplugin_ctx->cred = GSS_C_NO_CREDENTIAL; + gsplugin_ctx->connection = NULL; if ( (rv = bk_clnt_disconnect(conn, cdata)) ) return rv; soap_destroy(((struct clnt_data_t *)cdata)->soap); + glite_gsplugin_free_context(gsplugin_ctx); return 0; } diff --git a/org.glite.lb.server/src/stored_master.c b/org.glite.lb.server/src/stored_master.c index 84b4a70..2c21647 100644 --- a/org.glite.lb.server/src/stored_master.c +++ b/org.glite.lb.server/src/stored_master.c @@ -8,8 +8,8 @@ #include #include +#include "glite/security/glite_gss.h" #include "glite/lb/il_msg.h" -#include "glite/lb/lb_gss.h" #include "glite/lb/lb_plain_io.h" #include "glite/lb/context-int.h" diff --git a/org.glite.lb.server/src/ws_plugin.c b/org.glite.lb.server/src/ws_plugin.c deleted file mode 100644 index 926c26b..0000000 --- a/org.glite.lb.server/src/ws_plugin.c +++ /dev/null @@ -1,191 +0,0 @@ -#include -#include -#include -#include - -#include "glite/lb/lb_gss.h" -#include "glite/lb/context-int.h" - -#ifdef PLUGIN_TEST -extern int edg_wll_open(edg_wll_Context); -#endif - -#include "ws_plugin.h" - -#include "LoggingAndBookkeeping.nsmap" - -#ifdef WS_PLUGIN_DEBUG -# define pdprintf(s) printf s -#else -# define pdprintf(s) -#endif - -static const char plugin_id[] = PLUGIN_ID; - -#ifdef PLUGIN_TEST -static int edg_wll_ws_connect(struct soap *, const char *, const char *, int); -#endif -static void edg_wll_ws_delete(struct soap *, struct soap_plugin *); -static size_t edg_wll_ws_recv(struct soap *, char *, size_t); -static int edg_wll_ws_send(struct soap *, const char *, size_t); - - -int edg_wll_ws_plugin(struct soap *soap, struct soap_plugin *p, void *arg) -{ - /* The parametr (edg_wll_Context) must be given! */ - assert(arg != NULL); - - p->id = plugin_id; - p->data = arg; - p->fdelete = edg_wll_ws_delete; - -#ifdef PLUGIN_TEST - soap->fconnect = edg_wll_ws_connect; -#endif - soap->fsend = edg_wll_ws_send; - soap->frecv = edg_wll_ws_recv; - - return SOAP_OK; -} - -#ifdef PLUGIN_TEST -int edg_wll_ws_connect(struct soap *soap, const char *endpoint, - const char *host, int port) -{ - edg_wll_Context ctx = (edg_wll_Context)soap_lookup_plugin(soap, plugin_id); - - - ctx->srvName = strdup(host); - ctx->srvPort = port; - ctx->p_tmp_timeout = ctx->p_query_timeout; - if ( edg_wll_open(ctx) ) - return edg_wll_Error(ctx, NULL, NULL); - - soap->socket = 2; - - return SOAP_OK; -} -#endif - -static void edg_wll_ws_delete(struct soap *soap, struct soap_plugin *p) -{ - /* - * Keep silly gSOAP happy - */ -} - - -size_t edg_wll_ws_recv(struct soap *soap, char *buf, size_t bufsz) -{ - edg_wll_Context ctx = (edg_wll_Context)soap_lookup_plugin(soap, plugin_id); - edg_wll_GssStatus gss_code; - int len; - - - edg_wll_ResetError(ctx); - if ( ctx->connPool[ctx->connToUse].gss.context == GSS_C_NO_CONTEXT ) - { - edg_wll_SetError(ctx, ENOTCONN, NULL); - soap->errnum = ENOTCONN; - return 0; - } - - len = edg_wll_gss_read(&ctx->connPool[ctx->connToUse].gss, - buf, bufsz, &ctx->p_tmp_timeout, &gss_code); - - switch ( len ) - { - case EDG_WLL_GSS_OK: - break; - - case EDG_WLL_GSS_ERROR_GSS: - edg_wll_SetErrorGss(ctx, "receving WS request", &gss_code); - soap->errnum = ENOTCONN; - return 0; - - case EDG_WLL_GSS_ERROR_ERRNO: - edg_wll_SetError(ctx, errno, "edg_wll_gss_read()"); - soap->errnum = errno; - return 0; - - case EDG_WLL_GSS_ERROR_TIMEOUT: - edg_wll_SetError(ctx, ETIMEDOUT, NULL); - soap->errnum = ETIMEDOUT; - return 0; - - case EDG_WLL_GSS_ERROR_EOF: - edg_wll_SetError(ctx, ENOTCONN, NULL); - soap->errnum = ENOTCONN; - return 0; - - /* default: fallthrough */ - } - - pdprintf(("\nWS received:\n%s\n\n", buf)); - return len; -} - -static int edg_wll_ws_send(struct soap *soap, const char *buf, size_t bufsz) -{ - edg_wll_Context ctx = (edg_wll_Context) soap_lookup_plugin(soap, plugin_id); - edg_wll_GssStatus gss_code; - struct sigaction sa, osa; - size_t total = 0; - int ret; - - - edg_wll_ResetError(ctx); - - if ( ctx->connPool[ctx->connToUse].gss.context == GSS_C_NO_CONTEXT ) - { - edg_wll_SetError(ctx, ENOTCONN, NULL); - soap->errnum = ENOTCONN; - return SOAP_EOF; - } - - memset(&sa, 0, sizeof(sa)); - assert(sa.sa_handler == NULL); - sa.sa_handler = SIG_IGN; - sigaction(SIGPIPE, &sa, &osa); - - ret = edg_wll_gss_write_full(&ctx->connPool[ctx->connToUse].gss, - (void*)buf, bufsz, - &ctx->p_tmp_timeout, - &total, &gss_code); - - sigaction(SIGPIPE, &osa, NULL); - - switch ( ret ) - { - case EDG_WLL_GSS_OK: - pdprintf(("\nWS sent:\n%s\n\n", buf)); - break; - - case EDG_WLL_GSS_ERROR_TIMEOUT: - edg_wll_SetError(ctx, ETIMEDOUT, "edg_wll_ws_send()"); - soap->errnum = ETIMEDOUT; - return SOAP_EOF; - - case EDG_WLL_GSS_ERROR_ERRNO: - if ( errno == EPIPE ) - { - edg_wll_SetError(ctx, ENOTCONN, "edg_wll_ws_send()"); - soap->errnum = ENOTCONN; - } - else - { - edg_wll_SetError(ctx, errno, "edg_wll_ws_send()"); - soap->errnum = errno; - } - return SOAP_EOF; - - case EDG_WLL_GSS_ERROR_GSS: - case EDG_WLL_GSS_ERROR_EOF: - default: - edg_wll_SetError(ctx, ENOTCONN, "edg_wll_ws_send()"); - soap->errnum = ENOTCONN; - return SOAP_EOF; - } - - return SOAP_OK; -} diff --git a/org.glite.lb.server/src/ws_query.c b/org.glite.lb.server/src/ws_query.c index b59fcf6..473b8d3 100644 --- a/org.glite.lb.server/src/ws_query.c +++ b/org.glite.lb.server/src/ws_query.c @@ -1,11 +1,12 @@ #include +#include "glite/security/glite_gsplugin.h" + #include "glite/lb/context-int.h" #include "glite/lb/consumer.h" #include "jobstat.h" #include "query.h" -#include "ws_plugin.h" #include "bk_ws_H.h" #include "get_events.h" #include "ws_fault.h" @@ -27,7 +28,7 @@ int edgwll2__JobStatus( struct edgwll__JobStatFlags *flags, struct edgwll2__JobStatusResponse *out) { - edg_wll_Context ctx = (edg_wll_Context) soap_lookup_plugin(soap, PLUGIN_ID); + edg_wll_Context ctx = (edg_wll_Context) glite_gsplugin_get_udata(soap); edg_wlc_JobId j; edg_wll_JobStat s; @@ -56,7 +57,7 @@ int edgwll2__QueryJobs( struct edgwll__JobStatFlags *flags, struct edgwll2__QueryJobsResponse *out) { - edg_wll_Context ctx = (edg_wll_Context) soap_lookup_plugin(soap, PLUGIN_ID); + edg_wll_Context ctx = (edg_wll_Context) glite_gsplugin_get_udata(soap); edg_wlc_JobId *jobsOut = NULL; edg_wll_JobStat *statesOut = NULL; edg_wll_QueryRec **qr = NULL; -- 1.8.2.3