handle NULL msg_brokers
authorJiří Filipovič <fila@ics.muni.cz>
Fri, 27 May 2011 11:32:47 +0000 (11:32 +0000)
committerJiří Filipovič <fila@ics.muni.cz>
Fri, 27 May 2011 11:32:47 +0000 (11:32 +0000)
org.glite.lb.server/src/bkserverd.c
org.glite.lb.server/src/lb_proto.c
org.glite.lb.server/src/lb_text.c

index cbfaa16..83f902a 100644 (file)
@@ -1301,7 +1301,7 @@ int bk_handle_connection(int conn, struct timeval *timeout, void *data)
        for (npref = 0; npref<totpref; npref++) 
                ctx->msg_prefixes[npref]=strdup(msg_prefixes[npref]);
 
-       for (totpref = 0; msg_brokers[totpref]; totpref++);
+       for (totpref = 0; msg_brokers && msg_brokers[totpref]; totpref++);
        ctx->msg_brokers = (char**) calloc(sizeof(char*), totpref);
        for (npref = 0; npref<totpref; npref++) 
                ctx->msg_brokers[npref]=strdup(msg_brokers[npref]);
index d76edf4..4af0aca 100644 (file)
@@ -839,8 +839,13 @@ edg_wll_ErrorCode edg_wll_Proto(edg_wll_Context ctx,
                         if (edg_wll_WSDLOutput(ctx, &message, filename))
                                 ret = HTTP_INTERNAL;
                        free(filename);
+       /* GET /?version */
                } else if (strncmp(requestPTR, "/?version", strlen("/?version")) == 0) {
                        asprintf(&message, "%s", VERSION);
+       /* GET /?configuration*/
+               } else if (strncmp(requestPTR, "/?configuration", strlen("/?configuration")) == 0) {
+                       // also browser-readable HTML version here?
+                       edg_wll_ConfigurationToText(ctx, &message);
        /* GET [something else]: not understood */
                } else ret = HTTP_BADREQ;
                free(requestPTR); requestPTR = NULL;
index 0712737..b8eca91 100644 (file)
@@ -243,6 +243,18 @@ int edg_wll_JobStatusToText(edg_wll_Context ctx UNUSED_VAR, edg_wll_JobStat stat
         return 0;
 }
 
+int edg_wll_ConfigurationToText(edg_wll_Context ctx, char **message){
+       char *a = NULL, *b;
+       int pomL = 0;
+       b = strdup("");
+       TR("msg_brokers", "%s", ctx->msg_brokers);
+       TR("msg_prefixes", "%s", ctx->msg_prefixes);
+       
+       *message = b;
+
+       return 0;
+}
+
 char *edg_wll_ErrorToText(edg_wll_Context ctx,int code)
 {
        char    *out,*et,*ed;