fprintd: update to 0.8.1.

This commit is contained in:
Rasmus Thomsen 2019-01-02 12:02:15 +01:00 committed by maxice8
parent 05c80220c4
commit 069d05510e
3 changed files with 135 additions and 11 deletions

View file

@ -0,0 +1,47 @@
From 267e6b3238f41b19b61b6502d52769c06df1c8f6 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Thu, 23 Aug 2018 13:44:14 +0200
Subject: [PATCH] device: Fix client_username memory leak
No need to duplicate that string until we pass it out.
From https://bugs.launchpad.net/ubuntu/+source/fprintd/+bug/1745455/comments/7
---
src/device.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/device.c b/src/device.c
index e9b89bc..a305c9f 100644
--- a/src/device.c
+++ b/src/device.c
@@ -469,7 +469,6 @@ _fprint_device_check_for_username (FprintDevice *rdev,
char *sender;
unsigned long uid;
struct passwd *user;
- char *client_username;
/* Get details about the current sender, and username/uid */
conn = dbus_g_connection_get_connection (fprintd_dbus_conn);
@@ -490,17 +489,16 @@ _fprint_device_check_for_username (FprintDevice *rdev,
"Failed to get information about user UID %lu", uid);
return NULL;
}
- client_username = g_strdup (user->pw_name);
/* The current user is usually allowed to access their
* own data, this should be followed by PolicyKit checks
* anyway */
- if (username == NULL || *username == '\0' || g_str_equal (username, client_username)) {
+ if (username == NULL || *username == '\0' || g_str_equal (username, user->pw_name)) {
if (ret_sender != NULL)
*ret_sender = sender;
else
g_free (sender);
- return client_username;
+ return g_strdup (user->pw_name);
}
/* If we're not allowed to set a different username,
--
2.18.1

View file

@ -0,0 +1,75 @@
From 8de9164be0e4670cd8f3df3c9207a7555228efbf Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Thu, 23 Aug 2018 13:50:49 +0200
Subject: [PATCH] main: Fix memory leak when a save fails
and simplify the flow of that function.
From https://bugs.launchpad.net/ubuntu/+source/fprintd/+bug/1745455/comments/7
---
src/file_storage.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/file_storage.c b/src/file_storage.c
index 6b153ef..1c88be7 100644
--- a/src/file_storage.c
+++ b/src/file_storage.c
@@ -95,16 +95,16 @@ int file_storage_print_data_save(struct fp_print_data *data,
enum fp_finger finger, const char *username)
{
GError *err = NULL;
- char *path, *dirpath, *buf;
+ char *path, *dirpath;
size_t len;
int r;
char *base_store = NULL;
+ char *buf = NULL;
r = file_storage_get_basestore_for_username(username, &base_store);
- if (r < 0) {
- return r;
- }
+ if (r < 0)
+ goto out;
len = fp_print_data_get_data(data, (guchar **) &buf);
if (!len) {
@@ -115,27 +115,27 @@ int file_storage_print_data_save(struct fp_print_data *data,
path = __get_path_to_print(fp_print_data_get_driver_id(data), fp_print_data_get_devtype(data), finger, base_store);
dirpath = g_path_get_dirname(path);
r = g_mkdir_with_parents(dirpath, DIR_PERMS);
+ g_free(dirpath);
if (r < 0) {
- g_free(base_store);
g_free(path);
- g_free(dirpath);
- return r;
+ goto out;
}
//fp_dbg("saving to %s", path);
g_file_set_contents(path, buf, len, &err);
- free(buf);
- g_free(dirpath);
g_free(path);
if (err) {
r = err->code;
//fp_err("save failed: %s", err->message);
g_error_free(err);
/* FIXME interpret error codes */
- return r;
+ goto out;
}
- return 0;
+out:
+ g_clear_pointer(&buf, free);
+ g_clear_pointer(&base_store, g_free);
+ return r;
}
static int load_from_file(char *path, struct fp_print_data **data)
--
2.18.1

View file

@ -1,21 +1,23 @@
# Template file for 'fprintd'
pkgname=fprintd
version=0.8.0
version=0.8.1
revision=1
lib32disabled=yes
_release_hash=bdd9f91909f535368b7c21f72311704a
build_style=gnu-configure
configure_args="--sysconfdir=/etc/$pkgname --disable-static
configure_args="--sysconfdir=/etc/${pkgname} --disable-static
--without-systemdsystemunitdir"
conf_files="/etc/fprintd/fprintd.conf /etc/dbus-1/system.d/net.reactivated.Fprint.conf"
short_desc="Daemon that provides fingerprint scanning functionality"
maintainer="Enno Boland <gottox@voidlinux.eu>"
homepage="http://www.freedesktop.org/wiki/Software/fprint/"
conf_files="/etc/fprintd/fprintd.conf"
hostmakedepends="intltool pkg-config"
makedepends="libfprint-devel dbus-devel dbus-glib-devel polkit-devel pam-devel"
license="GPL-2"
distfiles="http://people.freedesktop.org/~hadess/${pkgname}-${version}.tar.xz"
checksum=33a54ca6c49b86c47469107e541d2b72d94e9236da57921c169d28af980f2202
short_desc="Daemon that provides fingerprint scanning functionality"
maintainer="Enno Boland <gottox@voidlinux.eu>"
license="GPL-2.0-or-later"
homepage="https://www.freedesktop.org/wiki/Software/fprint/"
distfiles="https://gitlab.freedesktop.org/libfprint/fprintd/uploads/${_release_hash}/fprintd-${version}.tar.xz"
checksum=34e91fdd0e41d1b57d4417c1ab3c43987dc09012772b8bab7ef46dafd3039a88
lib32disabled=yes
patch_args="-Np1"
post_install() {
mv $DESTDIR/etc/$pkgname/dbus-1 $DESTDIR/etc
mv $DESTDIR/etc/$pkgname/dbus-1 $DESTDIR/usr/share/dbus-1
}