[libsocialweb] keystore: frob-keystore test tool for lookup of values in keystore



commit 8a7ee94f16911d82150197edcce141ae89aa6174
Author: Stef Walter <stefw collabora co uk>
Date:   Tue Apr 19 11:29:40 2011 +0200

    keystore: frob-keystore test tool for lookup of values in keystore
    
     * Tool is not installed.
    
    Fixes: https://bugs.meego.com/show_bug.cgi?id=16373

 .gitignore                            |    1 +
 libsocialweb-keystore/Makefile.am     |    8 ++++
 libsocialweb-keystore/frob-keystore.c |   59 +++++++++++++++++++++++++++++++++
 3 files changed, 68 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 79e3be1..9e38447 100644
--- a/.gitignore
+++ b/.gitignore
@@ -69,3 +69,4 @@ docs/*/*.signals
 docs/libsocialweb-client/libsocialweb-client.types
 docs/libsocialweb-dbus/libsocialweb-dbus-sections.txt
 docs/libsocialweb-dbus/libsocialweb-dbus.types
+libsocialweb-keystore/frob-keystore
diff --git a/libsocialweb-keystore/Makefile.am b/libsocialweb-keystore/Makefile.am
index 1f7b886..d725b5b 100644
--- a/libsocialweb-keystore/Makefile.am
+++ b/libsocialweb-keystore/Makefile.am
@@ -11,6 +11,14 @@ libsocialweb_keystore_la_SOURCES = \
 libsocialweb_keystore_la_HEADERS = \
 	sw-keystore.h
 
+noinst_PROGRAMS = \
+	frob-keystore
+
+frob_keystore_CFLAGS = \
+	-I$(top_srcdir) $(GLIB_CFLAGS) $(GOBJECT_CFLAGS)
+
+frob_keystore_LDADD = \
+	libsocialweb-keystore.la
 
 TESTS = test-suite
 check_PROGRAMS = test-suite
diff --git a/libsocialweb-keystore/frob-keystore.c b/libsocialweb-keystore/frob-keystore.c
new file mode 100644
index 0000000..61bc3d1
--- /dev/null
+++ b/libsocialweb-keystore/frob-keystore.c
@@ -0,0 +1,59 @@
+/*
+ * libsocialweb - social data store
+ * Copyright (C) 2011 Intel Corporation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Author: Stef Walter <stefw collabora co uk>
+ */
+
+#include "config.h"
+
+#include "sw-keystore.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <glib.h>
+#include <glib-object.h>
+
+int
+main (int argc, char *argv[])
+{
+  const gchar *secret = NULL;
+  const gchar *key = NULL;
+  gint i;
+
+  g_type_init ();
+
+  for (i = 1; i < argc; ++i) {
+    if (sw_keystore_get_key_secret (argv[i], &key, &secret)) {
+      g_print ("%s\n\tkey = %s\n\tsecret = %s\n", argv[i],
+               key ? key : "[null]", secret ? secret : "[null]");
+    } else {
+      g_print ("%s (not found)\n", argv[i]);
+    }
+  }
+
+  return 0;
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]