Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
223612af
Commit
223612af
authored
10 years ago
by
David Woodhouse
Committed by
Daniel Stenberg
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ntlm_wb: Avoid invoking ntlm_auth helper with empty username
parent
9008f3d5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/curl_ntlm_wb.c
+31
-0
31 additions, 0 deletions
lib/curl_ntlm_wb.c
with
31 additions
and
0 deletions
lib/curl_ntlm_wb.c
+
31
−
0
View file @
223612af
...
...
@@ -39,6 +39,9 @@
#ifdef HAVE_SIGNAL_H
#include
<signal.h>
#endif
#ifdef HAVE_PWD_H
#include
<pwd.h>
#endif
#include
"urldata.h"
#include
"sendf.h"
...
...
@@ -117,6 +120,10 @@ static CURLcode ntlm_wb_init(struct connectdata *conn, const char *userp)
char
*
slash
,
*
domain
=
NULL
;
const
char
*
ntlm_auth
=
NULL
;
char
*
ntlm_auth_alloc
=
NULL
;
#if defined(HAVE_GETPWUID_R) && defined(HAVE_GETEUID)
struct
passwd
pw
,
*
pw_res
;
char
pwbuf
[
1024
];
#endif
int
error
;
/* Return if communication with ntlm_auth already set up */
...
...
@@ -125,6 +132,30 @@ static CURLcode ntlm_wb_init(struct connectdata *conn, const char *userp)
return
CURLE_OK
;
username
=
userp
;
/* The real ntlm_auth really doesn't like being invoked with an
empty username. It won't make inferences for itself, and expects
the client to do so (mostly because it's really designed for
servers like squid to use for auth, and client support is an
afterthought for it). So try hard to provide a suitable username
if we don't already have one. But if we can't, provide the
empty one anyway. Perhaps they have an implementation of the
ntlm_auth helper which *doesn't* need it so we might as well try */
if
(
!
username
||
!
username
[
0
])
{
username
=
getenv
(
"NTLMUSER"
);
if
(
!
username
||
!
username
[
0
])
username
=
getenv
(
"LOGNAME"
);
if
(
!
username
||
!
username
[
0
])
username
=
getenv
(
"USER"
);
#if defined(HAVE_GETPWUID_R) && defined(HAVE_GETEUID)
if
((
!
username
||
!
username
[
0
])
&&
!
getpwuid_r
(
geteuid
(),
&
pw
,
pwbuf
,
sizeof
(
pwbuf
),
&
pw_res
)
&&
pw_res
)
{
username
=
pw
.
pw_name
;
}
#endif
if
(
!
username
||
!
username
[
0
])
username
=
userp
;
}
slash
=
strpbrk
(
username
,
"
\\
/"
);
if
(
slash
)
{
if
((
domain
=
strdup
(
username
))
==
NULL
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment