canl_ctx_set_ssl_cred() added to public API
authorDaniel Kouřil <kouril@ics.muni.cz>
Fri, 13 Jan 2012 14:32:35 +0000 (14:32 +0000)
committerDaniel Kouřil <kouril@ics.muni.cz>
Fri, 13 Jan 2012 14:32:35 +0000 (14:32 +0000)
- removed the previous attempts

emi.canl.canl-c/src/canl.c
emi.canl.canl-c/src/canl.h
emi.canl.canl-c/src/canl_cert.c
emi.canl.canl-c/src/canl_locl.h
emi.canl.canl-c/src/canl_sample_server.c
emi.canl.canl-c/src/canl_ssl.c

index 10179e0..e831b32 100644 (file)
@@ -370,6 +370,7 @@ size_t canl_io_write(canl_ctx cc, canl_io_handler io, void *buffer, size_t size,
     return b_written;
 }
 
+#if 0
 int canl_set_ctx_own_cert(canl_ctx cc, canl_x509 cert, 
         canl_stack_of_x509 chain, canl_pkey key)
 {
@@ -409,3 +410,4 @@ int canl_set_ctx_own_cert_file(canl_ctx cc, char *cert, char *key,
     }
         return err;
 }
+#endif
index ba2b34d..0e0f82f 100644 (file)
@@ -20,6 +20,8 @@ typedef void *canl_principal;
 
 typedef long canl_err_code;
 
+typedef char (*canl_password_callback)(canl_ctx cc, void *userdata);
+
 canl_ctx CANL_CALLCONV
 canl_create_ctx();
 
@@ -72,6 +74,10 @@ canl_mech2str(canl_ctx, gss_OID);
 const gss_OID CANL_CALLCONV
 canl_str2mech(canl_ctx, const char mech);
 
+canl_err_code CANL_CALLCONV
+canl_ctx_set_ssl_cred(canl_ctx cc, char *cert, char *key,
+                     canl_password_callback cb, void *userdata);
+
 #ifdef __cplusplus
 }       
 #endif 
index 6069eb2..2d834e1 100644 (file)
@@ -4,6 +4,7 @@ static int set_cert(glb_ctx *cc, X509 *cert);
 static int set_key_file(glb_ctx *cc, char *key);
 static int set_cert_file(glb_ctx *cc, char *cert);
 
+#if 0
 //TODO just stub
 int do_set_ctx_own_cert(glb_ctx *cc, canl_x509 cert, canl_stack_of_x509 chain, 
         canl_pkey key)
@@ -33,6 +34,7 @@ int do_set_ctx_own_cert(glb_ctx *cc, canl_x509 cert, canl_stack_of_x509 chain,
 */
     return 0;
 }
+#endif
 
 static int set_cert(glb_ctx *cc, X509 *cert)
 {
index 951fe1e..c540a6b 100644 (file)
@@ -31,8 +31,6 @@
 
 #include "canl.h"
 
-#include "canl_ssl.h"
-
 typedef struct canl_err_desc {
     CANL_ERROR code;
     const char *desc;
@@ -110,7 +108,4 @@ int ssl_write(glb_ctx *cc, io_handler *io, void *buffer, size_t size,
         struct timeval *tout);
 int ssl_close(glb_ctx *cc, io_handler *io);
 
-int do_set_ctx_own_cert(glb_ctx *cc, canl_x509 cert, canl_stack_of_x509 chain, 
-        canl_pkey key);
-int do_set_ctx_own_cert_file(glb_ctx *cc, char *cert, char *key);
 #endif
index 9814106..800e0ab 100644 (file)
@@ -58,8 +58,7 @@ int main(int argc, char *argv[])
     }
 
     if (serv_cert || serv_key){
-        err = canl_set_ctx_own_cert_file(my_ctx, serv_cert, serv_key, 
-                NULL, NULL);
+       err = canl_ctx_set_ssl_cred(my_ctx, serv_cert, serv_key, NULL, NULL);
         if (err) {
             printf("[SERVER] cannot set certificate or key to context: %s\n",
                   canl_get_error_message(my_ctx));
index c702b54..21902c6 100644 (file)
@@ -714,6 +714,13 @@ int ssl_close(glb_ctx *cc, io_handler *io)
     }
 }
 
+canl_err_code 
+canl_ctx_set_ssl_cred(canl_ctx cc, char *cert, char *key,
+                     canl_password_callback cb, void *userdata)
+{
+    return ENOSYS;
+}
+
 #ifdef DEBUG
 static void dbg_print_ssl_error(int errorcode)
 {