Added glite_gsplugin_set_credential() call
authorDaniel Kouřil <kouril@ics.muni.cz>
Sun, 5 Feb 2006 13:10:02 +0000 (13:10 +0000)
committerDaniel Kouřil <kouril@ics.muni.cz>
Sun, 5 Feb 2006 13:10:02 +0000 (13:10 +0000)
org.glite.security.gsoap-plugin/examples/wscalc_srv_ex.c
org.glite.security.gsoap-plugin/interface/glite_gsplugin.h
org.glite.security.gsoap-plugin/project/version.properties
org.glite.security.gsoap-plugin/src/glite_gsplugin.c

index 6fe18d8..9e5da4d 100644 (file)
@@ -48,8 +48,10 @@ main(int argc, char **argv)
 
        if ( cert || key ) {
                if ( glite_gsplugin_init_context(&ctx) ) { perror("init context"); exit(1); }
-               ctx->cert_filename = strdup(cert? : key);
-               ctx->key_filename = strdup(key? : cert);
+               if (glite_gsplugin_set_credential(ctx, cert, key)) {
+                  fprintf (stderr, "Failed to set credentials\n");
+                  exit(1);
+               }
        }
 
        soap_init(&soap);
@@ -70,7 +72,7 @@ main(int argc, char **argv)
                if ( soap_accept(&soap) < 0 ) {
                        fprintf(stderr, "soap_accept() failed!!!\n");
                        soap_print_fault(&soap, stderr);
-//                     fprintf(stderr, "plugin err: %s", glite_gsplugin_errdesc(&soap));
+                       fprintf(stderr, "plugin err: %s\n", glite_gsplugin_errdesc(&soap));
                        continue;
                }
 
index ba6e131..4ebd8ef 100644 (file)
@@ -34,6 +34,7 @@ extern void *glite_gsplugin_get_udata(struct soap *);
 extern void glite_gsplugin_set_udata(struct soap *, void *);
 
 extern void glite_gsplugin_set_timeout(glite_gsplugin_Context, struct timeval const *);
+extern int glite_gsplugin_set_credential(glite_gsplugin_Context, const char *, const char *);
 
 extern int glite_gsplugin(struct soap *, struct soap_plugin *, void *);
 extern char *glite_gsplugin_errdesc(struct soap *);
index 43a1aee..a07ea68 100644 (file)
@@ -102,6 +102,25 @@ void glite_gsplugin_set_timeout(glite_gsplugin_Context ctx, struct timeval const
        else ctx->timeout = NULL;
 }
 
+int
+glite_gsplugin_set_credential(glite_gsplugin_Context ctx,
+                             const char *cert,
+                             const char *key)
+{
+   edg_wll_GssStatus gss_code;
+   int ret;
+
+   ret = edg_wll_gss_acquire_cred_gsi(cert, key, &ctx->cred, NULL, &gss_code);
+   if (ret) {
+      /* XXX propagate error description */
+      return EINVAL;
+   }
+
+   ctx->cert_filename = cert;
+   ctx->key_filename = key;
+
+   return 0;
+}
 
 int
 glite_gsplugin(struct soap *soap, struct soap_plugin *p, void *arg)