Skip to content

Negotiate ignored with --anyauth #21943

Description

@dfandrich

I did this

The current curl 8.21.0-DEV (commit 81cdf4d) ignores a WWW-Authenticate: Negotiate header when run with --anyauth without -u and does not attempt to negotiate Kerberos authentication. If run with --negotiate instead of --anyauth, it negotiates fine and succeeds. This used to work, e.g. in 8.20.0, 8.11.1 (and many others). The command-lines used are like curl -v --anyauth -k -u : https://example.com/protected. I believe some curl versions will work as well dropping the -u :.

As a workaround, adding a dummy, non-blank username (and optionally password) instead of : (e.g. -u literally:anything) in the command-line above causes negotiation to be performed again (and succeed) on master. Some historical curl versions work with Negotiate given -u : and others (IIRC) with no -u option at all, but as of this bug, a third way of making it work (dummy, non-blank data) seems to have been created.

The documentation for -u does mention including a Windows domain name for Kerberos on Windows (which is not relevant to my system), and it also says to use -u : to obtain the username automatically (but it also says this only on Windows). So, I don't think this change is desired, especially since the actual contents of the given username seems to be thrown out.

I didn't see any test cases for this, i.e. a server with Negotiate only and -u :.

I was able to bisect the issue to commit 8f71d0f "creds: hold credentials" (May 11, 2026).

I expected the following

-u : should be enough for --anyauth to work for Negotiate.

curl/libcurl version

8.21.0-DEV

operating system

Linux x86_64

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions