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
13Added-in: 7.66.0
14---
15
16# NAME
17
18CURLOPT_SASL_AUTHZID - authorization identity (identity to act as)
19
20# SYNOPSIS
21
22~~~c
23#include <curl/curl.h>
24
25CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SASL_AUTHZID, char *authzid);
26~~~
27
28# DESCRIPTION
29
30Pass a char pointer as parameter, which should be pointing to the
31null-terminated authorization identity (*authzid*) for the transfer. Only
32applicable to the PLAIN SASL authentication mechanism where it is optional.
33
34When not specified only the authentication identity (*authcid*) as specified
35by the username is sent to the server, along with the password. The server
36derives a *authzid* from the *authcid* when not provided, which it then uses
37internally.
38
39When the *authzid* is specified, the use of which is server dependent, it can
40be used to access another user's inbox, that the user has been granted access
41to, or a shared mailbox for example.
42
43The application does not have to keep the string around after setting this
44option.
45
46Using this option multiple times makes the last set string override the
47previous ones. Set it to NULL to disable its use again.
48
49# DEFAULT
50
51blank
52
53# %PROTOCOLS%
54
55# EXAMPLE
56
57~~~c
58int main(void)
59{
60  CURL *curl = curl_easy_init();
61  if(curl) {
62    CURLcode res;
63    curl_easy_setopt(curl, CURLOPT_URL, "imap://example.com/");
64    curl_easy_setopt(curl, CURLOPT_USERNAME, "Kurt");
65    curl_easy_setopt(curl, CURLOPT_PASSWORD, "xipj3plmq");
66    curl_easy_setopt(curl, CURLOPT_SASL_AUTHZID, "Ursel");
67    res = curl_easy_perform(curl);
68    curl_easy_cleanup(curl);
69  }
70}
71~~~
72
73# %AVAILABILITY%
74
75# RETURN VALUE
76
77Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
78