Subversion
Modules | Typedefs | Functions
Cached authentication data

Accessing cached authentication data in the user config area. More...

Modules

 Cached authentication data attributes
 Attributes of authentication credentials.
 

Typedefs

typedef svn_error_t *(* svn_config_auth_walk_func_t) (svn_boolean_t *delete_cred, void *walk_baton, const char *cred_kind, const char *realmstring, apr_hash_t *hash, apr_pool_t *scratch_pool)
 Callback for svn_config_walk_auth_data(). More...
 

Functions

svn_error_tsvn_config_read_auth_data (apr_hash_t **hash, const char *cred_kind, const char *realmstring, const char *config_dir, apr_pool_t *pool)
 Use cred_kind and realmstring to locate a file within the ~/.subversion/auth/ area. More...
 
svn_error_tsvn_config_write_auth_data (apr_hash_t *hash, const char *cred_kind, const char *realmstring, const char *config_dir, apr_pool_t *pool)
 Use cred_kind and realmstring to create or overwrite a file within the ~/.subversion/auth/ area. More...
 
svn_error_tsvn_config_walk_auth_data (const char *config_dir, svn_config_auth_walk_func_t walk_func, void *walk_baton, apr_pool_t *scratch_pool)
 Call walk_func with walk_baton and information describing each credential cached within the Subversion auth store located under config_dir. More...
 
svn_error_tsvn_config_get_user_config_path (const char **path, const char *config_dir, const char *fname, apr_pool_t *pool)
 Put the absolute path to the user's configuration directory, or to a file within that directory, into *path. More...
 
svn_error_tsvn_config_dup (svn_config_t **cfgp, const svn_config_t *src, apr_pool_t *pool)
 Create a deep copy of the config object src and return it in cfgp, allocating the memory in pool. More...
 
svn_error_tsvn_config_copy_config (apr_hash_t **cfg_hash, apr_hash_t *src_hash, apr_pool_t *pool)
 Create a deep copy of the config hash src_hash and return it in cfg_hash, allocating the memory in pool. More...
 

Detailed Description

Accessing cached authentication data in the user config area.

Typedef Documentation

◆ svn_config_auth_walk_func_t

typedef svn_error_t*(* svn_config_auth_walk_func_t) (svn_boolean_t *delete_cred, void *walk_baton, const char *cred_kind, const char *realmstring, apr_hash_t *hash, apr_pool_t *scratch_pool)

Callback for svn_config_walk_auth_data().

Called for each credential walked by that function (and able to be fully purged) to allow perusal and selective removal of credentials.

cred_kind and realmstring specify the key of the credential. hash contains the hash data associated with the record. walk_baton is the baton passed to svn_config_walk_auth_data().

Before returning set *delete_cred to TRUE to remove the credential from the cache; leave *delete_cred unchanged or set it to FALSE to keep the credential.

Implementations may return SVN_ERR_CEASE_INVOCATION to indicate that the callback should not be called again. Note that when that error is returned, the value of delete_cred will still be honored and action taken if necessary. (For other returned errors, delete_cred is ignored by svn_config_walk_auth_data().)

Since
New in 1.8.

Definition at line 824 of file svn_config.h.

Function Documentation

◆ svn_config_copy_config()

svn_error_t* svn_config_copy_config ( apr_hash_t **  cfg_hash,
apr_hash_t *  src_hash,
apr_pool_t *  pool 
)

Create a deep copy of the config hash src_hash and return it in cfg_hash, allocating the memory in pool.

Since
New in 1.8.

◆ svn_config_dup()

svn_error_t* svn_config_dup ( svn_config_t **  cfgp,
const svn_config_t src,
apr_pool_t *  pool 
)

Create a deep copy of the config object src and return it in cfgp, allocating the memory in pool.

Since
New in 1.8.

◆ svn_config_get_user_config_path()

svn_error_t* svn_config_get_user_config_path ( const char **  path,
const char *  config_dir,
const char *  fname,
apr_pool_t *  pool 
)

Put the absolute path to the user's configuration directory, or to a file within that directory, into *path.

If config_dir is not NULL, it must point to an alternative config directory location. If it is NULL, the default location is used. If fname is not NULL, it must specify the last component of the path to be returned. This can be used to create a path to any file in the configuration directory.

Do all allocations in pool.

Hint: To get the user configuration file, pass SVN_CONFIG_CATEGORY_CONFIG for fname. To get the servers configuration file, pass SVN_CONFIG_CATEGORY_SERVERS for fname.

Since
New in 1.6.

◆ svn_config_read_auth_data()

svn_error_t* svn_config_read_auth_data ( apr_hash_t **  hash,
const char *  cred_kind,
const char *  realmstring,
const char *  config_dir,
apr_pool_t *  pool 
)

Use cred_kind and realmstring to locate a file within the ~/.subversion/auth/ area.

If the file exists, initialize *hash and load the file contents into the hash, using pool. If the file doesn't exist, set *hash to NULL.

If config_dir is not NULL it specifies a directory from which to read the config overriding all other sources.

Besides containing the original credential fields, the hash will also contain SVN_CONFIG_REALMSTRING_KEY. The caller can examine this value as a sanity-check that the correct file was loaded.

The hashtable will contain const char * keys and svn_string_t * values.

◆ svn_config_walk_auth_data()

svn_error_t* svn_config_walk_auth_data ( const char *  config_dir,
svn_config_auth_walk_func_t  walk_func,
void *  walk_baton,
apr_pool_t *  scratch_pool 
)

Call walk_func with walk_baton and information describing each credential cached within the Subversion auth store located under config_dir.

If the callback sets its delete_cred return flag, delete the associated credential.

If config_dir is not NULL, it must point to an alternative config directory location. If it is NULL, the default location is used.

Note
config_dir may only be NULL in 1.8.2 and later.
Removing credentials from the config-based disk store will not purge them from any open svn_auth_baton_t instance. Consider using svn_auth_forget_credentials() – from the walk_func, even – for this purpose.
Removing credentials from the config-based disk store will not also remove any related credentials from third-party password stores. (Implementations of walk_func which delete credentials may wish to consult the "passtype" element of hash, if any, to see if a third-party store – such as "gnome-keyring" or "kwallet" is being used to hold the most sensitive portion of the credentials for this cred_kind and realmstring.)
See also
svn_auth_forget_credentials()
Since
New in 1.8.

◆ svn_config_write_auth_data()

svn_error_t* svn_config_write_auth_data ( apr_hash_t *  hash,
const char *  cred_kind,
const char *  realmstring,
const char *  config_dir,
apr_pool_t *  pool 
)

Use cred_kind and realmstring to create or overwrite a file within the ~/.subversion/auth/ area.

Write the contents of hash into the file. If config_dir is not NULL it specifies a directory to read the config overriding all other sources.

Also, add realmstring to the file, with key SVN_CONFIG_REALMSTRING_KEY. This allows programs (or users) to verify exactly which set credentials live within the file.

The hashtable must contain const char * keys and svn_string_t * values.