neon API reference NESETSERVERAUTH(3)
NAME
nesetserverauth, nesetproxyauth, neforgetauth -
register authentication callbacks
SYNOPSIS
#include
typedef int (*nerequestauth) (void *userdata,
const char *realm,
int attempt,
char *username,
char *password);
void nesetserverauth (nesession *session,
nerequestauth callback,
void *userdata);
void nesetproxyauth (nesession *session,
nerequestauth callback,
void *userdata);
void neforgetauth (nesession *session);
DESCRIPTION
The nerequestauth function type defines a callback which
is invoked when a server or proxy server requires user au-
thentication for a particular request. The realm string is
supplied by the server. The attempt is a counter giving the
number of times the request has been retried with different
authentication credentials. The first time the callback is
invoked for a particular request, attempt will be zero.
To retry the request using new authentication credentials,
the callback should return zero, and the username and pass-
word buffers must contain NUL-terminated strings. The
NEABUFSIZ constant gives the size of these buffers.
Tip
If you only wish to allow the user one attempt to enter
credentials, use the value of the attempt parameter as
the return value of the callback.
To abort the request, the callback should return a non-zero
value; in which case the contents of the username and pass-
word buffers are ignored.
neon 0.25.5 Last change: 20 January 2006 1
neon API reference NESETSERVERAUTH(3)
The neforgetauth function can be used to discard the
cached authentication credentials.
EXAMPLES
/* Function which prompts for a line of user input: */
extern char *promptfor(const char *prompt);
static int
myauth(void *userdata, const char *realm, int attempts,
char *username, char *password)
{
strncpy(username, promptfor("Username: "), NEABUFSIZ);
strncpy(password, promptfor("Password: "), NEABUFSIZ);
return attempts;
}
int main(...)
{
nesession *sess = nesessioncreate(...);
nesetserverauth(sess, myauth, NUL);
/* ... */
}
AUTHOR
Joe Orton .
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
box; cbp-1 cbp-1 l l . ATRIBUTE TYPE ATRIBUTE VALUE =
Availability SUNWneon = Interface Stability Volatile
NOTES
Source for Neon is available on http:/opensolaris.org.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
neon 0.25.5 Last change: 20 January 2006 2
neon API reference NESETSERVERAUTH(3)
ATRIBUTE TYPE ATRIBUTE VALUE
Availability SUNWneon
Interface Stability Volatile
NOTES
Source for Neon is available on http:/opensolaris.org.
neon 0.25.5 Last change: 20 January 2006 3
|