Skip to content

Commit f15c8ac

Browse files
ethomsonEdward Thomson
authored andcommitted
http: add SSPI authentication on Windows
Add support for SSPI on Windows, which offers NTLM and Negotiate authentication.
1 parent 0d7f3f5 commit f15c8ac

File tree

5 files changed

+350
-9
lines changed

5 files changed

+350
-9
lines changed

cmake/SelectGSSAPI.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ if(USE_GSSAPI)
2929
list(APPEND LIBGIT2_SYSTEM_LIBS ${GSSFRAMEWORK_LIBRARIES})
3030

3131
set(GIT_GSSFRAMEWORK 1)
32-
add_feature_info(SPNEGO GIT_GSSFRAMEWORK "SPNEGO authentication support (${USE_GSSAPI})")
32+
add_feature_info(GSSAPI GIT_GSSFRAMEWORK "GSSAPI support for SPNEGO authentication (${USE_GSSAPI})")
3333
elseif(USE_GSSAPI STREQUAL "gssapi")
3434
if(NOT GSSAPI_FOUND)
3535
message(FATAL_ERROR "Asked for gssapi GSS backend, but it wasn't found")
@@ -38,11 +38,11 @@ if(USE_GSSAPI)
3838
list(APPEND LIBGIT2_SYSTEM_LIBS ${GSSAPI_LIBRARIES})
3939

4040
set(GIT_GSSAPI 1)
41-
add_feature_info(SPNEGO GIT_GSSAPI "SPNEGO authentication support (${USE_GSSAPI})")
41+
add_feature_info(GSSAPI GIT_GSSAPI "GSSAPI support for SPNEGO authentication (${USE_GSSAPI})")
4242
else()
4343
message(FATAL_ERROR "Asked for backend ${USE_GSSAPI} but it wasn't found")
4444
endif()
4545
else()
4646
set(GIT_GSSAPI 0)
47-
add_feature_info(SPNEGO NO "SPNEGO authentication support")
47+
add_feature_info(GSSAPI NO "GSSAPI support for SPNEGO authentication")
4848
endif()

cmake/SelectHTTPSBackend.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ if(USE_HTTPS)
125125
list(APPEND LIBGIT2_PC_LIBS "-lwinhttp")
126126
endif()
127127

128-
list(APPEND LIBGIT2_SYSTEM_LIBS "rpcrt4" "crypt32" "ole32")
129-
list(APPEND LIBGIT2_PC_LIBS "-lrpcrt4" "-lcrypt32" "-lole32")
128+
list(APPEND LIBGIT2_SYSTEM_LIBS "rpcrt4" "crypt32" "ole32" "secur32")
129+
list(APPEND LIBGIT2_PC_LIBS "-lrpcrt4" "-lcrypt32" "-lole32" "-lsecur32")
130130
elseif(USE_HTTPS STREQUAL "OpenSSL-Dynamic")
131131
set(GIT_OPENSSL 1)
132132
set(GIT_OPENSSL_DYNAMIC 1)

src/libgit2/transports/auth_negotiate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "git2.h"
1313
#include "auth.h"
1414

15-
#if defined(GIT_GSSAPI) || defined(GIT_GSSFRAMEWORK)
15+
#if defined(GIT_GSSAPI) || defined(GIT_GSSFRAMEWORK) || defined(GIT_WIN32)
1616

1717
extern int git_http_auth_negotiate(
1818
git_http_auth_context **out,

src/libgit2/transports/auth_ntlm.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
* a Linking Exception. For full terms see the included COPYING file.
66
*/
77

8-
#ifndef INCLUDE_transports_auth_ntlmclient_h__
9-
#define INCLUDE_transports_auth_ntlmclient_h__
8+
#ifndef INCLUDE_transports_auth_ntlm_h__
9+
#define INCLUDE_transports_auth_ntlm_h__
1010

1111
#include "auth.h"
1212

1313
/* NTLM requires a full request/challenge/response */
1414
#define GIT_AUTH_STEPS_NTLM 2
1515

16-
#ifdef GIT_NTLM
16+
#if defined(GIT_NTLM) || defined(GIT_WIN32)
1717

1818
#if defined(GIT_OPENSSL)
1919
# define CRYPT_OPENSSL

0 commit comments

Comments
 (0)