[gnome-keyring] Don't be as strict with reserved/unused areas in keyrings.
- From: Stefan Walter <stefw src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-keyring] Don't be as strict with reserved/unused areas in keyrings.
- Date: Mon, 13 Jul 2009 17:14:23 +0000 (UTC)
commit a55053287ab6710bd882246aeb44267a7391d758
Author: Stef Walter <stef memberwebs com>
Date: Mon Jul 13 16:57:33 2009 +0000
Don't be as strict with reserved/unused areas in keyrings.
This will be used for future backwards compatibility where possible.
daemon/keyrings/gkr-keyring-binary.c | 34 +++++++++-------------------------
1 files changed, 9 insertions(+), 25 deletions(-)
---
diff --git a/daemon/keyrings/gkr-keyring-binary.c b/daemon/keyrings/gkr-keyring-binary.c
index 31076b7..8fe3401 100644
--- a/daemon/keyrings/gkr-keyring-binary.c
+++ b/daemon/keyrings/gkr-keyring-binary.c
@@ -380,17 +380,16 @@ decode_acl (EggBuffer *buffer, gsize offset, gsize *offset_out, GList **out)
g_free (name);
goto bail;
}
- if (!gkr_proto_get_utf8_string (buffer, offset, &offset, &reserved) ||
- reserved != NULL) {
+ reserved = NULL;
+ if (!gkr_proto_get_utf8_string (buffer, offset, &offset, &reserved)) {
g_free (name);
g_free (path);
- g_free (reserved);
goto bail;
}
+ g_free (reserved);
if (!egg_buffer_get_uint32 (buffer, offset, &offset, &y)) {
g_free (name);
g_free (path);
- g_free (reserved);
goto bail;
}
@@ -496,13 +495,8 @@ gkr_keyring_binary_parse (GkrKeyring *keyring, EggBuffer *buffer)
}
for (i = 0; i < 4; i++) {
- if (!egg_buffer_get_uint32 (buffer, offset, &offset, &tmp)) {
+ if (!egg_buffer_get_uint32 (buffer, offset, &offset, &tmp))
goto bail;
- }
- /* reserved bytes must be zero */
- if (tmp != 0) {
- goto bail;
- }
}
if (!egg_buffer_get_uint32 (buffer, offset, &offset, &num_items)) {
goto bail;
@@ -529,11 +523,9 @@ gkr_keyring_binary_parse (GkrKeyring *keyring, EggBuffer *buffer)
&crypto_size)) {
goto bail;
}
- /* Make sure the rest of the file is the crypted part only */
- if (crypto_size % 16 != 0 ||
- buffer->len - offset != crypto_size) {
+ /* Make the crypted part is the right size */
+ if (crypto_size % 16 != 0)
goto bail;
- }
/* Copy the data into to_decrypt into non-pageable memory */
egg_buffer_init_static (&to_decrypt, buffer->buf + offset, crypto_size);
@@ -568,21 +560,13 @@ gkr_keyring_binary_parse (GkrKeyring *keyring, EggBuffer *buffer)
goto bail;
}
reserved = NULL;
- if (!gkr_proto_get_utf8_string (buffer, offset, &offset,
- &reserved) ||
- reserved != NULL) {
- g_free (reserved);
+ if (!gkr_proto_get_utf8_string (buffer, offset, &offset, &reserved))
goto bail;
- }
+ g_free (reserved);
for (j = 0; j < 4; j++) {
guint32 tmp;
- if (!egg_buffer_get_uint32 (buffer, offset, &offset, &tmp)) {
- goto bail;
- }
- /* reserved bytes must be zero */
- if (tmp != 0) {
+ if (!egg_buffer_get_uint32 (buffer, offset, &offset, &tmp))
goto bail;
- }
}
if (!gkr_proto_decode_attribute_list (buffer, offset, &offset,
&items[i].attributes)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]