Imported Upstream version 7.59.0
[platform/upstream/curl.git] / docs / libcurl / opts / CURLOPT_USERPWD.3
1 .\" **************************************************************************
2 .\" *                                  _   _ ____  _
3 .\" *  Project                     ___| | | |  _ \| |
4 .\" *                             / __| | | | |_) | |
5 .\" *                            | (__| |_| |  _ <| |___
6 .\" *                             \___|\___/|_| \_\_____|
7 .\" *
8 .\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, 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 "August 24, 2017" "libcurl 7.59.0" "curl_easy_setopt options"
24
25 .SH NAME
26 CURLOPT_USERPWD \- user name and password to use in authentication
27 .SH SYNOPSIS
28 #include <curl/curl.h>
29
30 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_USERPWD, char *userpwd);
31 .SH DESCRIPTION
32 Pass a char * as parameter, pointing to a zero terminated login details string
33 for the connection. The format of which is: [user name]:[password].
34
35 When using Kerberos V5 authentication with a Windows based server, you should
36 specify the user name part with the domain name in order for the server to
37 successfully obtain a Kerberos Ticket. If you don't then the initial part of
38 the authentication handshake may fail.
39
40 When using NTLM, the user name can be specified simply as the user name
41 without the domain name should the server be part of a single domain and
42 forest.
43
44 To specify the domain name use either Down-Level Logon Name or UPN (User
45 Principal Name) formats. For example, EXAMPLE\\user and user@example.com
46 respectively.
47
48 Some HTTP servers (on Windows) support inclusion of the domain for Basic
49 authentication as well.
50
51 When using HTTP and \fICURLOPT_FOLLOWLOCATION(3)\fP, libcurl might perform
52 several requests to possibly different hosts. libcurl will only send this user
53 and password information to hosts using the initial host name (unless
54 \fICURLOPT_UNRESTRICTED_AUTH(3)\fP is set), so if libcurl follows locations to
55 other hosts it will not send the user and password to those. This is enforced
56 to prevent accidental information leakage.
57
58 Use \fICURLOPT_HTTPAUTH(3)\fP to specify the authentication method for HTTP
59 based connections or \fICURLOPT_LOGIN_OPTIONS(3)\fP to control IMAP, POP3 and
60 SMTP options.
61
62 The user and password strings are not URL decoded, so there's no way to send
63 in a user name containing a colon using this option. Use
64 \fICURLOPT_USERNAME(3)\fP for that, or include it in the URL.
65
66 The application does not have to keep the string around after setting this
67 option.
68 .SH DEFAULT
69 NULL
70 .SH PROTOCOLS
71 Most
72 .SH EXAMPLE
73 .nf
74 CURL *curl = curl_easy_init();
75 if(curl) {
76   curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
77
78   curl_easy_setopt(curl, CURLOPT_USERPWD, "clark:kent");
79
80   ret = curl_easy_perform(curl);
81
82   curl_easy_cleanup(curl);
83 }
84 .fi
85 .SH AVAILABILITY
86 Always
87 .SH RETURN VALUE
88 Returns CURLE_OK on success or
89 CURLE_OUT_OF_MEMORY if there was insufficient heap space.
90 .SH "SEE ALSO"
91 .BR CURLOPT_USERNAME "(3), " CURLOPT_PASSWORD "(3), "
92 .BR CURLOPT_PROXYUSERPWD "(3), "