From 59bce443a2778aea6b8ff1434fb855ea51e2ffd5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Thu, 3 Mar 2011 00:09:26 +0000 Subject: [PATCH] Fix/update glite location when searching for WSDLs. --- org.glite.lb.server/src/lb_proto.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/org.glite.lb.server/src/lb_proto.c b/org.glite.lb.server/src/lb_proto.c index cad1229..39e5bb2 100644 --- a/org.glite.lb.server/src/lb_proto.c +++ b/org.glite.lb.server/src/lb_proto.c @@ -17,6 +17,8 @@ limitations under the License. */ +#include +#include #include #include #include @@ -395,6 +397,23 @@ static void hup_handler(int sig) { purge_quit = 1; } +static char *glite_location() { + char *location = NULL; + struct stat info; + + if (!(location = getenv("GLITE_LB_LOCATION"))) + if (!(location = getenv("GLITE_LOCATION"))) + { + if (stat("/opt/glite/interfaces", &info) == 0 && S_ISDIR(info.st_mode)) + location = "/opt/glite"; + else + if (stat("/usr/interfaces", &info) == 0 && S_ISDIR(info.st_mode)) + location = "/usr"; + } + + return location; +} + edg_wll_ErrorCode edg_wll_ProtoV21(edg_wll_Context ctx, char *request,char **headers,char *messageBody, char **response,char ***headersOut,char **bodyOut) @@ -801,21 +820,21 @@ edg_wll_ErrorCode edg_wll_Proto(edg_wll_Context ctx, #define WSDL_LB4AGU "lb4agu.wsdl" } else if (strncmp(requestPTR, "/?wsdl", strlen("/?wsdl")) == 0) { char *filename; - asprintf(&filename, "%s/interface/%s", getenv("GLITE_LOCTION"), WSDL_LB); + asprintf(&filename, "%s/interface/%s", glite_location(), WSDL_LB); if (edg_wll_WSDLOutput(ctx, &message, filename)) ret = HTTP_INTERNAL; free(filename); /* GET /?types */ } else if (strncmp(requestPTR, "/?types", strlen("/?types")) == 0) { char *filename; - asprintf(&filename, "%s/interface/%s", getenv("GLITE_LOCTION"), WSDL_LBTYPES); + asprintf(&filename, "%s/interface/%s", glite_location(), WSDL_LBTYPES); if (edg_wll_WSDLOutput(ctx, &message, filename)) ret = HTTP_INTERNAL; free(filename); /* GET /?agu */ } else if (strncmp(requestPTR, "/?agu", strlen("/?agu")) == 0) { char *filename; - asprintf(&filename, "%s/interface/%s", getenv("GLITE_LOCTION"), WSDL_LB4AGU); + asprintf(&filename, "%s/interface/%s", glite_location(), WSDL_LB4AGU); if (edg_wll_WSDLOutput(ctx, &message, filename)) ret = HTTP_INTERNAL; free(filename); -- 1.8.2.3