AN_SET_BLOCKING

Section: Antinat Programmer's Manual (3)
Updated: 2005-01-03
Index Return to Main Contents
 

NAME

an_set_credentials - set the authentication details for a socket  

SYNOPSIS

#include <antinat.h>

int an_set_credentials(ANCONN s, const char * username, const char * password);  

DESCRIPTION

The an_set_credentials(3) function is used to set the username and password which will be used to authenticate to the proxy server. Authentication is only supported on some types of proxy server, and different schemes exist for eachi type. Some types support multiple authentication mechanisms.

Depending on the type of proxy you use, and its configuration, credentials may or may not be required. If they are, use this function to set the credentials on the socket. By default, credentials are read from the AN_USER and AN_PASS environment variables, if they are set. If not, the library will require a server that supports anonymous authentication, or connections will fail. Note also that if an_set_authscheme(3) has been called, and only an anonymous scheme has been selected, the values specified in this function will never be used.

s is a socket previously created with an_new_connection(3).

username is a pointer to a NULL-terminated character array containing the username to use. In many schemes, this is case-sensitive. This can be NULL if no username should be stored, and username-based authentication should not be supported.

password is a pointer to a NULL-terminated character array containing the password to use. In many schemes, this is case-sensitive. This can be NULL if no password is to be used.  

RETURN VALUE

This call returns AN_ERROR_SUCCESS to indicate successful completion.  

ERRORS

AN_ERROR_INVALIDARG
The socket handle is invalid.
AN_ERROR_NOMEM
There was not enough memory to allocate and store the username or password. If this occurs, the exact username and password combination remaining are undefined.
 

SEE ALSO

an_new_connection(3)  

AUTHOR

Malcolm Smith <[email protected]>


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
ERRORS
SEE ALSO
AUTHOR

Time: 14:19:44 GMT, January 09, 2005