merge 3.0 -> 3.1, #3
authorAleš Křenek <ljocha@ics.muni.cz>
Mon, 26 Feb 2007 16:13:55 +0000 (16:13 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Mon, 26 Feb 2007 16:13:55 +0000 (16:13 +0000)
org.glite.lb.client/Makefile
org.glite.lb.client/src/prod_proto.c

index ac82274..d7341d7 100644 (file)
@@ -63,8 +63,11 @@ l_SRC = \
 
 sh_PROGS = $(l_SRC:.l=.sh)
 
-
-DEBUG:=-g -O0 -Wall
+ifdef DEBUG
+        DEBUG:=-g -O0 -Wall -DEDG_WLL_LOG_STUB
+else
+        DEBUG:=-g -O0 -Wall
+endif
 
 GLOBUSINC:= -I${globus_prefix}/include/${nothrflavour}
 GLOBUSTHRINC:= -I${globus_prefix}/include/${thrflavour}
index a652916..456f3f2 100644 (file)
 int edg_wll_log_proto_handle_gss_failures(edg_wll_Context context, int code, edg_wll_GssStatus *gss_code, const char *text)
 {
         static char     err[256];
-        int             ret = 0;
+        int             myerrno, ret;
+
+       myerrno = errno;
+       ret = 0;
 
        edg_wll_ResetError(context);
 
@@ -40,8 +43,14 @@ int edg_wll_log_proto_handle_gss_failures(edg_wll_Context context, int code, edg
                        ret = edg_wll_SetError(context,ENOTCONN,err);
                        break;
                case EDG_WLL_GSS_ERROR_ERRNO: 
-                       snprintf(err, sizeof(err), "%s;; GSS Error: system error occured;", text);      
-                       ret = edg_wll_SetError(context,ENOTCONN,err);
+                       {
+                               const char *msg1;
+                               char *msg2;
+                               msg1 = strerror(myerrno);
+                               asprintf(&msg2, "%s;; System Error: %s", text, msg1);
+                               ret = edg_wll_SetError(context,ENOTCONN,msg2);
+                               free(msg2);
+                       }
                        break;
                 case EDG_WLL_GSS_ERROR_GSS:
                        snprintf(err, sizeof(err), "%s;; GSS Error: GSS failure occured", text);
@@ -51,7 +60,7 @@ int edg_wll_log_proto_handle_gss_failures(edg_wll_Context context, int code, edg
                         { 
                                 const char *msg1;
                                 char *msg2;
-                                msg1 = hstrerror(errno);
+                                msg1 = hstrerror(myerrno);
                                 asprintf(&msg2, "%s;; GSS Error: %s", text, msg1);
                                 ret = edg_wll_SetError(context,EDG_WLL_ERROR_DNS, msg2);
                                 free(msg2);
@@ -80,8 +89,10 @@ plain_reader(void *user_data, char *buffer, int max_len)
        int len;
 
        len = edg_wll_plain_read_full(data->conn, buffer, max_len, &data->ctx->p_tmp_timeout);
-       if(len < 0) 
-               edg_wll_SetError(data->ctx, EDG_WLL_IL_PROTO, "plain_reader(): error reading message data");
+       if(len < 0) {
+               edg_wll_SetError(data->ctx, errno, "edg_wll_plain_read_full()");
+               edg_wll_UpdateError(data->ctx, EDG_WLL_IL_PROTO, "plain_reader(): error reading message data");
+       }
 
        return(len);
 }
@@ -152,12 +163,15 @@ get_reply_gss(edg_wll_Context context, edg_wll_GssConnection *conn, char **buf,
        data.conn = conn;
        code = read_il_data(&data, &msg, gss_reader);
        if(code < 0) {
-               edg_wll_SetError(context, EDG_WLL_IL_PROTO, "get_reply_gss(): error reading reply");
+               edg_wll_UpdateError(context, EDG_WLL_IL_PROTO, "get_reply_gss(): error reading reply");
                goto get_reply_gss_end;
        }
 
        if(decode_il_reply(code_maj, code_min, buf, msg) < 0) {
-               edg_wll_SetError(context, EDG_WLL_IL_PROTO, "get_reply_gss(): error decoding reply");
+               char *et;
+               asprintf(&et,"get_reply_gss(): error decoding reply \"%s\"", msg);
+               edg_wll_UpdateError(context, EDG_WLL_IL_PROTO, et);
+               if (et) free(et);
                goto get_reply_gss_end;
        }
 
@@ -296,7 +310,8 @@ int edg_wll_log_proto_client_proxy(edg_wll_Context context, edg_wll_PlainConnect
                len = encode_il_msg(&buffer, &ll);
        }
        if(len < 0) {
-               edg_wll_SetError(context,ENOMEM,"edg_wll_log_proto_client_proxy(): error encoding message");
+               edg_wll_SetError(context,errno,"encode_il_msg()");
+               edg_wll_UpdateError(context,ENOMEM,"edg_wll_log_proto_client_proxy(): error encoding message");
                goto edg_wll_log_proto_client_proxy_end;
        }
 
@@ -305,7 +320,8 @@ int edg_wll_log_proto_client_proxy(edg_wll_Context context, edg_wll_PlainConnect
        fprintf(stderr,"log_proto_client_proxy: sending message...\n");
 #endif
        if (( count = edg_wll_plain_write_full(conn, buffer, len, &context->p_tmp_timeout)) < 0) {
-               edg_wll_SetError(context, EDG_WLL_IL_PROTO,"edg_wll_log_proto_client_proxy(): error sending message to socket");
+               edg_wll_SetError(context, errno, "edg_wll_plain_write_full()");
+               edg_wll_UpdateError(context, EDG_WLL_IL_PROTO,"edg_wll_log_proto_client_proxy(): error sending message to socket");
                goto edg_wll_log_proto_client_proxy_end;
        }
 
@@ -314,7 +330,7 @@ int edg_wll_log_proto_client_proxy(edg_wll_Context context, edg_wll_PlainConnect
        fprintf(stderr,"log_proto_client_proxy: reading answer from server...\n");
 #endif
        if ((err = get_reply_plain(context, conn, &answer, &lbproto_code, &code)) != 0 ) {
-               edg_wll_SetError(context, EDG_WLL_IL_PROTO,"edg_wll_log_proto_client_proxy(): error reading answer from L&B Proxy server");
+               edg_wll_UpdateError(context, EDG_WLL_IL_PROTO,"edg_wll_log_proto_client_proxy(): error reading answer from L&B Proxy server");
        } else {
 #ifdef EDG_WLL_LOG_STUB
                fprintf(stderr,"log_proto_client_proxy: read answer \"%d:%d: %s\"\n",lbproto_code,code,answer);
@@ -377,7 +393,8 @@ int edg_wll_log_proto_client_direct(edg_wll_Context context, edg_wll_GssConnecti
                len = encode_il_msg(&buffer, &ll);
        }
        if(len < 0) {
-               edg_wll_SetError(context, ENOMEM, "edg_wll_log_proto_client_direct(): error encoding message");
+               edg_wll_SetError(context, errno, "encode_il_msg()");
+               edg_wll_UpdateError(context, ENOMEM, "edg_wll_log_proto_client_direct(): error encoding message");
                goto edg_wll_log_proto_client_direct_end;
        }
                
@@ -396,7 +413,7 @@ int edg_wll_log_proto_client_direct(edg_wll_Context context, edg_wll_GssConnecti
        fprintf(stderr,"log_proto_client_direct: reading answer from server...\n");
 #endif
        if ((err = get_reply_gss(context, con, &answer, &lbproto_code, &code)) != 0 ) {
-               edg_wll_SetError(context, EDG_WLL_IL_PROTO,"edg_wll_log_proto_client_direct(): error reading answer from L&B direct server");
+               edg_wll_UpdateError(context, EDG_WLL_IL_PROTO,"edg_wll_log_proto_client_direct(): error reading answer from L&B direct server");
        } else {
 #ifdef EDG_WLL_LOG_STUB
                fprintf(stderr,"log_proto_client_direct: read answer \"%d:%d: %s\"\n",lbproto_code,code,answer);