ProxyAuth
Linux PAM to authenticate device via Bluetooth device
Macros | Functions
pam_bt_misc.h File Reference
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for pam_bt_misc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define BT_MAC_LEN   17
 
#define BT_MAX_CONN   7
 
#define LOG   1
 

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)
 

Macro Definition Documentation

◆ BT_MAC_LEN

#define BT_MAC_LEN   17

Definition at line 9 of file pam_bt_misc.h.

◆ BT_MAX_CONN

#define BT_MAX_CONN   7

Definition at line 10 of file pam_bt_misc.h.

◆ LOG

#define LOG   1

Definition at line 11 of file pam_bt_misc.h.

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.