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

Go to the source code of this file.

Functions

int verify_bt_addr (char *address, FILE *log_fp)
 
int is_dev_trusted (FILE *log_fp, char *dev, char **trusted_devices, int num_of_devices)
 
void free_device_list (char **device_list, int num_of_devices)
 

Variables

const char * trusted_dir_path = "/etc/proxy_auth/"
 

Function Documentation

◆ free_device_list()

void free_device_list ( char **  device_list,
int  num_of_devices 
)

Free the list of bluetooth MAC addresses from memory

Parameters
device_listthe list of bluetooth MAC addresses
num_of_devicesthe cardinality of device array - represents the number of bluetooth devices stored in the array

Definition at line 55 of file pam_bt_misc.c.

◆ is_dev_trusted()

int is_dev_trusted ( FILE *  log_fp,
char *  dev,
char **  trusted_devices,
int  num_of_devices 
)

Return 1 iff the given address is one of the trusted devices the user trusts

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
Returns
: 1 iff the given address is one of the trusted devices the user trusts. Else return 0

Definition at line 46 of file pam_bt_misc.c.

◆ verify_bt_addr()

int verify_bt_addr ( char *  address,
FILE *  log_fp 
)

Return 1 iff the address is a valid Bluetooth Address

NOTE: Bluetooth Address is a 48 bit address. The function will treat address as a string expecting:

  • 17 bit string
  • Each bit can only be a hexadecimal digit other than ":" in pos 2 5 8 11 14
  • i.e. 00:00:00:00:00:00
Parameters
addressthe bluetooth address
log_fpthe file handle for the log file
Returns
: 1 iff the address is a valid Bluetooth Address. Else return 0 (False)

Definition at line 5 of file pam_bt_misc.c.

Variable Documentation

◆ trusted_dir_path

const char* trusted_dir_path = "/etc/proxy_auth/"

Definition at line 3 of file pam_bt_misc.c.