Merge lp:~ubuntu-branches/ubuntu/oneiric/gnome-keyring/oneiric-proposed-201112050718 into lp:ubuntu/oneiric-proposed/gnome-keyring

Proposed by Ubuntu Package Importer
Status: Rejected
Rejected by: James Westby
Proposed branch: lp:~ubuntu-branches/ubuntu/oneiric/gnome-keyring/oneiric-proposed-201112050718
Merge into: lp:ubuntu/oneiric-proposed/gnome-keyring
Diff against target: 738 lines (+493/-36) (has conflicts)
9 files modified
.pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-gpg.desktop.in.in (+16/-0)
.pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-pkcs11.desktop.in.in (+16/-0)
.pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-secrets.desktop.in.in (+16/-0)
.pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-ssh.desktop.in.in (+16/-0)
.pc/applied-patches (+5/-0)
debian/patches/05_revert_order_fix.patch (+304/-0)
pkcs11/rpc-layer/gkm-rpc-util.c (+2/-2)
pkcs11/secret-store/gkm-secret-search.c (+45/-34)
pkcs11/secret-store/tests/test-secret-search.c (+73/-0)
Text conflict in .pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-gpg.desktop.in.in
Text conflict in .pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-pkcs11.desktop.in.in
Text conflict in .pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-secrets.desktop.in.in
Text conflict in .pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-ssh.desktop.in.in
Text conflict in .pc/applied-patches
Conflict adding file debian/patches/05_revert_order_fix.patch.  Moved existing file to debian/patches/05_revert_order_fix.patch.moved.
To merge this branch: bzr merge lp:~ubuntu-branches/ubuntu/oneiric/gnome-keyring/oneiric-proposed-201112050718
Reviewer Review Type Date Requested Status
Ubuntu Development Team Pending
Review via email: mp+84441@code.launchpad.net

Description of the change

The package importer has detected a possible inconsistency between the package history in the archive and the history in bzr. As the archive is authoritative the importer has made lp:ubuntu/oneiric-proposed/gnome-keyring reflect what is in the archive and the old bzr branch has been pushed to lp:~ubuntu-branches/ubuntu/oneiric/gnome-keyring/oneiric-proposed-201112050718. This merge proposal was created so that an Ubuntu developer can review the situations and perform a merge/upload if necessary. There are three typical cases where this can happen.
  1. Where someone pushes a change to bzr and someone else uploads the package without that change. This is the reason that this check is done by the importer. If this appears to be the case then a merge/upload should be done if the changes that were in bzr are still desirable.
  2. The importer incorrectly detected the above situation when someone made a change in bzr and then uploaded it.
  3. The importer incorrectly detected the above situation when someone just uploaded a package and didn't touch bzr.

If this case doesn't appear to be the first situation then set the status of the merge proposal to "Rejected" and help avoid the problem in future by filing a bug at https://bugs.launchpad.net/udd linking to this merge proposal.

(this is an automatically generated message)

To post a comment you must log in.

Unmerged revisions

132. By Ken VanDine

releasing version 3.2.2-0ubuntu0.1

131. By Ken VanDine

releasing version 3.2.2-0ubuntu0.1

130. By Ken VanDine

releasing version 3.2.2-0ubuntu1.1

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-gpg.desktop.in.in'
2--- .pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-gpg.desktop.in.in 2011-11-28 14:20:08 +0000
3+++ .pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-gpg.desktop.in.in 2011-12-05 07:24:26 +0000
4@@ -1,3 +1,4 @@
5+<<<<<<< TREE
6 [Desktop Entry]
7 Type=Application
8 _Name=GPG Password Agent
9@@ -11,3 +12,18 @@
10 X-GNOME-Bugzilla-Product=gnome-keyring
11 X-GNOME-Bugzilla-Component=general
12 X-GNOME-Bugzilla-Version=@VERSION@
13+=======
14+[Desktop Entry]
15+Type=Application
16+_Name=GPG Password Agent
17+_Comment=GNOME Keyring: GPG Agent
18+Exec=@VALGRIND_RUN@ gnome-keyring-daemon --start --components=gpg
19+OnlyShowIn=GNOME;LXDE;XFCE;Unity;
20+X-GNOME-Autostart-Phase=Initialization
21+X-GNOME-AutoRestart=false
22+X-GNOME-Autostart-Notify=true
23+X-GNOME-Bugzilla-Bugzilla=GNOME
24+X-GNOME-Bugzilla-Product=gnome-keyring
25+X-GNOME-Bugzilla-Component=general
26+X-GNOME-Bugzilla-Version=@VERSION@
27+>>>>>>> MERGE-SOURCE
28
29=== modified file '.pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-pkcs11.desktop.in.in'
30--- .pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-pkcs11.desktop.in.in 2011-11-28 14:20:08 +0000
31+++ .pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-pkcs11.desktop.in.in 2011-12-05 07:24:26 +0000
32@@ -1,3 +1,4 @@
33+<<<<<<< TREE
34 [Desktop Entry]
35 Type=Application
36 _Name=Certificate and Key Storage
37@@ -11,3 +12,18 @@
38 X-GNOME-Bugzilla-Product=gnome-keyring
39 X-GNOME-Bugzilla-Component=general
40 X-GNOME-Bugzilla-Version=@VERSION@
41+=======
42+[Desktop Entry]
43+Type=Application
44+_Name=Certificate and Key Storage
45+_Comment=GNOME Keyring: PKCS#11 Component
46+Exec=@VALGRIND_RUN@@BINDIR@/gnome-keyring-daemon --start --components=pkcs11
47+OnlyShowIn=GNOME;LXDE;XFCE;Unity;
48+X-GNOME-Autostart-Phase=Initialization
49+X-GNOME-AutoRestart=false
50+X-GNOME-Autostart-Notify=true
51+X-GNOME-Bugzilla-Bugzilla=GNOME
52+X-GNOME-Bugzilla-Product=gnome-keyring
53+X-GNOME-Bugzilla-Component=general
54+X-GNOME-Bugzilla-Version=@VERSION@
55+>>>>>>> MERGE-SOURCE
56
57=== modified file '.pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-secrets.desktop.in.in'
58--- .pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-secrets.desktop.in.in 2011-11-28 14:20:08 +0000
59+++ .pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-secrets.desktop.in.in 2011-12-05 07:24:26 +0000
60@@ -1,3 +1,4 @@
61+<<<<<<< TREE
62 [Desktop Entry]
63 Type=Application
64 _Name=Secret Storage Service
65@@ -11,3 +12,18 @@
66 X-GNOME-Bugzilla-Product=gnome-keyring
67 X-GNOME-Bugzilla-Component=general
68 X-GNOME-Bugzilla-Version=@VERSION@
69+=======
70+[Desktop Entry]
71+Type=Application
72+_Name=Secret Storage Service
73+_Comment=GNOME Keyring: Secret Service
74+Exec=@VALGRIND_RUN@@BINDIR@/gnome-keyring-daemon --start --components=secrets
75+OnlyShowIn=GNOME;LXDE;XFCE;Unity;
76+X-GNOME-Autostart-Phase=Initialization
77+X-GNOME-AutoRestart=false
78+X-GNOME-Autostart-Notify=true
79+X-GNOME-Bugzilla-Bugzilla=GNOME
80+X-GNOME-Bugzilla-Product=gnome-keyring
81+X-GNOME-Bugzilla-Component=general
82+X-GNOME-Bugzilla-Version=@VERSION@
83+>>>>>>> MERGE-SOURCE
84
85=== modified file '.pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-ssh.desktop.in.in'
86--- .pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-ssh.desktop.in.in 2011-11-28 14:20:08 +0000
87+++ .pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-ssh.desktop.in.in 2011-12-05 07:24:26 +0000
88@@ -1,3 +1,4 @@
89+<<<<<<< TREE
90 [Desktop Entry]
91 Type=Application
92 _Name=SSH Key Agent
93@@ -11,3 +12,18 @@
94 X-GNOME-Bugzilla-Product=gnome-keyring
95 X-GNOME-Bugzilla-Component=general
96 X-GNOME-Bugzilla-Version=@VERSION@
97+=======
98+[Desktop Entry]
99+Type=Application
100+_Name=SSH Key Agent
101+_Comment=GNOME Keyring: SSH Agent
102+Exec=@VALGRIND_RUN@@BINDIR@/gnome-keyring-daemon --start --components=ssh
103+OnlyShowIn=GNOME;LXDE;XFCE;Unity;
104+X-GNOME-Autostart-Phase=Initialization
105+X-GNOME-AutoRestart=false
106+X-GNOME-Autostart-Notify=true
107+X-GNOME-Bugzilla-Bugzilla=GNOME
108+X-GNOME-Bugzilla-Product=gnome-keyring
109+X-GNOME-Bugzilla-Component=general
110+X-GNOME-Bugzilla-Version=@VERSION@
111+>>>>>>> MERGE-SOURCE
112
113=== modified file '.pc/applied-patches'
114--- .pc/applied-patches 2011-11-28 14:20:08 +0000
115+++ .pc/applied-patches 2011-12-05 07:24:26 +0000
116@@ -1,3 +1,8 @@
117+<<<<<<< TREE
118 05_revert_order_fix.patch
119 04_nodisplay_autostart.patch
120 99_ltmain_as-needed.patch
121+=======
122+04_nodisplay_autostart.patch
123+99_ltmain_as-needed.patch
124+>>>>>>> MERGE-SOURCE
125
126=== added file 'debian/patches/05_revert_order_fix.patch'
127--- debian/patches/05_revert_order_fix.patch 1970-01-01 00:00:00 +0000
128+++ debian/patches/05_revert_order_fix.patch 2011-12-05 07:24:26 +0000
129@@ -0,0 +1,304 @@
130+diff --git a/pkcs11/rpc-layer/gkm-rpc-util.c b/pkcs11/rpc-layer/gkm-rpc-util.c
131+index 5609ec5..725cc13 100644
132+--- a/pkcs11/rpc-layer/gkm-rpc-util.c
133++++ b/pkcs11/rpc-layer/gkm-rpc-util.c
134+@@ -50,7 +50,7 @@ gkm_rpc_warn (const char* msg, ...)
135+ {
136+ va_list va;
137+ va_start (va, msg);
138+- do_log ("WARNING: gnome-keyring:", msg, va);
139++ do_log ("WARNING", msg, va);
140+ va_end (va);
141+ }
142+
143+@@ -59,7 +59,7 @@ gkm_rpc_debug (const char* msg, ...)
144+ {
145+ va_list va;
146+ va_start (va, msg);
147+- do_log ("DEBUG: gnome-keyring:", msg, va);
148++ do_log ("DEBUG", msg, va);
149+ va_end (va);
150+ }
151+
152+diff --git a/pkcs11/secret-store/gkm-secret-search.c b/pkcs11/secret-store/gkm-secret-search.c
153+index 02eb9e9..fd86056 100644
154+--- a/pkcs11/secret-store/gkm-secret-search.c
155++++ b/pkcs11/secret-store/gkm-secret-search.c
156+@@ -48,11 +48,15 @@ struct _GkmSecretSearch {
157+ gchar *collection_id;
158+ GHashTable *fields;
159+ GList *managers;
160+- GHashTable *objects;
161++ GHashTable *handles;
162+ };
163+
164+ G_DEFINE_TYPE (GkmSecretSearch, gkm_secret_search, GKM_TYPE_OBJECT);
165+
166++/* -----------------------------------------------------------------------------
167++ * INTERNAL
168++ */
169++
170+ static gboolean
171+ match_object_against_criteria (GkmSecretSearch *self, GkmObject *object)
172+ {
173+@@ -85,13 +89,17 @@ static void
174+ on_manager_added_object (GkmManager *manager, GkmObject *object, gpointer user_data)
175+ {
176+ GkmSecretSearch *self = user_data;
177++ CK_OBJECT_HANDLE handle;
178+
179+ g_return_if_fail (GKM_IS_SECRET_SEARCH (self));
180+
181+- g_return_if_fail (g_hash_table_lookup (self->objects, object) == NULL);
182++ handle = gkm_object_get_handle (object);
183++ g_return_if_fail (handle);
184++
185++ g_return_if_fail (g_hash_table_lookup (self->handles, &handle) == NULL);
186+
187+ if (match_object_against_criteria (self, object)) {
188+- g_hash_table_replace (self->objects, g_object_ref (object), "unused");
189++ g_hash_table_replace (self->handles, gkm_util_ulong_alloc (handle), "unused");
190+ gkm_object_notify_attribute (GKM_OBJECT (self), CKA_G_MATCHED);
191+ }
192+ }
193+@@ -100,11 +108,17 @@ static void
194+ on_manager_removed_object (GkmManager *manager, GkmObject *object, gpointer user_data)
195+ {
196+ GkmSecretSearch *self = user_data;
197++ CK_OBJECT_HANDLE handle;
198+
199+ g_return_if_fail (GKM_IS_SECRET_SEARCH (self));
200+
201+- if (g_hash_table_remove (self->objects, object))
202++ handle = gkm_object_get_handle (object);
203++ g_return_if_fail (handle);
204++
205++ if (g_hash_table_lookup (self->handles, &handle) != NULL) {
206++ g_hash_table_remove (self->handles, &handle);
207+ gkm_object_notify_attribute (GKM_OBJECT (self), CKA_G_MATCHED);
208++ }
209+ }
210+
211+ static void
212+@@ -124,15 +138,17 @@ on_manager_changed_object (GkmManager *manager, GkmObject *object,
213+
214+ /* Should we have this object? */
215+ if (match_object_against_criteria (self, object)) {
216+- if (g_hash_table_lookup (self->objects, object) == NULL) {
217+- g_hash_table_replace (self->objects, g_object_ref (object), "unused");
218++ if (g_hash_table_lookup (self->handles, &handle) == NULL) {
219++ g_hash_table_replace (self->handles, gkm_util_ulong_alloc (handle), "unused");
220+ gkm_object_notify_attribute (GKM_OBJECT (self), CKA_G_MATCHED);
221+ }
222+
223+ /* Should we not have this object? */
224+ } else {
225+- if (g_hash_table_remove (self->objects, object))
226++ if (g_hash_table_lookup (self->handles, &handle) != NULL) {
227++ g_hash_table_remove (self->handles, &handle);
228+ gkm_object_notify_attribute (GKM_OBJECT (self), CKA_G_MATCHED);
229++ }
230+ }
231+ }
232+
233+@@ -234,57 +250,34 @@ factory_create_search (GkmSession *session, GkmTransaction *transaction,
234+ return GKM_OBJECT (search);
235+ }
236+
237+-static gint
238+-on_matched_sort_modified (gconstpointer a,
239+- gconstpointer b)
240++static void
241++add_each_handle_to_array (gpointer key, gpointer value, gpointer user_data)
242+ {
243+- glong modified_a;
244+- glong modified_b;
245+-
246+- /* Sorting in reverse order */
247+-
248+- modified_a = gkm_secret_object_get_modified (GKM_SECRET_OBJECT (a));
249+- modified_b = gkm_secret_object_get_modified (GKM_SECRET_OBJECT (b));
250+-
251+- if (modified_a < modified_b)
252+- return 1;
253+- if (modified_a > modified_b)
254+- return -1;
255+-
256+- return 0;
257++ GArray *array = user_data;
258++ CK_OBJECT_HANDLE *handle = key;
259++ g_array_append_val (array, *handle);
260+ }
261+
262+ static CK_RV
263+-attribute_set_handles (GHashTable *objects,
264+- CK_ATTRIBUTE_PTR attr)
265++attribute_set_handles (GHashTable *handles, CK_ATTRIBUTE_PTR attr)
266+ {
267+- GList *list, *l;
268+ GArray *array;
269+- gulong handle;
270+ CK_RV rv;
271+
272+- g_assert (objects);
273++ g_assert (handles);
274+ g_assert (attr);
275+
276+ /* Want the length */
277+ if (!attr->pValue) {
278+- attr->ulValueLen = sizeof (CK_OBJECT_HANDLE) * g_hash_table_size (objects);
279++ attr->ulValueLen = sizeof (CK_OBJECT_HANDLE) * g_hash_table_size (handles);
280+ return CKR_OK;
281+ }
282+
283+ /* Get the actual values */
284+- list = g_list_sort (g_hash_table_get_keys (objects), on_matched_sort_modified);
285+ array = g_array_new (FALSE, TRUE, sizeof (CK_OBJECT_HANDLE));
286+-
287+- for (l = list; l != NULL; l = g_list_next (l)) {
288+- handle = gkm_object_get_handle (l->data);
289+- g_array_append_val (array, handle);
290+- }
291+-
292++ g_hash_table_foreach (handles, add_each_handle_to_array, array);
293+ rv = gkm_attribute_set_data (attr, array->data, array->len * sizeof (CK_OBJECT_HANDLE));
294+ g_array_free (array, TRUE);
295+- g_list_free (list);
296+-
297+ return rv;
298+ }
299+
300+@@ -309,7 +302,7 @@ gkm_secret_search_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIB
301+ case CKA_G_FIELDS:
302+ return gkm_secret_fields_serialize (attr, self->fields);
303+ case CKA_G_MATCHED:
304+- return attribute_set_handles (self->objects, attr);
305++ return attribute_set_handles (self->handles, attr);
306+ }
307+
308+ return GKM_OBJECT_CLASS (gkm_secret_search_parent_class)->get_attribute (base, session, attr);
309+@@ -319,7 +312,7 @@ gkm_secret_search_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIB
310+ static void
311+ gkm_secret_search_init (GkmSecretSearch *self)
312+ {
313+- self->objects = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL);
314++ self->handles = g_hash_table_new_full (gkm_util_ulong_hash, gkm_util_ulong_equal, gkm_util_ulong_free, NULL);
315+ }
316+
317+ static GObject*
318+@@ -391,8 +384,6 @@ gkm_secret_search_dispose (GObject *obj)
319+ g_free (self->collection_id);
320+ self->collection_id = NULL;
321+
322+- g_hash_table_remove_all (self->objects);
323+-
324+ G_OBJECT_CLASS (gkm_secret_search_parent_class)->dispose (obj);
325+ }
326+
327+@@ -407,8 +398,6 @@ gkm_secret_search_finalize (GObject *obj)
328+ g_hash_table_destroy (self->fields);
329+ self->fields = NULL;
330+
331+- g_hash_table_destroy (self->objects);
332+-
333+ G_OBJECT_CLASS (gkm_secret_search_parent_class)->finalize (obj);
334+ }
335+
336+diff --git a/pkcs11/secret-store/tests/test-secret-search.c b/pkcs11/secret-store/tests/test-secret-search.c
337+index fc75996..303a314 100644
338+--- a/pkcs11/secret-store/tests/test-secret-search.c
339++++ b/pkcs11/secret-store/tests/test-secret-search.c
340+@@ -31,7 +31,6 @@
341+
342+ #include "gkm/gkm-session.h"
343+ #include "gkm/gkm-transaction.h"
344+-#include "gkm/gkm-test.h"
345+
346+ #include "pkcs11/pkcs11i.h"
347+
348+@@ -361,77 +360,6 @@ test_for_collection_no_match (Test *test, gconstpointer unused)
349+ g_object_unref (ocoll);
350+ }
351+
352+-static void
353+-test_order (Test *test,
354+- gconstpointer unused)
355+-{
356+- CK_ATTRIBUTE attrs[] = {
357+- { CKA_G_FIELDS, "test\0value", 11 },
358+- { CKA_G_COLLECTION, "other-collection", 16 },
359+- };
360+-
361+- GkmObject *object = NULL;
362+- GkmSecretCollection *collection;
363+- GkmSecretItem *item;
364+- GHashTable *fields;
365+- gulong *matched;
366+- gsize vsize;
367+- gchar *identifier;
368+- glong modified;
369+- glong last;
370+- gint i;
371+- CK_RV rv;
372+-
373+- collection = g_object_new (GKM_TYPE_SECRET_COLLECTION,
374+- "module", test->module,
375+- "manager", gkm_session_get_manager (test->session),
376+- "identifier", "other-collection",
377+- NULL);
378+-
379+- gkm_object_expose (GKM_OBJECT (collection), TRUE);
380+-
381+- /* Add a bunch of items */
382+- for (i = 0; i < 2000; i++) {
383+- identifier = g_strdup_printf ("item-%d", i);
384+- item = gkm_secret_collection_new_item (collection, identifier);
385+- g_free (identifier);
386+-
387+- /* Make it match, but remember, wrong collection*/
388+- fields = gkm_secret_fields_new ();
389+- gkm_secret_fields_add (fields, "test", "value");
390+- gkm_secret_item_set_fields (item, fields);
391+- g_hash_table_unref (fields);
392+-
393+- gkm_secret_object_set_modified (GKM_SECRET_OBJECT (item),
394+- (glong)g_random_int ());
395+- gkm_object_expose (GKM_OBJECT (item), TRUE);
396+- }
397+-
398+- object = gkm_session_create_object_for_factory (test->session, test->factory, NULL, attrs, 2);
399+- g_assert (object != NULL);
400+- g_assert (GKM_IS_SECRET_SEARCH (object));
401+-
402+- /* No objects matched */
403+- matched = gkm_object_get_attribute_data (object, test->session, CKA_G_MATCHED, &vsize);
404+- g_assert (matched != NULL);
405+- gkm_assert_cmpulong (vsize, ==, sizeof (gulong) * 2000);
406+-
407+- last = G_MAXLONG;
408+- for (i = 0; i < vsize / sizeof (gulong); i++) {
409+- rv = gkm_session_lookup_readable_object (test->session, matched[i], (GkmObject **)&item);
410+- gkm_assert_cmprv (rv, ==, CKR_OK);
411+-
412+- modified = gkm_secret_object_get_modified (GKM_SECRET_OBJECT (item));
413+- g_assert (last > modified);
414+- last = modified;
415+- }
416+-
417+- g_free (matched);
418+-
419+- g_object_unref (object);
420+- g_object_unref (collection);
421+-}
422+-
423+ int
424+ main (int argc, char **argv)
425+ {
426+@@ -447,7 +375,6 @@ main (int argc, char **argv)
427+ g_test_add ("/secret-store/search/for_bad_collection", Test, NULL, setup, test_for_bad_collection, teardown);
428+ g_test_add ("/secret-store/search/for_collection", Test, NULL, setup, test_for_collection, teardown);
429+ g_test_add ("/secret-store/search/for_collection_no_match", Test, NULL, setup, test_for_collection_no_match, teardown);
430+- g_test_add ("/secret-store/search/order", Test, NULL, setup, test_order, teardown);
431+
432+ return g_test_run ();
433+ }
434
435=== renamed file 'debian/patches/05_revert_order_fix.patch' => 'debian/patches/05_revert_order_fix.patch.moved'
436=== modified file 'pkcs11/rpc-layer/gkm-rpc-util.c'
437--- pkcs11/rpc-layer/gkm-rpc-util.c 2011-11-28 14:20:08 +0000
438+++ pkcs11/rpc-layer/gkm-rpc-util.c 2011-12-05 07:24:26 +0000
439@@ -50,7 +50,7 @@
440 {
441 va_list va;
442 va_start (va, msg);
443- do_log ("WARNING", msg, va);
444+ do_log ("WARNING: gnome-keyring:", msg, va);
445 va_end (va);
446 }
447
448@@ -59,7 +59,7 @@
449 {
450 va_list va;
451 va_start (va, msg);
452- do_log ("DEBUG", msg, va);
453+ do_log ("DEBUG: gnome-keyring:", msg, va);
454 va_end (va);
455 }
456
457
458=== modified file 'pkcs11/secret-store/gkm-secret-search.c'
459--- pkcs11/secret-store/gkm-secret-search.c 2011-11-28 14:20:08 +0000
460+++ pkcs11/secret-store/gkm-secret-search.c 2011-12-05 07:24:26 +0000
461@@ -48,15 +48,11 @@
462 gchar *collection_id;
463 GHashTable *fields;
464 GList *managers;
465- GHashTable *handles;
466+ GHashTable *objects;
467 };
468
469 G_DEFINE_TYPE (GkmSecretSearch, gkm_secret_search, GKM_TYPE_OBJECT);
470
471-/* -----------------------------------------------------------------------------
472- * INTERNAL
473- */
474-
475 static gboolean
476 match_object_against_criteria (GkmSecretSearch *self, GkmObject *object)
477 {
478@@ -89,17 +85,13 @@
479 on_manager_added_object (GkmManager *manager, GkmObject *object, gpointer user_data)
480 {
481 GkmSecretSearch *self = user_data;
482- CK_OBJECT_HANDLE handle;
483
484 g_return_if_fail (GKM_IS_SECRET_SEARCH (self));
485
486- handle = gkm_object_get_handle (object);
487- g_return_if_fail (handle);
488-
489- g_return_if_fail (g_hash_table_lookup (self->handles, &handle) == NULL);
490+ g_return_if_fail (g_hash_table_lookup (self->objects, object) == NULL);
491
492 if (match_object_against_criteria (self, object)) {
493- g_hash_table_replace (self->handles, gkm_util_ulong_alloc (handle), "unused");
494+ g_hash_table_replace (self->objects, g_object_ref (object), "unused");
495 gkm_object_notify_attribute (GKM_OBJECT (self), CKA_G_MATCHED);
496 }
497 }
498@@ -108,17 +100,11 @@
499 on_manager_removed_object (GkmManager *manager, GkmObject *object, gpointer user_data)
500 {
501 GkmSecretSearch *self = user_data;
502- CK_OBJECT_HANDLE handle;
503
504 g_return_if_fail (GKM_IS_SECRET_SEARCH (self));
505
506- handle = gkm_object_get_handle (object);
507- g_return_if_fail (handle);
508-
509- if (g_hash_table_lookup (self->handles, &handle) != NULL) {
510- g_hash_table_remove (self->handles, &handle);
511+ if (g_hash_table_remove (self->objects, object))
512 gkm_object_notify_attribute (GKM_OBJECT (self), CKA_G_MATCHED);
513- }
514 }
515
516 static void
517@@ -138,17 +124,15 @@
518
519 /* Should we have this object? */
520 if (match_object_against_criteria (self, object)) {
521- if (g_hash_table_lookup (self->handles, &handle) == NULL) {
522- g_hash_table_replace (self->handles, gkm_util_ulong_alloc (handle), "unused");
523+ if (g_hash_table_lookup (self->objects, object) == NULL) {
524+ g_hash_table_replace (self->objects, g_object_ref (object), "unused");
525 gkm_object_notify_attribute (GKM_OBJECT (self), CKA_G_MATCHED);
526 }
527
528 /* Should we not have this object? */
529 } else {
530- if (g_hash_table_lookup (self->handles, &handle) != NULL) {
531- g_hash_table_remove (self->handles, &handle);
532+ if (g_hash_table_remove (self->objects, object))
533 gkm_object_notify_attribute (GKM_OBJECT (self), CKA_G_MATCHED);
534- }
535 }
536 }
537
538@@ -250,34 +234,57 @@
539 return GKM_OBJECT (search);
540 }
541
542-static void
543-add_each_handle_to_array (gpointer key, gpointer value, gpointer user_data)
544+static gint
545+on_matched_sort_modified (gconstpointer a,
546+ gconstpointer b)
547 {
548- GArray *array = user_data;
549- CK_OBJECT_HANDLE *handle = key;
550- g_array_append_val (array, *handle);
551+ glong modified_a;
552+ glong modified_b;
553+
554+ /* Sorting in reverse order */
555+
556+ modified_a = gkm_secret_object_get_modified (GKM_SECRET_OBJECT (a));
557+ modified_b = gkm_secret_object_get_modified (GKM_SECRET_OBJECT (b));
558+
559+ if (modified_a < modified_b)
560+ return 1;
561+ if (modified_a > modified_b)
562+ return -1;
563+
564+ return 0;
565 }
566
567 static CK_RV
568-attribute_set_handles (GHashTable *handles, CK_ATTRIBUTE_PTR attr)
569+attribute_set_handles (GHashTable *objects,
570+ CK_ATTRIBUTE_PTR attr)
571 {
572+ GList *list, *l;
573 GArray *array;
574+ gulong handle;
575 CK_RV rv;
576
577- g_assert (handles);
578+ g_assert (objects);
579 g_assert (attr);
580
581 /* Want the length */
582 if (!attr->pValue) {
583- attr->ulValueLen = sizeof (CK_OBJECT_HANDLE) * g_hash_table_size (handles);
584+ attr->ulValueLen = sizeof (CK_OBJECT_HANDLE) * g_hash_table_size (objects);
585 return CKR_OK;
586 }
587
588 /* Get the actual values */
589+ list = g_list_sort (g_hash_table_get_keys (objects), on_matched_sort_modified);
590 array = g_array_new (FALSE, TRUE, sizeof (CK_OBJECT_HANDLE));
591- g_hash_table_foreach (handles, add_each_handle_to_array, array);
592+
593+ for (l = list; l != NULL; l = g_list_next (l)) {
594+ handle = gkm_object_get_handle (l->data);
595+ g_array_append_val (array, handle);
596+ }
597+
598 rv = gkm_attribute_set_data (attr, array->data, array->len * sizeof (CK_OBJECT_HANDLE));
599 g_array_free (array, TRUE);
600+ g_list_free (list);
601+
602 return rv;
603 }
604
605@@ -302,7 +309,7 @@
606 case CKA_G_FIELDS:
607 return gkm_secret_fields_serialize (attr, self->fields);
608 case CKA_G_MATCHED:
609- return attribute_set_handles (self->handles, attr);
610+ return attribute_set_handles (self->objects, attr);
611 }
612
613 return GKM_OBJECT_CLASS (gkm_secret_search_parent_class)->get_attribute (base, session, attr);
614@@ -312,7 +319,7 @@
615 static void
616 gkm_secret_search_init (GkmSecretSearch *self)
617 {
618- self->handles = g_hash_table_new_full (gkm_util_ulong_hash, gkm_util_ulong_equal, gkm_util_ulong_free, NULL);
619+ self->objects = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL);
620 }
621
622 static GObject*
623@@ -384,6 +391,8 @@
624 g_free (self->collection_id);
625 self->collection_id = NULL;
626
627+ g_hash_table_remove_all (self->objects);
628+
629 G_OBJECT_CLASS (gkm_secret_search_parent_class)->dispose (obj);
630 }
631
632@@ -398,6 +407,8 @@
633 g_hash_table_destroy (self->fields);
634 self->fields = NULL;
635
636+ g_hash_table_destroy (self->objects);
637+
638 G_OBJECT_CLASS (gkm_secret_search_parent_class)->finalize (obj);
639 }
640
641
642=== modified file 'pkcs11/secret-store/tests/test-secret-search.c'
643--- pkcs11/secret-store/tests/test-secret-search.c 2011-11-28 14:20:08 +0000
644+++ pkcs11/secret-store/tests/test-secret-search.c 2011-12-05 07:24:26 +0000
645@@ -31,6 +31,7 @@
646
647 #include "gkm/gkm-session.h"
648 #include "gkm/gkm-transaction.h"
649+#include "gkm/gkm-test.h"
650
651 #include "pkcs11/pkcs11i.h"
652
653@@ -360,6 +361,77 @@
654 g_object_unref (ocoll);
655 }
656
657+static void
658+test_order (Test *test,
659+ gconstpointer unused)
660+{
661+ CK_ATTRIBUTE attrs[] = {
662+ { CKA_G_FIELDS, "test\0value", 11 },
663+ { CKA_G_COLLECTION, "other-collection", 16 },
664+ };
665+
666+ GkmObject *object = NULL;
667+ GkmSecretCollection *collection;
668+ GkmSecretItem *item;
669+ GHashTable *fields;
670+ gulong *matched;
671+ gsize vsize;
672+ gchar *identifier;
673+ glong modified;
674+ glong last;
675+ gint i;
676+ CK_RV rv;
677+
678+ collection = g_object_new (GKM_TYPE_SECRET_COLLECTION,
679+ "module", test->module,
680+ "manager", gkm_session_get_manager (test->session),
681+ "identifier", "other-collection",
682+ NULL);
683+
684+ gkm_object_expose (GKM_OBJECT (collection), TRUE);
685+
686+ /* Add a bunch of items */
687+ for (i = 0; i < 2000; i++) {
688+ identifier = g_strdup_printf ("item-%d", i);
689+ item = gkm_secret_collection_new_item (collection, identifier);
690+ g_free (identifier);
691+
692+ /* Make it match, but remember, wrong collection*/
693+ fields = gkm_secret_fields_new ();
694+ gkm_secret_fields_add (fields, "test", "value");
695+ gkm_secret_item_set_fields (item, fields);
696+ g_hash_table_unref (fields);
697+
698+ gkm_secret_object_set_modified (GKM_SECRET_OBJECT (item),
699+ (glong)g_random_int ());
700+ gkm_object_expose (GKM_OBJECT (item), TRUE);
701+ }
702+
703+ object = gkm_session_create_object_for_factory (test->session, test->factory, NULL, attrs, 2);
704+ g_assert (object != NULL);
705+ g_assert (GKM_IS_SECRET_SEARCH (object));
706+
707+ /* No objects matched */
708+ matched = gkm_object_get_attribute_data (object, test->session, CKA_G_MATCHED, &vsize);
709+ g_assert (matched != NULL);
710+ gkm_assert_cmpulong (vsize, ==, sizeof (gulong) * 2000);
711+
712+ last = G_MAXLONG;
713+ for (i = 0; i < vsize / sizeof (gulong); i++) {
714+ rv = gkm_session_lookup_readable_object (test->session, matched[i], (GkmObject **)&item);
715+ gkm_assert_cmprv (rv, ==, CKR_OK);
716+
717+ modified = gkm_secret_object_get_modified (GKM_SECRET_OBJECT (item));
718+ g_assert (last > modified);
719+ last = modified;
720+ }
721+
722+ g_free (matched);
723+
724+ g_object_unref (object);
725+ g_object_unref (collection);
726+}
727+
728 int
729 main (int argc, char **argv)
730 {
731@@ -375,6 +447,7 @@
732 g_test_add ("/secret-store/search/for_bad_collection", Test, NULL, setup, test_for_bad_collection, teardown);
733 g_test_add ("/secret-store/search/for_collection", Test, NULL, setup, test_for_collection, teardown);
734 g_test_add ("/secret-store/search/for_collection_no_match", Test, NULL, setup, test_for_collection_no_match, teardown);
735+ g_test_add ("/secret-store/search/order", Test, NULL, setup, test_order, teardown);
736
737 return g_test_run ();
738 }

Subscribers

People subscribed via source and target branches

to all changes: