[Pvfs2-cvs] commit by sampson in
pvfs2/src/client/windows/client-service: cert.c
CVS commit program
cvs at parl.clemson.edu
Tue Apr 26 17:30:47 EDT 2011
Update of /projects/cvsroot/pvfs2/src/client/windows/client-service
In directory parlweb1:/tmp/cvs-serv6946/src/client/windows/client-service
Modified Files:
Tag: windows-client
cert.c
Log Message:
Initial Windows certificates
Index: cert.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/windows/client-service/Attic/cert.c,v
diff -p -u -r1.1.2.1 -r1.1.2.2
--- cert.c 25 Apr 2011 21:32:52 -0000 1.1.2.1
+++ cert.c 26 Apr 2011 21:30:47 -0000 1.1.2.2
@@ -51,13 +51,44 @@ static unsigned long verify_cert(X509 *c
{
X509_STORE *trust_store;
X509_STORE_CTX *ctx;
+ int ret;
+ unsigned long err;
/* add CA cert to trusted store */
trust_store = X509_STORE_new();
if (trust_store == NULL)
- return ERR_get_error();
+ goto verify_cert_exit;
- X509_STORE_add_cert(trust_store, ca_cert);
+ ret = X509_STORE_add_cert(trust_store, ca_cert);
+ if (!ret)
+ goto verify_cert_exit;
+ /* setup the context with the certs */
+ ctx = X509_STORE_CTX_new();
+ if (ctx == NULL)
+ goto verify_cert_exit;
-}
\ No newline at end of file
+ ret = X509_STORE_CTX_init(ctx, trust_store, cert, NULL);
+ if (!ret)
+ goto verify_cert_exit;
+
+ /* TODO: verify proxy cert */
+ /* verify the cert */
+ X509_verify_cert(ctx);
+
+verify_cert_exit:
+ err = ERR_get_error();
+
+ if (ctx != NULL)
+ {
+ X509_STORE_CTX_cleanup(ctx);
+ X509_STORE_CTX_free(ctx);
+ }
+
+ if (trust_store != NULL)
+ {
+ X509_STORE_free(trust_store);
+ }
+
+ return err;
+}
More information about the Pvfs2-cvs
mailing list