ProxyAuth
Linux PAM to authenticate device via Bluetooth device
Functions
pam_bt_trust.c File Reference
#include "pam_bt_trust.h"
Include dependency graph for pam_bt_trust.c:

Go to the source code of this file.

Functions

int find_trusted_paired_device (FILE *log_fp, char **trusted_devices, int num_of_devices, char **paired_devices, int num_of_paired, char **detected_dev)
 
FILE * get_trusted_dev_file (const char *trusted_dir_path, const char *username, FILE *log_fp)
 
void set_trusted_devices (FILE *trusted_dev_fp, char **trusted_devices, int num_trusted_devices)
 
char ** find_trusted_devices (FILE *log_fp, const char *trusted_dir_path, const char *username, int *num_of_devices)
 
int bluetooth_login (FILE *log_fp, const char *trusted_dir_path, const char *username, char **detected_dev)
 

Function Documentation

◆ bluetooth_login()

int bluetooth_login ( FILE *  log_fp,
const char *  trusted_dir_path,
const char *  username,
char **  detected_dev 
)

Deals whether or not the device is able to login via bluetooth

Parameters
log_fpthe file handle for the log file
trusted_dir_paththe path of where all the user's trusted devices are located
usernamethe username of the user who wants to login
detected_devThe bluetooth address of the device that authenticates PAM NOTE: find_trusted_paired_device(...) will allocate and set the bluetooth address. Developer must free the memory themselves
Returns
: return 1 if the trusted bluetooth device is detected

Definition at line 148 of file pam_bt_trust.c.

Here is the call graph for this function:

◆ find_trusted_devices()

char** find_trusted_devices ( FILE *  log_fp,
const char *  trusted_dir_path,
const char *  username,
int *  num_of_devices 
)

Populate the array with trusted devices

Parameters
log_fpthe file handle for the log file
trusted_dir_paththe path where the trusted bluetooth device files for all users are located
usernamethe username of the user that wants to log in
num_of_devicesthe number of devices the users trust to authenticate their system Note: the number is set in this function
Returns
the list of trusted devices

Definition at line 109 of file pam_bt_trust.c.

Here is the call graph for this function:

◆ find_trusted_paired_device()

int find_trusted_paired_device ( FILE *  log_fp,
char **  trusted_devices,
int  num_of_devices,
char **  paired_devices,
int  num_of_paired,
char **  detected_dev 
)

Return 1 iff a trusted device for the user is connected

Parameters
log_fpthe handle of the log file
trusted_devicesthe array of trusted bluetooth MAC addresses of the user
num_of_devicesthe number of devices the user trusts
detected_devthe address of the detected device NOTE: detected_dev will be set in this function if a device was detected
Returns
: 1 iff a trusted device for the user is detected

Definition at line 3 of file pam_bt_trust.c.

Here is the call graph for this function:

◆ get_trusted_dev_file()

FILE* get_trusted_dev_file ( const char *  trusted_dir_path,
const char *  username,
FILE *  log_fp 
)

Return file pointer for the user's trusted bluetooth device

Parameters
trusted_dir_paththe path to where all the user's trusted device file is located
usernamethe username
log_fpthe handle for the log file
Returns
: the file handle of the user's trusted device file

Definition at line 26 of file pam_bt_trust.c.

Here is the call graph for this function:

◆ set_trusted_devices()

void set_trusted_devices ( FILE *  trusted_dev_fp,
char **  trusted_devices,
int  num_trusted_devices 
)

Write to the array all the trusted bluetooth MAC addresses.

Parameters
trusted_dev_fpthe file handle of the user's trusted device file
trusted_devicesan array that will contain all the user's trusted bluetooth MAC addresses to authenticate from

Definition at line 81 of file pam_bt_trust.c.