removed direct globus/gssapi dependency
authorDaniel Kouřil <kouril@ics.muni.cz>
Mon, 6 Aug 2007 16:47:21 +0000 (16:47 +0000)
committerDaniel Kouřil <kouril@ics.muni.cz>
Mon, 6 Aug 2007 16:47:21 +0000 (16:47 +0000)
- edg_wll_gss_gethostname() used instead of globus_libc_gethostname()
- s/gss_release_cred/edg_wll_gss_release_cred
- edg_wll_gss_get_client_conn() used instead of gss_inquire_context() to get
  information about the client

org.glite.jp.primary/src/bones_server.c
org.glite.jp.primary/src/is_client.c

index 552b888..25e055b 100644 (file)
@@ -2,6 +2,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
+#include <assert.h>
 
 #include "glite/jp/types.h"
 #include "glite/jp/context.h"
@@ -35,7 +36,7 @@ static struct glite_srvbones_service stab = {
 
 static time_t cert_mtime;
 char *server_cert, *server_key, *cadir;
-gss_cred_id_t mycred = GSS_C_NO_CREDENTIAL;
+edg_wll_GssCred mycred = NULL;
 static char *mysubj;
 
 static char *port = "8901";
@@ -63,7 +64,7 @@ int main(int argc, char *argv[])
        FILE    *fpid;
 
        glite_jp_init_context(&ctx);
-       globus_libc_gethostname(buf,sizeof buf);
+       edg_wll_gss_gethostname(buf,sizeof buf);
        buf[999] = 0;
        ctx->myURL = buf;
 
@@ -238,11 +239,9 @@ static int newconn(int conn,struct timeval *to,void *data)
        struct soap     *soap = (struct soap *) data;
        glite_gsplugin_Context  plugin_ctx;
 
-       gss_cred_id_t           newcred = GSS_C_NO_CREDENTIAL;
+       edg_wll_GssCred         newcred = NULL;
        edg_wll_GssStatus       gss_code;
-       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_GssPrincipal    client = NULL;
        edg_wll_GssConnection   connection;
 
        int     ret = 0;
@@ -261,7 +260,7 @@ static int newconn(int conn,struct timeval *to,void *data)
                        {
 
                                printf("[%d] reloading credentials\n",getpid()); /* XXX: log */
-                               gss_release_cred(&min_stat,&mycred);
+                               edg_wll_gss_release_cred(&mycred, NULL);
                                mycred = newcred;
 
                                /* drop it too, it is recreated and reloads creds when necessary */
@@ -290,26 +289,19 @@ static int newconn(int conn,struct timeval *to,void *data)
                goto cleanup;
        }
 
-       maj_stat = gss_inquire_context(&min_stat,connection.context,
-                       &client_name, NULL, NULL, NULL, NULL, NULL, NULL);
-
-       if (!GSS_ERROR(maj_stat))
-               maj_stat = gss_display_name(&min_stat,client_name,&token,NULL);
+        ret = edg_wll_gss_get_client_conn(&connection, &client, NULL);
 
        if (ctx->peer) free(ctx->peer);
-       if (!GSS_ERROR(maj_stat)) {
-               printf("[%d] client DN: %s\n",getpid(),(char *) token.value); /* XXX: log */
-
-               ctx->peer = strdup(token.value);
-               memset(&token, 0, sizeof(token));
-       }
-       else {
+       if (ret || client->flags & EDG_WLL_GSS_FLAG_ANON) {
                printf("[%d] annonymous client\n",getpid());
                ctx->peer = NULL;
        }
+       else {
+               printf("[%d] client DN: %s\n",getpid(),client->name); /* XXX: log */
 
-       if (client_name != GSS_C_NO_NAME) gss_release_name(&min_stat, &client_name);
-       if (token.value) gss_release_buffer(&min_stat, &token);
+               ctx->peer = strdup(client->name);
+               edg_wll_gss_free_princ(client);
+       }
 
        glite_gsplugin_init_context(&plugin_ctx);
        glite_gsplugin_set_connection(plugin_ctx, &connection);
index 2444722..9c11052 100644 (file)
@@ -44,7 +44,7 @@ static int check_other_soap(glite_jp_context_t ctx)
        if (!ctx->other_soap) {
                glite_gsplugin_init_context(&plugin_ctx);
                if (server_key || server_cert) {
-                       gss_cred_id_t cred;
+                       edg_wll_GssCred cred;
 
                        ret = edg_wll_gss_acquire_cred_gsi(server_cert, server_key, &cred, NULL, NULL);
                        glite_gsplugin_set_credential(plugin_ctx, cred);