xsecurelock  1.7.0
XSecureLock is an X11 screen lock utility.
Functions | Variables
authproto_pam.c File Reference
#include <locale.h>
#include <security/pam_appl.h>
#include <stdlib.h>
#include <string.h>
#include "../env_info.h"
#include "../env_settings.h"
#include "../logging.h"
#include "../util.h"
#include "authproto.h"

Functions

int ConverseOne (const struct pam_message *msg, struct pam_response *resp)
 Perform a single PAM conversation step. More...
 
int Converse (int num_msg, const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr)
 Perform a PAM conversation. More...
 
int CallPAMWithRetries (int(*pam_call)(pam_handle_t *, int), pam_handle_t *pam, int flags)
 Perform a single PAM operation with retrying logic. More...
 
int Authenticate (struct pam_conv *conv, pam_handle_t **pam)
 Perform PAM authentication. More...
 
int main ()
 The main program. More...
 

Variables

static int conv_error = 0
 Set if a conversation error has happened during the last PAM call. More...
 

Function Documentation

◆ Authenticate()

int Authenticate ( struct pam_conv *  conv,
pam_handle_t **  pam 
)

Perform PAM authentication.

Parameters
convThe PAM conversation handler.
pamThe PAM handle will be returned here.
Returns
The PAM status (PAM_SUCCESS after successful authentication, or anything else in case of error).

◆ CallPAMWithRetries()

int CallPAMWithRetries ( int(*)(pam_handle_t *, int)  pam_call,
pam_handle_t *  pam,
int  flags 
)

Perform a single PAM operation with retrying logic.

◆ Converse()

int Converse ( int  num_msg,
const struct pam_message **  msg,
struct pam_response **  resp,
void *  appdata_ptr 
)

Perform a PAM conversation.

Parameters
num_msgThe number of conversation steps to execute.
msgThe PAM messages.
respThe PAM responses to store the output in.
appdata_ptrUnused.
Returns
The PAM status (PAM_SUCCESS in case of success, or anything else in case of error).

◆ ConverseOne()

int ConverseOne ( const struct pam_message *  msg,
struct pam_response *  resp 
)

Perform a single PAM conversation step.

Parameters
msgThe PAM message.
respThe PAM response to store the output in.
Returns
The PAM status (PAM_SUCCESS in case of success, or anything else in case of error).

◆ main()

int main ( )

The main program.

Usage: ./authproto_pam; status=$?

Returns
0 if authentication successful, anything else otherwise.

Variable Documentation

◆ conv_error

int conv_error = 0
static

Set if a conversation error has happened during the last PAM call.