2 * svn_server.h : declarations for the svn server
4 * ====================================================================
5 * Copyright (c) 2000-2006 CollabNet. All rights reserved.
7 * This software is licensed as described in the file COPYING, which
8 * you should have received as part of this distribution. The terms
9 * are also available at http://subversion.tigris.org/license-1.html.
10 * If newer versions of this license are posted there, you may use a
11 * newer version instead, at your option.
13 * This software consists of voluntary contributions made by many
14 * individuals. For exact contribution history, see the revision
15 * history and logs, available at http://subversion.tigris.org/.
16 * ====================================================================
24 #include <apr_network_io.h>
28 #endif /* __cplusplus */
30 #include "svn_repos.h"
32 typedef struct server_baton_t
{
34 svn_fs_t
*fs
; /* For convenience; same as svn_repos_fs(repos) */
35 svn_config_t
*cfg
; /* Parsed repository svnserve.conf */
36 svn_config_t
*pwdb
; /* Parsed password database */
37 svn_authz_t
*authzdb
; /* Parsed authz rules */
38 const char *authz_repos_name
; /* The name of the repository */
39 const char *realm
; /* Authentication realm */
40 const char *repos_url
; /* URL to base of repository */
41 svn_stringbuf_t
*fs_path
;/* Decoded base in-repos path (w/ leading slash) */
43 svn_boolean_t tunnel
; /* Tunneled through login agent */
44 const char *tunnel_user
; /* Allow EXTERNAL to authenticate as this */
45 svn_boolean_t read_only
; /* Disallow write access (global flag) */
46 svn_boolean_t use_sasl
; /* Use Cyrus SASL for authentication;
47 always false if SVN_HAVE_SASL not defined */
51 enum authn_type
{ UNAUTHENTICATED
, AUTHENTICATED
};
52 enum access_type
{ NO_ACCESS
, READ_ACCESS
, WRITE_ACCESS
};
54 enum access_type
get_access(server_baton_t
*b
, enum authn_type auth
);
56 typedef struct serve_params_t
{
57 /* The virtual root of the repositories to serve. The client URL
58 path is interpreted relative to this root and is not allowed to
62 /* True if the connection is tunneled over an ssh-like transport,
63 such that the client may use EXTERNAL to authenticate as the
64 current uid's username. */
67 /* If tunnel is true, overrides the current uid's username as the
68 identity EXTERNAL authenticates as. */
69 const char *tunnel_user
;
71 /* True if the read-only flag was specified on the command-line,
72 which forces all connections to be read-only. */
73 svn_boolean_t read_only
;
75 /* A parsed repository svnserve configuration file, ala
76 svnserve.conf. If this is NULL, then no configuration file was
77 specified on the command line. If this is non-NULL, then
78 per-repository svnserve.conf are not read. */
81 /* A parsed repository password database. If this is NULL, then
82 either no svnserve configuration file was specified on the
83 command line, or it was specified and it did not refer to a
87 /* A parsed repository authorization database. If this is NULL,
88 then either no svnserve configuration file was specified on the
89 command line, or it was specified and it did not refer to a
90 authorization database. */
94 /* Serve the connection CONN according to the parameters PARAMS. */
95 svn_error_t
*serve(svn_ra_svn_conn_t
*conn
, serve_params_t
*params
,
98 /* Load a svnserve configuration file located at FILENAME into CFG,
99 any referenced password database into PWDB and any referenced
100 authorization database into AUTHZDB. If MUST_EXIST is true and
101 FILENAME does not exist, then this returns an error. BASE may be
102 specified as the base path to any referenced password and
103 authorization files found in FILENAME. */
104 svn_error_t
*load_configs(svn_config_t
**cfg
,
106 svn_authz_t
**authzdb
,
107 const char *filename
,
108 svn_boolean_t must_exist
,
112 /* Initialize the Cyrus SASL library. POOL is used for allocations. */
113 svn_error_t
*cyrus_init(apr_pool_t
*pool
);
115 /* Authenticate using Cyrus SASL. */
116 svn_error_t
*cyrus_auth_request(svn_ra_svn_conn_t
*conn
,
119 enum access_type required
,
120 svn_boolean_t needs_username
);
124 #endif /* __cplusplus */
126 #endif /* SERVER_H */