Skip to content

Commit a48da8f

Browse files
authored
Merge pull request libgit2#5417 from pks-t/pks/ntlmclient-htonll
deps: ntlmclient: fix missing htonll symbols on FreeBSD and SunOS
2 parents 45ed17b + ebade23 commit a48da8f

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

deps/ntlmclient/compat.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,30 @@
2222
#endif
2323

2424
#ifdef __linux__
25+
/* See man page endian(3) */
2526
# include <endian.h>
2627
# define htonll htobe64
28+
#elif defined(__OpenBSD__)
29+
/* See man page htobe64(3) */
30+
# include <endian.h>
31+
# define htonll htobe64
32+
#elif defined(__FreeBSD__)
33+
/* See man page bwaps64(9) */
34+
# include <sys/endian.h>
35+
# define htonll bswap64
36+
#elif defined(sun) || defined(__sun)
37+
/* See man page byteorder(3SOCKET) */
38+
# include <sys/types.h>
39+
# include <netinet/in.h>
40+
# include <inttypes.h>
41+
42+
# if !defined(htonll)
43+
# if defined(_BIG_ENDIAN)
44+
# define htonll(x) (x)
45+
# else
46+
# define htonll(x) ((((uint64_t)htonl(x)) << 32) + htonl((uint64_t)(x) >> 32))
47+
# endif
48+
# endif
2749
#endif
2850

2951
#ifndef MIN

src/transports/auth_ntlm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ static int ntlm_set_credentials(http_auth_ntlm_context *ctx, git_credential *_cr
5050
cred = (git_credential_userpass_plaintext *)_cred;
5151

5252
if ((sep = strchr(cred->username, '\\')) != NULL) {
53-
domain = strndup(cred->username, (sep - cred->username));
53+
domain = git__strndup(cred->username, (sep - cred->username));
5454
GIT_ERROR_CHECK_ALLOC(domain);
5555

56-
domainuser = strdup(sep + 1);
56+
domainuser = git__strdup(sep + 1);
5757
GIT_ERROR_CHECK_ALLOC(domainuser);
5858

5959
username = domainuser;

0 commit comments

Comments
 (0)