From ef8db7e177dd1da2ed99398fa31188c9b04acc14 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Posp=C3=AD=C5=A1il?= Date: Fri, 5 Nov 2004 16:36:49 +0000 Subject: [PATCH] Added user credentials when logging to L&B Proxy --- org.glite.lb.client-interface/interface/context.h | 1 + org.glite.lb.client/src/producer.c | 3 ++- org.glite.lb.common/interface/context-int.h | 1 + org.glite.lb.common/src/context.c | 1 + org.glite.lb.common/src/param.c | 9 +++++++++ 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/org.glite.lb.client-interface/interface/context.h b/org.glite.lb.client-interface/interface/context.h index 8fb448b..dd423f8 100644 --- a/org.glite.lb.client-interface/interface/context.h +++ b/org.glite.lb.client-interface/interface/context.h @@ -26,6 +26,7 @@ typedef enum _edg_wll_ContextParam { EDG_WLL_PARAM_LEVEL, /**< logging level */ EDG_WLL_PARAM_DESTINATION, /**< logging destination host */ EDG_WLL_PARAM_DESTINATION_PORT, /**< logging destination port */ + EDG_WLL_PARAM_USER_LBPROXY, /**< user credentials when logging to L&B Proxy */ EDG_WLL_PARAM_LOG_TIMEOUT, /**< logging timeout (asynchronous) */ EDG_WLL_PARAM_LOG_SYNC_TIMEOUT, /**< logging timeout (synchronous) */ EDG_WLL_PARAM_QUERY_SERVER, /**< default server name to query */ diff --git a/org.glite.lb.client/src/producer.c b/org.glite.lb.client/src/producer.c index 69fc1df..c7885f3 100644 --- a/org.glite.lb.client/src/producer.c +++ b/org.glite.lb.client/src/producer.c @@ -417,7 +417,7 @@ static int edg_wll_LogEventMasterProxy( } /* format the DG.USER string */ /* XXX: put user credentials here probably from context */ - name_esc = edg_wll_LogEscape("User credentials should go here"); + name_esc = edg_wll_LogEscape(context->p_user_lbproxy); if (asprintf(&dguser,"DG.USER=\"%s\" ",name_esc) == -1) { edg_wll_SetError(context,ret = ENOMEM,"edg_wll_LogEventMasterProxy(): asprintf() error"); goto edg_wll_logeventmasterproxy_end; @@ -720,6 +720,7 @@ int edg_wll_SetLoggingJobProxy( edg_wll_IncSequenceCode(context); } /* XXX: add user credentials somewhere - to context? */ + edg_wll_SetParamString(context, EDG_WLL_PARAM_USER_LBPROXY, user); return edg_wll_Error(context,NULL,NULL); } diff --git a/org.glite.lb.common/interface/context-int.h b/org.glite.lb.common/interface/context-int.h index 5085595..3a90ef3 100644 --- a/org.glite.lb.common/interface/context-int.h +++ b/org.glite.lb.common/interface/context-int.h @@ -103,6 +103,7 @@ struct _edg_wll_Context { enum edg_wll_Level p_level; char *p_destination; int p_dest_port; + char *p_user_lbproxy; struct timeval p_log_timeout,p_sync_timeout,p_query_timeout, p_notif_timeout, p_tmp_timeout; char *p_query_server; int p_query_server_port; diff --git a/org.glite.lb.common/src/context.c b/org.glite.lb.common/src/context.c index cb1a385..ec9ba46 100644 --- a/org.glite.lb.common/src/context.c +++ b/org.glite.lb.common/src/context.c @@ -68,6 +68,7 @@ void edg_wll_FreeContext(edg_wll_Context ctx) if (ctx->p_host) free(ctx->p_host); if (ctx->p_instance) free(ctx->p_instance); if (ctx->p_destination) free(ctx->p_destination); + if (ctx->p_user_lbproxy) free(ctx->p_user_lbproxy); if (ctx->p_query_server) free(ctx->p_query_server); if (ctx->p_notif_server) free(ctx->p_notif_server); if (ctx->p_proxy_filename) free(ctx->p_proxy_filename); diff --git a/org.glite.lb.common/src/param.c b/org.glite.lb.common/src/param.c index 0f4ba51..eb50d67 100644 --- a/org.glite.lb.common/src/param.c +++ b/org.glite.lb.common/src/param.c @@ -115,6 +115,10 @@ int edg_wll_SetParamString(edg_wll_Context ctx,edg_wll_ContextParam param,const free(ctx->p_destination); ctx->p_destination = val ? strdup(val) : extract_host(param,EDG_WLL_LOG_HOST_DEFAULT); break; + case EDG_WLL_PARAM_USER_LBPROXY: + free(ctx->p_user_lbproxy); + ctx->p_user_lbproxy = val ? strdup(val) : NULL; + break; case EDG_WLL_PARAM_QUERY_SERVER: free(ctx->p_query_server); ctx->p_query_server = val ? strdup(val) : extract_host(param,NULL); @@ -270,6 +274,7 @@ int edg_wll_SetParam(edg_wll_Context ctx,edg_wll_ContextParam param,...) case EDG_WLL_PARAM_HOST: case EDG_WLL_PARAM_INSTANCE: case EDG_WLL_PARAM_DESTINATION: + case EDG_WLL_PARAM_USER_LBPROXY: case EDG_WLL_PARAM_QUERY_SERVER: case EDG_WLL_PARAM_NOTIF_SERVER: case EDG_WLL_PARAM_QUERY_SERVER_OVERRIDE: @@ -349,6 +354,10 @@ int edg_wll_GetParam(edg_wll_Context ctx,edg_wll_ContextParam param,...) p_string = va_arg(ap, char **); *p_string = estrdup(ctx->p_destination); break; + case EDG_WLL_PARAM_USER_LBPROXY: + p_string = va_arg(ap, char **); + *p_string = estrdup(ctx->p_user_lbproxy); + break; case EDG_WLL_PARAM_QUERY_SERVER: p_string = va_arg(ap, char **); *p_string = estrdup(ctx->p_query_server); -- 1.8.2.3