apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Jones" <oscare...@gmail.com>
Subject PATCH: apr-util/test/testpass.c does not support EBCDIC platforms
Date Wed, 19 Dec 2007 16:58:27 GMT
Adding the support needed to get testpass to work on ebcdic:

Index: apr-util/test/testpass.c
===================================================================
--- apr-util/test/testpass.c    (revision 605614)
+++ apr-util/test/testpass.c    (working copy)
@@ -46,6 +46,16 @@
   htpasswd -b passwords pass8 pass8
   (insert Perl one-liner to convert to initializer :) )
  */
+#if APR_CHARSET_EBCDIC
+    {"pass1", "rWy/HnBer2TdJ"},
+    {"pass2", "qdrOSG4cj7MC3"},
+    {"pass3", "PI4o9ZJbivdDX"},
+    {"pass4", "pkKRZ8C5iOHZy"},
+    {"pass5", "OP3zqMQDbFvJT"},
+    {"pass6", ".4hyjmhze4PhM"},
+    {"pass7", "akP2LZLNYQ23e"},
+    {"pass8", "APf2p0wuJ9iNs"}
+#else
     {"pass1", "1fWDc9QWYCWrQ"},
     {"pass2", "1fiGx3u7QoXaM"},
     {"pass3", "1fzijMylTiwCs"},
@@ -54,6 +64,7 @@
     {"pass6", "nHbsbWmJ3uyhc"},
     {"pass7", "nHQ3BbF0Y9vpI"},
     {"pass8", "nHZA1rViSldQk"}
+#endif
 };
 static int num_passwords = sizeof(passwords) / sizeof(passwords[0]);

@@ -128,6 +139,30 @@

 abts_suite *testpass(abts_suite *suite)
 {
+#if APR_CHARSET_EBCDIC
+    apr_status_t rv;
+    apr_xlate_t *to_ascii;
+    apr_pool_t *pool;
+
+    apr_initialize();
+    atexit(apr_terminate);
+    apr_pool_create(&pool, NULL);
+    rv = apr_xlate_open(&to_ascii, "ISO-8859-1", APR_DEFAULT_CHARSET,
pool);
+    if (rv) {
+        fprintf(stderr, "apr_xlate_open(to ASCII)->%d", rv);
+        return suite;
+    }
+    rv = apr_SHA1InitEBCDIC(to_ascii);
+    if (rv) {
+        fprintf(stderr, "apr_SHA1InitEBCDIC()->%d", rv);
+        return suite;
+    }
+    rv = apr_MD5InitEBCDIC(to_ascii);
+    if (rv) {
+        fprintf(stderr, "apr_MD5InitEBCDIC()->%d", rv);
+        return suite;
+    }
+#endif
     suite = ADD_SUITE(suite);

     abts_run_test(suite, test_crypt, NULL);

Mime
View raw message