Connecting to a Remote Instance and Authenticating in C Using RAD

When connecting to a remote instance, no implicit authentication is performed. The connection is not established until you authenticate. You can authenticate a connection to a remote instance by using the rc_auth_login() function. The client application must use the #include <rad/client/2/auth_login.h> header and link to the authentication module C binding library, /usr/lib/rad/client/c/libauthentication2_client.so.

Authentication is non-interactive, and a username and a password must be provided. Optionally, a handle to the PAM authentication object is returned if a reference is provided as the second argument to the rc_auth_login() function.

Example 2-2 C Language – Creating a RAD Remote Connection Over TCP IPv4 on Port 7777

#include <rad/radclient.h>
#include <rad/client/2/auth_login.h>

rc_instance_t *pam_inst;
rc_conn_t conn = rc_connect_tcp("host1",7777, NULL);

if (conn !=NULL) {
            rc_err_t status = rc_auth_login(conn, &pam_inst, "user", "password");
            if (status == RCE_OK){
                printf("Connected and authenticated!\n");
                }    
}

RAD is deployed as two cooperating processes. A proxy process is responsible for authentication and establishing communications. A slave process is created by the proxy and handles module processing. A slave is created for each client connection.