get peer's id (DN) out of the certificate in canl_io_connect
authorMarcel Poul <marcel.poul@cern.ch>
Mon, 2 Jul 2012 13:17:19 +0000 (13:17 +0000)
committerMarcel Poul <marcel.poul@cern.ch>
Mon, 2 Jul 2012 13:17:19 +0000 (13:17 +0000)
emi.canl.canl-c/examples/canl_sample_client.c
emi.canl.canl-c/src/canl.c
emi.canl.canl-c/src/canl_ssl.h

index 2210b65..2afb0ff 100644 (file)
@@ -89,7 +89,8 @@ int main(int argc, char *argv[])
         }
     }
 
-    err = canl_io_connect(my_ctx, my_io_h, p_server, NULL, port, NULL, 0, &timeout);
+    err = canl_io_connect(my_ctx, my_io_h, p_server, NULL, port, NULL, 0,
+            NULL, &timeout);
     if (err) {
         printf("[CLIENT] connection to %s cannot be established: %s\n",
               p_server, canl_get_error_message(my_ctx));
index 9d885ad..5a7d503 100644 (file)
@@ -89,7 +89,7 @@ static int init_io_content(glb_ctx *cc, io_handler *io)
 canl_err_code
 canl_io_connect(canl_ctx cc, canl_io_handler io, const char *host, 
         const char *service, int port, gss_OID_set auth_mechs, 
-        int flags, struct timeval *timeout)
+        int flags, canl_principal *peer, struct timeval *timeout)
 {
     int err = 0;
     io_handler *io_cc = (io_handler*) io;
@@ -169,16 +169,23 @@ canl_io_connect(canl_ctx cc, canl_io_handler io, const char *host,
                    continue;
                }
 
-               err = mech->connect(glb_cc, io_cc, ctx, timeout, host); //TODO timeout
+               err = mech->connect(glb_cc, io_cc, ctx, timeout, host);
                if (err) {
                    canl_io_close(glb_cc, io_cc);
                    mech->free_ctx(glb_cc, ctx);
                    ctx = NULL;
-                   continue;
-               }
-               io_cc->conn_ctx = ctx;
-               done = 1;
-               break;
+                    continue;
+                }
+                io_cc->conn_ctx = ctx;
+                done = 1;
+                /*TODO Not mandatory peer certificate for now*/
+                /*    if (peer) {
+                      err = mech->get_peer(glb_cc, io_cc, conn_ctx, peer);
+                      if (err)
+                      goto end;
+                      }
+                 */
+                break;
            }
            if (err == ETIMEDOUT)
                goto end;
index 09f01fd..87a41c7 100644 (file)
@@ -9,6 +9,7 @@ extern "C" {
 
 typedef enum canl_ctx_ssl_flags {
     CANL_ACCEPT_SSLv2          = 0x0001,
+    CANL_DN_OSSL               = 0x0002,
 } canl_ctx_ssl_flags;
 
 canl_ctx CANL_CALLCONV