1.. saslman:: sasl_client_new(3)
2
3.. _sasl-reference-manpages-library-sasl_client_new:
4
5
6===============================================================
7**sasl_client_new** - Create a new client authentication object
8===============================================================
9
10Synopsis
11========
12
13.. code-block:: C
14
15    #include <sasl/sasl.h>
16
17    int sasl_client_new(const char *service,
18                        const char *serverFQDN,
19                        const char *iplocalport,
20                        const char *ipremoteport,
21                        const sasl_callback_t *prompt_supp,
22                        unsigned flags,
23                        sasl_conn_t ** pconn);
24
25
26Description
27===========
28
29.. c:function:: int sasl_client_new(const char *service,
30    const char *serverFQDN,
31    const char *iplocalport,
32    const char *ipremoteport,
33    const sasl_callback_t *prompt_supp,
34    unsigned flags,
35    sasl_conn_t ** pconn);
36
37    **sasl_client_new()** creates a new SASL context. This context will be
38    used for all SASL calls for one connection. It handles both
39    authentication and integrity/encryption layers after authentication.
40
41    :param service: the registered name of the service (usually the protocol name) using SASL (e.g. "imap").
42    :param serverFQDN: the fully qualified domain name of the server (e.g. "serverhost.example.com").
43    :param iplocalport:  the IP and port of the local side of the
44        connection, or NULL.  If iplocalport is NULL it will disable
45        mechanisms that require IP address information.  This
46        string must be in one of the   following   formats:
47        "a.b.c.d;port"  (IPv4),  "e:f:g:h:i:j:k:l;port" (IPv6), or
48        "e:f:g:h:i:j:a.b.c.d;port" (IPv6)
49    :param ipremoteport:  the IP and port of the remote side of the
50        connection, or NULL (see iplocalport)
51    :param prompt_supp: a list of client interactions supported
52        that is unique to this connection. If this parameter is
53        NULL the global callbacks (specified in :saslman:`sasl_client_init(3)`)
54        will be used. See :saslman:`sasl_callbacks(3)` for more information.
55    :param flags: are connection flags (see below)
56    :param pconn: the connection context allocated by the library.
57        This structure will be used for all future SASL calls for
58        this connection.
59
60Connection Flags
61----------------
62
63Flags that may be passed to **sasl_client_new()**:
64
65* `SASL_SUCCESS_DATA`: The protocol supports a server‐last send
66* `SASL_NEED_PROXY`: Force the use of a mechanism that supports an
67        authorization id that is not the authentication id.
68
69Return Value
70============
71
72SASL callback functions should return SASL return codes.
73See sasl.h for a complete list. :c:macro:`SASL_OK` indicates success.
74
75The following return codes indicate errors and should either be handled or the authentication
76session should be quit:
77
78* :c:macro:`SASL_NOMECH`: No mechanism meets requested properties
79* :c:macro:`SASL_BADPARAM`: Error in config file
80* :c:macro:`SASL_NOMEM`: Not enough memory to complete operation
81
82See Also
83========
84
85:rfc:`4422`,:saslman:`sasl(3)`, :saslman:`sasl_callbacks(3)`,
86:saslman:`sasl_client_init(3)`, :saslman:`sasl_client_start(3)`,
87:saslman:`sasl_client_step(3)`, :saslman:`sasl_setprop(3)`
88