openbsd-ports/x11/gnome/libsecret/patches/patch-libsecret_secret-attributes_c

51 lines
2.0 KiB
Plaintext

$OpenBSD: patch-libsecret_secret-attributes_c,v 1.1 2012/10/16 06:55:21 ajacoutot Exp $
From 7e02a594a77c2730efcc13dd141cc78e201cd7e3 Mon Sep 17 00:00:00 2001
From: Stef Walter <stefw@gnome.org>
Date: Fri, 12 Oct 2012 09:27:34 +0000
Subject: Better critical preconditions for invalid attributes
--- libsecret/secret-attributes.c.orig Wed Aug 8 07:48:25 2012
+++ libsecret/secret-attributes.c Tue Oct 16 08:50:16 2012
@@ -153,7 +153,7 @@ secret_attributes_buildv (const SecretSchema *schema,
}
if (!type_found) {
- g_warning ("The attribute '%s' was not found in the password schema.", attribute_name);
+ g_critical ("The attribute '%s' was not found in the password schema.", attribute_name);
g_hash_table_unref (attributes);
return NULL;
}
@@ -165,8 +165,12 @@ secret_attributes_buildv (const SecretSchema *schema,
break;
case SECRET_SCHEMA_ATTRIBUTE_STRING:
string = va_arg (va, gchar *);
+ if (string == NULL) {
+ g_critical ("The value for attribute '%s' was NULL", attribute_name);
+ return NULL;
+ }
if (!g_utf8_validate (string, -1, NULL)) {
- g_warning ("The value for attribute '%s' was not a valid utf-8 string.", attribute_name);
+ g_critical ("The value for attribute '%s' was not a valid UTF-8 string.", attribute_name);
g_hash_table_unref (attributes);
return NULL;
}
@@ -177,7 +181,7 @@ secret_attributes_buildv (const SecretSchema *schema,
value = g_strdup_printf ("%d", integer);
break;
default:
- g_warning ("The password attribute '%s' has an invalid type in the password schema.", attribute_name);
+ g_critical ("The password attribute '%s' has an invalid type in the password schema.", attribute_name);
g_hash_table_unref (attributes);
return NULL;
}
@@ -220,7 +224,7 @@ _secret_attributes_validate (const SecretSchema *schem
}
if (attribute == NULL) {
- g_critical ("%s: invalid %s attribute in for %s schema",
+ g_critical ("%s: invalid %s attribute for %s schema",
pretty_function, key, schema->name);
return FALSE;
}