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

Go to the source code of this file.

Macros

#define BLUEZ_DBUS_NAME   "org.bluez"
 
#define BLUEZ_DBUS_OBJ_PATH   "/"
 
#define DBUS_INTERFACE_NAME   "org.freedesktop.DBus.ObjectManager"
 
#define DBUS_METHOD_NAME   "GetManagedObjects"
 
#define DBUS_METHOD_RETURN_TYPE   "(a{oa{sa{sv}}})"
 

Functions

char * check_is_paired (GVariant *properties)
 
char ** process_dbus_bt_list (GVariant *result, int *num_of_paired)
 
char ** get_paired_devices (int *num_of_paired)
 

Macro Definition Documentation

◆ BLUEZ_DBUS_NAME

#define BLUEZ_DBUS_NAME   "org.bluez"

Definition at line 9 of file pam_bt_pair.h.

◆ BLUEZ_DBUS_OBJ_PATH

#define BLUEZ_DBUS_OBJ_PATH   "/"

Definition at line 10 of file pam_bt_pair.h.

◆ DBUS_INTERFACE_NAME

#define DBUS_INTERFACE_NAME   "org.freedesktop.DBus.ObjectManager"

Definition at line 11 of file pam_bt_pair.h.

◆ DBUS_METHOD_NAME

#define DBUS_METHOD_NAME   "GetManagedObjects"

Definition at line 12 of file pam_bt_pair.h.

◆ DBUS_METHOD_RETURN_TYPE

#define DBUS_METHOD_RETURN_TYPE   "(a{oa{sa{sv}}})"

Definition at line 13 of file pam_bt_pair.h.

Function Documentation

◆ check_is_paired()

char* check_is_paired ( GVariant *  properties)

Return Bluetooth address if the device is paired. Else return NULL

Parameters
propertiesAn 'object' that holds a specific bluetooth device's metadata
Returns
: Return Bluetooth address if the device is paired. Else return NULL

Definition at line 3 of file pam_bt_pair.c.

◆ get_paired_devices()

char** get_paired_devices ( int *  num_of_paired)

Return a list of Bluetooth addresses that is currently paired (connected) to the host

Approach: Use dbus to list all the bluetooth devices and see the connected property The paired property only indicates if the device has been paired with the host before and not if it is currently paired

Parameters
num_of_pairedthe number of devices paired to the host NOTE: the value is set within the helper function that the function will call
Returns
: return a list of bluetooth addresses connected to the host

Definition at line 86 of file pam_bt_pair.c.

Here is the call graph for this function:

◆ process_dbus_bt_list()

char** process_dbus_bt_list ( GVariant *  result,
int *  num_of_paired 
)

Return a list of paired devices

Parameters
num_of_pairedthe number of devices that are paired NOTE: The number is set in this function
resultThe object returned by request to DBUS for all managed bluetooth object
Returns
: returns a list of paired devices. Need to free

Definition at line 43 of file pam_bt_pair.c.

Here is the call graph for this function: