Subversion
svn_config.h
Go to the documentation of this file.
00001 /**
00002  * @copyright
00003  * ====================================================================
00004  *    Licensed to the Apache Software Foundation (ASF) under one
00005  *    or more contributor license agreements.  See the NOTICE file
00006  *    distributed with this work for additional information
00007  *    regarding copyright ownership.  The ASF licenses this file
00008  *    to you under the Apache License, Version 2.0 (the
00009  *    "License"); you may not use this file except in compliance
00010  *    with the License.  You may obtain a copy of the License at
00011  *
00012  *      http://www.apache.org/licenses/LICENSE-2.0
00013  *
00014  *    Unless required by applicable law or agreed to in writing,
00015  *    software distributed under the License is distributed on an
00016  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00017  *    KIND, either express or implied.  See the License for the
00018  *    specific language governing permissions and limitations
00019  *    under the License.
00020  * ====================================================================
00021  * @endcopyright
00022  *
00023  * @file svn_config.h
00024  * @brief Accessing SVN configuration files.
00025  */
00026 
00027 
00028 
00029 #ifndef SVN_CONFIG_H
00030 #define SVN_CONFIG_H
00031 
00032 #include <apr.h>        /* for apr_int64_t */
00033 #include <apr_pools.h>  /* for apr_pool_t */
00034 #include <apr_hash.h>   /* for apr_hash_t */
00035 
00036 #include "svn_types.h"
00037 
00038 #ifdef __cplusplus
00039 extern "C" {
00040 #endif /* __cplusplus */
00041 
00042 
00043 /**************************************************************************
00044  ***                                                                    ***
00045  ***  For a description of the SVN configuration file syntax, see       ***
00046  ***  your ~/.subversion/README, which is written out automatically by  ***
00047  ***  svn_config_ensure().                                              ***
00048  ***                                                                    ***
00049  **************************************************************************/
00050 
00051 
00052 /** Opaque structure describing a set of configuration options. */
00053 typedef struct svn_config_t svn_config_t;
00054 
00055 
00056 /*** Configuration Defines ***/
00057 
00058 /**
00059  * @name Client configuration files strings
00060  * Strings for the names of files, sections, and options in the
00061  * client configuration files.
00062  * @{
00063  */
00064 #define SVN_CONFIG_CATEGORY_SERVERS        "servers"
00065 #define SVN_CONFIG_SECTION_GROUPS               "groups"
00066 #define SVN_CONFIG_SECTION_GLOBAL               "global"
00067 #define SVN_CONFIG_OPTION_HTTP_PROXY_HOST           "http-proxy-host"
00068 #define SVN_CONFIG_OPTION_HTTP_PROXY_PORT           "http-proxy-port"
00069 #define SVN_CONFIG_OPTION_HTTP_PROXY_USERNAME       "http-proxy-username"
00070 #define SVN_CONFIG_OPTION_HTTP_PROXY_PASSWORD       "http-proxy-password"
00071 #define SVN_CONFIG_OPTION_HTTP_PROXY_EXCEPTIONS     "http-proxy-exceptions"
00072 #define SVN_CONFIG_OPTION_HTTP_TIMEOUT              "http-timeout"
00073 #define SVN_CONFIG_OPTION_HTTP_COMPRESSION          "http-compression"
00074 #define SVN_CONFIG_OPTION_NEON_DEBUG_MASK           "neon-debug-mask"
00075 #define SVN_CONFIG_OPTION_HTTP_AUTH_TYPES           "http-auth-types"
00076 #define SVN_CONFIG_OPTION_SSL_AUTHORITY_FILES       "ssl-authority-files"
00077 #define SVN_CONFIG_OPTION_SSL_TRUST_DEFAULT_CA      "ssl-trust-default-ca"
00078 #define SVN_CONFIG_OPTION_SSL_CLIENT_CERT_FILE      "ssl-client-cert-file"
00079 #define SVN_CONFIG_OPTION_SSL_CLIENT_CERT_PASSWORD  "ssl-client-cert-password"
00080 #define SVN_CONFIG_OPTION_SSL_PKCS11_PROVIDER       "ssl-pkcs11-provider"
00081 #define SVN_CONFIG_OPTION_HTTP_LIBRARY              "http-library"
00082 #define SVN_CONFIG_OPTION_STORE_PASSWORDS           "store-passwords"
00083 #define SVN_CONFIG_OPTION_STORE_PLAINTEXT_PASSWORDS "store-plaintext-passwords"
00084 #define SVN_CONFIG_OPTION_STORE_AUTH_CREDS          "store-auth-creds"
00085 #define SVN_CONFIG_OPTION_STORE_SSL_CLIENT_CERT_PP  "store-ssl-client-cert-pp"
00086 #define SVN_CONFIG_OPTION_STORE_SSL_CLIENT_CERT_PP_PLAINTEXT \
00087                                           "store-ssl-client-cert-pp-plaintext"
00088 #define SVN_CONFIG_OPTION_USERNAME                  "username"
00089 
00090 #define SVN_CONFIG_CATEGORY_CONFIG          "config"
00091 #define SVN_CONFIG_SECTION_AUTH                 "auth"
00092 #define SVN_CONFIG_OPTION_PASSWORD_STORES           "password-stores"
00093 #define SVN_CONFIG_OPTION_KWALLET_WALLET            "kwallet-wallet"
00094 #define SVN_CONFIG_OPTION_KWALLET_SVN_APPLICATION_NAME_WITH_PID "kwallet-svn-application-name-with-pid"
00095 /* The majority of options of the "auth" section
00096  * has been moved to SVN_CONFIG_CATEGORY_SERVERS. */
00097 #define SVN_CONFIG_SECTION_HELPERS              "helpers"
00098 #define SVN_CONFIG_OPTION_EDITOR_CMD                "editor-cmd"
00099 #define SVN_CONFIG_OPTION_DIFF_CMD                  "diff-cmd"
00100 /** @since New in 1.7. */
00101 #define SVN_CONFIG_OPTION_DIFF_EXTENSIONS           "diff-extensions"
00102 #define SVN_CONFIG_OPTION_DIFF3_CMD                 "diff3-cmd"
00103 #define SVN_CONFIG_OPTION_DIFF3_HAS_PROGRAM_ARG     "diff3-has-program-arg"
00104 #define SVN_CONFIG_OPTION_MERGE_TOOL_CMD            "merge-tool-cmd"
00105 #define SVN_CONFIG_SECTION_MISCELLANY           "miscellany"
00106 #define SVN_CONFIG_OPTION_GLOBAL_IGNORES            "global-ignores"
00107 #define SVN_CONFIG_OPTION_LOG_ENCODING              "log-encoding"
00108 #define SVN_CONFIG_OPTION_USE_COMMIT_TIMES          "use-commit-times"
00109 #define SVN_CONFIG_OPTION_TEMPLATE_ROOT             "template-root"
00110 #define SVN_CONFIG_OPTION_ENABLE_AUTO_PROPS         "enable-auto-props"
00111 #define SVN_CONFIG_OPTION_NO_UNLOCK                 "no-unlock"
00112 #define SVN_CONFIG_OPTION_MIMETYPES_FILE            "mime-types-file"
00113 #define SVN_CONFIG_OPTION_PRESERVED_CF_EXTS         "preserved-conflict-file-exts"
00114 #define SVN_CONFIG_OPTION_INTERACTIVE_CONFLICTS     "interactive-conflicts"
00115 #define SVN_CONFIG_OPTION_MEMORY_CACHE_SIZE         "memory-cache-size"
00116 #define SVN_CONFIG_SECTION_TUNNELS              "tunnels"
00117 #define SVN_CONFIG_SECTION_AUTO_PROPS           "auto-props"
00118 /** @} */
00119 
00120 /** @name Repository conf directory configuration files strings
00121  * Strings for the names of sections and options in the
00122  * repository conf directory configuration files.
00123  * @{
00124  */
00125 /* For repository svnserve.conf files */
00126 #define SVN_CONFIG_SECTION_GENERAL              "general"
00127 #define SVN_CONFIG_OPTION_ANON_ACCESS               "anon-access"
00128 #define SVN_CONFIG_OPTION_AUTH_ACCESS               "auth-access"
00129 #define SVN_CONFIG_OPTION_PASSWORD_DB               "password-db"
00130 #define SVN_CONFIG_OPTION_REALM                     "realm"
00131 #define SVN_CONFIG_OPTION_AUTHZ_DB                  "authz-db"
00132 /** @since New in 1.7. */
00133 #define SVN_CONFIG_OPTION_FORCE_USERNAME_CASE       "force-username-case"
00134 #define SVN_CONFIG_SECTION_SASL                 "sasl"
00135 #define SVN_CONFIG_OPTION_USE_SASL                  "use-sasl"
00136 #define SVN_CONFIG_OPTION_MIN_SSF                   "min-encryption"
00137 #define SVN_CONFIG_OPTION_MAX_SSF                   "max-encryption"
00138 
00139 /* For repository password database */
00140 #define SVN_CONFIG_SECTION_USERS                "users"
00141 /** @} */
00142 
00143 /*** Configuration Default Values ***/
00144 
00145 /* '*' matches leading dots, e.g. '*.rej' matches '.foo.rej'. */
00146 /* We want this to be printed on two lines in the generated config file,
00147  * but we don't want the # character to end up in the variable.
00148  */
00149 #define SVN_CONFIG__DEFAULT_GLOBAL_IGNORES_LINE_1 \
00150   "*.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo"
00151 #define SVN_CONFIG__DEFAULT_GLOBAL_IGNORES_LINE_2 \
00152   "*.rej *~ #*# .#* .*.swp .DS_Store"
00153 
00154 #define SVN_CONFIG_DEFAULT_GLOBAL_IGNORES \
00155   SVN_CONFIG__DEFAULT_GLOBAL_IGNORES_LINE_1 " " \
00156   SVN_CONFIG__DEFAULT_GLOBAL_IGNORES_LINE_2
00157 
00158 #define SVN_CONFIG_TRUE  "TRUE"
00159 #define SVN_CONFIG_FALSE "FALSE"
00160 #define SVN_CONFIG_ASK   "ASK"
00161 
00162 /* Default values for some options. Should be passed as default values
00163  * to svn_config_get and friends, instead of hard-coding the defaults in
00164  * multiple places. */
00165 #define SVN_CONFIG_DEFAULT_OPTION_STORE_PASSWORDS            TRUE
00166 #define SVN_CONFIG_DEFAULT_OPTION_STORE_PLAINTEXT_PASSWORDS  SVN_CONFIG_ASK
00167 #define SVN_CONFIG_DEFAULT_OPTION_STORE_AUTH_CREDS           TRUE
00168 #define SVN_CONFIG_DEFAULT_OPTION_STORE_SSL_CLIENT_CERT_PP   TRUE
00169 #define SVN_CONFIG_DEFAULT_OPTION_STORE_SSL_CLIENT_CERT_PP_PLAINTEXT \
00170                                                              SVN_CONFIG_ASK
00171 
00172 /** Read configuration information from the standard sources and merge it
00173  * into the hash @a *cfg_hash.  If @a config_dir is not NULL it specifies a
00174  * directory from which to read the configuration files, overriding all
00175  * other sources.  Otherwise, first read any system-wide configurations
00176  * (from a file or from the registry), then merge in personal
00177  * configurations (again from file or registry).  The hash and all its data
00178  * are allocated in @a pool.
00179  *
00180  * @a *cfg_hash is a hash whose keys are @c const char * configuration
00181  * categories (@c SVN_CONFIG_CATEGORY_SERVERS,
00182  * @c SVN_CONFIG_CATEGORY_CONFIG, etc.) and whose values are the @c
00183  * svn_config_t * items representing the configuration values for that
00184  * category.
00185  */
00186 svn_error_t *
00187 svn_config_get_config(apr_hash_t **cfg_hash,
00188                       const char *config_dir,
00189                       apr_pool_t *pool);
00190 
00191 
00192 /** Set @a *cfgp to an empty @c svn_config_t structure,
00193  * allocated in @a result_pool.
00194  *
00195  * Pass TRUE to @a section_names_case_sensitive if
00196  * section names are to be populated case sensitively.
00197  *
00198  * @since New in 1.7.
00199  */
00200 svn_error_t *
00201 svn_config_create(svn_config_t **cfgp,
00202                   svn_boolean_t section_names_case_sensitive,
00203                   apr_pool_t *result_pool);
00204 
00205 /** Read configuration data from @a file (a file or registry path) into
00206  * @a *cfgp, allocated in @a pool.
00207  *
00208  * If @a file does not exist, then if @a must_exist, return an error,
00209  * otherwise return an empty @c svn_config_t.
00210  *
00211  * If @a section_names_case_sensitive is TRUE, populate section name hashes
00212  * case sensitively, except for the default SVN_CONFIG__DEFAULT_SECTION.
00213  *
00214  * @since New in 1.7.
00215  */
00216 
00217 svn_error_t *
00218 svn_config_read2(svn_config_t **cfgp,
00219                  const char *file,
00220                  svn_boolean_t must_exist,
00221                  svn_boolean_t section_names_case_sensitive,
00222                  apr_pool_t *pool);
00223 
00224 /** Similar to svn_config_read2, but always passes FALSE to
00225  * section_names_case_sensitive.
00226  *
00227  * @deprecated Provided for backward compatibility with 1.6 API.
00228  */
00229 SVN_DEPRECATED
00230 svn_error_t *
00231 svn_config_read(svn_config_t **cfgp,
00232                 const char *file,
00233                 svn_boolean_t must_exist,
00234                 apr_pool_t *pool);
00235 
00236 /** Like svn_config_read(), but merges the configuration data from @a file
00237  * (a file or registry path) into @a *cfg, which was previously returned
00238  * from svn_config_read().  This function invalidates all value
00239  * expansions in @a cfg, so that the next svn_config_get() takes the
00240  * modifications into account.
00241  */
00242 svn_error_t *
00243 svn_config_merge(svn_config_t *cfg,
00244                  const char *file,
00245                  svn_boolean_t must_exist);
00246 
00247 
00248 /** Find the value of a (@a section, @a option) pair in @a cfg, set @a
00249  * *valuep to the value.
00250  *
00251  * If @a cfg is @c NULL, just sets @a *valuep to @a default_value. If
00252  * the value does not exist, expand and return @a default_value. @a
00253  * default_value can be NULL.
00254  *
00255  * The returned value will be valid at least until the next call to
00256  * svn_config_get(), or for the lifetime of @a default_value. It is
00257  * safest to consume the returned value immediately.
00258  *
00259  * This function may change @a cfg by expanding option values.
00260  */
00261 void
00262 svn_config_get(svn_config_t *cfg,
00263                const char **valuep,
00264                const char *section,
00265                const char *option,
00266                const char *default_value);
00267 
00268 /** Add or replace the value of a (@a section, @a option) pair in @a cfg with
00269  * @a value.
00270  *
00271  * This function invalidates all value expansions in @a cfg.
00272  *
00273  * To remove an option, pass NULL for the @a value.
00274  */
00275 void
00276 svn_config_set(svn_config_t *cfg,
00277                const char *section,
00278                const char *option,
00279                const char *value);
00280 
00281 /** Like svn_config_get(), but for boolean values.
00282  *
00283  * Parses the option as a boolean value. The recognized representations
00284  * are 'TRUE'/'FALSE', 'yes'/'no', 'on'/'off', '1'/'0'; case does not
00285  * matter. Returns an error if the option doesn't contain a known string.
00286  */
00287 svn_error_t *
00288 svn_config_get_bool(svn_config_t *cfg,
00289                     svn_boolean_t *valuep,
00290                     const char *section,
00291                     const char *option,
00292                     svn_boolean_t default_value);
00293 
00294 /** Like svn_config_set(), but for boolean values.
00295  *
00296  * Sets the option to 'TRUE'/'FALSE', depending on @a value.
00297  */
00298 void
00299 svn_config_set_bool(svn_config_t *cfg,
00300                     const char *section,
00301                     const char *option,
00302                     svn_boolean_t value);
00303 
00304 /** Like svn_config_get(), but only for yes/no/ask values.
00305  *
00306  * Parse @a option in @a section and set @a *valuep to one of
00307  * SVN_CONFIG_TRUE, SVN_CONFIG_FALSE, or SVN_CONFIG_ASK.  If there is
00308  * no setting for @a option, then parse @a default_value and set
00309  * @a *valuep accordingly.  If @a default_value is NULL, the result is
00310  * undefined, and may be an error; we recommend that you pass one of
00311  * SVN_CONFIG_TRUE, SVN_CONFIG_FALSE, or SVN_CONFIG_ASK for @a default value.
00312  *
00313  * Valid representations are (at least) "true"/"false", "yes"/"no",
00314  * "on"/"off", "1"/"0", and "ask"; they are case-insensitive.  Return
00315  * an SVN_ERR_BAD_CONFIG_VALUE error if either @a default_value or
00316  * @a option's value is not a valid representation.
00317  *
00318  * @since New in 1.6.
00319  */
00320 svn_error_t *
00321 svn_config_get_yes_no_ask(svn_config_t *cfg,
00322                           const char **valuep,
00323                           const char *section,
00324                           const char *option,
00325                           const char* default_value);
00326 
00327 /** Similar to @c svn_config_section_enumerator2_t, but is not
00328  * provided with a memory pool argument.
00329  *
00330  * See svn_config_enumerate_sections() for the details of this type.
00331  *
00332  * @deprecated Provided for backwards compatibility with the 1.2 API.
00333  */
00334 typedef svn_boolean_t (*svn_config_section_enumerator_t)(const char *name,
00335                                                          void *baton);
00336 
00337 /** Similar to svn_config_enumerate_sections2(), but uses a memory pool of
00338  * @a cfg instead of one that is explicitly provided.
00339  *
00340  * @deprecated Provided for backwards compatibility with the 1.2 API.
00341  */
00342 SVN_DEPRECATED
00343 int
00344 svn_config_enumerate_sections(svn_config_t *cfg,
00345                               svn_config_section_enumerator_t callback,
00346                               void *baton);
00347 
00348 /** A callback function used in enumerating config sections.
00349  *
00350  * See svn_config_enumerate_sections2() for the details of this type.
00351  *
00352  * @since New in 1.3.
00353  */
00354 typedef svn_boolean_t (*svn_config_section_enumerator2_t)(const char *name,
00355                                                           void *baton,
00356                                                           apr_pool_t *pool);
00357 
00358 /** Enumerate the sections, passing @a baton and the current section's name
00359  * to @a callback.  Continue the enumeration if @a callback returns @c TRUE.
00360  * Return the number of times @a callback was called.
00361  *
00362  * ### See kff's comment to svn_config_enumerate2().  It applies to this
00363  * function, too. ###
00364  *
00365  * @a callback's @a name parameter is only valid for the duration of the call.
00366  *
00367  * @since New in 1.3.
00368  */
00369 int
00370 svn_config_enumerate_sections2(svn_config_t *cfg,
00371                                svn_config_section_enumerator2_t callback,
00372                                void *baton, apr_pool_t *pool);
00373 
00374 /** Similar to @c svn_config_enumerator2_t, but is not
00375  * provided with a memory pool argument.
00376  * See svn_config_enumerate() for the details of this type.
00377  *
00378  * @deprecated Provided for backwards compatibility with the 1.2 API.
00379  */
00380 typedef svn_boolean_t (*svn_config_enumerator_t)(const char *name,
00381                                                  const char *value,
00382                                                  void *baton);
00383 
00384 /** Similar to svn_config_enumerate2(), but uses a memory pool of
00385  * @a cfg instead of one that is explicitly provided.
00386  *
00387  * @deprecated Provided for backwards compatibility with the 1.2 API.
00388  */
00389 SVN_DEPRECATED
00390 int
00391 svn_config_enumerate(svn_config_t *cfg,
00392                      const char *section,
00393                      svn_config_enumerator_t callback,
00394                      void *baton);
00395 
00396 
00397 /** A callback function used in enumerating config options.
00398  *
00399  * See svn_config_enumerate2() for the details of this type.
00400  *
00401  * @since New in 1.3.
00402  */
00403 typedef svn_boolean_t (*svn_config_enumerator2_t)(const char *name,
00404                                                   const char *value,
00405                                                   void *baton,
00406                                                   apr_pool_t *pool);
00407 
00408 /** Enumerate the options in @a section, passing @a baton and the current
00409  * option's name and value to @a callback.  Continue the enumeration if
00410  * @a callback returns @c TRUE.  Return the number of times @a callback
00411  * was called.
00412  *
00413  * ### kff asks: A more usual interface is to continue enumerating
00414  *     while @a callback does not return error, and if @a callback does
00415  *     return error, to return the same error (or a wrapping of it)
00416  *     from svn_config_enumerate().  What's the use case for
00417  *     svn_config_enumerate()?  Is it more likely to need to break out
00418  *     of an enumeration early, with no error, than an invocation of
00419  *     @a callback is likely to need to return an error? ###
00420  *
00421  * @a callback's @a name and @a value parameters are only valid for the
00422  * duration of the call.
00423  *
00424  * @since New in 1.3.
00425  */
00426 int
00427 svn_config_enumerate2(svn_config_t *cfg,
00428                       const char *section,
00429                       svn_config_enumerator2_t callback,
00430                       void *baton,
00431                       apr_pool_t *pool);
00432 
00433 /**
00434  * Return @c TRUE if @a section exists in @a cfg, @c FALSE otherwise.
00435  *
00436  * @since New in 1.4.
00437  */
00438 svn_boolean_t
00439 svn_config_has_section(svn_config_t *cfg,
00440                        const char *section);
00441 
00442 /** Enumerate the group @a master_section in @a cfg.  Each variable
00443  * value is interpreted as a list of glob patterns (separated by comma
00444  * and optional whitespace).  Return the name of the first variable
00445  * whose value matches @a key, or @c NULL if no variable matches.
00446  */
00447 const char *
00448 svn_config_find_group(svn_config_t *cfg,
00449                       const char *key,
00450                       const char *master_section,
00451                       apr_pool_t *pool);
00452 
00453 /** Retrieve value corresponding to @a option_name in @a cfg, or
00454  *  return @a default_value if none is found.
00455  *
00456  *  The config will first be checked for a default.
00457  *  If @a server_group is not @c NULL, the config will also be checked
00458  *  for an override in a server group,
00459  *
00460  */
00461 const char *
00462 svn_config_get_server_setting(svn_config_t *cfg,
00463                               const char* server_group,
00464                               const char* option_name,
00465                               const char* default_value);
00466 
00467 /** Retrieve value into @a result_value corresponding to @a option_name for a
00468  *  given @a server_group in @a cfg, or return @a default_value if none is
00469  *  found.
00470  *
00471  *  The config will first be checked for a default, then will be checked for
00472  *  an override in a server group. If the value found is not a valid integer,
00473  *  a @c svn_error_t* will be returned.
00474  */
00475 svn_error_t *
00476 svn_config_get_server_setting_int(svn_config_t *cfg,
00477                                   const char *server_group,
00478                                   const char *option_name,
00479                                   apr_int64_t default_value,
00480                                   apr_int64_t *result_value,
00481                                   apr_pool_t *pool);
00482 
00483 
00484 /** Set @a *valuep according to @a option_name for a given
00485  * @a  server_group in @a cfg, or set to @a default_value if no value is
00486  * specified.
00487  *
00488  * Check first a default, then for an override in a server group.  If
00489  * a value is found but is not a valid boolean, return an
00490  * SVN_ERR_BAD_CONFIG_VALUE error.
00491  *
00492  * @since New in 1.6.
00493  */
00494 svn_error_t *
00495 svn_config_get_server_setting_bool(svn_config_t *cfg,
00496                                    svn_boolean_t *valuep,
00497                                    const char *server_group,
00498                                    const char *option_name,
00499                                    svn_boolean_t default_value);
00500 
00501 
00502 
00503 /** Try to ensure that the user's ~/.subversion/ area exists, and create
00504  * no-op template files for any absent config files.  Use @a pool for any
00505  * temporary allocation.  If @a config_dir is not @c NULL it specifies a
00506  * directory from which to read the config overriding all other sources.
00507  *
00508  * Don't error if something exists but is the wrong kind (for example,
00509  * ~/.subversion exists but is a file, or ~/.subversion/servers exists
00510  * but is a directory).
00511  *
00512  * Also don't error if trying to create something and failing -- it's
00513  * okay for the config area or its contents not to be created.
00514  * However, if creating a config template file succeeds, return an
00515  * error if unable to initialize its contents.
00516  */
00517 svn_error_t *
00518 svn_config_ensure(const char *config_dir,
00519                   apr_pool_t *pool);
00520 
00521 
00522 
00523 
00524 /** Accessing cached authentication data in the user config area.
00525  *
00526  * @defgroup cached_authentication_data Cached authentication data
00527  * @{
00528  */
00529 
00530 
00531 /** A hash-key pointing to a realmstring.  Every file containing
00532  * authentication data should have this key.
00533  */
00534 #define SVN_CONFIG_REALMSTRING_KEY  "svn:realmstring"
00535 
00536 /** Use @a cred_kind and @a realmstring to locate a file within the
00537  * ~/.subversion/auth/ area.  If the file exists, initialize @a *hash
00538  * and load the file contents into the hash, using @a pool.  If the
00539  * file doesn't exist, set @a *hash to NULL.
00540  *
00541  * If @a config_dir is not NULL it specifies a directory from which to
00542  * read the config overriding all other sources.
00543  *
00544  * Besides containing the original credential fields, the hash will
00545  * also contain @c SVN_CONFIG_REALMSTRING_KEY.  The caller can examine
00546  * this value as a sanity-check that the correct file was loaded.
00547  *
00548  * The hashtable will contain <tt>const char *</tt> keys and
00549  * <tt>svn_string_t *</tt> values.
00550  */
00551 svn_error_t *
00552 svn_config_read_auth_data(apr_hash_t **hash,
00553                           const char *cred_kind,
00554                           const char *realmstring,
00555                           const char *config_dir,
00556                           apr_pool_t *pool);
00557 
00558 /** Use @a cred_kind and @a realmstring to create or overwrite a file
00559  * within the ~/.subversion/auth/ area.  Write the contents of @a hash into
00560  * the file.  If @a config_dir is not NULL it specifies a directory to read
00561  * the config overriding all other sources.
00562  *
00563  * Also, add @a realmstring to the file, with key @c
00564  * SVN_CONFIG_REALMSTRING_KEY.  This allows programs (or users) to
00565  * verify exactly which set credentials live within the file.
00566  *
00567  * The hashtable must contain <tt>const char *</tt> keys and
00568  * <tt>svn_string_t *</tt> values.
00569  */
00570 svn_error_t *
00571 svn_config_write_auth_data(apr_hash_t *hash,
00572                            const char *cred_kind,
00573                            const char *realmstring,
00574                            const char *config_dir,
00575                            apr_pool_t *pool);
00576 
00577 /** Put the absolute path to the user's configuration directory,
00578  * or to a file within that directory, into @a *path.
00579  *
00580  * If @a config_dir is not NULL, it must point to an alternative
00581  * config directory location. If it is NULL, the default location
00582  * is used.  If @a fname is not NULL, it must specify the last
00583  * component of the path to be returned. This can be used to create
00584  * a path to any file in the configuration directory.
00585  *
00586  * Do all allocations in @a pool.
00587  *
00588  * Hint:
00589  * To get the user configuration file, pass @c SVN_CONFIG_CATEGORY_CONFIG
00590  * for @a fname. To get the servers configuration file, pass
00591  * @c SVN_CONFIG_CATEGORY_SERVERS for @a fname.
00592  *
00593  * @since New in 1.6.
00594  */
00595 svn_error_t *
00596 svn_config_get_user_config_path(const char **path,
00597                                 const char *config_dir,
00598                                 const char *fname,
00599                                 apr_pool_t *pool);
00600 
00601 /** @} */
00602 
00603 #ifdef __cplusplus
00604 }
00605 #endif /* __cplusplus */
00606 
00607 #endif /* SVN_CONFIG_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines