char *name,
pidfile[PATH_MAX] = GLITE_JPIMPORTER_PIDFILE;
glite_gsplugin_Context plugin_ctx;
-
+ gss_cred_id_t cred;
name = strrchr(argv[0],'/');
if (name) name++; else name = argv[0];
soap_set_namespaces(soap, jpps__namespaces);
glite_gsplugin_init_context(&plugin_ctx);
- if (server_key) plugin_ctx->key_filename = strdup(server_key);
- if (server_cert) plugin_ctx->cert_filename = strdup(server_cert);
+ if (edg_wll_gss_acquire_cred_gsi(server_cert, server_key, &cred, NULL, NULL) != 0) {
+ perror("can't acquire credentials");
+ exit(1);
+ }
glite_gsplugin_set_timeout(plugin_ctx, &to);
+ glite_gsplugin_set_credential(plugin_ctx, mycred);
soap_register_plugin_arg(soap, glite_gsplugin,plugin_ctx);
#include <stdsoap2.h>
#include <glite/security/glite_gss.h>
#include <glite/security/glite_gsplugin.h>
-#include <glite/security/glite_gsplugin-int.h>
#include "conf.h"
#include "db_ops.h"
gss_buffer_desc token = GSS_C_EMPTY_BUFFER;
OM_uint32 maj_stat,min_stat;
int ret = 0;
+ edg_wll_GssConnection connection;
soap_init2(soap,SOAP_IO_KEEPALIVE,SOAP_IO_KEEPALIVE);
soap_set_namespaces(soap,jp__namespaces);
soap->user = (void *) private;
- glite_gsplugin_init_context(&plugin_ctx);
- plugin_ctx->connection = calloc(1,sizeof *plugin_ctx->connection);
-
switch (edg_wll_gss_watch_creds(server_cert,&cert_mtime)) {
case 0: break;
case 1: if (!edg_wll_gss_acquire_cred_gsi(server_cert,server_key,
}
/* TODO: DNS paranoia etc. */
-
- if (edg_wll_gss_accept(mycred,conn,to,plugin_ctx->connection,&gss_code)) {
+ memset(&connection, 0, sizeof(connection));
+ if (edg_wll_gss_accept(mycred,conn,to,&connection,&gss_code)) {
char *et;
edg_wll_gss_get_error(&gss_code,"",&et);
goto cleanup;
}
- maj_stat = gss_inquire_context(&min_stat,plugin_ctx->connection->context,
+ maj_stat = gss_inquire_context(&min_stat,connection.context,
&client_name, NULL, NULL, NULL, NULL, NULL, NULL);
if (!GSS_ERROR(maj_stat))
if (client_name != GSS_C_NO_NAME) gss_release_name(&min_stat, &client_name);
if (token.value) gss_release_buffer(&min_stat, &token);
+ glite_gsplugin_init_context(&plugin_ctx);
+ glite_gsplugin_set_connection(plugin_ctx, &connection);
soap_register_plugin_arg(soap,glite_gsplugin,plugin_ctx);
return 0;
#include "glite/jp/types.h"
#include "glite/jp/context.h"
#include "glite/security/glite_gsplugin.h"
-#include "glite/security/glite_gsplugin-int.h"
#include "glite/security/glite_gscompat.h"
#include "jp_H.h"
int i, dest_index, status;
struct soap *soap = soap_new();
glite_gsplugin_Context plugin_ctx;
+ gss_cred_id_t cred;
glite_jp_error_t err;
char *src, *desc = NULL;
// preventive very long timeout
glite_gsplugin_init_context(&plugin_ctx);
glite_gsplugin_set_timeout(plugin_ctx, &to);
- if (ctx->conf->server_key) plugin_ctx->key_filename = strdup(ctx->conf->server_key);
- if (ctx->conf->server_cert) plugin_ctx->cert_filename = strdup(ctx->conf->server_cert);
+ if (edg_wll_gss_acquire_cred_gsi(ctx->conf->server_cert, ctx->conf->server_key, &cred, NULL, NULL) != 0) {
+
+ err.code = EINVAL;
+ err.desc = "can't set credentials";
+ asprintf(&src, "%s/%s():%d", __FILE__, __FUNCTION__, __LINE__);
+ fprintf(stderr, "%s\n", src);
+ goto err;
+ }
+ glite_gsplugin_set_credential(plugin_ctx, cred);
soap_init(soap);
soap_set_namespaces(soap, jp__namespaces);
gss_name_t client_name = GSS_C_NO_NAME;
gss_buffer_desc token = GSS_C_EMPTY_BUFFER;
OM_uint32 maj_stat,min_stat;
-
+ edg_wll_GssConnection connection;
int ret = 0;
soap_set_namespaces(soap,jpps__namespaces);
soap->user = (void *) ctx; /* XXX: one instance per slave */
- glite_gsplugin_init_context(&plugin_ctx);
- plugin_ctx->connection = calloc(1,sizeof *plugin_ctx->connection);
-
switch (edg_wll_gss_watch_creds(server_cert,&cert_mtime)) {
case 0: break;
case 1: if (!edg_wll_gss_acquire_cred_gsi(server_cert,server_key,
/* TODO: DNS paranoia etc. */
- if (edg_wll_gss_accept(mycred,conn,to,plugin_ctx->connection,&gss_code)) {
+ if (edg_wll_gss_accept(mycred,conn,to,&connection,&gss_code)) {
char *et;
edg_wll_gss_get_error(&gss_code,"",&et);
goto cleanup;
}
- maj_stat = gss_inquire_context(&min_stat,plugin_ctx->connection->context,
+ maj_stat = gss_inquire_context(&min_stat,connection.context,
&client_name, NULL, NULL, NULL, NULL, NULL, NULL);
if (!GSS_ERROR(maj_stat))
if (client_name != GSS_C_NO_NAME) gss_release_name(&min_stat, &client_name);
if (token.value) gss_release_buffer(&min_stat, &token);
+ glite_gsplugin_init_context(&plugin_ctx);
+ glite_gsplugin_set_connection(plugin_ctx, &connection);
soap_register_plugin_arg(soap,glite_gsplugin,plugin_ctx);
+
return 0;
cleanup:
static int check_other_soap(glite_jp_context_t ctx)
{
glite_gsplugin_Context plugin_ctx;
+ int ret = 0;
if (!ctx->other_soap) {
glite_gsplugin_init_context(&plugin_ctx);
- if (server_key) plugin_ctx->key_filename = strdup(server_key);
- if (server_cert) plugin_ctx->cert_filename = strdup(server_cert);
+ if (server_key || server_cert) {
+ gss_cred_id_t cred;
+
+ ret = edg_wll_gss_acquire_cred_gsi(server_cert, server_key, &cred, NULL, NULL);
+ glite_gsplugin_set_credential(plugin_ctx, cred);
+ }
ctx->other_soap = soap_new();
soap_init(ctx->other_soap);
soap_register_plugin_arg(ctx->other_soap,glite_gsplugin,plugin_ctx);
ctx->other_soap->user = ctx;
}
- return 0;
+ return ret;
}
static check_fault(glite_jp_context_t ctx,struct soap *soap,int ec)
in.feedId = (char *) feed; /* XXX: const */
in.feedDone = done;
in.__sizejobAttributes = 1;
+#warning FIXME for valtri
in.jobAttributes = &jrp;
for (i=0; attrs[i].name; i++);
memset(&err,0,sizeof err);
err.code = code;
err.source = fullsource;
- err.desc = desc;
+ err.desc = desc && desc[0] ? desc : "(error without description)";
ret = glite_jp_stack_error(ctx,&err);
free(fullsource);
}
-static int my_errstmt(glite_jp_db_stmt_t jpstmt, const char *source, int line) {
+static int my_errstmt(glite_jp_db_stmt_t jpstmt, const char *source, int line) {
return jp_err(jpstmt->ctx, EIO, mysql_stmt_error(jpstmt->stmt), source, line);
}
(*retry)--;
return 0;
} else
+ jp_err(jpstmt->ctx, EIO, "CR_SERVER_LOST", source, line);
return -1;
break;
default:
// no error in JP context?
if (!item) return;
- detail = soap_faultdetail(soap);
+ detail = (struct SOAP_ENV__Detail *)soap_faultdetail(soap);
#if GSOAP_VERSION >= 20700
detail->fault = (void *)f;
#else
{
fprintf(stderr,"usage: %s [option]\n"
"\t-a, --address\t use this server address (may be faked for debugging)\n"
- "\t-b, --transactions\t transactions switch\n"
+ "\t-b, --transactions\t transactions switch (0, 1)\n"
"\t-k, --key\t private key file\n"
"\t-c, --cert\t certificate file\n"
"\t-C, --CAdir\t trusted certificates directory\n"
soap_done(soap);
goto err;
}
- gsplugin_ctx->connection = &cdata->ctx->connections->serverConnection->gss;
- gsplugin_ctx->cred = mycred;
+ glite_gsplugin_set_connection(gsplugin_ctx, &cdata->ctx->connections->serverConnection->gss);
+ glite_gsplugin_set_credential(gsplugin_ctx, mycred);
cdata->soap = soap;
gsplugin_ctx = glite_gsplugin_get_context(soap);
- gsplugin_ctx->cred = GSS_C_NO_CREDENTIAL;
- gsplugin_ctx->connection = NULL;
+ glite_gsplugin_set_connection(gsplugin_ctx, NULL);
+ glite_gsplugin_set_credential(gsplugin_ctx, GSS_C_NO_CREDENTIAL);
if ( (rv = bk_clnt_disconnect(conn, timeout, cdata)) )
return rv;