mirror of
https://gitlab.com/mishakmak/pam-fprint-grosshack.git
synced 2026-04-09 04:13:33 +02:00
Don't crash the server if there's no devices
Big ninny just crashed because there's no fingerprint readers. Hoo, hoo. My eyes are bleeding.
This commit is contained in:
committed by
Daniel Drake
parent
9743d9d2a0
commit
1abf51afa4
@ -70,7 +70,6 @@ typedef struct FprintManager FprintManager;
|
|||||||
typedef struct FprintManagerClass FprintManagerClass;
|
typedef struct FprintManagerClass FprintManagerClass;
|
||||||
|
|
||||||
FprintManager *fprint_manager_new(gboolean no_timeout);
|
FprintManager *fprint_manager_new(gboolean no_timeout);
|
||||||
GError *fprint_manager_get_error(FprintManager *manager);
|
|
||||||
GType fprint_manager_get_type(void);
|
GType fprint_manager_get_type(void);
|
||||||
|
|
||||||
/* Device */
|
/* Device */
|
||||||
|
|||||||
@ -346,12 +346,6 @@ int main(int argc, char **argv)
|
|||||||
/* create the one instance of the Manager object to be shared between
|
/* create the one instance of the Manager object to be shared between
|
||||||
* all fprintd users */
|
* all fprintd users */
|
||||||
manager = fprint_manager_new(no_timeout);
|
manager = fprint_manager_new(no_timeout);
|
||||||
error = fprint_manager_get_error (manager);
|
|
||||||
if (error != NULL) {
|
|
||||||
g_error("Couldn't create manager object: %s", error->message);
|
|
||||||
g_error_free (error);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
driver_proxy = dbus_g_proxy_new_for_name(fprintd_dbus_conn,
|
driver_proxy = dbus_g_proxy_new_for_name(fprintd_dbus_conn,
|
||||||
DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
|
DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
|
||||||
|
|||||||
@ -41,7 +41,6 @@ G_DEFINE_TYPE(FprintManager, fprint_manager, G_TYPE_OBJECT);
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GError *last_error;
|
|
||||||
GSList *dev_registry;
|
GSList *dev_registry;
|
||||||
gboolean no_timeout;
|
gboolean no_timeout;
|
||||||
guint timeout_id;
|
guint timeout_id;
|
||||||
@ -55,8 +54,6 @@ static void fprint_manager_finalize(GObject *object)
|
|||||||
FprintManagerPrivate *priv = FPRINT_MANAGER_GET_PRIVATE (object);
|
FprintManagerPrivate *priv = FPRINT_MANAGER_GET_PRIVATE (object);
|
||||||
|
|
||||||
g_slist_free(priv->dev_registry);
|
g_slist_free(priv->dev_registry);
|
||||||
if (priv->last_error)
|
|
||||||
g_error_free (priv->last_error);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS(parent_class)->finalize(object);
|
G_OBJECT_CLASS(parent_class)->finalize(object);
|
||||||
}
|
}
|
||||||
@ -123,15 +120,12 @@ fprint_manager_init (FprintManager *manager)
|
|||||||
struct fp_dscv_dev *ddev;
|
struct fp_dscv_dev *ddev;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
if (!discovered_devs) {
|
|
||||||
priv->last_error = g_error_new (FPRINT_ERROR, FPRINT_ERROR_INTERNAL,
|
|
||||||
_("An internal error occurred in libfprint"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dbus_g_connection_register_g_object(fprintd_dbus_conn,
|
dbus_g_connection_register_g_object(fprintd_dbus_conn,
|
||||||
"/net/reactivated/Fprint/Manager", G_OBJECT(manager));
|
"/net/reactivated/Fprint/Manager", G_OBJECT(manager));
|
||||||
|
|
||||||
|
if (discovered_devs == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
while ((ddev = discovered_devs[i++]) != NULL) {
|
while ((ddev = discovered_devs[i++]) != NULL) {
|
||||||
FprintDevice *rdev = fprint_device_new(ddev);
|
FprintDevice *rdev = fprint_device_new(ddev);
|
||||||
gchar *path;
|
gchar *path;
|
||||||
@ -162,16 +156,6 @@ FprintManager *fprint_manager_new(gboolean no_timeout)
|
|||||||
return FPRINT_MANAGER (object);
|
return FPRINT_MANAGER (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
GError *fprint_manager_get_error(FprintManager *manager)
|
|
||||||
{
|
|
||||||
FprintManagerPrivate *priv = FPRINT_MANAGER_GET_PRIVATE (manager);
|
|
||||||
|
|
||||||
if (priv->last_error == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return g_error_copy (priv->last_error);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean fprint_manager_get_devices(FprintManager *manager,
|
static gboolean fprint_manager_get_devices(FprintManager *manager,
|
||||||
GPtrArray **devices, GError **error)
|
GPtrArray **devices, GError **error)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user