int edg_wll_log_direct_connect(edg_wll_Context ctx, edg_wll_GssConnection *conn)
{
int ret,answer;
- char *my_subject_name = NULL;
edg_wll_GssStatus gss_stat;
edg_wll_GssCred cred = NULL;
char *host;
answer = edg_wll_SetErrorGss(ctx, "edg_wll_gss_acquire_cred_gsi(): failed to load GSI credentials", &gss_stat);
goto edg_wll_log_direct_connect_end;
}
- my_subject_name = cred->name;
#ifdef EDG_WLL_LOG_STUB
- if (my_subject_name) {
+ if (cred && cred->name) {
/* TODO: merge - shouldn't be probably ctx->p_user_lbproxy but some new parameter, eg. ctx->p_user
related to the change in producer.c
*/
- edg_wll_SetParamString(ctx, EDG_WLL_PARAM_LBPROXY_USER, my_subject_name);
- fprintf(stderr,"edg_wll_log_direct_connect: using certificate: %s\n",my_subject_name);
+ edg_wll_SetParamString(ctx, EDG_WLL_PARAM_LBPROXY_USER, cred->name);
+ fprintf(stderr,"edg_wll_log_direct_connect: using certificate: %s\n", cred->name);
} else {
fprintf(stderr,"edg_wll_log_direct_connect: going on anonymously\n");
}
edg_wll_GssStatus gss_stat;
edg_wll_GssCred cred = NULL;
- /* acquire gss credentials */
- err = edg_wll_gss_acquire_cred_gsi(
- ctx->p_proxy_filename ? ctx->p_proxy_filename : ctx->p_cert_filename,
- ctx->p_proxy_filename ? ctx->p_proxy_filename : ctx->p_key_filename,
- &cred, &gss_stat);
- /* give up if unable to acquire prescribed credentials */
- if (err && ctx->p_proxy_filename) {
- edg_wll_SetErrorGss(ctx, "failed to load GSI credentials", &gss_stat);
+ if (ctx->p_proxy_filename || (ctx->p_cert_filename && ctx->p_key_filename)) {
+ /* acquire gss credentials */
+ err = edg_wll_gss_acquire_cred_gsi(
+ ctx->p_proxy_filename ? ctx->p_proxy_filename : ctx->p_cert_filename,
+ ctx->p_proxy_filename ? ctx->p_proxy_filename : ctx->p_key_filename,
+ &cred, &gss_stat);
+ /* give up if unable to acquire prescribed credentials */
+ if (err) {
+ edg_wll_SetErrorGss(ctx, "failed to load GSI credentials", &gss_stat);
+ } else {
+ edg_wll_SetParamString(ctx, EDG_WLL_PARAM_LBPROXY_USER, cred->name);
+ }
+ if (cred != NULL)
+ edg_wll_gss_release_cred(&cred, NULL);
+ }
+ else {
edg_wll_SetParamString(ctx, EDG_WLL_PARAM_LBPROXY_USER, EDG_WLL_LOG_USER_DEFAULT);
- } else {
- edg_wll_SetParamString(ctx, EDG_WLL_PARAM_LBPROXY_USER, cred->name);
+
+ // XXX: stop here - further changes need to be done in
+ // edg_wll_gss_connect() to support annonymous connetion
+ return edg_wll_SetError(ctx, ENOENT, "No credentials found.");
}
- if (cred != NULL)
- edg_wll_gss_release_cred(&cred, NULL);
}
return edg_wll_Error(ctx,NULL,NULL);
edg_wll_GssStatus gss_stat;
edg_wll_GssCred cred = NULL;
- /* acquire gss credentials */
- err = edg_wll_gss_acquire_cred_gsi(
- ctx->p_proxy_filename ? ctx->p_proxy_filename : ctx->p_cert_filename,
- ctx->p_proxy_filename ? ctx->p_proxy_filename : ctx->p_key_filename,
- &cred, &gss_stat);
- /* give up if unable to acquire prescribed credentials */
- if (err && ctx->p_proxy_filename) {
- edg_wll_SetErrorGss(ctx, "failed to load GSI credentials", &gss_stat);
- edg_wll_SetParamString(ctx, EDG_WLL_PARAM_LBPROXY_USER, EDG_WLL_LOG_USER_DEFAULT);
- } else {
- edg_wll_SetParamString(ctx, EDG_WLL_PARAM_LBPROXY_USER, cred->name);
+ if (ctx->p_proxy_filename || (ctx->p_cert_filename && ctx->p_key_filename)) {
+ /* acquire gss credentials */
+ err = edg_wll_gss_acquire_cred_gsi(
+ ctx->p_proxy_filename ? ctx->p_proxy_filename : ctx->p_cert_filename,
+ ctx->p_proxy_filename ? ctx->p_proxy_filename : ctx->p_key_filename,
+ &cred, &gss_stat);
+ /* give up if unable to acquire prescribed credentials */
+ if (err && ctx->p_proxy_filename) {
+ edg_wll_SetErrorGss(ctx, "failed to load GSI credentials", &gss_stat);
+ } else {
+ edg_wll_SetParamString(ctx, EDG_WLL_PARAM_LBPROXY_USER, cred->name);
+ }
+
+ if (cred != NULL)
+ edg_wll_gss_release_cred(&cred, NULL);
}
+ else {
+ edg_wll_SetParamString(ctx, EDG_WLL_PARAM_LBPROXY_USER, EDG_WLL_LOG_USER_DEFAULT);
- if (cred != NULL)
- edg_wll_gss_release_cred(&cred, NULL);
+ // XXX: stop here - further changes need to be done in
+ // edg_wll_gss_connect() to support annonymous connetion
+ return edg_wll_SetError(ctx, ENOENT, "No credentials found.");
+ }
}
/* query LBProxyServer for sequence code if not user-suplied */