Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
be9d7b7ea0 | ||
|
a0a7b2ccb2 | ||
|
21f2fdeeb9 | ||
|
fe268be38e | ||
|
2821e645a6 | ||
|
8e404a9411 | ||
|
f3fe7fe40b | ||
|
c3f5987ba2 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
||||
/glib-2.*.tar.xz
|
||||
glib-2.24.1.tar.bz2
|
||||
|
3417
1719.patch
3417
1719.patch
File diff suppressed because it is too large
Load Diff
32
1728.patch
32
1728.patch
@ -1,32 +0,0 @@
|
||||
From c2b8fa8a34765d42be69e7eb9a4c44eeb970f775 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Catanzaro <mcatanzaro@gnome.org>
|
||||
Date: Wed, 28 Oct 2020 10:41:13 -0500
|
||||
Subject: [PATCH] gsocketclient: fix crash when async connection step fails
|
||||
|
||||
This is a regression from !1686. The tmp_error is no longer valid after
|
||||
it is "considered" and cannot be used at this point. We should print the
|
||||
error earlier instead.
|
||||
|
||||
Fixes #2233
|
||||
---
|
||||
gio/gsocketclient.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gio/gsocketclient.c b/gio/gsocketclient.c
|
||||
index ce3c186fb..373774682 100644
|
||||
--- a/gio/gsocketclient.c
|
||||
+++ b/gio/gsocketclient.c
|
||||
@@ -1837,9 +1837,9 @@ g_socket_client_connected_callback (GObject *source,
|
||||
{
|
||||
if (!g_cancellable_is_cancelled (attempt->cancellable))
|
||||
{
|
||||
+ g_debug ("GSocketClient: Connection attempt failed: %s", data->error_info->tmp_error->message);
|
||||
clarify_connect_error (data->error_info->tmp_error, data->connectable, attempt->address);
|
||||
consider_tmp_error (data->error_info, G_SOCKET_CLIENT_CONNECTING);
|
||||
- g_debug ("GSocketClient: Connection attempt failed: %s", data->error_info->tmp_error->message);
|
||||
connection_attempt_remove (attempt);
|
||||
connection_attempt_unref (attempt);
|
||||
try_next_connection_or_finish (data, FALSE);
|
||||
--
|
||||
GitLab
|
||||
|
120
gio-2.16-selinux-set-support.diff
Normal file
120
gio-2.16-selinux-set-support.diff
Normal file
@ -0,0 +1,120 @@
|
||||
Index: gio/glocalfileinfo.c
|
||||
===================================================================
|
||||
--- gio/glocalfileinfo.c (revision 6871)
|
||||
+++ gio/glocalfileinfo.c (working copy)
|
||||
@@ -1706,6 +1706,24 @@
|
||||
#endif
|
||||
|
||||
static gboolean
|
||||
+get_string (const GFileAttributeValue *value,
|
||||
+ const char **val_out,
|
||||
+ GError **error)
|
||||
+{
|
||||
+ if (value->type != G_FILE_ATTRIBUTE_TYPE_STRING)
|
||||
+ {
|
||||
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
|
||||
+ _("Invalid attribute type (byte string expected)"));
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ *val_out = value->u.string;
|
||||
+
|
||||
+ return TRUE;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static gboolean
|
||||
set_unix_mode (char *filename,
|
||||
const GFileAttributeValue *value,
|
||||
GError **error)
|
||||
@@ -1948,6 +1966,52 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
+
|
||||
+static gboolean
|
||||
+set_selinux_context (char *filename,
|
||||
+ const GFileAttributeValue *value,
|
||||
+ GError **error)
|
||||
+{
|
||||
+ const char *val;
|
||||
+
|
||||
+ if (!get_string (value, &val, error))
|
||||
+ return FALSE;
|
||||
+
|
||||
+ if (val == NULL)
|
||||
+ {
|
||||
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
|
||||
+ _("SELinux context must be non-NULL"));
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+#ifdef HAVE_SELINUX
|
||||
+ if (is_selinux_enabled ()) {
|
||||
+ security_context_t val_s;
|
||||
+
|
||||
+ val_s = g_strdup (val);
|
||||
+
|
||||
+ if (setfilecon_raw (filename, val_s) < 0)
|
||||
+ {
|
||||
+ int errsv = errno;
|
||||
+
|
||||
+ g_set_error (error, G_IO_ERROR,
|
||||
+ g_io_error_from_errno (errsv),
|
||||
+ _("Error setting SELinux context: %s"),
|
||||
+ g_strerror (errsv));
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+ g_free (val_s);
|
||||
+ } else {
|
||||
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
|
||||
+ _("SELinux is not enabled on this system"));
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+ return TRUE;
|
||||
+}
|
||||
+
|
||||
+
|
||||
gboolean
|
||||
_g_local_file_info_set_attribute (char *filename,
|
||||
const char *attribute,
|
||||
@@ -1993,6 +2057,11 @@
|
||||
else if (g_str_has_prefix (attribute, "xattr-sys::"))
|
||||
return set_xattr (filename, attribute, &value, error);
|
||||
#endif
|
||||
+
|
||||
+#ifdef HAVE_SELINUX
|
||||
+ else if (strcmp (attribute, G_FILE_ATTRIBUTE_SELINUX_CONTEXT) == 0)
|
||||
+ return set_selinux_context (filename, &value, error);
|
||||
+#endif
|
||||
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
|
||||
_("Setting attribute %s not supported"), attribute);
|
||||
@@ -2110,5 +2179,25 @@
|
||||
|
||||
/* xattrs are handled by default callback */
|
||||
|
||||
+
|
||||
+ /* SELinux context */
|
||||
+#ifdef HAVE_SELINUX
|
||||
+ if (is_selinux_enabled ()) {
|
||||
+ value = _g_file_info_get_attribute_value (info, G_FILE_ATTRIBUTE_SELINUX_CONTEXT);
|
||||
+ if (value)
|
||||
+ {
|
||||
+ if (!set_selinux_context (filename, value, error))
|
||||
+ {
|
||||
+ value->status = G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING;
|
||||
+ res = FALSE;
|
||||
+ /* Don't set error multiple times */
|
||||
+ error = NULL;
|
||||
+ }
|
||||
+ else
|
||||
+ value->status = G_FILE_ATTRIBUTE_STATUS_SET;
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
return res;
|
||||
}
|
17
glib-abort-msg.patch
Normal file
17
glib-abort-msg.patch
Normal file
@ -0,0 +1,17 @@
|
||||
diff -up glib-2.23.2/glib/gtestutils.c.abort_msg glib-2.23.2/glib/gtestutils.c
|
||||
--- glib-2.23.2/glib/gtestutils.c.abort_msg 2010-01-25 18:32:10.793495994 -0500
|
||||
+++ glib-2.23.2/glib/gtestutils.c 2010-01-25 18:33:23.898497049 -0500
|
||||
@@ -40,7 +40,12 @@
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif /* HAVE_SYS_SELECT_H */
|
||||
-
|
||||
+
|
||||
+/* We can't use the libc variable, since rpm doesn't let us depend on
|
||||
+ * GLIBC_PRIVATE symbols.
|
||||
+ */
|
||||
+#undef HAVE_LIBC_ABORT_MSG
|
||||
+
|
||||
/* if we have a recent enough glibc, use its __abort_msg variable for storing
|
||||
* assertion messages (just like assert()). If not, declare our own variable,
|
||||
* so that platforms with older glibc or different libc implementations can use
|
6
glib2.csh
Normal file
6
glib2.csh
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
## This caused GLib2 applications to convert filenames from
|
||||
## locale encoding to UTF-8. If the locale encoding is already
|
||||
## UTF-8 then it makes no difference.
|
||||
|
||||
setenv G_BROKEN_FILENAMES 1
|
6
glib2.sh
Normal file
6
glib2.sh
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
## This caused GLib2 applications to convert filenames from
|
||||
## locale encoding to UTF-8. If the locale encoding is already
|
||||
## UTF-8 then it makes no difference.
|
||||
|
||||
export G_BROKEN_FILENAMES=1
|
1281
glib2.spec
1281
glib2.spec
File diff suppressed because it is too large
Load Diff
@ -1,668 +0,0 @@
|
||||
From afb5735506e2ed1c638a8c916aa3748bf0615f32 Mon Sep 17 00:00:00 2001
|
||||
From: Colin Walters <walters@verbum.org>
|
||||
Date: Fri, 7 Jun 2019 18:44:43 +0000
|
||||
Subject: [PATCH 1/2] ghmac: Split off wrapper functions into ghmac-utils.c
|
||||
|
||||
Prep for adding a GnuTLS HMAC implementation; these are just
|
||||
utility functions that call the "core" API.
|
||||
---
|
||||
glib/ghmac-utils.c | 145 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
glib/ghmac.c | 112 ----------------------------------
|
||||
glib/meson.build | 1 +
|
||||
3 files changed, 146 insertions(+), 112 deletions(-)
|
||||
create mode 100644 glib/ghmac-utils.c
|
||||
|
||||
diff --git a/glib/ghmac-utils.c b/glib/ghmac-utils.c
|
||||
new file mode 100644
|
||||
index 000000000..a17359ff1
|
||||
--- /dev/null
|
||||
+++ b/glib/ghmac-utils.c
|
||||
@@ -0,0 +1,145 @@
|
||||
+/* ghmac.h - data hashing functions
|
||||
+ *
|
||||
+ * Copyright (C) 2011 Collabora Ltd.
|
||||
+ * Copyright (C) 2019 Red Hat, Inc.
|
||||
+ *
|
||||
+ * This library is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This library is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public License
|
||||
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
+
|
||||
+#include "config.h"
|
||||
+
|
||||
+#include <string.h>
|
||||
+
|
||||
+#include "ghmac.h"
|
||||
+
|
||||
+#include "glib/galloca.h"
|
||||
+#include "gatomic.h"
|
||||
+#include "gslice.h"
|
||||
+#include "gmem.h"
|
||||
+#include "gstrfuncs.h"
|
||||
+#include "gtestutils.h"
|
||||
+#include "gtypes.h"
|
||||
+#include "glibintl.h"
|
||||
+
|
||||
+/**
|
||||
+ * g_compute_hmac_for_data:
|
||||
+ * @digest_type: a #GChecksumType to use for the HMAC
|
||||
+ * @key: (array length=key_len): the key to use in the HMAC
|
||||
+ * @key_len: the length of the key
|
||||
+ * @data: (array length=length): binary blob to compute the HMAC of
|
||||
+ * @length: length of @data
|
||||
+ *
|
||||
+ * Computes the HMAC for a binary @data of @length. This is a
|
||||
+ * convenience wrapper for g_hmac_new(), g_hmac_get_string()
|
||||
+ * and g_hmac_unref().
|
||||
+ *
|
||||
+ * The hexadecimal string returned will be in lower case.
|
||||
+ *
|
||||
+ * Returns: the HMAC of the binary data as a string in hexadecimal.
|
||||
+ * The returned string should be freed with g_free() when done using it.
|
||||
+ *
|
||||
+ * Since: 2.30
|
||||
+ */
|
||||
+gchar *
|
||||
+g_compute_hmac_for_data (GChecksumType digest_type,
|
||||
+ const guchar *key,
|
||||
+ gsize key_len,
|
||||
+ const guchar *data,
|
||||
+ gsize length)
|
||||
+{
|
||||
+ GHmac *hmac;
|
||||
+ gchar *retval;
|
||||
+
|
||||
+ g_return_val_if_fail (length == 0 || data != NULL, NULL);
|
||||
+
|
||||
+ hmac = g_hmac_new (digest_type, key, key_len);
|
||||
+ if (!hmac)
|
||||
+ return NULL;
|
||||
+
|
||||
+ g_hmac_update (hmac, data, length);
|
||||
+ retval = g_strdup (g_hmac_get_string (hmac));
|
||||
+ g_hmac_unref (hmac);
|
||||
+
|
||||
+ return retval;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * g_compute_hmac_for_bytes:
|
||||
+ * @digest_type: a #GChecksumType to use for the HMAC
|
||||
+ * @key: the key to use in the HMAC
|
||||
+ * @data: binary blob to compute the HMAC of
|
||||
+ *
|
||||
+ * Computes the HMAC for a binary @data. This is a
|
||||
+ * convenience wrapper for g_hmac_new(), g_hmac_get_string()
|
||||
+ * and g_hmac_unref().
|
||||
+ *
|
||||
+ * The hexadecimal string returned will be in lower case.
|
||||
+ *
|
||||
+ * Returns: the HMAC of the binary data as a string in hexadecimal.
|
||||
+ * The returned string should be freed with g_free() when done using it.
|
||||
+ *
|
||||
+ * Since: 2.50
|
||||
+ */
|
||||
+gchar *
|
||||
+g_compute_hmac_for_bytes (GChecksumType digest_type,
|
||||
+ GBytes *key,
|
||||
+ GBytes *data)
|
||||
+{
|
||||
+ gconstpointer byte_data;
|
||||
+ gsize length;
|
||||
+ gconstpointer key_data;
|
||||
+ gsize key_len;
|
||||
+
|
||||
+ g_return_val_if_fail (data != NULL, NULL);
|
||||
+ g_return_val_if_fail (key != NULL, NULL);
|
||||
+
|
||||
+ byte_data = g_bytes_get_data (data, &length);
|
||||
+ key_data = g_bytes_get_data (key, &key_len);
|
||||
+ return g_compute_hmac_for_data (digest_type, key_data, key_len, byte_data, length);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * g_compute_hmac_for_string:
|
||||
+ * @digest_type: a #GChecksumType to use for the HMAC
|
||||
+ * @key: (array length=key_len): the key to use in the HMAC
|
||||
+ * @key_len: the length of the key
|
||||
+ * @str: the string to compute the HMAC for
|
||||
+ * @length: the length of the string, or -1 if the string is nul-terminated
|
||||
+ *
|
||||
+ * Computes the HMAC for a string.
|
||||
+ *
|
||||
+ * The hexadecimal string returned will be in lower case.
|
||||
+ *
|
||||
+ * Returns: the HMAC as a hexadecimal string.
|
||||
+ * The returned string should be freed with g_free()
|
||||
+ * when done using it.
|
||||
+ *
|
||||
+ * Since: 2.30
|
||||
+ */
|
||||
+gchar *
|
||||
+g_compute_hmac_for_string (GChecksumType digest_type,
|
||||
+ const guchar *key,
|
||||
+ gsize key_len,
|
||||
+ const gchar *str,
|
||||
+ gssize length)
|
||||
+{
|
||||
+ g_return_val_if_fail (length == 0 || str != NULL, NULL);
|
||||
+
|
||||
+ if (length < 0)
|
||||
+ length = strlen (str);
|
||||
+
|
||||
+ return g_compute_hmac_for_data (digest_type, key, key_len,
|
||||
+ (const guchar *) str, length);
|
||||
+}
|
||||
diff --git a/glib/ghmac.c b/glib/ghmac.c
|
||||
index 49fd272f0..4f181f21f 100644
|
||||
--- a/glib/ghmac.c
|
||||
+++ b/glib/ghmac.c
|
||||
@@ -329,115 +329,3 @@ g_hmac_get_digest (GHmac *hmac,
|
||||
g_checksum_update (hmac->digesto, buffer, len);
|
||||
g_checksum_get_digest (hmac->digesto, buffer, digest_len);
|
||||
}
|
||||
-
|
||||
-/**
|
||||
- * g_compute_hmac_for_data:
|
||||
- * @digest_type: a #GChecksumType to use for the HMAC
|
||||
- * @key: (array length=key_len): the key to use in the HMAC
|
||||
- * @key_len: the length of the key
|
||||
- * @data: (array length=length): binary blob to compute the HMAC of
|
||||
- * @length: length of @data
|
||||
- *
|
||||
- * Computes the HMAC for a binary @data of @length. This is a
|
||||
- * convenience wrapper for g_hmac_new(), g_hmac_get_string()
|
||||
- * and g_hmac_unref().
|
||||
- *
|
||||
- * The hexadecimal string returned will be in lower case.
|
||||
- *
|
||||
- * Returns: the HMAC of the binary data as a string in hexadecimal.
|
||||
- * The returned string should be freed with g_free() when done using it.
|
||||
- *
|
||||
- * Since: 2.30
|
||||
- */
|
||||
-gchar *
|
||||
-g_compute_hmac_for_data (GChecksumType digest_type,
|
||||
- const guchar *key,
|
||||
- gsize key_len,
|
||||
- const guchar *data,
|
||||
- gsize length)
|
||||
-{
|
||||
- GHmac *hmac;
|
||||
- gchar *retval;
|
||||
-
|
||||
- g_return_val_if_fail (length == 0 || data != NULL, NULL);
|
||||
-
|
||||
- hmac = g_hmac_new (digest_type, key, key_len);
|
||||
- if (!hmac)
|
||||
- return NULL;
|
||||
-
|
||||
- g_hmac_update (hmac, data, length);
|
||||
- retval = g_strdup (g_hmac_get_string (hmac));
|
||||
- g_hmac_unref (hmac);
|
||||
-
|
||||
- return retval;
|
||||
-}
|
||||
-
|
||||
-/**
|
||||
- * g_compute_hmac_for_bytes:
|
||||
- * @digest_type: a #GChecksumType to use for the HMAC
|
||||
- * @key: the key to use in the HMAC
|
||||
- * @data: binary blob to compute the HMAC of
|
||||
- *
|
||||
- * Computes the HMAC for a binary @data. This is a
|
||||
- * convenience wrapper for g_hmac_new(), g_hmac_get_string()
|
||||
- * and g_hmac_unref().
|
||||
- *
|
||||
- * The hexadecimal string returned will be in lower case.
|
||||
- *
|
||||
- * Returns: the HMAC of the binary data as a string in hexadecimal.
|
||||
- * The returned string should be freed with g_free() when done using it.
|
||||
- *
|
||||
- * Since: 2.50
|
||||
- */
|
||||
-gchar *
|
||||
-g_compute_hmac_for_bytes (GChecksumType digest_type,
|
||||
- GBytes *key,
|
||||
- GBytes *data)
|
||||
-{
|
||||
- gconstpointer byte_data;
|
||||
- gsize length;
|
||||
- gconstpointer key_data;
|
||||
- gsize key_len;
|
||||
-
|
||||
- g_return_val_if_fail (data != NULL, NULL);
|
||||
- g_return_val_if_fail (key != NULL, NULL);
|
||||
-
|
||||
- byte_data = g_bytes_get_data (data, &length);
|
||||
- key_data = g_bytes_get_data (key, &key_len);
|
||||
- return g_compute_hmac_for_data (digest_type, key_data, key_len, byte_data, length);
|
||||
-}
|
||||
-
|
||||
-
|
||||
-/**
|
||||
- * g_compute_hmac_for_string:
|
||||
- * @digest_type: a #GChecksumType to use for the HMAC
|
||||
- * @key: (array length=key_len): the key to use in the HMAC
|
||||
- * @key_len: the length of the key
|
||||
- * @str: the string to compute the HMAC for
|
||||
- * @length: the length of the string, or -1 if the string is nul-terminated
|
||||
- *
|
||||
- * Computes the HMAC for a string.
|
||||
- *
|
||||
- * The hexadecimal string returned will be in lower case.
|
||||
- *
|
||||
- * Returns: the HMAC as a hexadecimal string.
|
||||
- * The returned string should be freed with g_free()
|
||||
- * when done using it.
|
||||
- *
|
||||
- * Since: 2.30
|
||||
- */
|
||||
-gchar *
|
||||
-g_compute_hmac_for_string (GChecksumType digest_type,
|
||||
- const guchar *key,
|
||||
- gsize key_len,
|
||||
- const gchar *str,
|
||||
- gssize length)
|
||||
-{
|
||||
- g_return_val_if_fail (length == 0 || str != NULL, NULL);
|
||||
-
|
||||
- if (length < 0)
|
||||
- length = strlen (str);
|
||||
-
|
||||
- return g_compute_hmac_for_data (digest_type, key, key_len,
|
||||
- (const guchar *) str, length);
|
||||
-}
|
||||
diff --git a/glib/meson.build b/glib/meson.build
|
||||
index aaf40a218..b3bf067c7 100644
|
||||
--- a/glib/meson.build
|
||||
+++ b/glib/meson.build
|
||||
@@ -253,6 +253,7 @@ glib_sources = files(
|
||||
'ggettext.c',
|
||||
'ghash.c',
|
||||
'ghmac.c',
|
||||
+ 'ghmac-utils.c',
|
||||
'ghook.c',
|
||||
'ghostutils.c',
|
||||
'giochannel.c',
|
||||
--
|
||||
2.28.0
|
||||
|
||||
|
||||
From 703e63f9d8b3ea4f26f41f0d2287b301025a73cc Mon Sep 17 00:00:00 2001
|
||||
From: Colin Walters <walters@verbum.org>
|
||||
Date: Fri, 7 Jun 2019 19:36:54 +0000
|
||||
Subject: [PATCH 2/2] Add a gnutls backend for GHmac
|
||||
|
||||
For RHEL we want apps to use FIPS-certified crypto libraries,
|
||||
and HMAC apparently counts as "keyed" and hence needs to
|
||||
be validated.
|
||||
|
||||
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1630260
|
||||
Replaces: https://gitlab.gnome.org/GNOME/glib/merge_requests/897
|
||||
|
||||
This is a build-time option that backs the GHmac API with GnuTLS.
|
||||
Most distributors ship glib-networking built with GnuTLS, and
|
||||
most apps use glib-networking, so this isn't a net-new library
|
||||
in most cases.
|
||||
|
||||
mcatanzaro note: I've updated Colin's original patch to implement
|
||||
g_hmac_copy() using gnutls_hmac_copy(), which didn't exist when Colin
|
||||
developed this patch.
|
||||
---
|
||||
glib/gchecksum.c | 9 ++-
|
||||
glib/gchecksumprivate.h | 32 ++++++++
|
||||
glib/ghmac-gnutls.c | 164 ++++++++++++++++++++++++++++++++++++++++
|
||||
glib/ghmac.c | 3 +
|
||||
glib/meson.build | 10 ++-
|
||||
meson.build | 7 ++
|
||||
meson_options.txt | 5 ++
|
||||
7 files changed, 224 insertions(+), 6 deletions(-)
|
||||
create mode 100644 glib/gchecksumprivate.h
|
||||
create mode 100644 glib/ghmac-gnutls.c
|
||||
|
||||
diff --git a/glib/gchecksum.c b/glib/gchecksum.c
|
||||
index f8a3f9ab8..b391a6264 100644
|
||||
--- a/glib/gchecksum.c
|
||||
+++ b/glib/gchecksum.c
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
-#include "gchecksum.h"
|
||||
+#include "gchecksumprivate.h"
|
||||
|
||||
#include "gslice.h"
|
||||
#include "gmem.h"
|
||||
@@ -173,9 +173,9 @@ sha_byte_reverse (guint32 *buffer,
|
||||
}
|
||||
#endif /* G_BYTE_ORDER == G_BIG_ENDIAN */
|
||||
|
||||
-static gchar *
|
||||
-digest_to_string (guint8 *digest,
|
||||
- gsize digest_len)
|
||||
+gchar *
|
||||
+gchecksum_digest_to_string (guint8 *digest,
|
||||
+ gsize digest_len)
|
||||
{
|
||||
gsize i, len = digest_len * 2;
|
||||
gchar *retval;
|
||||
@@ -194,6 +194,7 @@ digest_to_string (guint8 *digest,
|
||||
|
||||
return retval;
|
||||
}
|
||||
+#define digest_to_string gchecksum_digest_to_string
|
||||
|
||||
/*
|
||||
* MD5 Checksum
|
||||
diff --git a/glib/gchecksumprivate.h b/glib/gchecksumprivate.h
|
||||
new file mode 100644
|
||||
index 000000000..86c7a3b61
|
||||
--- /dev/null
|
||||
+++ b/glib/gchecksumprivate.h
|
||||
@@ -0,0 +1,32 @@
|
||||
+/* gstdioprivate.h - Private GLib stdio functions
|
||||
+ *
|
||||
+ * Copyright 2017 Руслан Ижбулатов
|
||||
+ *
|
||||
+ * This library is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This library is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public License
|
||||
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
+
|
||||
+#ifndef __G_CHECKSUMPRIVATE_H__
|
||||
+#define __G_CHECKSUMPRIVATE_H__
|
||||
+
|
||||
+#include "gchecksum.h"
|
||||
+
|
||||
+G_BEGIN_DECLS
|
||||
+
|
||||
+gchar *
|
||||
+gchecksum_digest_to_string (guint8 *digest,
|
||||
+ gsize digest_len);
|
||||
+
|
||||
+G_END_DECLS
|
||||
+
|
||||
+#endif
|
||||
\ No newline at end of file
|
||||
diff --git a/glib/ghmac-gnutls.c b/glib/ghmac-gnutls.c
|
||||
new file mode 100644
|
||||
index 000000000..f1a74a849
|
||||
--- /dev/null
|
||||
+++ b/glib/ghmac-gnutls.c
|
||||
@@ -0,0 +1,164 @@
|
||||
+/* ghmac.h - data hashing functions
|
||||
+ *
|
||||
+ * Copyright (C) 2011 Collabora Ltd.
|
||||
+ * Copyright (C) 2019 Red Hat, Inc.
|
||||
+ *
|
||||
+ * This library is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This library is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public License
|
||||
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
+
|
||||
+#include "config.h"
|
||||
+
|
||||
+#include <string.h>
|
||||
+#include <gnutls/crypto.h>
|
||||
+
|
||||
+#include "ghmac.h"
|
||||
+
|
||||
+#include "glib/galloca.h"
|
||||
+#include "gatomic.h"
|
||||
+#include "gslice.h"
|
||||
+#include "gmem.h"
|
||||
+#include "gstrfuncs.h"
|
||||
+#include "gchecksumprivate.h"
|
||||
+#include "gtestutils.h"
|
||||
+#include "gtypes.h"
|
||||
+#include "glibintl.h"
|
||||
+
|
||||
+#ifndef HAVE_GNUTLS
|
||||
+#error "build configuration error"
|
||||
+#endif
|
||||
+
|
||||
+struct _GHmac
|
||||
+{
|
||||
+ int ref_count;
|
||||
+ GChecksumType digest_type;
|
||||
+ gnutls_hmac_hd_t hmac;
|
||||
+ gchar *digest_str;
|
||||
+};
|
||||
+
|
||||
+GHmac *
|
||||
+g_hmac_new (GChecksumType digest_type,
|
||||
+ const guchar *key,
|
||||
+ gsize key_len)
|
||||
+{
|
||||
+ gnutls_mac_algorithm_t algo;
|
||||
+ GHmac *hmac = g_slice_new0 (GHmac);
|
||||
+ hmac->ref_count = 1;
|
||||
+ hmac->digest_type = digest_type;
|
||||
+
|
||||
+ switch (digest_type)
|
||||
+ {
|
||||
+ case G_CHECKSUM_MD5:
|
||||
+ algo = GNUTLS_MAC_MD5;
|
||||
+ break;
|
||||
+ case G_CHECKSUM_SHA1:
|
||||
+ algo = GNUTLS_MAC_SHA1;
|
||||
+ break;
|
||||
+ case G_CHECKSUM_SHA256:
|
||||
+ algo = GNUTLS_MAC_SHA256;
|
||||
+ break;
|
||||
+ case G_CHECKSUM_SHA384:
|
||||
+ algo = GNUTLS_MAC_SHA384;
|
||||
+ break;
|
||||
+ case G_CHECKSUM_SHA512:
|
||||
+ algo = GNUTLS_MAC_SHA512;
|
||||
+ break;
|
||||
+ default:
|
||||
+ g_return_val_if_reached (NULL);
|
||||
+ }
|
||||
+
|
||||
+ gnutls_hmac_init (&hmac->hmac, algo, key, key_len);
|
||||
+
|
||||
+ return hmac;
|
||||
+}
|
||||
+
|
||||
+GHmac *
|
||||
+g_hmac_copy (const GHmac *hmac)
|
||||
+{
|
||||
+ GHmac *copy;
|
||||
+
|
||||
+ g_return_val_if_fail (hmac != NULL, NULL);
|
||||
+
|
||||
+ copy = g_slice_new0 (GHmac);
|
||||
+ copy->ref_count = 1;
|
||||
+ copy->digest_type = hmac->digest_type;
|
||||
+ copy->hmac = gnutls_hmac_copy (hmac->hmac);
|
||||
+
|
||||
+ return copy;
|
||||
+}
|
||||
+
|
||||
+GHmac *
|
||||
+g_hmac_ref (GHmac *hmac)
|
||||
+{
|
||||
+ g_return_val_if_fail (hmac != NULL, NULL);
|
||||
+
|
||||
+ g_atomic_int_inc (&hmac->ref_count);
|
||||
+
|
||||
+ return hmac;
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+g_hmac_unref (GHmac *hmac)
|
||||
+{
|
||||
+ g_return_if_fail (hmac != NULL);
|
||||
+
|
||||
+ if (g_atomic_int_dec_and_test (&hmac->ref_count))
|
||||
+ {
|
||||
+ gnutls_hmac_deinit (hmac->hmac, NULL);
|
||||
+ g_free (hmac->digest_str);
|
||||
+ g_slice_free (GHmac, hmac);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
+void
|
||||
+g_hmac_update (GHmac *hmac,
|
||||
+ const guchar *data,
|
||||
+ gssize length)
|
||||
+{
|
||||
+ g_return_if_fail (hmac != NULL);
|
||||
+ g_return_if_fail (length == 0 || data != NULL);
|
||||
+
|
||||
+ gnutls_hmac (hmac->hmac, data, length);
|
||||
+}
|
||||
+
|
||||
+const gchar *
|
||||
+g_hmac_get_string (GHmac *hmac)
|
||||
+{
|
||||
+ guint8 *buffer;
|
||||
+ gsize digest_len;
|
||||
+
|
||||
+ g_return_val_if_fail (hmac != NULL, NULL);
|
||||
+
|
||||
+ if (hmac->digest_str)
|
||||
+ return hmac->digest_str;
|
||||
+
|
||||
+ digest_len = g_checksum_type_get_length (hmac->digest_type);
|
||||
+ buffer = g_alloca (digest_len);
|
||||
+
|
||||
+ gnutls_hmac_output (hmac->hmac, buffer);
|
||||
+ hmac->digest_str = gchecksum_digest_to_string (buffer, digest_len);
|
||||
+ return hmac->digest_str;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+void
|
||||
+g_hmac_get_digest (GHmac *hmac,
|
||||
+ guint8 *buffer,
|
||||
+ gsize *digest_len)
|
||||
+{
|
||||
+ g_return_if_fail (hmac != NULL);
|
||||
+
|
||||
+ gnutls_hmac_output (hmac->hmac, buffer);
|
||||
+ *digest_len = g_checksum_type_get_length (hmac->digest_type);
|
||||
+}
|
||||
diff --git a/glib/ghmac.c b/glib/ghmac.c
|
||||
index 4f181f21f..c62d9ce4e 100644
|
||||
--- a/glib/ghmac.c
|
||||
+++ b/glib/ghmac.c
|
||||
@@ -33,6 +33,9 @@
|
||||
#include "gtypes.h"
|
||||
#include "glibintl.h"
|
||||
|
||||
+#ifdef HAVE_GNUTLS
|
||||
+#error "build configuration error"
|
||||
+#endif
|
||||
|
||||
/**
|
||||
* SECTION:hmac
|
||||
diff --git a/glib/meson.build b/glib/meson.build
|
||||
index b3bf067c7..3cdc3b573 100644
|
||||
--- a/glib/meson.build
|
||||
+++ b/glib/meson.build
|
||||
@@ -252,7 +252,6 @@ glib_sources = files(
|
||||
'gfileutils.c',
|
||||
'ggettext.c',
|
||||
'ghash.c',
|
||||
- 'ghmac.c',
|
||||
'ghmac-utils.c',
|
||||
'ghook.c',
|
||||
'ghostutils.c',
|
||||
@@ -308,6 +307,7 @@ glib_sources = files(
|
||||
'guriprivate.h',
|
||||
'gutils.c',
|
||||
'gutilsprivate.h',
|
||||
+ 'gchecksumprivate.h',
|
||||
'guuid.c',
|
||||
'gvariant.c',
|
||||
'gvariant-core.c',
|
||||
@@ -352,6 +352,12 @@ else
|
||||
glib_dtrace_hdr = []
|
||||
endif
|
||||
|
||||
+if get_option('gnutls')
|
||||
+ glib_sources += files('ghmac-gnutls.c')
|
||||
+else
|
||||
+ glib_sources += files('ghmac.c')
|
||||
+endif
|
||||
+
|
||||
pcre_static_args = []
|
||||
|
||||
if use_pcre_static_flag
|
||||
@@ -378,7 +384,7 @@ libglib = library('glib-2.0',
|
||||
# intl.lib is not compatible with SAFESEH
|
||||
link_args : [noseh_link_args, glib_link_flags, win32_ldflags],
|
||||
include_directories : configinc,
|
||||
- dependencies : pcre_deps + [thread_dep, librt] + libintl_deps + libiconv + platform_deps + gnulib_libm_dependency + [libsysprof_capture_dep],
|
||||
+ dependencies : pcre_deps + libgnutls_dep + [thread_dep, librt] + libintl_deps + libiconv + platform_deps + gnulib_libm_dependency + [libsysprof_capture_dep],
|
||||
c_args : glib_c_args,
|
||||
objc_args : glib_c_args,
|
||||
)
|
||||
diff --git a/meson.build b/meson.build
|
||||
index e0b308a25..70dd5355e 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -2056,6 +2056,13 @@ if host_system == 'linux'
|
||||
glib_conf.set('HAVE_LIBMOUNT', libmount_dep.found())
|
||||
endif
|
||||
|
||||
+# gnutls is used optionally by ghmac
|
||||
+libgnutls_dep = []
|
||||
+if get_option('gnutls')
|
||||
+ libgnutls_dep = [dependency('gnutls', version : '>=3.6.9', required : true)]
|
||||
+ glib_conf.set('HAVE_GNUTLS', 1)
|
||||
+endif
|
||||
+
|
||||
if host_system == 'windows'
|
||||
winsock2 = cc.find_library('ws2_32')
|
||||
endif
|
||||
diff --git a/meson_options.txt b/meson_options.txt
|
||||
index af9645eda..2c4b2c37e 100644
|
||||
--- a/meson_options.txt
|
||||
+++ b/meson_options.txt
|
||||
@@ -34,6 +34,11 @@ option('libmount',
|
||||
value : 'auto',
|
||||
description : 'build with libmount support')
|
||||
|
||||
+option('gnutls',
|
||||
+ type : 'boolean',
|
||||
+ value : false,
|
||||
+ description : 'build with gnutls support')
|
||||
+
|
||||
option('internal_pcre',
|
||||
type : 'boolean',
|
||||
value : false,
|
||||
--
|
||||
2.28.0
|
43
pyloc.patch
Normal file
43
pyloc.patch
Normal file
@ -0,0 +1,43 @@
|
||||
diff -up glib-2.22.0/configure.in.pyloc glib-2.22.0/configure.in
|
||||
--- glib-2.22.0/configure.in.pyloc 2009-09-22 09:40:56.000000000 -0400
|
||||
+++ glib-2.22.0/configure.in 2009-09-23 15:37:23.729418282 -0400
|
||||
@@ -256,8 +256,10 @@ AC_ARG_WITH(runtime-libdir,
|
||||
[Install runtime libraries relative to libdir])],
|
||||
[],
|
||||
[with_runtime_libdir=""])
|
||||
-GLIB_RUNTIME_LIBDIR=$with_runtime_libdir
|
||||
+GLIB_RUNTIME_LIBDIR="$with_runtime_libdir"
|
||||
+ABS_GLIB_RUNTIME_LIBDIR="`readlink -f $libdir/$with_runtime_libdir`"
|
||||
AC_SUBST(GLIB_RUNTIME_LIBDIR)
|
||||
+AC_SUBST(ABS_GLIB_RUNTIME_LIBDIR)
|
||||
AM_CONDITIONAL(HAVE_GLIB_RUNTIME_LIBDIR, [test "x$with_runtime_libdir" != "x"])
|
||||
|
||||
dnl Checks for programs.
|
||||
diff -up glib-2.22.0/glib/Makefile.am.pyloc glib-2.22.0/glib/Makefile.am
|
||||
--- glib-2.22.0/glib/Makefile.am.pyloc 2009-09-22 16:19:35.000000000 -0400
|
||||
+++ glib-2.22.0/glib/Makefile.am 2009-09-23 15:53:09.109395306 -0400
|
||||
@@ -380,8 +380,8 @@ libglib-gdb.py: libglib-gdb.py.in
|
||||
|
||||
|
||||
install-data-hook: libglib-gdb.py
|
||||
- mkdir -p $(DESTDIR)$(datadir)/gdb/auto-load${libdir}
|
||||
- $(INSTALL) libglib-gdb.py $(DESTDIR)$(datadir)/gdb/auto-load${libdir}/libglib-2.0.so.0.$(LT_CURRENT).0-gdb.py
|
||||
+ mkdir -p $(DESTDIR)$(datadir)/gdb/auto-load$(ABS_GLIB_RUNTIME_LIBDIR)
|
||||
+ $(INSTALL) libglib-gdb.py $(DESTDIR)$(datadir)/gdb/auto-load$(ABS_GLIB_RUNTIME_LIBDIR)/libglib-2.0.so.0.$(LT_CURRENT).0-gdb.py
|
||||
if HAVE_GLIB_RUNTIME_LIBDIR
|
||||
mkdir -p $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
|
||||
mv $(DESTDIR)$(libdir)/libglib-2.0.so.0 $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
|
||||
diff -up glib-2.22.0/gobject/Makefile.am.pyloc glib-2.22.0/gobject/Makefile.am
|
||||
--- glib-2.22.0/gobject/Makefile.am.pyloc 2009-09-22 16:19:20.000000000 -0400
|
||||
+++ glib-2.22.0/gobject/Makefile.am 2009-09-23 15:53:18.011645753 -0400
|
||||
@@ -274,8 +274,8 @@ uninstall-gdb:
|
||||
-rm -r $(DESTDIR)$(datadir)/gdb
|
||||
|
||||
install-data-hook: libgobject-gdb.py
|
||||
- mkdir -p $(DESTDIR)$(datadir)/gdb/auto-load${libdir}
|
||||
- $(INSTALL) libgobject-gdb.py $(DESTDIR)$(datadir)/gdb/auto-load${libdir}/libgobject-2.0.so.0.$(LT_CURRENT).0-gdb.py
|
||||
+ mkdir -p $(DESTDIR)$(datadir)/gdb/auto-load/$(ABS_GLIB_RUNTIME_LIBDIR)
|
||||
+ $(INSTALL) libgobject-gdb.py $(DESTDIR)$(datadir)/gdb/auto-load/$(ABS_GLIB_RUNTIME_LIBDIR)/libgobject-2.0.so.0.$(LT_CURRENT).0-gdb.py
|
||||
if HAVE_GLIB_RUNTIME_LIBDIR
|
||||
mkdir -p $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
|
||||
mv $(DESTDIR)$(libdir)/libgobject-2.0.so.0 $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
|
Loading…
Reference in New Issue
Block a user