summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2013-06-25 17:13:40 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2013-07-05 11:44:57 +0200
commitc6285d97ec443b908f20ea3e44811e9b8a391368 (patch)
tree47772d73bcc0c4b7eb42a31dc5990c0977d0ee2f /examples
parentd43b738c5bbd9a03617a370a72303af0bf9ddc81 (diff)
sync-test: Add a way to pass credentials
This is done through environment variables.
Diffstat (limited to 'examples')
-rw-r--r--examples/sync-test.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/examples/sync-test.c b/examples/sync-test.c
index fffc548..9e7a2f6 100644
--- a/examples/sync-test.c
+++ b/examples/sync-test.c
@@ -2,6 +2,20 @@
#include <govirt/govirt.h>
+static gboolean
+authenticate_cb(RestProxy *proxy, G_GNUC_UNUSED RestProxyAuth *auth,
+ G_GNUC_UNUSED gboolean retrying, gpointer user_data)
+{
+ if (retrying)
+ return FALSE;
+
+ g_object_set(G_OBJECT(proxy),
+ "username", g_getenv("LIBGOVIRT_TEST_USERNAME"),
+ "password", g_getenv("LIBGOVIRT_TEST_PASSWORD"),
+ NULL);
+ return TRUE;
+}
+
int main(int argc, char **argv)
{
OvirtProxy *proxy = NULL;
@@ -26,8 +40,8 @@ int main(int argc, char **argv)
if (proxy == NULL)
goto error;
- /*g_signal_connect(G_OBJECT(proxy), "authenticate",
- G_CALLBACK(authenticate_cb), app);*/
+ g_signal_connect(G_OBJECT(proxy), "authenticate",
+ G_CALLBACK(authenticate_cb), NULL);
ovirt_proxy_fetch_ca_certificate(proxy, &error);
if (error != NULL) {