GME  13
svn_auth.h
Go to the documentation of this file.
00001 
00027 #ifndef SVN_AUTH_H
00028 #define SVN_AUTH_H
00029 
00030 #include <apr.h>
00031 #include <apr_pools.h>
00032 #include <apr_hash.h>
00033 #include <apr_tables.h>
00034 
00035 #include "svn_types.h"
00036 #include "svn_config.h"
00037 
00038 #ifdef __cplusplus
00039 extern "C" {
00040 #endif /* __cplusplus */
00041 
00087 typedef struct svn_auth_baton_t svn_auth_baton_t;
00088 
00090 typedef struct svn_auth_iterstate_t svn_auth_iterstate_t;
00091 
00092 
00094 typedef struct svn_auth_provider_t
00095 {
00097   const char *cred_kind;
00098 
00110   svn_error_t * (*first_credentials)(void **credentials,
00111                                      void **iter_baton,
00112                                      void *provider_baton,
00113                                      apr_hash_t *parameters,
00114                                      const char *realmstring,
00115                                      apr_pool_t *pool);
00116 
00128   svn_error_t * (*next_credentials)(void **credentials,
00129                                     void *iter_baton,
00130                                     void *provider_baton,
00131                                     apr_hash_t *parameters,
00132                                     const char *realmstring,
00133                                     apr_pool_t *pool);
00134 
00146   svn_error_t * (*save_credentials)(svn_boolean_t *saved,
00147                                     void *credentials,
00148                                     void *provider_baton,
00149                                     apr_hash_t *parameters,
00150                                     const char *realmstring,
00151                                     apr_pool_t *pool);
00152 
00153 } svn_auth_provider_t;
00154 
00155 
00158 typedef struct svn_auth_provider_object_t
00159 {
00160   const svn_auth_provider_t *vtable;
00161   void *provider_baton;
00162 
00163 } svn_auth_provider_object_t;
00164 
00166 typedef void (*svn_auth_simple_provider_func_t)(
00167   svn_auth_provider_object_t **provider,
00168   apr_pool_t *pool);
00169 
00170 
00186 #define SVN_AUTH_CRED_SIMPLE "svn.simple"
00187 
00189 typedef struct svn_auth_cred_simple_t
00190 {
00192   const char *username;
00194   const char *password;
00199   svn_boolean_t may_save;
00200 } svn_auth_cred_simple_t;
00201 
00202 
00210 #define SVN_AUTH_CRED_USERNAME "svn.username"
00211 
00213 typedef struct svn_auth_cred_username_t
00214 {
00216   const char *username;
00221   svn_boolean_t may_save;
00222 } svn_auth_cred_username_t;
00223 
00224 
00236 #define SVN_AUTH_CRED_SSL_CLIENT_CERT "svn.ssl.client-cert"
00237 
00239 typedef struct svn_auth_cred_ssl_client_cert_t
00240 {
00242   const char *cert_file;
00247   svn_boolean_t may_save;
00248 } svn_auth_cred_ssl_client_cert_t;
00249 
00250 
00252 typedef void (*svn_auth_ssl_client_cert_pw_provider_func_t)(
00253   svn_auth_provider_object_t **provider,
00254   apr_pool_t *pool);
00255 
00271 #define SVN_AUTH_CRED_SSL_CLIENT_CERT_PW "svn.ssl.client-passphrase"
00272 
00274 typedef struct svn_auth_cred_ssl_client_cert_pw_t
00275 {
00277   const char *password;
00282   svn_boolean_t may_save;
00283 } svn_auth_cred_ssl_client_cert_pw_t;
00284 
00285 
00300 #define SVN_AUTH_CRED_SSL_SERVER_TRUST "svn.ssl.server"
00301 
00305 typedef struct svn_auth_ssl_server_cert_info_t
00306 {
00308   const char *hostname;
00310   const char *fingerprint;
00312   const char *valid_from;
00314   const char *valid_until;
00316   const char *issuer_dname;
00318   const char *ascii_cert;
00319 } svn_auth_ssl_server_cert_info_t;
00320 
00326 svn_auth_ssl_server_cert_info_t *
00327 svn_auth_ssl_server_cert_info_dup(const svn_auth_ssl_server_cert_info_t *info,
00328                                   apr_pool_t *pool);
00329 
00331 typedef struct svn_auth_cred_ssl_server_trust_t
00332 {
00337   svn_boolean_t may_save;
00339   apr_uint32_t accepted_failures;
00340 } svn_auth_cred_ssl_server_trust_t;
00341 
00342 
00343 
00376 typedef svn_error_t *(*svn_auth_simple_prompt_func_t)(
00377   svn_auth_cred_simple_t **cred,
00378   void *baton,
00379   const char *realm,
00380   const char *username,
00381   svn_boolean_t may_save,
00382   apr_pool_t *pool);
00383 
00384 
00396 typedef svn_error_t *(*svn_auth_username_prompt_func_t)(
00397   svn_auth_cred_username_t **cred,
00398   void *baton,
00399   const char *realm,
00400   svn_boolean_t may_save,
00401   apr_pool_t *pool);
00402 
00403 
00412 #define SVN_AUTH_SSL_NOTYETVALID 0x00000001
00413 
00414 #define SVN_AUTH_SSL_EXPIRED     0x00000002
00415 
00416 #define SVN_AUTH_SSL_CNMISMATCH  0x00000004
00417 
00418 #define SVN_AUTH_SSL_UNKNOWNCA   0x00000008
00419 
00421 #define SVN_AUTH_SSL_OTHER       0x40000000
00422 
00439 typedef svn_error_t *(*svn_auth_ssl_server_trust_prompt_func_t)(
00440   svn_auth_cred_ssl_server_trust_t **cred,
00441   void *baton,
00442   const char *realm,
00443   apr_uint32_t failures,
00444   const svn_auth_ssl_server_cert_info_t *cert_info,
00445   svn_boolean_t may_save,
00446   apr_pool_t *pool);
00447 
00448 
00459 typedef svn_error_t *(*svn_auth_ssl_client_cert_prompt_func_t)(
00460   svn_auth_cred_ssl_client_cert_t **cred,
00461   void *baton,
00462   const char *realm,
00463   svn_boolean_t may_save,
00464   apr_pool_t *pool);
00465 
00466 
00477 typedef svn_error_t *(*svn_auth_ssl_client_cert_pw_prompt_func_t)(
00478   svn_auth_cred_ssl_client_cert_pw_t **cred,
00479   void *baton,
00480   const char *realm,
00481   svn_boolean_t may_save,
00482   apr_pool_t *pool);
00483 
00497 typedef svn_error_t *(*svn_auth_plaintext_prompt_func_t)(
00498   svn_boolean_t *may_save_plaintext,
00499   const char *realmstring,
00500   void *baton,
00501   apr_pool_t *pool);
00502 
00516 typedef svn_error_t *(*svn_auth_plaintext_passphrase_prompt_func_t)(
00517   svn_boolean_t *may_save_plaintext,
00518   const char *realmstring,
00519   void *baton,
00520   apr_pool_t *pool);
00521 
00522 
00533 void
00534 svn_auth_open(svn_auth_baton_t **auth_baton,
00535               const apr_array_header_t *providers,
00536               apr_pool_t *pool);
00537 
00545 void
00546 svn_auth_set_parameter(svn_auth_baton_t *auth_baton,
00547                        const char *name,
00548                        const void *value);
00549 
00555 const void *
00556 svn_auth_get_parameter(svn_auth_baton_t *auth_baton,
00557                        const char *name);
00558 
00568 #define SVN_AUTH_PARAM_PREFIX "svn:auth:"
00569 
00575 #define SVN_AUTH_PARAM_DEFAULT_USERNAME  SVN_AUTH_PARAM_PREFIX "username"
00576 
00577 #define SVN_AUTH_PARAM_DEFAULT_PASSWORD  SVN_AUTH_PARAM_PREFIX "password"
00578 
00583 #define SVN_AUTH_PARAM_NON_INTERACTIVE  SVN_AUTH_PARAM_PREFIX "non-interactive"
00584 
00588 #define SVN_AUTH_PARAM_DONT_STORE_PASSWORDS  SVN_AUTH_PARAM_PREFIX \
00589                                                  "dont-store-passwords"
00590 
00596 #define SVN_AUTH_PARAM_STORE_PLAINTEXT_PASSWORDS  SVN_AUTH_PARAM_PREFIX \
00597                                                   "store-plaintext-passwords"
00598 
00604 #define SVN_AUTH_PARAM_DONT_STORE_SSL_CLIENT_CERT_PP \
00605   SVN_AUTH_PARAM_PREFIX "dont-store-ssl-client-cert-pp"
00606 
00612 #define SVN_AUTH_PARAM_STORE_SSL_CLIENT_CERT_PP_PLAINTEXT \
00613   SVN_AUTH_PARAM_PREFIX "store-ssl-client-cert-pp-plaintext"
00614 
00618 #define SVN_AUTH_PARAM_NO_AUTH_CACHE  SVN_AUTH_PARAM_PREFIX "no-auth-cache"
00619 
00623 #define SVN_AUTH_PARAM_SSL_SERVER_FAILURES SVN_AUTH_PARAM_PREFIX \
00624   "ssl:failures"
00625 
00628 #define SVN_AUTH_PARAM_SSL_SERVER_CERT_INFO SVN_AUTH_PARAM_PREFIX \
00629   "ssl:cert-info"
00630 
00633 #define SVN_AUTH_PARAM_CONFIG_CATEGORY_CONFIG SVN_AUTH_PARAM_PREFIX \
00634   "config-category-config"
00635 
00638 #define SVN_AUTH_PARAM_CONFIG_CATEGORY_SERVERS SVN_AUTH_PARAM_PREFIX \
00639   "config-category-servers"
00640 
00642 #define SVN_AUTH_PARAM_CONFIG SVN_AUTH_PARAM_CONFIG_CATEGORY_SERVERS
00643 
00645 #define SVN_AUTH_PARAM_SERVER_GROUP SVN_AUTH_PARAM_PREFIX "server-group"
00646 
00649 #define SVN_AUTH_PARAM_CONFIG_DIR SVN_AUTH_PARAM_PREFIX "config-dir"
00650 
00663 svn_error_t *
00664 svn_auth_first_credentials(void **credentials,
00665                            svn_auth_iterstate_t **state,
00666                            const char *cred_kind,
00667                            const char *realmstring,
00668                            svn_auth_baton_t *auth_baton,
00669                            apr_pool_t *pool);
00670 
00681 svn_error_t *
00682 svn_auth_next_credentials(void **credentials,
00683                           svn_auth_iterstate_t *state,
00684                           apr_pool_t *pool);
00685 
00694 svn_error_t *
00695 svn_auth_save_credentials(svn_auth_iterstate_t *state,
00696                           apr_pool_t *pool);
00697 
00714 svn_error_t *
00715 svn_auth_forget_credentials(svn_auth_baton_t *auth_baton,
00716                             const char *cred_kind,
00717                             const char *realmstring,
00718                             apr_pool_t *pool);
00719 
00737 void
00738 svn_auth_get_simple_prompt_provider(svn_auth_provider_object_t **provider,
00739                                     svn_auth_simple_prompt_func_t prompt_func,
00740                                     void *prompt_baton,
00741                                     int retry_limit,
00742                                     apr_pool_t *pool);
00743 
00744 
00759 void
00760 svn_auth_get_username_prompt_provider(
00761   svn_auth_provider_object_t **provider,
00762   svn_auth_username_prompt_func_t prompt_func,
00763   void *prompt_baton,
00764   int retry_limit,
00765   apr_pool_t *pool);
00766 
00767 
00799 void
00800 svn_auth_get_simple_provider2(
00801   svn_auth_provider_object_t **provider,
00802   svn_auth_plaintext_prompt_func_t plaintext_prompt_func,
00803   void *prompt_baton,
00804   apr_pool_t *pool);
00805 
00813 SVN_DEPRECATED
00814 void
00815 svn_auth_get_simple_provider(svn_auth_provider_object_t **provider,
00816                              apr_pool_t *pool);
00817 
00837 svn_error_t *
00838 svn_auth_get_platform_specific_provider(
00839   svn_auth_provider_object_t **provider,
00840   const char *provider_name,
00841   const char *provider_type,
00842   apr_pool_t *pool);
00843 
00862 svn_error_t *
00863 svn_auth_get_platform_specific_client_providers(
00864   apr_array_header_t **providers,
00865   svn_config_t *config,
00866   apr_pool_t *pool);
00867 
00868 #if (defined(WIN32) && !defined(__MINGW32__)) || defined(DOXYGEN)
00869 
00888 void
00889 svn_auth_get_windows_simple_provider(svn_auth_provider_object_t **provider,
00890                                      apr_pool_t *pool);
00891 
00910 void
00911 svn_auth_get_windows_ssl_client_cert_pw_provider(
00912   svn_auth_provider_object_t **provider,
00913   apr_pool_t *pool);
00914 
00927 void
00928 svn_auth_get_windows_ssl_server_trust_provider(
00929   svn_auth_provider_object_t **provider,
00930   apr_pool_t *pool);
00931 
00932 #endif /* WIN32 && !__MINGW32__ || DOXYGEN */
00933 
00934 #if defined(DARWIN) || defined(DOXYGEN)
00935 
00947 void
00948 svn_auth_get_keychain_simple_provider(svn_auth_provider_object_t **provider,
00949                                       apr_pool_t *pool);
00950 
00963 void
00964 svn_auth_get_keychain_ssl_client_cert_pw_provider(
00965   svn_auth_provider_object_t **provider,
00966   apr_pool_t *pool);
00967 #endif /* DARWIN || DOXYGEN */
00968 
00969 #if (!defined(DARWIN) && !defined(WIN32)) || defined(DOXYGEN)
00970 
00981 typedef svn_error_t *(*svn_auth_gnome_keyring_unlock_prompt_func_t)(
00982   char **keyring_password,
00983   const char *keyring_name,
00984   void *baton,
00985   apr_pool_t *pool);
00986 
00987 
00993 #define SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_FUNC "gnome-keyring-unlock-prompt-func"
00994 
00997 #define SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_BATON "gnome-keyring-unlock-prompt-baton"
00998 
00999 
01005 const svn_version_t *
01006 svn_auth_gnome_keyring_version(void);
01007 
01008 
01030 void
01031 svn_auth_get_gnome_keyring_simple_provider(
01032   svn_auth_provider_object_t **provider,
01033   apr_pool_t *pool);
01034 
01035 
01057 void
01058 svn_auth_get_gnome_keyring_ssl_client_cert_pw_provider(
01059   svn_auth_provider_object_t **provider,
01060   apr_pool_t *pool);
01061 
01062 
01068 const svn_version_t *
01069 svn_auth_kwallet_version(void);
01070 
01071 
01085 void
01086 svn_auth_get_kwallet_simple_provider(svn_auth_provider_object_t **provider,
01087                                      apr_pool_t *pool);
01088 
01089 
01103 void
01104 svn_auth_get_kwallet_ssl_client_cert_pw_provider(
01105   svn_auth_provider_object_t **provider,
01106   apr_pool_t *pool);
01107 #endif /* (!DARWIN && !WIN32) || DOXYGEN */
01108 
01109 #if !defined(WIN32) || defined(DOXYGEN)
01110 
01125 void
01126 svn_auth_get_gpg_agent_simple_provider
01127     (svn_auth_provider_object_t **provider,
01128      apr_pool_t *pool);
01129 #endif /* !defined(WIN32) || defined(DOXYGEN) */
01130 
01131 
01143 void
01144 svn_auth_get_username_provider(svn_auth_provider_object_t **provider,
01145                                apr_pool_t *pool);
01146 
01147 
01157 void
01158 svn_auth_get_ssl_server_trust_file_provider(
01159   svn_auth_provider_object_t **provider,
01160   apr_pool_t *pool);
01161 
01171 void
01172 svn_auth_get_ssl_client_cert_file_provider(
01173   svn_auth_provider_object_t **provider,
01174   apr_pool_t *pool);
01175 
01176 
01199 void
01200 svn_auth_get_ssl_client_cert_pw_file_provider2(
01201   svn_auth_provider_object_t **provider,
01202   svn_auth_plaintext_passphrase_prompt_func_t plaintext_passphrase_prompt_func,
01203   void *prompt_baton,
01204   apr_pool_t *pool);
01205 
01214 SVN_DEPRECATED
01215 void
01216 svn_auth_get_ssl_client_cert_pw_file_provider(
01217   svn_auth_provider_object_t **provider,
01218   apr_pool_t *pool);
01219 
01220 
01230 void
01231 svn_auth_get_ssl_server_trust_prompt_provider(
01232   svn_auth_provider_object_t **provider,
01233   svn_auth_ssl_server_trust_prompt_func_t prompt_func,
01234   void *prompt_baton,
01235   apr_pool_t *pool);
01236 
01237 
01249 void
01250 svn_auth_get_ssl_client_cert_prompt_provider(
01251   svn_auth_provider_object_t **provider,
01252   svn_auth_ssl_client_cert_prompt_func_t prompt_func,
01253   void *prompt_baton,
01254   int retry_limit,
01255   apr_pool_t *pool);
01256 
01257 
01269 void
01270 svn_auth_get_ssl_client_cert_pw_prompt_provider(
01271   svn_auth_provider_object_t **provider,
01272   svn_auth_ssl_client_cert_pw_prompt_func_t prompt_func,
01273   void *prompt_baton,
01274   int retry_limit,
01275   apr_pool_t *pool);
01276 
01277 
01278 #ifdef __cplusplus
01279 }
01280 #endif /* __cplusplus */
01281 
01282 #endif /* SVN_AUTH_H */