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

« back to all changes in this revision

Viewing changes to subversion/mod_dav_svn/status.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:
 
1
/*
 
2
 * ====================================================================
 
3
 *    Licensed to the Apache Software Foundation (ASF) under one
 
4
 *    or more contributor license agreements.  See the NOTICE file
 
5
 *    distributed with this work for additional information
 
6
 *    regarding copyright ownership.  The ASF licenses this file
 
7
 *    to you under the Apache License, Version 2.0 (the
 
8
 *    "License"); you may not use this file except in compliance
 
9
 *    with the License.  You may obtain a copy of the License at
 
10
 *
 
11
 *      http://www.apache.org/licenses/LICENSE-2.0
 
12
 *
 
13
 *    Unless required by applicable law or agreed to in writing,
 
14
 *    software distributed under the License is distributed on an
 
15
 *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 
16
 *    KIND, either express or implied.  See the License for the
 
17
 *    specific language governing permissions and limitations
 
18
 *    under the License.
 
19
 * ====================================================================
 
20
 */
 
21
 
 
22
#include <httpd.h>
 
23
#include <http_core.h>
 
24
#include <http_config.h>
 
25
#include <http_request.h>
 
26
#include <http_protocol.h>
 
27
 
 
28
#include "dav_svn.h"
 
29
#include "private/svn_cache.h"
 
30
#include "private/svn_fs_private.h"
 
31
 
 
32
#ifndef DEFAULT_TIME_FORMAT
 
33
#define DEFAULT_TIME_FORMAT "%Y-%m-%d %H:%M:%S %Z"
 
34
#endif
 
35
 
 
36
/* A bit like mod_status: add a location:
 
37
 
 
38
     <Location /svn-status>
 
39
       SetHandler svn-status
 
40
     </Location>
 
41
 
 
42
  and then point a browser at http://server/svn-status.
 
43
*/
 
44
int dav_svn__status(request_rec *r)
 
45
{
 
46
  svn_cache__info_t *info;
 
47
  svn_string_t *text_stats;
 
48
  apr_array_header_t *lines;
 
49
  int i;
 
50
 
 
51
  if (r->method_number != M_GET || strcmp(r->handler, "svn-status"))
 
52
    return DECLINED;
 
53
 
 
54
  info = svn_cache__membuffer_get_global_info(r->pool);
 
55
  text_stats = svn_cache__format_info(info, FALSE, r->pool);
 
56
  lines = svn_cstring_split(text_stats->data, "\n", FALSE, r->pool);
 
57
 
 
58
  ap_set_content_type(r, "text/html; charset=ISO-8859-1");
 
59
 
 
60
  ap_rvputs(r,
 
61
            DOCTYPE_HTML_3_2
 
62
            "<html><head>\n"
 
63
            "<title>Apache SVN Status</title>\n"
 
64
            "</head><body>\n"
 
65
            "<h1>Apache SVN Cache Status for ",
 
66
            ap_escape_html(r->pool, ap_get_server_name(r)),
 
67
            " (via ",
 
68
            r->connection->local_ip,
 
69
            ")</h1>\n<dl>\n<dt>Server Version: ",
 
70
            ap_get_server_description(),
 
71
            "</dt>\n<dt>Current Time: ",
 
72
            ap_ht_time(r->pool, apr_time_now(), DEFAULT_TIME_FORMAT, 0),
 
73
            "</dt>\n", SVN_VA_NULL);
 
74
 
 
75
#if !defined(WIN32) && defined(HAVE_UNISTD_H) && defined(HAVE_GETPID)
 
76
  /* On Unix the server is generally multiple processes and this
 
77
     request only shows the status of the single process that handles
 
78
     the request. Ideally we would iterate over all processes but that
 
79
     would need some MPM support, so we settle for simply showing the
 
80
     process ID. */
 
81
#include <unistd.h>
 
82
  ap_rprintf(r, "<dt>Server process id: %d</dt>\n", (int)getpid());
 
83
#endif
 
84
 
 
85
  for (i = 0; i < lines->nelts; ++i)
 
86
    {
 
87
      const char *line = APR_ARRAY_IDX(lines, i, const char *);
 
88
      ap_rvputs(r, "<dt>", line, "</dt>\n", SVN_VA_NULL);
 
89
    }
 
90
 
 
91
  ap_rvputs(r, "</dl></body></html>\n", SVN_VA_NULL);
 
92
 
 
93
  return 0;
 
94
}