1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_SASL_AUTHZID
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_PASSWORD (3)
9  - CURLOPT_USERNAME (3)
10  - CURLOPT_USERPWD (3)
11Protocol:
12  - IMAP
13---
14
15# NAME
16
17CURLOPT_SASL_AUTHZID - authorization identity (identity to act as)
18
19# SYNOPSIS
20
21~~~c
22#include <curl/curl.h>
23
24CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SASL_AUTHZID, char *authzid);
25~~~
26
27# DESCRIPTION
28
29Pass a char pointer as parameter, which should be pointing to the
30null-terminated authorization identity (*authzid*) for the transfer. Only
31applicable to the PLAIN SASL authentication mechanism where it is optional.
32
33When not specified only the authentication identity (*authcid*) as
34specified by the username is sent to the server, along with the password. The
35server derives a *authzid* from the *authcid* when not provided, which
36it then uses internally.
37
38When the *authzid* is specified, the use of which is server dependent, it
39can be used to access another user's inbox, that the user has been granted
40access to, or a shared mailbox for example.
41
42# DEFAULT
43
44blank
45
46# EXAMPLE
47
48~~~c
49int main(void)
50{
51  CURL *curl = curl_easy_init();
52  if(curl) {
53    CURLcode res;
54    curl_easy_setopt(curl, CURLOPT_URL, "imap://example.com/");
55    curl_easy_setopt(curl, CURLOPT_USERNAME, "Kurt");
56    curl_easy_setopt(curl, CURLOPT_PASSWORD, "xipj3plmq");
57    curl_easy_setopt(curl, CURLOPT_SASL_AUTHZID, "Ursel");
58    res = curl_easy_perform(curl);
59    curl_easy_cleanup(curl);
60  }
61}
62~~~
63
64# AVAILABILITY
65
66Added in 7.66.0. Support for OpenLDAP added in 7.82.0.
67
68# RETURN VALUE
69
70Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
71