Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
6d931ba7
Commit
6d931ba7
authored
Mar 22, 2019
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http: don't set the header in the auth token
parent
10718526
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
21 deletions
+25
-21
src/transports/auth.c
+2
-4
src/transports/auth.h
+1
-1
src/transports/auth_negotiate.c
+1
-3
src/transports/auth_ntlm.c
+1
-3
src/transports/http.c
+20
-10
No files found.
src/transports/auth.c
View file @
6d931ba7
...
...
@@ -13,7 +13,6 @@
static
int
basic_next_token
(
git_buf
*
out
,
git_http_auth_context
*
ctx
,
const
char
*
header_name
,
git_cred
*
c
)
{
git_cred_userpass_plaintext
*
cred
;
...
...
@@ -32,9 +31,8 @@ static int basic_next_token(
git_buf_printf
(
&
raw
,
"%s:%s"
,
cred
->
username
,
cred
->
password
);
if
(
git_buf_oom
(
&
raw
)
||
git_buf_printf
(
out
,
"%s: Basic "
,
header_name
)
<
0
||
git_buf_encode_base64
(
out
,
git_buf_cstr
(
&
raw
),
raw
.
size
)
<
0
||
git_buf_puts
(
out
,
"
\r\n
"
)
<
0
)
git_buf_puts
(
out
,
"Basic "
)
<
0
||
git_buf_encode_base64
(
out
,
git_buf_cstr
(
&
raw
),
raw
.
size
)
<
0
)
goto
on_error
;
error
=
0
;
...
...
src/transports/auth.h
View file @
6d931ba7
...
...
@@ -32,7 +32,7 @@ struct git_http_auth_context {
int
(
*
set_challenge
)(
git_http_auth_context
*
ctx
,
const
char
*
challenge
);
/** Gets the next authentication token from the context */
int
(
*
next_token
)(
git_buf
*
out
,
git_http_auth_context
*
ctx
,
const
char
*
header_name
,
git_cred
*
cred
);
int
(
*
next_token
)(
git_buf
*
out
,
git_http_auth_context
*
ctx
,
git_cred
*
cred
);
/** Examines if all tokens have been presented. */
int
(
*
is_complete
)(
git_http_auth_context
*
ctx
);
...
...
src/transports/auth_negotiate.c
View file @
6d931ba7
...
...
@@ -73,7 +73,6 @@ static int negotiate_set_challenge(
static
int
negotiate_next_token
(
git_buf
*
buf
,
git_http_auth_context
*
c
,
const
char
*
header_name
,
git_cred
*
cred
)
{
http_auth_negotiate_context
*
ctx
=
(
http_auth_negotiate_context
*
)
c
;
...
...
@@ -156,9 +155,8 @@ static int negotiate_next_token(
goto
done
;
}
git_buf_p
rintf
(
buf
,
"%s: Negotiate "
,
header_name
);
git_buf_p
uts
(
buf
,
"Negotiate "
);
git_buf_encode_base64
(
buf
,
output_token
.
value
,
output_token
.
length
);
git_buf_puts
(
buf
,
"
\r\n
"
);
if
(
git_buf_oom
(
buf
))
error
=
-
1
;
...
...
src/transports/auth_ntlm.c
View file @
6d931ba7
...
...
@@ -77,7 +77,6 @@ done:
static
int
ntlm_next_token
(
git_buf
*
buf
,
git_http_auth_context
*
c
,
const
char
*
header_name
,
git_cred
*
cred
)
{
http_auth_ntlm_context
*
ctx
=
(
http_auth_ntlm_context
*
)
c
;
...
...
@@ -145,9 +144,8 @@ static int ntlm_next_token(
}
}
git_buf_p
rintf
(
buf
,
"%s: NTLM "
,
header_name
);
git_buf_p
uts
(
buf
,
"NTLM "
);
git_buf_encode_base64
(
buf
,
(
const
char
*
)
msg
,
msg_len
);
git_buf_puts
(
buf
,
"
\r\n
"
);
if
(
git_buf_oom
(
buf
))
goto
done
;
...
...
src/transports/http.c
View file @
6d931ba7
...
...
@@ -208,37 +208,47 @@ static int apply_credentials(
git_cred
*
cred
=
server
->
cred
;
git_http_auth_context
*
context
;
authmatch_data
data
=
{
0
};
git_buf
token
=
GIT_BUF_INIT
;
int
error
=
0
;
if
(
!
server
->
server_types
)
return
0
;
goto
done
;
/* Get or create a context for the best scheme for this cred type */
if
(
auth_context_match
(
&
context
,
server
,
credtype_match
,
&
cred
->
credtype
)
<
0
)
return
-
1
;
if
(
(
error
=
auth_context_match
(
&
context
,
server
,
credtype_match
,
&
cred
->
credtype
)
)
<
0
)
goto
done
;
if
(
!
context
)
return
0
;
goto
done
;
/*
* If we do have creds, find the first mechanism supported by both
* the server and ourselves that supports the credential type.
*/
if
(
!
cred
)
return
0
;
goto
done
;
data
.
server_types
=
server
->
server_types
;
data
.
credtype
=
cred
->
credtype
;
if
(
auth_context_match
(
&
context
,
server
,
auth_match
,
&
data
)
<
0
)
return
-
1
;
if
(
(
error
=
auth_context_match
(
&
context
,
server
,
auth_match
,
&
data
)
)
<
0
)
goto
done
;
if
(
!
context
)
{
git_error_set
(
GIT_ERROR_NET
,
"no suitable mechanism found for authentication"
);
return
-
1
;
error
=
-
1
;
goto
done
;
}
return
context
->
next_token
(
buf
,
context
,
header_name
,
cred
);
if
((
error
=
context
->
next_token
(
&
token
,
context
,
cred
))
<
0
)
goto
done
;
error
=
git_buf_printf
(
buf
,
"%s: %s
\r\n
"
,
header_name
,
token
.
ptr
);
done:
git_buf_dispose
(
&
token
);
return
error
;
}
static
int
gen_request
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment