diff options
| author | Edward Thomson <ethomson@microsoft.com> | 2013-11-13 16:57:51 -0500 |
|---|---|---|
| committer | Edward Thomson <ethomson@microsoft.com> | 2013-11-18 12:56:35 -0500 |
| commit | 84efffc33ab352d68cf981da0d6c8d358244cabc (patch) | |
| tree | 761cc446f2141ebedd82b88a6bdf31d893effdd2 /tests/online/push.c | |
| parent | 80fc7d6bf08834acc5696c8f0c73680236f84375 (diff) | |
| download | libgit2-84efffc33ab352d68cf981da0d6c8d358244cabc.tar.gz | |
Introduce git_cred_default for NTLM/SPNEGO auth
Diffstat (limited to 'tests/online/push.c')
| -rw-r--r-- | tests/online/push.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/online/push.c b/tests/online/push.c index aeb1ab47d..be505c3a1 100644 --- a/tests/online/push.c +++ b/tests/online/push.c @@ -9,14 +9,17 @@ static git_repository *_repo; +static char *_remote_url; + static char *_remote_ssh_key; static char *_remote_ssh_pubkey; static char *_remote_ssh_passphrase; -static char *_remote_url; static char *_remote_user; static char *_remote_pass; +static char *_remote_default; + static int cred_acquire_cb(git_cred **, const char *, const char *, unsigned int, void *); static git_remote *_remote; @@ -47,11 +50,21 @@ static int cred_acquire_cb( GIT_UNUSED(user_from_url); GIT_UNUSED(payload); + if (GIT_CREDTYPE_DEFAULT & allowed_types) { + if (!_remote_default) { + printf("GITTEST_REMOTE_DEFAULT must be set to use NTLM/Negotiate credentials\n"); + return -1; + } + + return git_cred_default_new(cred); + } + if (GIT_CREDTYPE_SSH_KEY & allowed_types) { if (!_remote_user || !_remote_ssh_pubkey || !_remote_ssh_key || !_remote_ssh_passphrase) { printf("GITTEST_REMOTE_USER, GITTEST_REMOTE_SSH_PUBKEY, GITTEST_REMOTE_SSH_KEY and GITTEST_REMOTE_SSH_PASSPHRASE must be set\n"); return -1; } + return git_cred_ssh_key_new(cred, _remote_user, _remote_ssh_pubkey, _remote_ssh_key, _remote_ssh_passphrase); } @@ -298,6 +311,7 @@ void test_online_push__initialize(void) _remote_ssh_key = cl_getenv("GITTEST_REMOTE_SSH_KEY"); _remote_ssh_pubkey = cl_getenv("GITTEST_REMOTE_SSH_PUBKEY"); _remote_ssh_passphrase = cl_getenv("GITTEST_REMOTE_SSH_PASSPHRASE"); + _remote_default = cl_getenv("GITTEST_REMOTE_DEFAULT"); _remote = NULL; if (_remote_url) { |
