~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to subversion/libsvn_subr/time.c

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2015-08-07 21:32:47 UTC
  • mfrom: (0.2.15) (4.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20150807213247-ozyewtmgsr6tkewl
Tags: 1.9.0-1
* Upload to unstable
* New upstream release.
  + Security fixes
    - CVE-2015-3184: Mixed anonymous/authenticated path-based authz with
      httpd 2.4
    - CVE-2015-3187: svn_repos_trace_node_locations() reveals paths hidden
      by authz
* Add >= 2.7 requirement for python-all-dev Build-Depends, needed to run
  tests.
* Remove Build-Conflicts against ruby-test-unit.  (Closes: #791844)
* Remove patches/apache_module_dependency in favor of expressing the
  dependencies in authz_svn.load/dav_svn.load.
* Build-Depend on apache2-dev (>= 2.4.16) to ensure ap_some_authn_required()
  is available when building mod_authz_svn and Depend on apache2-bin (>=
  2.4.16) for runtime support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
#include "svn_error.h"
35
35
#include "svn_private_config.h"
36
36
 
 
37
#include "private/svn_string_private.h"
 
38
 
37
39
 
38
40
 
39
41
/*** Code. ***/
82
84
/* Machine parseable part, generated by apr_snprintf. */
83
85
#define HUMAN_TIMESTAMP_FORMAT "%.4d-%.2d-%.2d %.2d:%.2d:%.2d %+.2d%.2d"
84
86
/* Human explanatory part, generated by apr_strftime as "Sat, 01 Jan 2000" */
85
 
#define human_timestamp_format_suffix _(" (%a, %d %b %Y)")
 
87
#define HUMAN_TIMESTAMP_FORMAT_SUFFIX _(" (%a, %d %b %Y)")
86
88
 
87
89
const char *
88
90
svn_time_to_cstring(apr_time_t when, apr_pool_t *pool)
135
137
  apr_time_exp_t exploded_time;
136
138
  apr_status_t apr_err;
137
139
  char wday[4], month[4];
138
 
  char *c;
 
140
  const char *c;
139
141
 
140
142
  /* Open-code parsing of the new timestamp format, as this
141
143
     is a hot path for reading the entries file.  This format looks
142
144
     like:  "2001-08-31T04:24:14.966996Z"  */
143
 
  exploded_time.tm_year = (apr_int32_t) strtol(data, &c, 10);
144
 
  if (*c++ != '-') goto fail;
145
 
  exploded_time.tm_mon = (apr_int32_t) strtol(c, &c, 10);
146
 
  if (*c++ != '-') goto fail;
147
 
  exploded_time.tm_mday = (apr_int32_t) strtol(c, &c, 10);
 
145
  exploded_time.tm_year = (apr_int32_t) svn__strtoul(data, &c);
 
146
  if (*c++ != '-') goto fail;
 
147
  exploded_time.tm_mon = (apr_int32_t) svn__strtoul(c, &c);
 
148
  if (*c++ != '-') goto fail;
 
149
  exploded_time.tm_mday = (apr_int32_t) svn__strtoul(c, &c);
148
150
  if (*c++ != 'T') goto fail;
149
 
  exploded_time.tm_hour = (apr_int32_t) strtol(c, &c, 10);
150
 
  if (*c++ != ':') goto fail;
151
 
  exploded_time.tm_min = (apr_int32_t) strtol(c, &c, 10);
152
 
  if (*c++ != ':') goto fail;
153
 
  exploded_time.tm_sec = (apr_int32_t) strtol(c, &c, 10);
 
151
  exploded_time.tm_hour = (apr_int32_t) svn__strtoul(c, &c);
 
152
  if (*c++ != ':') goto fail;
 
153
  exploded_time.tm_min = (apr_int32_t) svn__strtoul(c, &c);
 
154
  if (*c++ != ':') goto fail;
 
155
  exploded_time.tm_sec = (apr_int32_t) svn__strtoul(c, &c);
154
156
  if (*c++ != '.') goto fail;
155
 
  exploded_time.tm_usec = (apr_int32_t) strtol(c, &c, 10);
 
157
  exploded_time.tm_usec = (apr_int32_t) svn__strtoul(c, &c);
156
158
  if (*c++ != 'Z') goto fail;
157
159
 
158
160
  exploded_time.tm_year  -= 1900;
245
247
  ret = apr_strftime(human_datestr,
246
248
                     &retlen,
247
249
                     SVN_TIME__MAX_LENGTH - len,
248
 
                     human_timestamp_format_suffix,
 
250
                     HUMAN_TIMESTAMP_FORMAT_SUFFIX,
249
251
                     &exploded_time);
250
252
 
251
253
  /* If there was an error, ensure that the string is zero-terminated. */