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);
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);
{
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);
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);
}
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;
}
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;
}
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;
}
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);
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;
}
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);