2014-08-29 12:27:47 -04:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
|
|
|
|
/*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
|
* any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
*
|
|
|
|
|
* Copyright 2010 - 2014 Red Hat, Inc.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2016-02-19 14:57:48 +01:00
|
|
|
#include "nm-default.h"
|
2014-11-13 10:07:02 -05:00
|
|
|
|
2014-08-29 12:27:47 -04:00
|
|
|
#include <string.h>
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <signal.h>
|
|
|
|
|
|
2016-02-19 14:57:48 +01:00
|
|
|
#include "nm-secret-agent-old.h"
|
2014-08-29 12:27:47 -04:00
|
|
|
|
2015-12-20 21:59:13 +01:00
|
|
|
#include "nm-test-libnm-utils.h"
|
2014-08-29 12:27:47 -04:00
|
|
|
|
2016-10-02 18:22:50 +02:00
|
|
|
/*****************************************************************************/
|
2014-08-29 12:27:47 -04:00
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
SECRET_REQUESTED,
|
|
|
|
|
|
|
|
|
|
LAST_SIGNAL
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static guint signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
|
2014-11-20 11:53:19 -05:00
|
|
|
typedef NMSecretAgentOld TestSecretAgent;
|
|
|
|
|
typedef NMSecretAgentOldClass TestSecretAgentClass;
|
2014-08-29 12:27:47 -04:00
|
|
|
|
|
|
|
|
GType test_secret_agent_get_type (void);
|
2014-11-20 11:53:19 -05:00
|
|
|
G_DEFINE_TYPE (TestSecretAgent, test_secret_agent, NM_TYPE_SECRET_AGENT_OLD)
|
2014-08-29 12:27:47 -04:00
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
test_secret_agent_init (TestSecretAgent *agent)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2014-11-20 11:53:19 -05:00
|
|
|
test_secret_agent_get_secrets (NMSecretAgentOld *agent,
|
|
|
|
|
NMConnection *connection,
|
|
|
|
|
const char *connection_path,
|
|
|
|
|
const char *setting_name,
|
|
|
|
|
const char **hints,
|
|
|
|
|
NMSecretAgentGetSecretsFlags flags,
|
|
|
|
|
NMSecretAgentOldGetSecretsFunc callback,
|
|
|
|
|
gpointer callback_data)
|
2014-08-29 12:27:47 -04:00
|
|
|
{
|
|
|
|
|
NMSettingWirelessSecurity *s_wsec;
|
2014-08-16 10:09:48 -04:00
|
|
|
GVariant *secrets = NULL;
|
|
|
|
|
GVariantBuilder secrets_builder, setting_builder;
|
2014-08-29 12:27:47 -04:00
|
|
|
char *secret = NULL;
|
|
|
|
|
GError *error = NULL;
|
|
|
|
|
|
|
|
|
|
g_assert_cmpstr (setting_name, ==, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME);
|
|
|
|
|
|
|
|
|
|
s_wsec = nm_connection_get_setting_wireless_security (connection);
|
|
|
|
|
g_assert (s_wsec);
|
|
|
|
|
g_assert_cmpstr (nm_setting_wireless_security_get_key_mgmt (s_wsec), ==, "wpa-psk");
|
|
|
|
|
g_assert_cmpstr (nm_setting_wireless_security_get_psk (s_wsec), ==, NULL);
|
|
|
|
|
|
|
|
|
|
g_signal_emit (agent, signals[SECRET_REQUESTED], 0,
|
|
|
|
|
connection,
|
|
|
|
|
connection_path,
|
|
|
|
|
NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRELESS_SECURITY_PSK,
|
|
|
|
|
&secret);
|
|
|
|
|
|
|
|
|
|
if (!secret) {
|
|
|
|
|
error = g_error_new (NM_SECRET_AGENT_ERROR, NM_SECRET_AGENT_ERROR_NO_SECRETS,
|
|
|
|
|
"No secrets");
|
|
|
|
|
goto done;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!strcmp (secret, "CANCEL")) {
|
|
|
|
|
error = g_error_new (NM_SECRET_AGENT_ERROR, NM_SECRET_AGENT_ERROR_USER_CANCELED,
|
|
|
|
|
"User canceled");
|
|
|
|
|
goto done;
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-16 10:09:48 -04:00
|
|
|
g_variant_builder_init (&setting_builder, NM_VARIANT_TYPE_SETTING);
|
|
|
|
|
g_variant_builder_add (&setting_builder, "{sv}",
|
|
|
|
|
NM_SETTING_WIRELESS_SECURITY_PSK,
|
|
|
|
|
g_variant_new_string (secret));
|
2014-08-29 12:27:47 -04:00
|
|
|
|
2014-08-16 10:09:48 -04:00
|
|
|
g_variant_builder_init (&secrets_builder, NM_VARIANT_TYPE_CONNECTION);
|
|
|
|
|
g_variant_builder_add (&secrets_builder, "{sa{sv}}",
|
|
|
|
|
setting_name,
|
|
|
|
|
&setting_builder);
|
|
|
|
|
secrets = g_variant_ref_sink (g_variant_builder_end (&secrets_builder));
|
2014-08-29 12:27:47 -04:00
|
|
|
|
|
|
|
|
done:
|
2014-08-16 10:09:48 -04:00
|
|
|
callback (agent, connection, secrets, error, callback_data);
|
2014-08-29 12:27:47 -04:00
|
|
|
g_clear_error (&error);
|
2014-08-16 10:09:48 -04:00
|
|
|
g_clear_pointer (&secrets, g_variant_unref);
|
2014-08-29 12:27:47 -04:00
|
|
|
g_free (secret);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2014-11-20 11:53:19 -05:00
|
|
|
test_secret_agent_cancel_get_secrets (NMSecretAgentOld *agent,
|
all: don't use gchar/gshort/gint/glong but C types
We commonly don't use the glib typedefs for char/short/int/long,
but their C types directly.
$ git grep '\<g\(char\|short\|int\|long\|float\|double\)\>' | wc -l
587
$ git grep '\<\(char\|short\|int\|long\|float\|double\)\>' | wc -l
21114
One could argue that using the glib typedefs is preferable in
public API (of our glib based libnm library) or where it clearly
is related to glib, like during
g_object_set (obj, PROPERTY, (gint) value, NULL);
However, that argument does not seem strong, because in practice we don't
follow that argument today, and seldomly use the glib typedefs.
Also, the style guide for this would be hard to formalize, because
"using them where clearly related to a glib" is a very loose suggestion.
Also note that glib typedefs will always just be typedefs of the
underlying C types. There is no danger of glib changing the meaning
of these typedefs (because that would be a major API break of glib).
A simple style guide is instead: don't use these typedefs.
No manual actions, I only ran the bash script:
FILES=($(git ls-files '*.[hc]'))
sed -i \
-e 's/\<g\(char\|short\|int\|long\|float\|double\)\>\( [^ ]\)/\1\2/g' \
-e 's/\<g\(char\|short\|int\|long\|float\|double\)\> /\1 /g' \
-e 's/\<g\(char\|short\|int\|long\|float\|double\)\>/\1/g' \
"${FILES[@]}"
2018-07-11 07:40:19 +02:00
|
|
|
const char *connection_path,
|
|
|
|
|
const char *setting_name)
|
2014-08-29 12:27:47 -04:00
|
|
|
{
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2014-11-20 11:53:19 -05:00
|
|
|
test_secret_agent_save_secrets (NMSecretAgentOld *agent,
|
|
|
|
|
NMConnection *connection,
|
all: don't use gchar/gshort/gint/glong but C types
We commonly don't use the glib typedefs for char/short/int/long,
but their C types directly.
$ git grep '\<g\(char\|short\|int\|long\|float\|double\)\>' | wc -l
587
$ git grep '\<\(char\|short\|int\|long\|float\|double\)\>' | wc -l
21114
One could argue that using the glib typedefs is preferable in
public API (of our glib based libnm library) or where it clearly
is related to glib, like during
g_object_set (obj, PROPERTY, (gint) value, NULL);
However, that argument does not seem strong, because in practice we don't
follow that argument today, and seldomly use the glib typedefs.
Also, the style guide for this would be hard to formalize, because
"using them where clearly related to a glib" is a very loose suggestion.
Also note that glib typedefs will always just be typedefs of the
underlying C types. There is no danger of glib changing the meaning
of these typedefs (because that would be a major API break of glib).
A simple style guide is instead: don't use these typedefs.
No manual actions, I only ran the bash script:
FILES=($(git ls-files '*.[hc]'))
sed -i \
-e 's/\<g\(char\|short\|int\|long\|float\|double\)\>\( [^ ]\)/\1\2/g' \
-e 's/\<g\(char\|short\|int\|long\|float\|double\)\> /\1 /g' \
-e 's/\<g\(char\|short\|int\|long\|float\|double\)\>/\1/g' \
"${FILES[@]}"
2018-07-11 07:40:19 +02:00
|
|
|
const char *connection_path,
|
2014-11-20 11:53:19 -05:00
|
|
|
NMSecretAgentOldSaveSecretsFunc callback,
|
|
|
|
|
gpointer callback_data)
|
2014-08-29 12:27:47 -04:00
|
|
|
{
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2014-11-20 11:53:19 -05:00
|
|
|
test_secret_agent_delete_secrets (NMSecretAgentOld *agent,
|
|
|
|
|
NMConnection *connection,
|
all: don't use gchar/gshort/gint/glong but C types
We commonly don't use the glib typedefs for char/short/int/long,
but their C types directly.
$ git grep '\<g\(char\|short\|int\|long\|float\|double\)\>' | wc -l
587
$ git grep '\<\(char\|short\|int\|long\|float\|double\)\>' | wc -l
21114
One could argue that using the glib typedefs is preferable in
public API (of our glib based libnm library) or where it clearly
is related to glib, like during
g_object_set (obj, PROPERTY, (gint) value, NULL);
However, that argument does not seem strong, because in practice we don't
follow that argument today, and seldomly use the glib typedefs.
Also, the style guide for this would be hard to formalize, because
"using them where clearly related to a glib" is a very loose suggestion.
Also note that glib typedefs will always just be typedefs of the
underlying C types. There is no danger of glib changing the meaning
of these typedefs (because that would be a major API break of glib).
A simple style guide is instead: don't use these typedefs.
No manual actions, I only ran the bash script:
FILES=($(git ls-files '*.[hc]'))
sed -i \
-e 's/\<g\(char\|short\|int\|long\|float\|double\)\>\( [^ ]\)/\1\2/g' \
-e 's/\<g\(char\|short\|int\|long\|float\|double\)\> /\1 /g' \
-e 's/\<g\(char\|short\|int\|long\|float\|double\)\>/\1/g' \
"${FILES[@]}"
2018-07-11 07:40:19 +02:00
|
|
|
const char *connection_path,
|
2014-11-20 11:53:19 -05:00
|
|
|
NMSecretAgentOldDeleteSecretsFunc callback,
|
|
|
|
|
gpointer callback_data)
|
2014-08-29 12:27:47 -04:00
|
|
|
{
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
test_secret_agent_class_init (TestSecretAgentClass *klass)
|
|
|
|
|
{
|
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2014-11-20 11:53:19 -05:00
|
|
|
NMSecretAgentOldClass *agent_class = NM_SECRET_AGENT_OLD_CLASS (klass);
|
2014-08-29 12:27:47 -04:00
|
|
|
|
|
|
|
|
agent_class->get_secrets = test_secret_agent_get_secrets;
|
|
|
|
|
agent_class->cancel_get_secrets = test_secret_agent_cancel_get_secrets;
|
|
|
|
|
agent_class->save_secrets = test_secret_agent_save_secrets;
|
|
|
|
|
agent_class->delete_secrets = test_secret_agent_delete_secrets;
|
|
|
|
|
|
|
|
|
|
signals[SECRET_REQUESTED] =
|
|
|
|
|
g_signal_new ("secret-requested",
|
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
|
0, NULL, NULL, NULL,
|
|
|
|
|
G_TYPE_STRING, 4,
|
|
|
|
|
NM_TYPE_CONNECTION,
|
|
|
|
|
G_TYPE_STRING,
|
|
|
|
|
G_TYPE_STRING,
|
|
|
|
|
G_TYPE_STRING);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-20 11:53:19 -05:00
|
|
|
static NMSecretAgentOld *
|
2014-08-29 12:27:47 -04:00
|
|
|
test_secret_agent_new (void)
|
|
|
|
|
{
|
2014-11-20 11:53:19 -05:00
|
|
|
NMSecretAgentOld *agent;
|
2014-09-02 21:41:05 -04:00
|
|
|
GError *error = NULL;
|
|
|
|
|
|
|
|
|
|
agent = g_initable_new (test_secret_agent_get_type (), NULL, &error,
|
2014-11-20 11:53:19 -05:00
|
|
|
NM_SECRET_AGENT_OLD_IDENTIFIER, "test-secret-agent",
|
|
|
|
|
NM_SECRET_AGENT_OLD_AUTO_REGISTER, FALSE,
|
2014-09-02 21:41:05 -04:00
|
|
|
NULL);
|
|
|
|
|
g_assert_no_error (error);
|
|
|
|
|
|
|
|
|
|
return agent;
|
2014-08-29 12:27:47 -04:00
|
|
|
}
|
|
|
|
|
|
2016-10-02 18:22:50 +02:00
|
|
|
/*****************************************************************************/
|
2014-08-29 12:27:47 -04:00
|
|
|
|
|
|
|
|
typedef struct {
|
2015-12-21 10:22:33 +01:00
|
|
|
NMTstcServiceInfo *sinfo;
|
2014-08-29 12:27:47 -04:00
|
|
|
NMClient *client;
|
|
|
|
|
|
2014-11-20 11:53:19 -05:00
|
|
|
NMSecretAgentOld *agent;
|
2014-08-29 12:27:47 -04:00
|
|
|
NMDevice *device;
|
|
|
|
|
NMConnection *connection;
|
|
|
|
|
|
|
|
|
|
GMainLoop *loop;
|
|
|
|
|
guint timeout_id;
|
|
|
|
|
|
|
|
|
|
char *ifname;
|
|
|
|
|
char *con_id;
|
|
|
|
|
|
|
|
|
|
int secrets_requested;
|
|
|
|
|
} TestSecretAgentData;
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
timeout_assert (gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2014-09-11 16:27:13 -04:00
|
|
|
connection_added_cb (GObject *s,
|
|
|
|
|
GAsyncResult *result,
|
2014-08-29 12:27:47 -04:00
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
TestSecretAgentData *sadata = user_data;
|
2014-09-11 16:27:13 -04:00
|
|
|
NMRemoteConnection *connection;
|
|
|
|
|
GError *error = NULL;
|
|
|
|
|
|
2014-09-29 10:58:16 -04:00
|
|
|
connection = nm_client_add_connection_finish (sadata->client, result, &error);
|
2014-08-29 12:27:47 -04:00
|
|
|
|
|
|
|
|
g_assert_no_error (error);
|
|
|
|
|
g_assert_cmpstr (nm_connection_get_id (NM_CONNECTION (connection)), ==, sadata->con_id);
|
|
|
|
|
|
|
|
|
|
sadata->connection = NM_CONNECTION (connection);
|
|
|
|
|
g_main_loop_quit (sadata->loop);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2014-09-02 21:41:05 -04:00
|
|
|
register_cb (GObject *object, GAsyncResult *result, gpointer user_data)
|
2014-08-29 12:27:47 -04:00
|
|
|
{
|
|
|
|
|
TestSecretAgentData *sadata = user_data;
|
2014-09-02 21:41:05 -04:00
|
|
|
GError *error = NULL;
|
2014-08-29 12:27:47 -04:00
|
|
|
|
2014-11-20 11:53:19 -05:00
|
|
|
nm_secret_agent_old_register_finish (sadata->agent, result, &error);
|
2014-08-29 12:27:47 -04:00
|
|
|
g_assert_no_error (error);
|
2014-11-20 11:53:19 -05:00
|
|
|
g_assert (nm_secret_agent_old_get_registered (sadata->agent));
|
2014-09-02 21:41:05 -04:00
|
|
|
|
2014-08-29 12:27:47 -04:00
|
|
|
g_main_loop_quit (sadata->loop);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define TEST_CON_ID_PREFIX "test-secret-agent"
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
test_setup (TestSecretAgentData *sadata, gconstpointer test_data)
|
|
|
|
|
{
|
|
|
|
|
static int counter = 0;
|
2014-09-02 21:41:05 -04:00
|
|
|
const char *agent_notes = test_data;
|
2014-08-29 12:27:47 -04:00
|
|
|
NMConnection *connection;
|
|
|
|
|
NMSettingConnection *s_con;
|
|
|
|
|
NMSettingWireless *s_wireless;
|
|
|
|
|
GBytes *ssid;
|
|
|
|
|
NMSetting *s_wsec;
|
|
|
|
|
GError *error = NULL;
|
|
|
|
|
|
2015-12-21 10:22:33 +01:00
|
|
|
sadata->sinfo = nmtstc_service_init ();
|
2018-05-06 08:51:26 +02:00
|
|
|
if (!sadata->sinfo)
|
|
|
|
|
return;
|
|
|
|
|
|
2014-08-29 12:27:47 -04:00
|
|
|
sadata->client = nm_client_new (NULL, &error);
|
|
|
|
|
g_assert_no_error (error);
|
|
|
|
|
|
|
|
|
|
sadata->loop = g_main_loop_new (NULL, FALSE);
|
|
|
|
|
sadata->timeout_id = g_timeout_add_seconds (5, timeout_assert, NULL);
|
|
|
|
|
|
|
|
|
|
sadata->ifname = g_strdup_printf ("wlan%d", counter);
|
|
|
|
|
sadata->con_id = g_strdup_printf ("%s-%d", TEST_CON_ID_PREFIX, counter);
|
|
|
|
|
counter++;
|
|
|
|
|
|
|
|
|
|
/* Create the device */
|
2015-12-21 10:22:33 +01:00
|
|
|
sadata->device = nmtstc_service_add_device (sadata->sinfo, sadata->client,
|
|
|
|
|
"AddWifiDevice", sadata->ifname);
|
2014-08-29 12:27:47 -04:00
|
|
|
|
|
|
|
|
/* Create the connection */
|
|
|
|
|
connection = nmtst_create_minimal_connection (sadata->con_id, NULL, NM_SETTING_WIRELESS_SETTING_NAME, &s_con);
|
|
|
|
|
g_object_set (s_con,
|
|
|
|
|
NM_SETTING_CONNECTION_INTERFACE_NAME, sadata->ifname,
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
s_wireless = nm_connection_get_setting_wireless (connection);
|
|
|
|
|
ssid = g_bytes_new ("foo", 3);
|
|
|
|
|
g_object_set (s_wireless,
|
|
|
|
|
NM_SETTING_WIRELESS_SSID, ssid,
|
|
|
|
|
NULL);
|
|
|
|
|
g_bytes_unref (ssid);
|
|
|
|
|
|
|
|
|
|
s_wsec = g_object_new (NM_TYPE_SETTING_WIRELESS_SECURITY,
|
|
|
|
|
NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-psk",
|
|
|
|
|
NULL);
|
|
|
|
|
nm_connection_add_setting (connection, s_wsec);
|
|
|
|
|
|
2014-09-29 10:58:16 -04:00
|
|
|
nm_client_add_connection_async (sadata->client,
|
|
|
|
|
connection,
|
|
|
|
|
TRUE,
|
|
|
|
|
NULL,
|
|
|
|
|
connection_added_cb,
|
|
|
|
|
sadata);
|
2014-08-29 12:27:47 -04:00
|
|
|
g_object_unref (connection);
|
|
|
|
|
|
|
|
|
|
g_main_loop_run (sadata->loop);
|
|
|
|
|
g_assert (sadata->connection);
|
|
|
|
|
|
2014-09-02 21:41:05 -04:00
|
|
|
if (agent_notes) {
|
2014-08-29 12:27:47 -04:00
|
|
|
sadata->agent = test_secret_agent_new ();
|
2014-09-02 21:41:05 -04:00
|
|
|
|
|
|
|
|
if (!strcmp (agent_notes, "sync")) {
|
2014-11-20 11:53:19 -05:00
|
|
|
nm_secret_agent_old_register (sadata->agent, NULL, &error);
|
2014-09-02 21:41:05 -04:00
|
|
|
g_assert_no_error (error);
|
2014-11-20 11:53:19 -05:00
|
|
|
g_assert (nm_secret_agent_old_get_registered (sadata->agent));
|
2014-09-02 21:41:05 -04:00
|
|
|
} else {
|
2014-11-20 11:53:19 -05:00
|
|
|
nm_secret_agent_old_register_async (sadata->agent, NULL,
|
2014-09-02 21:41:05 -04:00
|
|
|
register_cb, sadata);
|
|
|
|
|
g_main_loop_run (sadata->loop);
|
|
|
|
|
}
|
2014-08-29 12:27:47 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
test_cleanup (TestSecretAgentData *sadata, gconstpointer test_data)
|
|
|
|
|
{
|
|
|
|
|
GVariant *ret;
|
|
|
|
|
GError *error = NULL;
|
|
|
|
|
|
2018-05-06 08:51:26 +02:00
|
|
|
if (!sadata->sinfo)
|
|
|
|
|
return;
|
|
|
|
|
|
2014-08-29 12:27:47 -04:00
|
|
|
if (sadata->agent) {
|
2014-11-20 11:53:19 -05:00
|
|
|
if (nm_secret_agent_old_get_registered (sadata->agent)) {
|
|
|
|
|
nm_secret_agent_old_unregister (sadata->agent, NULL, &error);
|
2014-09-02 21:41:05 -04:00
|
|
|
g_assert_no_error (error);
|
|
|
|
|
}
|
2014-08-29 12:27:47 -04:00
|
|
|
g_object_unref (sadata->agent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ret = g_dbus_proxy_call_sync (sadata->sinfo->proxy,
|
|
|
|
|
"RemoveDevice",
|
2014-10-08 18:14:30 -04:00
|
|
|
g_variant_new ("(s)", nm_object_get_path (NM_OBJECT (sadata->device))),
|
2014-08-29 12:27:47 -04:00
|
|
|
G_DBUS_CALL_FLAGS_NO_AUTO_START,
|
|
|
|
|
3000,
|
|
|
|
|
NULL,
|
|
|
|
|
&error);
|
|
|
|
|
g_assert_no_error (error);
|
|
|
|
|
g_variant_unref (ret);
|
|
|
|
|
|
2014-10-08 18:14:30 -04:00
|
|
|
g_object_unref (sadata->connection);
|
|
|
|
|
g_object_unref (sadata->client);
|
|
|
|
|
|
2015-12-21 10:22:33 +01:00
|
|
|
nmtstc_service_cleanup (sadata->sinfo);
|
2014-08-29 12:27:47 -04:00
|
|
|
|
|
|
|
|
g_source_remove (sadata->timeout_id);
|
|
|
|
|
g_main_loop_unref (sadata->loop);
|
|
|
|
|
|
|
|
|
|
g_free (sadata->ifname);
|
|
|
|
|
g_free (sadata->con_id);
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-02 18:22:50 +02:00
|
|
|
/*****************************************************************************/
|
2014-08-29 12:27:47 -04:00
|
|
|
|
|
|
|
|
static void
|
2014-09-11 16:27:13 -04:00
|
|
|
connection_activated_none_cb (GObject *c,
|
|
|
|
|
GAsyncResult *result,
|
2014-08-29 12:27:47 -04:00
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
TestSecretAgentData *sadata = user_data;
|
2015-02-08 13:34:32 +01:00
|
|
|
gs_free_error GError *error = NULL;
|
2014-09-11 16:27:13 -04:00
|
|
|
|
2017-12-18 08:36:51 +01:00
|
|
|
nm_client_activate_connection_finish (sadata->client, result, &error);
|
2014-10-15 15:27:25 -04:00
|
|
|
g_assert_error (error, NM_AGENT_MANAGER_ERROR, NM_AGENT_MANAGER_ERROR_NO_SECRETS);
|
2014-08-29 12:27:47 -04:00
|
|
|
|
|
|
|
|
g_main_loop_quit (sadata->loop);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
test_secret_agent_none (TestSecretAgentData *sadata, gconstpointer test_data)
|
|
|
|
|
{
|
2018-05-06 08:51:26 +02:00
|
|
|
if (!nmtstc_service_available (sadata->sinfo))
|
|
|
|
|
return;
|
|
|
|
|
|
2014-09-11 16:27:13 -04:00
|
|
|
nm_client_activate_connection_async (sadata->client,
|
|
|
|
|
sadata->connection,
|
|
|
|
|
sadata->device,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
connection_activated_none_cb,
|
|
|
|
|
sadata);
|
2014-08-29 12:27:47 -04:00
|
|
|
g_main_loop_run (sadata->loop);
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-02 18:22:50 +02:00
|
|
|
/*****************************************************************************/
|
2014-08-29 12:27:47 -04:00
|
|
|
|
|
|
|
|
static char *
|
|
|
|
|
secrets_requested_no_secrets_cb (TestSecretAgent *agent,
|
|
|
|
|
NMConnection *connection,
|
|
|
|
|
const char *connection_path,
|
|
|
|
|
const char *setting_name,
|
|
|
|
|
const char *secret_name,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
TestSecretAgentData *sadata = user_data;
|
|
|
|
|
|
|
|
|
|
g_assert_cmpstr (connection_path, ==, nm_connection_get_path (sadata->connection));
|
|
|
|
|
sadata->secrets_requested++;
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2014-09-11 16:27:13 -04:00
|
|
|
connection_activated_no_secrets_cb (GObject *c,
|
|
|
|
|
GAsyncResult *result,
|
2014-08-29 12:27:47 -04:00
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
TestSecretAgentData *sadata = user_data;
|
2015-02-08 13:34:32 +01:00
|
|
|
gs_unref_object NMActiveConnection *ac = NULL;
|
|
|
|
|
gs_free_error GError *error = NULL;
|
2014-09-11 16:27:13 -04:00
|
|
|
|
|
|
|
|
ac = nm_client_activate_connection_finish (sadata->client, result, &error);
|
2014-10-15 15:27:25 -04:00
|
|
|
g_assert_error (error, NM_AGENT_MANAGER_ERROR, NM_AGENT_MANAGER_ERROR_NO_SECRETS);
|
2014-08-29 12:27:47 -04:00
|
|
|
g_main_loop_quit (sadata->loop);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
test_secret_agent_no_secrets (TestSecretAgentData *sadata, gconstpointer test_data)
|
|
|
|
|
{
|
2018-05-06 08:51:26 +02:00
|
|
|
if (!nmtstc_service_available (sadata->sinfo))
|
|
|
|
|
return;
|
|
|
|
|
|
2014-08-29 12:27:47 -04:00
|
|
|
g_signal_connect (sadata->agent, "secret-requested",
|
|
|
|
|
G_CALLBACK (secrets_requested_no_secrets_cb),
|
|
|
|
|
sadata);
|
|
|
|
|
|
2014-09-11 16:27:13 -04:00
|
|
|
nm_client_activate_connection_async (sadata->client,
|
|
|
|
|
sadata->connection,
|
|
|
|
|
sadata->device,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
connection_activated_no_secrets_cb,
|
|
|
|
|
sadata);
|
2014-08-29 12:27:47 -04:00
|
|
|
g_main_loop_run (sadata->loop);
|
|
|
|
|
|
|
|
|
|
g_assert_cmpint (sadata->secrets_requested, ==, 1);
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-02 18:22:50 +02:00
|
|
|
/*****************************************************************************/
|
2014-08-29 12:27:47 -04:00
|
|
|
|
|
|
|
|
static void
|
2014-09-11 16:27:13 -04:00
|
|
|
connection_activated_cancel_cb (GObject *c,
|
|
|
|
|
GAsyncResult *result,
|
2014-08-29 12:27:47 -04:00
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
TestSecretAgentData *sadata = user_data;
|
2015-02-09 15:17:53 +01:00
|
|
|
gs_unref_object NMActiveConnection *ac = NULL;
|
2015-02-08 13:34:32 +01:00
|
|
|
gs_free_error GError *error = NULL;
|
2014-09-11 16:27:13 -04:00
|
|
|
|
|
|
|
|
ac = nm_client_activate_connection_finish (sadata->client, result, &error);
|
2014-10-15 15:27:25 -04:00
|
|
|
g_assert_error (error, NM_AGENT_MANAGER_ERROR, NM_AGENT_MANAGER_ERROR_USER_CANCELED);
|
2014-08-29 12:27:47 -04:00
|
|
|
g_main_loop_quit (sadata->loop);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static char *
|
|
|
|
|
secrets_requested_cancel_cb (TestSecretAgent *agent,
|
|
|
|
|
NMConnection *connection,
|
|
|
|
|
const char *connection_path,
|
|
|
|
|
const char *setting_name,
|
|
|
|
|
const char *secret_name,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
TestSecretAgentData *sadata = user_data;
|
|
|
|
|
|
|
|
|
|
g_assert_cmpstr (connection_path, ==, nm_connection_get_path (sadata->connection));
|
|
|
|
|
sadata->secrets_requested++;
|
|
|
|
|
|
|
|
|
|
return g_strdup ("CANCEL");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
test_secret_agent_cancel (TestSecretAgentData *sadata, gconstpointer test_data)
|
|
|
|
|
{
|
2018-05-06 08:51:26 +02:00
|
|
|
if (!nmtstc_service_available (sadata->sinfo))
|
|
|
|
|
return;
|
|
|
|
|
|
2014-08-29 12:27:47 -04:00
|
|
|
g_signal_connect (sadata->agent, "secret-requested",
|
|
|
|
|
G_CALLBACK (secrets_requested_cancel_cb),
|
|
|
|
|
sadata);
|
|
|
|
|
|
2014-09-11 16:27:13 -04:00
|
|
|
nm_client_activate_connection_async (sadata->client,
|
|
|
|
|
sadata->connection,
|
|
|
|
|
sadata->device,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
connection_activated_cancel_cb,
|
|
|
|
|
sadata);
|
2014-08-29 12:27:47 -04:00
|
|
|
g_main_loop_run (sadata->loop);
|
|
|
|
|
|
|
|
|
|
g_assert_cmpint (sadata->secrets_requested, ==, 1);
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-02 18:22:50 +02:00
|
|
|
/*****************************************************************************/
|
2014-08-29 12:27:47 -04:00
|
|
|
|
|
|
|
|
static void
|
2014-09-11 16:27:13 -04:00
|
|
|
connection_activated_good_cb (GObject *c,
|
|
|
|
|
GAsyncResult *result,
|
2014-08-29 12:27:47 -04:00
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
TestSecretAgentData *sadata = user_data;
|
2014-09-11 16:27:13 -04:00
|
|
|
NMActiveConnection *ac;
|
|
|
|
|
GError *error = NULL;
|
|
|
|
|
|
|
|
|
|
ac = nm_client_activate_connection_finish (sadata->client, result, &error);
|
2014-10-06 13:35:03 -04:00
|
|
|
g_assert_no_error (error);
|
2014-08-29 12:27:47 -04:00
|
|
|
|
2014-10-06 13:35:03 -04:00
|
|
|
g_object_unref (ac);
|
2014-08-29 12:27:47 -04:00
|
|
|
|
|
|
|
|
g_main_loop_quit (sadata->loop);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static char *
|
|
|
|
|
secrets_requested_good_cb (TestSecretAgent *agent,
|
|
|
|
|
NMConnection *connection,
|
|
|
|
|
const char *connection_path,
|
|
|
|
|
const char *setting_name,
|
|
|
|
|
const char *secret_name,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
TestSecretAgentData *sadata = user_data;
|
|
|
|
|
|
|
|
|
|
g_assert_cmpstr (connection_path, ==, nm_connection_get_path (sadata->connection));
|
|
|
|
|
sadata->secrets_requested++;
|
|
|
|
|
|
|
|
|
|
return g_strdup ("password");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
test_secret_agent_good (TestSecretAgentData *sadata, gconstpointer test_data)
|
|
|
|
|
{
|
2018-05-06 08:51:26 +02:00
|
|
|
if (!nmtstc_service_available (sadata->sinfo))
|
|
|
|
|
return;
|
|
|
|
|
|
2014-08-29 12:27:47 -04:00
|
|
|
g_signal_connect (sadata->agent, "secret-requested",
|
|
|
|
|
G_CALLBACK (secrets_requested_good_cb),
|
|
|
|
|
sadata);
|
|
|
|
|
|
2014-09-11 16:27:13 -04:00
|
|
|
nm_client_activate_connection_async (sadata->client,
|
|
|
|
|
sadata->connection,
|
|
|
|
|
sadata->device,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
connection_activated_good_cb,
|
|
|
|
|
sadata);
|
2014-08-29 12:27:47 -04:00
|
|
|
g_main_loop_run (sadata->loop);
|
|
|
|
|
|
|
|
|
|
g_assert_cmpint (sadata->secrets_requested, ==, 1);
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-02 21:41:05 -04:00
|
|
|
static void
|
|
|
|
|
async_init_cb (GObject *object, GAsyncResult *result, gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
GMainLoop *loop = user_data;
|
|
|
|
|
GError *error = NULL;
|
|
|
|
|
GObject *agent;
|
|
|
|
|
|
|
|
|
|
agent = g_async_initable_new_finish (G_ASYNC_INITABLE (object), result, &error);
|
libnm-core, libnm, settings: move NMSecretAgentError to nm-errors
Move the definition of NMSecretAgentError to nm-errors, register it
with D-Bus, and verify in the tests that it maps correctly.
NM_SECRET_AGENT_ERROR_INTERNAL_ERROR is renamed to
NM_SECRET_AGENT_ERROR_FAILED, and NM_SECRET_AGENT_ERROR_NOT_AUTHORIZED
to NM_SECRET_AGENT_ERROR_PERMISSION_DENIED, for consistency with other
error domains. While NMSecretAgentError, unlike most other error
domains, has always been correctly mapped across D-Bus, the renaming
is not an ABI break, because the daemon never checks for either of
those values, so all versions of the daemon will treat
"org.freedesktop.NetworkManager.SecretAgent.InternalError" and
"org.freedesktop.NetworkManager.SecretAgent.Failed" the same (by just
ignoring the error name and keeping only the error message).
2014-10-15 15:27:25 -04:00
|
|
|
g_assert_error (error, NM_SECRET_AGENT_ERROR, NM_SECRET_AGENT_ERROR_FAILED);
|
2014-09-02 21:41:05 -04:00
|
|
|
g_assert (agent == NULL);
|
|
|
|
|
g_clear_error (&error);
|
|
|
|
|
|
|
|
|
|
g_main_loop_quit (loop);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-29 12:27:47 -04:00
|
|
|
static void
|
|
|
|
|
test_secret_agent_nm_not_running (void)
|
|
|
|
|
{
|
2014-11-20 11:53:19 -05:00
|
|
|
NMSecretAgentOld *agent;
|
2014-09-02 21:41:05 -04:00
|
|
|
GMainLoop *loop;
|
|
|
|
|
GError *error = NULL;
|
2014-08-29 12:27:47 -04:00
|
|
|
|
2014-09-02 21:41:05 -04:00
|
|
|
agent = g_initable_new (test_secret_agent_get_type (), NULL, &error,
|
2014-11-20 11:53:19 -05:00
|
|
|
NM_SECRET_AGENT_OLD_IDENTIFIER, "test-secret-agent",
|
2014-09-02 21:41:05 -04:00
|
|
|
NULL);
|
libnm-core, libnm, settings: move NMSecretAgentError to nm-errors
Move the definition of NMSecretAgentError to nm-errors, register it
with D-Bus, and verify in the tests that it maps correctly.
NM_SECRET_AGENT_ERROR_INTERNAL_ERROR is renamed to
NM_SECRET_AGENT_ERROR_FAILED, and NM_SECRET_AGENT_ERROR_NOT_AUTHORIZED
to NM_SECRET_AGENT_ERROR_PERMISSION_DENIED, for consistency with other
error domains. While NMSecretAgentError, unlike most other error
domains, has always been correctly mapped across D-Bus, the renaming
is not an ABI break, because the daemon never checks for either of
those values, so all versions of the daemon will treat
"org.freedesktop.NetworkManager.SecretAgent.InternalError" and
"org.freedesktop.NetworkManager.SecretAgent.Failed" the same (by just
ignoring the error name and keeping only the error message).
2014-10-15 15:27:25 -04:00
|
|
|
g_assert_error (error, NM_SECRET_AGENT_ERROR, NM_SECRET_AGENT_ERROR_FAILED);
|
2014-09-02 21:41:05 -04:00
|
|
|
g_assert (agent == NULL);
|
|
|
|
|
g_clear_error (&error);
|
2014-08-29 12:27:47 -04:00
|
|
|
|
2014-09-02 21:41:05 -04:00
|
|
|
loop = g_main_loop_new (NULL, FALSE);
|
|
|
|
|
g_async_initable_new_async (test_secret_agent_get_type (),
|
|
|
|
|
G_PRIORITY_DEFAULT,
|
|
|
|
|
NULL, async_init_cb, loop,
|
2014-11-20 11:53:19 -05:00
|
|
|
NM_SECRET_AGENT_OLD_IDENTIFIER, "test-secret-agent",
|
2014-09-02 21:41:05 -04:00
|
|
|
NULL);
|
|
|
|
|
g_main_loop_run (loop);
|
|
|
|
|
g_main_loop_unref (loop);
|
2014-08-29 12:27:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
registered_changed (GObject *object, GParamSpec *pspec, gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
GMainLoop *loop = user_data;
|
|
|
|
|
|
|
|
|
|
g_main_loop_quit (loop);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
test_secret_agent_auto_register (void)
|
|
|
|
|
{
|
2015-12-21 10:22:33 +01:00
|
|
|
NMTstcServiceInfo *sinfo;
|
2014-11-20 11:53:19 -05:00
|
|
|
NMSecretAgentOld *agent;
|
2014-08-29 12:27:47 -04:00
|
|
|
GMainLoop *loop;
|
2014-09-02 21:41:05 -04:00
|
|
|
GError *error = NULL;
|
2014-08-29 12:27:47 -04:00
|
|
|
|
2015-12-21 10:22:33 +01:00
|
|
|
sinfo = nmtstc_service_init ();
|
2018-05-06 08:51:26 +02:00
|
|
|
if (!nmtstc_service_available (sinfo))
|
|
|
|
|
return;
|
|
|
|
|
|
2014-08-29 12:27:47 -04:00
|
|
|
loop = g_main_loop_new (NULL, FALSE);
|
|
|
|
|
|
|
|
|
|
agent = test_secret_agent_new ();
|
|
|
|
|
g_object_set (agent,
|
2014-11-20 11:53:19 -05:00
|
|
|
NM_SECRET_AGENT_OLD_AUTO_REGISTER, TRUE,
|
2014-08-29 12:27:47 -04:00
|
|
|
NULL);
|
2014-11-20 11:53:19 -05:00
|
|
|
g_signal_connect (agent, "notify::" NM_SECRET_AGENT_OLD_REGISTERED,
|
2014-08-29 12:27:47 -04:00
|
|
|
G_CALLBACK (registered_changed), loop);
|
|
|
|
|
|
2014-11-20 11:53:19 -05:00
|
|
|
g_assert (!nm_secret_agent_old_get_registered (agent));
|
|
|
|
|
nm_secret_agent_old_register (agent, NULL, &error);
|
2014-09-02 21:41:05 -04:00
|
|
|
g_assert_no_error (error);
|
2014-11-20 11:53:19 -05:00
|
|
|
g_assert (nm_secret_agent_old_get_registered (agent));
|
2014-08-29 12:27:47 -04:00
|
|
|
|
2016-10-01 19:28:11 +02:00
|
|
|
/* The GLib ObjectManager doesn't like when we drop the service
|
|
|
|
|
* in between it sees the service disappear and the call to
|
|
|
|
|
* GetManagedObjects. Give it a chance to do its business.
|
|
|
|
|
* Arguably a bug. */
|
|
|
|
|
g_main_context_iteration (NULL, FALSE);
|
|
|
|
|
|
2014-08-29 12:27:47 -04:00
|
|
|
/* Shut down test service */
|
2015-12-21 10:22:33 +01:00
|
|
|
nmtstc_service_cleanup (sinfo);
|
2014-08-29 12:27:47 -04:00
|
|
|
g_main_loop_run (loop);
|
2014-11-20 11:53:19 -05:00
|
|
|
g_assert (!nm_secret_agent_old_get_registered (agent));
|
2014-08-29 12:27:47 -04:00
|
|
|
|
|
|
|
|
/* Restart test service */
|
2015-12-21 10:22:33 +01:00
|
|
|
sinfo = nmtstc_service_init ();
|
2018-05-06 08:51:26 +02:00
|
|
|
g_assert (nmtstc_service_available (sinfo));
|
|
|
|
|
|
2014-08-29 12:27:47 -04:00
|
|
|
g_main_loop_run (loop);
|
2014-11-20 11:53:19 -05:00
|
|
|
g_assert (nm_secret_agent_old_get_registered (agent));
|
2014-08-29 12:27:47 -04:00
|
|
|
|
2016-10-01 19:28:11 +02:00
|
|
|
/* Let ObjectManager initialize (see above). */
|
|
|
|
|
g_main_context_iteration (NULL, FALSE);
|
|
|
|
|
|
2014-08-29 12:27:47 -04:00
|
|
|
/* Shut down test service again */
|
2015-12-21 10:22:33 +01:00
|
|
|
nmtstc_service_cleanup (sinfo);
|
2014-08-29 12:27:47 -04:00
|
|
|
g_main_loop_run (loop);
|
2014-11-20 11:53:19 -05:00
|
|
|
g_assert (!nm_secret_agent_old_get_registered (agent));
|
2014-08-29 12:27:47 -04:00
|
|
|
|
|
|
|
|
g_object_unref (agent);
|
|
|
|
|
g_main_loop_unref (loop);
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-02 18:22:50 +02:00
|
|
|
/*****************************************************************************/
|
2014-08-29 12:27:47 -04:00
|
|
|
|
2015-07-03 15:11:17 +02:00
|
|
|
NMTST_DEFINE ();
|
|
|
|
|
|
2014-08-29 12:27:47 -04:00
|
|
|
int
|
|
|
|
|
main (int argc, char **argv)
|
|
|
|
|
{
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
|
g_setenv ("LIBNM_USE_SESSION_BUS", "1", TRUE);
|
|
|
|
|
|
2015-07-03 15:11:17 +02:00
|
|
|
nmtst_init (&argc, &argv, TRUE);
|
2014-08-29 12:27:47 -04:00
|
|
|
|
2014-09-02 21:41:05 -04:00
|
|
|
g_test_add ("/libnm/secret-agent/none", TestSecretAgentData, NULL,
|
2014-08-29 12:27:47 -04:00
|
|
|
test_setup, test_secret_agent_none, test_cleanup);
|
2014-09-02 21:41:05 -04:00
|
|
|
g_test_add ("/libnm/secret-agent/no-secrets", TestSecretAgentData, "sync",
|
2014-08-29 12:27:47 -04:00
|
|
|
test_setup, test_secret_agent_no_secrets, test_cleanup);
|
2014-09-02 21:41:05 -04:00
|
|
|
g_test_add ("/libnm/secret-agent/cancel", TestSecretAgentData, "async",
|
2014-08-29 12:27:47 -04:00
|
|
|
test_setup, test_secret_agent_cancel, test_cleanup);
|
2014-09-02 21:41:05 -04:00
|
|
|
g_test_add ("/libnm/secret-agent/good", TestSecretAgentData, "async",
|
2014-08-29 12:27:47 -04:00
|
|
|
test_setup, test_secret_agent_good, test_cleanup);
|
|
|
|
|
g_test_add_func ("/libnm/secret-agent/nm-not-running", test_secret_agent_nm_not_running);
|
|
|
|
|
g_test_add_func ("/libnm/secret-agent/auto-register", test_secret_agent_auto_register);
|
|
|
|
|
|
|
|
|
|
ret = g_test_run ();
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|