| 1 |
.\" ************************************************************************** |
| 2 |
.\" * _ _ ____ _ |
| 3 |
.\" * Project ___| | | | _ \| | |
| 4 |
.\" * / __| | | | |_) | | |
| 5 |
.\" * | (__| |_| | _ <| |___ |
| 6 |
.\" * \___|\___/|_| \_\_____| |
| 7 |
.\" * |
| 8 |
.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <[email protected]>, et al. |
| 9 |
.\" * |
| 10 |
.\" * This software is licensed as described in the file COPYING, which |
| 11 |
.\" * you should have received as part of this distribution. The terms |
| 12 |
.\" * are also available at https://curl.haxx.se/docs/copyright.html. |
| 13 |
.\" * |
| 14 |
.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell |
| 15 |
.\" * copies of the Software, and permit persons to whom the Software is |
| 16 |
.\" * furnished to do so, under the terms of the COPYING file. |
| 17 |
.\" * |
| 18 |
.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 19 |
.\" * KIND, either express or implied. |
| 20 |
.\" * |
| 21 |
.\" ************************************************************************** |
| 22 |
.\" |
| 23 |
.TH CURLOPT_USERPWD 3 "17 Jun 2014" "libcurl 7.37.0" "curl_easy_setopt options" |
| 24 |
.SH NAME |
| 25 |
CURLOPT_USERPWD \- user name and password to use in authentication |
| 26 |
.SH SYNOPSIS |
| 27 |
#include <curl/curl.h> |
| 28 |
|
| 29 |
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_USERPWD, char *userpwd); |
| 30 |
.SH DESCRIPTION |
| 31 |
Pass a char * as parameter, pointing to a zero terminated login details string |
| 32 |
for the connection. The format of which is: [user name]:[password]. |
| 33 |
|
| 34 |
When using Kerberos V5 authentication with a Windows based server, you should |
| 35 |
specify the user name part with the domain name in order for the server to |
| 36 |
successfully obtain a Kerberos Ticket. If you don't then the initial part of |
| 37 |
the authentication handshake may fail. |
| 38 |
|
| 39 |
When using NTLM, the user name can be specified simply as the user name |
| 40 |
without the domain name should the server be part of a single domain and |
| 41 |
forest. |
| 42 |
|
| 43 |
To specify the domain name use either Down-Level Logon Name or UPN (User |
| 44 |
Principal Name) formats. For example, EXAMPLE\\user and [email protected] |
| 45 |
respectively. |
| 46 |
|
| 47 |
Some HTTP servers (on Windows) support inclusion of the domain for Basic |
| 48 |
authentication as well. |
| 49 |
|
| 50 |
When using HTTP and \fICURLOPT_FOLLOWLOCATION(3)\fP, libcurl might perform |
| 51 |
several requests to possibly different hosts. libcurl will only send this user |
| 52 |
and password information to hosts using the initial host name (unless |
| 53 |
\fICURLOPT_UNRESTRICTED_AUTH(3)\fP is set), so if libcurl follows locations to |
| 54 |
other hosts it will not send the user and password to those. This is enforced |
| 55 |
to prevent accidental information leakage. |
| 56 |
|
| 57 |
Use \fICURLOPT_HTTPAUTH(3)\fP to specify the authentication method for HTTP |
| 58 |
based connections or \fICURLOPT_LOGIN_OPTIONS(3)\fP to control IMAP, POP3 and |
| 59 |
SMTP options. |
| 60 |
|
| 61 |
The user and password strings are not URL decoded, so there's no way to send |
| 62 |
in a user name containing a colon using this option. Use |
| 63 |
\fICURLOPT_USERNAME(3)\fP for that, or include it in the URL. |
| 64 |
|
| 65 |
The application does not have to keep the string around after setting this |
| 66 |
option. |
| 67 |
.SH DEFAULT |
| 68 |
NULL |
| 69 |
.SH PROTOCOLS |
| 70 |
Most |
| 71 |
.SH EXAMPLE |
| 72 |
.nf |
| 73 |
CURL *curl = curl_easy_init(); |
| 74 |
if(curl) { |
| 75 |
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin"); |
| 76 |
|
| 77 |
curl_easy_setopt(curl, CURLOPT_USERPWD, "clark:kent"); |
| 78 |
|
| 79 |
ret = curl_easy_perform(curl); |
| 80 |
|
| 81 |
curl_easy_cleanup(curl); |
| 82 |
} |
| 83 |
.fi |
| 84 |
.SH AVAILABILITY |
| 85 |
Always |
| 86 |
.SH RETURN VALUE |
| 87 |
Returns CURLE_OK on success or |
| 88 |
CURLE_OUT_OF_MEMORY if there was insufficient heap space. |
| 89 |
.SH "SEE ALSO" |
| 90 |
.BR CURLOPT_USERNAME "(3), " CURLOPT_PASSWORD "(3), " |
| 91 |
.BR CURLOPT_PROXYUSERPWD "(3), " |