]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Test more.
authorSimon Josefsson <simon@josefsson.org>
Wed, 3 Jun 2009 04:38:18 +0000 (06:38 +0200)
committerSimon Josefsson <simon@josefsson.org>
Wed, 3 Jun 2009 04:38:18 +0000 (06:38 +0200)
tests/crq_apis.c

index 43dd3bebc8d7e631c35088d56d34da82132891d2..ee5da504dfbab081cbbd28403e1c747edda831a5 100644 (file)
@@ -66,6 +66,8 @@ void doit (void)
 
   size_t s = 0;
 
+  char smallbuf[10];
+
   int ret;
 
   ret = gnutls_global_init ();
@@ -112,6 +114,25 @@ void doit (void)
   if (ret != 0)
     fail ("gnutls_x509_crq_set_key_usage %d\n", ret);
 
+  ret = gnutls_x509_crq_get_challenge_password (crq, NULL, &s);
+  if (ret != GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE)
+    fail ("gnutls_x509_crq_get_challenge_password %d\n", ret);
+
+  ret = gnutls_x509_crq_set_challenge_password (crq, "foo");
+  if (ret != 0)
+    fail ("gnutls_x509_crq_set_challenge_password %d\n", ret);
+
+  s = 0;
+  ret = gnutls_x509_crq_get_challenge_password (crq, NULL, &s);
+  if (ret != 0 || s != 3)
+    fail ("gnutls_x509_crq_get_challenge_password2 %d/%d\n", ret, s);
+
+  s = 10;
+  ret = gnutls_x509_crq_get_challenge_password (crq, smallbuf, &s);
+  if (ret != 0 || s != 3 || strcmp (smallbuf, "foo") != 0)
+    fail ("gnutls_x509_crq_get_challenge_password3 %d/%d/%s\n",
+         ret, s, smallbuf);
+
   s = 0;
   ret = gnutls_x509_crq_get_extension_info (crq, 0, NULL, &s, NULL);
   if (ret != 0)