• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_LOGIN_OPTIONS
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_PASSWORD (3)
9  - CURLOPT_USERNAME (3)
10---
11
12# NAME
13
14CURLOPT_LOGIN_OPTIONS - login options
15
16# SYNOPSIS
17
18~~~c
19#include <curl/curl.h>
20
21CURLcode curl_easy_setopt(CURL *handle, CURLOPT_LOGIN_OPTIONS, char *options);
22~~~
23
24# DESCRIPTION
25
26Pass a char pointer as parameter, which should be pointing to the
27null-terminated *options* string to use for the transfer.
28
29For more information about the login options please see RFC 2384, RFC 5092 and
30the IETF draft **draft-earhart-url-smtp-00.txt**.
31
32CURLOPT_LOGIN_OPTIONS(3) can be used to set protocol specific login options,
33such as the preferred authentication mechanism via "AUTH=NTLM" or "AUTH=*",
34and should be used in conjunction with the CURLOPT_USERNAME(3) option.
35
36Since 8.2.0, IMAP supports the login option "AUTH=+LOGIN". With this option,
37curl uses the plain (not SASL) LOGIN IMAP command even if the server
38advertises SASL authentication. Care should be taken in using this option, as
39it sends your password in plain text. This does not work if the IMAP server
40disables the plain LOGIN (e.g. to prevent password snooping).
41
42The application does not have to keep the string around after setting this
43option.
44
45# DEFAULT
46
47NULL
48
49# PROTOCOLS
50
51Only IMAP, LDAP, POP3 and SMTP support login options.
52
53# EXAMPLE
54
55~~~c
56int main(void)
57{
58  CURL *curl = curl_easy_init();
59  if(curl) {
60    CURLcode res;
61    curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/");
62    curl_easy_setopt(curl, CURLOPT_LOGIN_OPTIONS, "AUTH=*");
63    res = curl_easy_perform(curl);
64    curl_easy_cleanup(curl);
65  }
66}
67~~~
68
69# AVAILABILITY
70
71Added in 7.34.0. Support for OpenLDAP added in 7.82.0.
72
73# RETURN VALUE
74
75Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or
76CURLE_OUT_OF_MEMORY if there was insufficient heap space.
77