Author: ivan
Date: Mon Aug 11 08:54:38 2014
New Revision: 1617225
URL: http://svn.apache.org/r1617225
Log:
On 'svn-auth-x509' branch: Revert r1617088, r1617095 and r1617096 per brane
request: The branch is in review/vote stage, so it's incorrect to change
it. Discussion:
http://svn.haxx.se/dev/archive-2014-08/0113.shtml
Modified:
subversion/branches/svn-auth-x509/subversion/include/svn_checksum.h
subversion/branches/svn-auth-x509/subversion/include/svn_x509.h (contents, props changed)
subversion/branches/svn-auth-x509/subversion/libsvn_fs_base/bdb/checksum-reps-table.c
subversion/branches/svn-auth-x509/subversion/libsvn_fs_base/err.c
subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/lock.c
subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/low_level.c
subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/rep-cache.c
subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/lock.c
subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/low_level.c
subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/rep-cache.c
subversion/branches/svn-auth-x509/subversion/libsvn_subr/cache-memcache.c
subversion/branches/svn-auth-x509/subversion/libsvn_subr/checksum.c
subversion/branches/svn-auth-x509/subversion/libsvn_subr/checksum.h
subversion/branches/svn-auth-x509/subversion/libsvn_subr/deprecated.c
subversion/branches/svn-auth-x509/subversion/libsvn_subr/md5.c
subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509.h (contents, props changed)
subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509info.c (contents, props
changed)
subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509parse.c (contents, props
changed)
subversion/branches/svn-auth-x509/subversion/libsvn_wc/adm_crawler.c
subversion/branches/svn-auth-x509/subversion/libsvn_wc/entries.c
subversion/branches/svn-auth-x509/subversion/libsvn_wc/update_editor.c
subversion/branches/svn-auth-x509/subversion/libsvn_wc/wc_db_pristine.c
subversion/branches/svn-auth-x509/subversion/mod_dav_svn/activity.c
subversion/branches/svn-auth-x509/subversion/svn/auth-cmd.c
subversion/branches/svn-auth-x509/subversion/svnserve/serve.c
subversion/branches/svn-auth-x509/subversion/tests/libsvn_subr/checksum-test.c
subversion/branches/svn-auth-x509/subversion/tests/libsvn_subr/x509-test.c (contents,
props changed)
subversion/branches/svn-auth-x509/tools/server-side/svn-rep-sharing-stats.c
subversion/branches/svn-auth-x509/tools/server-side/svnfsfs/dump-index-cmd.c
Modified: subversion/branches/svn-auth-x509/subversion/include/svn_checksum.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/include/svn_checksum.h?rev=1617225&r1=1617224&r2=1617225&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/include/svn_checksum.h (original)
+++ subversion/branches/svn-auth-x509/subversion/include/svn_checksum.h Mon Aug 11 08:54:38
2014
@@ -119,12 +119,59 @@ svn_checksum_t *
svn_checksum_dup(const svn_checksum_t *checksum,
apr_pool_t *pool);
+/** Flags for use with svn_checksum_to_cstring_display2().
+ *
+ * @defgroup checksum_display_flags Checksum Display flags
+ * @{
+ */
+
+ /** Display hex characters as lower case letters.
+ *
+ * Either this flag or #SVN_CHECKSUM_CSTRING_UPPER should be specified,
+ * but not both.
+ */
+#define SVN_CHECKSUM_CSTRING_LOWER 0
+
+ /** Display hex characters as upper case letters.
+ *
+ * Either this flag or #SVN_CHECKSUM_CSTRING_LOWER should be specified,
+ * but not both.
+ */
+#define SVN_CHECKSUM_CSTRING_UPPER 1
+
+ /** Include colons between every 2 characters of output (one byte of
+ * checksum). */
+#define SVN_CHECKSUM_CSTRING_COLONS 2
+
+/** @} */
/** Return the hex representation of @a checksum, allocating the string
* in @a pool.
*
+ * The output can be modified by setting the @a flags.
+ *
+ * The caller can choose upper or lower case characters for the hex digits
+ * by specifying #SVN_CHECKSUM_CSTRING_LOWER or #SVN_CHECKSUM_CSTRING_UPPER
+ * in @a flags.
+ *
+ * The caller can request colons for every 2 characters of output by
+ * specifying #SVN_CHECKSUM_CSTRING_COLONS.
+ *
+ * @since New in 1.9.
+ */
+const char *
+svn_checksum_to_cstring_display2(const svn_checksum_t *checksum,
+ int format_flags,
+ apr_pool_t *pool);
+
+/** Similar to svn_checksum_to_cstring_display2() but with @a flags
+ * set to #SVN_CHECKSUM_CSTRING_LOWER.
+ *
+ * @deprecated Provided for backwards compatibility with the 1.8 API
+ *
* @since New in 1.6.
*/
+SVN_DEPRECATED
const char *
svn_checksum_to_cstring_display(const svn_checksum_t *checksum,
apr_pool_t *pool);
Modified: subversion/branches/svn-auth-x509/subversion/include/svn_x509.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/include/svn_x509.h?rev=1617225&r1=1617224&r2=1617225&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/include/svn_x509.h (original)
+++ subversion/branches/svn-auth-x509/subversion/include/svn_x509.h Mon Aug 11 08:54:38 2014
@@ -1,138 +1,129 @@
-/**
- * @copyright
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- * @endcopyright
- *
- * @file svn_x509.h
- * @brief Subversion's X509 parser
- */
-
-#ifndef SVN_X509_H
-#define SVN_X509_H
-
-#include <apr_pools.h>
-#include <apr_tables.h>
-#include <apr_time.h>
-
-#include "svn_error.h"
-#include "svn_checksum.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Representation of parsed certificate info.
- *
- * @since New in 1.9.
- */
-typedef struct svn_x509_certinfo_t svn_x509_certinfo_t;
-
-/**
- * Parse x509 @a der certificate data from @a buf with length @a
- * buflen and return certificate information in @a *certinfo,
- * allocated in @a result_pool.
- *
- * @note This function has been written with the intent of display data in a
- * certificate for a user to see. As a result, it does not do much
- * validation on the data it parses from the certificate. It does not
- * for instance verify that the certificate is signed by the issuer. It
- * does not verify a trust chain. It does not error on critical
- * extensions it does not know how to parse. So while it can be used as
- * part of a certificate validation scheme, it can't be used alone for
- * that purpose.
- *
- * @since New in 1.9.
- */
-svn_error_t *
-svn_x509_parse_cert(svn_x509_certinfo_t **certinfo,
- const char *buf,
- apr_size_t buflen,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool);
-
-/**
- * Returns a deep copy of @a certinfo, allocated in @a result_pool.
- * May use @a scratch_pool for temporary allocations.
- * @since New in 1.9.
- */
-svn_x509_certinfo_t *
-svn_x509_certinfo_dup(const svn_x509_certinfo_t *certinfo,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool);
-
-/**
- * Returns the subject name from @a certinfo.
- * @since New in 1.9.
- */
-const char *
-svn_x509_certinfo_get_subject(const svn_x509_certinfo_t *certinfo);
-
-/**
- * Returns the cerficiate issuer name from @a certinfo.
- * @since New in 1.9.
- */
-const char *
-svn_x509_certinfo_get_issuer(const svn_x509_certinfo_t *certinfo);
-
-/**
- * Returns the start of the certificate validity period from @a certinfo.
- *
- * @since New in 1.9.
- */
-apr_time_t
-svn_x509_certinfo_get_valid_from(const svn_x509_certinfo_t *certinfo);
-
-/**
- * Returns the end of the certificate validity period from @a certinfo.
- *
- * @since New in 1.9.
- */
-const apr_time_t
-svn_x509_certinfo_get_valid_to(const svn_x509_certinfo_t *certinfo);
-
-/**
- * Returns the digest (fingerprint) from @a certinfo
- * @since New in 1.9.
- */
-const svn_checksum_t *
-svn_x509_certinfo_get_digest(const svn_x509_certinfo_t *certinfo);
-
-/**
- * Returns an array of (const char*) host names from @a certinfo.
- *
- * @since New in 1.9.
- */
-const apr_array_header_t *
-svn_x509_certinfo_get_hostnames(const svn_x509_certinfo_t *certinfo);
-
-/** Return the properly formatted representation of a certificate
- * @a fingerprint, allocating the string in @a pool.
- *
- * @since New in 1.9.
- */
-const char *
-svn_x509_fingerprint_to_display(const svn_checksum_t *fingerprint,
- apr_pool_t *pool);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* SVN_X509_H */
+/**
+ * @copyright
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ * @endcopyright
+ *
+ * @file svn_x509.h
+ * @brief Subversion's X509 parser
+ */
+
+#ifndef SVN_X509_H
+#define SVN_X509_H
+
+#include <apr_pools.h>
+#include <apr_tables.h>
+#include <apr_time.h>
+
+#include "svn_error.h"
+#include "svn_checksum.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Representation of parsed certificate info.
+ *
+ * @since New in 1.9.
+ */
+typedef struct svn_x509_certinfo_t svn_x509_certinfo_t;
+
+/**
+ * Parse x509 @a der certificate data from @a buf with length @a
+ * buflen and return certificate information in @a *certinfo,
+ * allocated in @a result_pool.
+ *
+ * @note This function has been written with the intent of display data in a
+ * certificate for a user to see. As a result, it does not do much
+ * validation on the data it parses from the certificate. It does not
+ * for instance verify that the certificate is signed by the issuer. It
+ * does not verify a trust chain. It does not error on critical
+ * extensions it does not know how to parse. So while it can be used as
+ * part of a certificate validation scheme, it can't be used alone for
+ * that purpose.
+ *
+ * @since New in 1.9.
+ */
+svn_error_t *
+svn_x509_parse_cert(svn_x509_certinfo_t **certinfo,
+ const char *buf,
+ apr_size_t buflen,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
+/**
+ * Returns a deep copy of @a certinfo, allocated in @a result_pool.
+ * May use @a scratch_pool for temporary allocations.
+ * @since New in 1.9.
+ */
+svn_x509_certinfo_t *
+svn_x509_certinfo_dup(const svn_x509_certinfo_t *certinfo,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
+/**
+ * Returns the subject name from @a certinfo.
+ * @since New in 1.9.
+ */
+const char *
+svn_x509_certinfo_get_subject(const svn_x509_certinfo_t *certinfo);
+
+/**
+ * Returns the cerficiate issuer name from @a certinfo.
+ * @since New in 1.9.
+ */
+const char *
+svn_x509_certinfo_get_issuer(const svn_x509_certinfo_t *certinfo);
+
+/**
+ * Returns the start of the certificate validity period from @a certinfo.
+ *
+ * @since New in 1.9.
+ */
+apr_time_t
+svn_x509_certinfo_get_valid_from(const svn_x509_certinfo_t *certinfo);
+
+/**
+ * Returns the end of the certificate validity period from @a certinfo.
+ *
+ * @since New in 1.9.
+ */
+const apr_time_t
+svn_x509_certinfo_get_valid_to(const svn_x509_certinfo_t *certinfo);
+
+/**
+ * Returns the digest (fingerprint) from @a certinfo
+ * @since New in 1.9.
+ */
+const svn_checksum_t *
+svn_x509_certinfo_get_digest(const svn_x509_certinfo_t *certinfo);
+
+/**
+ * Returns an array of (const char*) host names from @a certinfo.
+ *
+ * @since New in 1.9.
+ */
+const apr_array_header_t *
+svn_x509_certinfo_get_hostnames(const svn_x509_certinfo_t *certinfo);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* SVN_X509_H */
Propchange: subversion/branches/svn-auth-x509/subversion/include/svn_x509.h
('svn:eol-style' removed)
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_base/bdb/checksum-reps-table.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_base/bdb/checksum-reps-table.c?rev=1617225&r1=1617224&r2=1617225&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_fs_base/bdb/checksum-reps-table.c
(original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_base/bdb/checksum-reps-table.c
Mon Aug 11 08:54:38 2014
@@ -129,7 +129,9 @@ svn_error_t *svn_fs_bdb__set_checksum_re
svn_fs_base__track_dbt(&value, pool);
if (db_err != DB_NOTFOUND)
{
- const char *sum_str = svn_checksum_to_cstring_display(checksum, pool);
+ const char *sum_str = svn_checksum_to_cstring_display2(checksum,
+ SVN_CHECKSUM_CSTRING_LOWER,
+ pool);
return svn_error_createf
(SVN_ERR_FS_ALREADY_EXISTS, NULL,
_("Representation key for checksum '%s' exists in filesystem '%s'."),
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_base/err.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_base/err.c?rev=1617225&r1=1617224&r2=1617225&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_fs_base/err.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_base/err.c Mon Aug 11 08:54:38
2014
@@ -171,7 +171,8 @@ svn_fs_base__err_no_such_checksum_rep(sv
svn_error_createf
(SVN_ERR_FS_NO_SUCH_CHECKSUM_REP, 0,
_("No record in 'checksum-reps' table for checksum '%s' in "
- "filesystem '%s'"), svn_checksum_to_cstring_display(checksum,
- fs->pool),
+ "filesystem '%s'"), svn_checksum_to_cstring_display2(checksum,
+ SVN_CHECKSUM_CSTRING_LOWER,
+ fs->pool),
fs->path);
}
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/lock.c?rev=1617225&r1=1617224&r2=1617225&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/lock.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/lock.c Mon Aug 11 08:54:38 2014
@@ -72,7 +72,9 @@ make_digest(const char **digest,
SVN_ERR(svn_checksum(&checksum, svn_checksum_md5, str, strlen(str), pool));
- *digest = svn_checksum_to_cstring_display(checksum, pool);
+ *digest = svn_checksum_to_cstring_display2(checksum,
+ SVN_CHECKSUM_CSTRING_LOWER,
+ pool);
return SVN_NO_ERROR;
}
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/low_level.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/low_level.c?rev=1617225&r1=1617224&r2=1617225&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/low_level.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/low_level.c Mon Aug 11 08:54:38
2014
@@ -943,7 +943,9 @@ format_digest(const unsigned char *diges
if (is_null)
return "(null)";
- return svn_checksum_to_cstring_display(&checksum, result_pool);
+ return svn_checksum_to_cstring_display2(&checksum,
+ SVN_CHECKSUM_CSTRING_LOWER,
+ result_pool);
}
svn_stringbuf_t *
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/rep-cache.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/rep-cache.c?rev=1617225&r1=1617224&r2=1617225&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/rep-cache.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_fs/rep-cache.c Mon Aug 11 08:54:38
2014
@@ -287,8 +287,9 @@ svn_fs_fs__get_rep_reference(representat
if (err)
return svn_error_createf(SVN_ERR_FS_CORRUPT, err,
"Checksum '%s' in rep-cache is beyond HEAD",
- svn_checksum_to_cstring_display(checksum,
- pool));
+ svn_checksum_to_cstring_display2(checksum,
+ SVN_CHECKSUM_CSTRING_LOWER,
+ pool));
}
return SVN_NO_ERROR;
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/lock.c?rev=1617225&r1=1617224&r2=1617225&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/lock.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/lock.c Mon Aug 11 08:54:38 2014
@@ -72,7 +72,9 @@ make_digest(const char **digest,
SVN_ERR(svn_checksum(&checksum, svn_checksum_md5, str, strlen(str), pool));
- *digest = svn_checksum_to_cstring_display(checksum, pool);
+ *digest = svn_checksum_to_cstring_display2(checksum,
+ SVN_CHECKSUM_CSTRING_LOWER,
+ pool);
return SVN_NO_ERROR;
}
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/low_level.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/low_level.c?rev=1617225&r1=1617224&r2=1617225&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/low_level.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/low_level.c Mon Aug 11 08:54:38
2014
@@ -553,7 +553,9 @@ format_digest(const unsigned char *diges
if (is_null)
return "(null)";
- return svn_checksum_to_cstring_display(&checksum, pool);
+ return svn_checksum_to_cstring_display2(&checksum,
+ SVN_CHECKSUM_CSTRING_LOWER,
+ pool);
}
svn_stringbuf_t *
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/rep-cache.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/rep-cache.c?rev=1617225&r1=1617224&r2=1617225&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/rep-cache.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/rep-cache.c Mon Aug 11 08:54:38
2014
@@ -282,8 +282,9 @@ svn_fs_x__get_rep_reference(representati
if (err)
return svn_error_createf(SVN_ERR_FS_CORRUPT, err,
"Checksum '%s' in rep-cache is beyond HEAD",
- svn_checksum_to_cstring_display(checksum,
- pool));
+ svn_checksum_to_cstring_display2(checksum,
+ SVN_CHECKSUM_CSTRING_LOWER,
+ pool));
}
return SVN_NO_ERROR;
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/cache-memcache.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/cache-memcache.c?rev=1617225&r1=1617224&r2=1617225&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/cache-memcache.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/cache-memcache.c Mon Aug 11 08:54:38
2014
@@ -119,7 +119,9 @@ build_key(const char **mc_key,
long_key = apr_pstrcat(pool,
apr_pstrmemdup(pool, long_key,
MEMCACHED_KEY_UNHASHED_LEN),
- svn_checksum_to_cstring_display(checksum, pool),
+ svn_checksum_to_cstring_display2(checksum,
+ SVN_CHECKSUM_CSTRING_LOWER,
+ pool),
SVN_VA_NULL);
}
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/checksum.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/checksum.c?rev=1617225&r1=1617224&r2=1617225&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/checksum.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/checksum.c Mon Aug 11 08:54:38
2014
@@ -96,18 +96,29 @@ svn__empty_string_digest(svn_checksum_ki
const char *
svn__digest_to_cstring_display(const unsigned char digest[],
apr_size_t digest_size,
+ int format_flags,
apr_pool_t *pool)
{
- static const char *hex = "0123456789abcdef";
- char *str = apr_palloc(pool, (digest_size * 2) + 1);
+ const char *hex;
+ svn_boolean_t colons = format_flags & SVN_CHECKSUM_CSTRING_COLONS;
+ int chars_per_byte = 2 + (colons ? 1 : 0);
+ char *str = apr_palloc(pool,
+ (digest_size * chars_per_byte) + (colons ? 0 : 1));
apr_size_t i;
+ if (format_flags & SVN_CHECKSUM_CSTRING_UPPER)
+ hex = "0123456789ABCDEF";
+ else
+ hex = "0123456789abcdef";
+
for (i = 0; i < digest_size; i++)
{
- str[i*2] = hex[digest[i] >> 4];
- str[i*2+1] = hex[digest[i] & 0x0f];
+ str[i*chars_per_byte] = hex[digest[i] >> 4];
+ str[i*chars_per_byte+1] = hex[digest[i] & 0x0f];
+ if (colons)
+ str[i*chars_per_byte+2] = ':';
}
- str[i*2] = '\0';
+ str[i*chars_per_byte-(colons ? 1 : 0)] = '\0';
return str;
}
@@ -121,7 +132,9 @@ svn__digest_to_cstring(const unsigned ch
static const unsigned char zeros_digest[MAX_DIGESTSIZE] = { 0 };
if (memcmp(digest, zeros_digest, digest_size) != 0)
- return svn__digest_to_cstring_display(digest, digest_size, pool);
+ return svn__digest_to_cstring_display(digest, digest_size,
+ SVN_CHECKSUM_CSTRING_LOWER,
+ pool);
else
return NULL;
}
@@ -270,8 +283,9 @@ svn_checksum_match(const svn_checksum_t
}
const char *
-svn_checksum_to_cstring_display(const svn_checksum_t *checksum,
- apr_pool_t *pool)
+svn_checksum_to_cstring_display2(const svn_checksum_t *checksum,
+ int format_flags,
+ apr_pool_t *pool)
{
switch (checksum->kind)
{
@@ -281,6 +295,7 @@ svn_checksum_to_cstring_display(const sv
case svn_checksum_fnv1a_32x4:
return svn__digest_to_cstring_display(checksum->digest,
digest_sizes[checksum->kind],
+ format_flags,
pool);
default:
@@ -634,8 +649,12 @@ svn_checksum_mismatch_err(const svn_chec
" expected: %s\n"
" actual: %s\n"),
desc,
- svn_checksum_to_cstring_display(expected, scratch_pool),
- svn_checksum_to_cstring_display(actual, scratch_pool));
+ svn_checksum_to_cstring_display2(expected,
+ SVN_CHECKSUM_CSTRING_LOWER,
+ scratch_pool),
+ svn_checksum_to_cstring_display2(actual,
+ SVN_CHECKSUM_CSTRING_LOWER,
+ scratch_pool));
}
svn_boolean_t
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/checksum.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/checksum.h?rev=1617225&r1=1617224&r2=1617225&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/checksum.h (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/checksum.h Mon Aug 11 08:54:38
2014
@@ -45,6 +45,7 @@ svn__empty_string_digest(svn_checksum_ki
const char *
svn__digest_to_cstring_display(const unsigned char digest[],
apr_size_t digest_size,
+ int format_flags,
apr_pool_t *pool);
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/deprecated.c?rev=1617225&r1=1617224&r2=1617225&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/deprecated.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/deprecated.c Mon Aug 11 08:54:38
2014
@@ -1491,3 +1491,16 @@ svn_auth_get_gpg_agent_simple_provider(s
svn_auth__get_gpg_agent_simple_provider(provider, pool);
}
#endif /* !WIN32 */
+
+/*** From checksum.c ***/
+const char *
+svn_checksum_to_cstring_display(const svn_checksum_t *checksum,
+ apr_pool_t
+ *pool)
+{
+ return svn_checksum_to_cstring_display2(checksum,
+ SVN_CHECKSUM_CSTRING_LOWER,
+ pool);
+}
+
+
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/md5.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/md5.c?rev=1617225&r1=1617224&r2=1617225&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/md5.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/md5.c Mon Aug 11 08:54:38 2014
@@ -42,7 +42,8 @@ const char *
svn_md5_digest_to_cstring_display(const unsigned char digest[],
apr_pool_t *pool)
{
- return svn__digest_to_cstring_display(digest, APR_MD5_DIGESTSIZE, pool);
+ return svn__digest_to_cstring_display(digest, APR_MD5_DIGESTSIZE,
+ SVN_CHECKSUM_CSTRING_LOWER, pool);
}
const char *
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509.h?rev=1617225&r1=1617224&r2=1617225&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509.h (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509.h Mon Aug 11 08:54:38 2014
@@ -1,136 +1,136 @@
-/**
- * \file x509.h
- *
- * Based on XySSL: Copyright (C) 2006-2008 Christophe Devine
- *
- * Copyright (C) 2009 Paul Bakker <polarssl_maintainer at polarssl dot org>
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the names of PolarSSL or XySSL nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef SVN_LIBSVN_SUBR_X509_H
-#define SVN_LIBSVN_SUBR_X509_H
-
-#include <stddef.h>
-#include <apr_time.h>
-
-/*
- * DER constants
- */
-#define ASN1_BOOLEAN 0x01
-#define ASN1_INTEGER 0x02
-#define ASN1_BIT_STRING 0x03
-#define ASN1_OCTET_STRING 0x04
-#define ASN1_NULL 0x05
-#define ASN1_OID 0x06
-#define ASN1_UTF8_STRING 0x0C
-#define ASN1_SEQUENCE 0x10
-#define ASN1_SET 0x11
-#define ASN1_PRINTABLE_STRING 0x13
-#define ASN1_T61_STRING 0x14
-#define ASN1_IA5_STRING 0x16
-#define ASN1_UTC_TIME 0x17
-#define ASN1_GENERALIZED_TIME 0x18
-#define ASN1_UNIVERSAL_STRING 0x1C
-#define ASN1_BMP_STRING 0x1E
-#define ASN1_PRIMITIVE 0x00
-#define ASN1_CONSTRUCTED 0x20
-#define ASN1_CONTEXT_SPECIFIC 0x80
-
-/*
- * various object identifiers
- */
-#define X520_COMMON_NAME 3
-#define X520_COUNTRY 6
-#define X520_LOCALITY 7
-#define X520_STATE 8
-#define X520_ORGANIZATION 10
-#define X520_ORG_UNIT 11
-#define PKCS9_EMAIL 1
-
-#define OID_X520 "\x55\x04"
-#define OID_PKCS9 "\x2A\x86\x48\x86\xF7\x0D\x01\x09"
-#define OID_SUBJECT_ALT_NAME "\x55\x1D\x11"
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * Structures for parsing X.509 certificates
- */
-typedef struct _x509_buf {
- int tag;
- ptrdiff_t len;
- const unsigned char *p;
-} x509_buf;
-
-typedef struct _x509_name {
- x509_buf oid;
- x509_buf val;
- struct _x509_name *next;
-} x509_name;
-
-typedef struct _x509_cert {
- int version;
- x509_buf serial;
- x509_buf sig_oid1;
-
- x509_name issuer;
- x509_name subject;
-
- apr_time_t valid_from;
- apr_time_t valid_to;
-
- x509_buf issuer_id;
- x509_buf subject_id;
- apr_array_header_t *dnsnames;
-
- x509_buf sig_oid2;
- x509_buf sig;
-
-} x509_cert;
-
-
-/*
- * Certificate info, returned from the parser
- */
-struct svn_x509_certinfo_t
-{
- const char *subject;
- const char *issuer;
- apr_time_t valid_from;
- apr_time_t valid_to;
- svn_checksum_t *digest;
- apr_array_header_t *hostnames;
-};
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* SVN_LIBSVN_SUBR_X509_H */
+/**
+ * \file x509.h
+ *
+ * Based on XySSL: Copyright (C) 2006-2008 Christophe Devine
+ *
+ * Copyright (C) 2009 Paul Bakker <polarssl_maintainer at polarssl dot org>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the names of PolarSSL or XySSL nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef SVN_LIBSVN_SUBR_X509_H
+#define SVN_LIBSVN_SUBR_X509_H
+
+#include <stddef.h>
+#include <apr_time.h>
+
+/*
+ * DER constants
+ */
+#define ASN1_BOOLEAN 0x01
+#define ASN1_INTEGER 0x02
+#define ASN1_BIT_STRING 0x03
+#define ASN1_OCTET_STRING 0x04
+#define ASN1_NULL 0x05
+#define ASN1_OID 0x06
+#define ASN1_UTF8_STRING 0x0C
+#define ASN1_SEQUENCE 0x10
+#define ASN1_SET 0x11
+#define ASN1_PRINTABLE_STRING 0x13
+#define ASN1_T61_STRING 0x14
+#define ASN1_IA5_STRING 0x16
+#define ASN1_UTC_TIME 0x17
+#define ASN1_GENERALIZED_TIME 0x18
+#define ASN1_UNIVERSAL_STRING 0x1C
+#define ASN1_BMP_STRING 0x1E
+#define ASN1_PRIMITIVE 0x00
+#define ASN1_CONSTRUCTED 0x20
+#define ASN1_CONTEXT_SPECIFIC 0x80
+
+/*
+ * various object identifiers
+ */
+#define X520_COMMON_NAME 3
+#define X520_COUNTRY 6
+#define X520_LOCALITY 7
+#define X520_STATE 8
+#define X520_ORGANIZATION 10
+#define X520_ORG_UNIT 11
+#define PKCS9_EMAIL 1
+
+#define OID_X520 "\x55\x04"
+#define OID_PKCS9 "\x2A\x86\x48\x86\xF7\x0D\x01\x09"
+#define OID_SUBJECT_ALT_NAME "\x55\x1D\x11"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * Structures for parsing X.509 certificates
+ */
+typedef struct _x509_buf {
+ int tag;
+ ptrdiff_t len;
+ const unsigned char *p;
+} x509_buf;
+
+typedef struct _x509_name {
+ x509_buf oid;
+ x509_buf val;
+ struct _x509_name *next;
+} x509_name;
+
+typedef struct _x509_cert {
+ int version;
+ x509_buf serial;
+ x509_buf sig_oid1;
+
+ x509_name issuer;
+ x509_name subject;
+
+ apr_time_t valid_from;
+ apr_time_t valid_to;
+
+ x509_buf issuer_id;
+ x509_buf subject_id;
+ apr_array_header_t *dnsnames;
+
+ x509_buf sig_oid2;
+ x509_buf sig;
+
+} x509_cert;
+
+
+/*
+ * Certificate info, returned from the parser
+ */
+struct svn_x509_certinfo_t
+{
+ const char *subject;
+ const char *issuer;
+ apr_time_t valid_from;
+ apr_time_t valid_to;
+ svn_checksum_t *digest;
+ apr_array_header_t *hostnames;
+};
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* SVN_LIBSVN_SUBR_X509_H */
Propchange: subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509.h
('svn:eol-style' removed)
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509info.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509info.c?rev=1617225&r1=1617224&r2=1617225&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509info.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509info.c Mon Aug 11 08:54:38
2014
@@ -1,132 +1,99 @@
-/*
- * x509info.c: Accessors for svn_x509_certinfo_t
- *
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- */
-
-
-
-#include <string.h>
-
-#include <apr_pools.h>
-#include <apr_tables.h>
-#include <apr_md5.h>
-#include <apr_sha1.h>
-#include <svn_string.h>
-
-#include "svn_x509.h"
-#include "x509.h"
-
-
-
-svn_x509_certinfo_t *
-svn_x509_certinfo_dup(const svn_x509_certinfo_t *certinfo,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- svn_x509_certinfo_t *result = apr_palloc(result_pool, sizeof(*result));
- result->subject = apr_pstrdup(result_pool, certinfo->subject);
- result->issuer = apr_pstrdup(result_pool, certinfo->issuer);
- result->valid_from = certinfo->valid_from;
- result->valid_to = certinfo->valid_to;
- result->digest = svn_checksum_dup(certinfo->digest, result_pool);
-
- if (!certinfo->hostnames)
- result->hostnames = NULL;
- else
- {
- int i;
- result->hostnames = apr_array_copy(result_pool, certinfo->hostnames);
-
- /* Make a deep copy of the strings in the array. */
- for (i = 0; i < result->hostnames->nelts; ++i)
- APR_ARRAY_IDX(result->hostnames, i, const char*) =
- apr_pstrdup(result_pool,
- APR_ARRAY_IDX(result->hostnames, i, const char*));
- }
-
- return result;
-}
-
-const char *
-svn_x509_certinfo_get_subject(const svn_x509_certinfo_t *certinfo)
-{
- return certinfo->subject;
-}
-
-const char *
-svn_x509_certinfo_get_issuer(const svn_x509_certinfo_t *certinfo)
-{
- return certinfo->issuer;
-}
-
-apr_time_t
-svn_x509_certinfo_get_valid_from(const svn_x509_certinfo_t *certinfo)
-{
- return certinfo->valid_from;
-}
-
-const apr_time_t
-svn_x509_certinfo_get_valid_to(const svn_x509_certinfo_t *certinfo)
-{
- return certinfo->valid_to;
-}
-
-const svn_checksum_t *
-svn_x509_certinfo_get_digest(const svn_x509_certinfo_t *certinfo)
-{
- return certinfo->digest;
-}
-
-const apr_array_header_t *
-svn_x509_certinfo_get_hostnames(const svn_x509_certinfo_t *certinfo)
-{
- return certinfo->hostnames;
-}
-
-const char *
-svn_x509_fingerprint_to_display(const svn_checksum_t *fingerprint,
- apr_pool_t *pool)
-{
- static const char *hex = "0123456789ABCDEF";
- apr_size_t digest_size;
- apr_size_t i;
- svn_stringbuf_t *buf;
-
- if (fingerprint->kind == svn_checksum_md5)
- digest_size = APR_MD5_DIGESTSIZE;
- else if(fingerprint->kind == svn_checksum_sha1)
- digest_size = APR_SHA1_DIGESTSIZE;
- else
- return NULL;
-
- buf = svn_stringbuf_create_ensure(digest_size * 3, pool);
-
- for (i = 0; i < digest_size; i++)
- {
- if (i > 0)
- svn_stringbuf_appendbyte(buf, ':');
-
- svn_stringbuf_appendbyte(buf, hex[fingerprint->digest[i] >> 4]);
- svn_stringbuf_appendbyte(buf, hex[fingerprint->digest[i] & 0x0f]);
- }
-
- return buf->data;
-}
+/*
+ * x509info.c: Accessors for svn_x509_certinfo_t
+ *
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ */
+
+
+
+#include <string.h>
+
+#include <apr_pools.h>
+#include <apr_tables.h>
+
+#include "svn_x509.h"
+#include "x509.h"
+
+
+
+svn_x509_certinfo_t *
+svn_x509_certinfo_dup(const svn_x509_certinfo_t *certinfo,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ svn_x509_certinfo_t *result = apr_palloc(result_pool, sizeof(*result));
+ result->subject = apr_pstrdup(result_pool, certinfo->subject);
+ result->issuer = apr_pstrdup(result_pool, certinfo->issuer);
+ result->valid_from = certinfo->valid_from;
+ result->valid_to = certinfo->valid_to;
+ result->digest = svn_checksum_dup(certinfo->digest, result_pool);
+
+ if (!certinfo->hostnames)
+ result->hostnames = NULL;
+ else
+ {
+ int i;
+ result->hostnames = apr_array_copy(result_pool, certinfo->hostnames);
+
+ /* Make a deep copy of the strings in the array. */
+ for (i = 0; i < result->hostnames->nelts; ++i)
+ APR_ARRAY_IDX(result->hostnames, i, const char*) =
+ apr_pstrdup(result_pool,
+ APR_ARRAY_IDX(result->hostnames, i, const char*));
+ }
+
+ return result;
+}
+
+const char *
+svn_x509_certinfo_get_subject(const svn_x509_certinfo_t *certinfo)
+{
+ return certinfo->subject;
+}
+
+const char *
+svn_x509_certinfo_get_issuer(const svn_x509_certinfo_t *certinfo)
+{
+ return certinfo->issuer;
+}
+
+apr_time_t
+svn_x509_certinfo_get_valid_from(const svn_x509_certinfo_t *certinfo)
+{
+ return certinfo->valid_from;
+}
+
+const apr_time_t
+svn_x509_certinfo_get_valid_to(const svn_x509_certinfo_t *certinfo)
+{
+ return certinfo->valid_to;
+}
+
+const svn_checksum_t *
+svn_x509_certinfo_get_digest(const svn_x509_certinfo_t *certinfo)
+{
+ return certinfo->digest;
+}
+
+const apr_array_header_t *
+svn_x509_certinfo_get_hostnames(const svn_x509_certinfo_t *certinfo)
+{
+ return certinfo->hostnames;
+}
Propchange: subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509info.c
('svn:eol-style' removed)
|