summary refs log tree commit diff
path: root/src/ppp-manager/nm-pppd-plugin.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2014-07-06 02:16:10 +0200
committerMichael Biebl <biebl@debian.org>2014-07-06 02:16:10 +0200
commit33491bc4279481db8ae47213e34a6d695a0e8830 (patch)
tree097d2b0fdff3fae6885381ae5e57a182cd8cbbba /src/ppp-manager/nm-pppd-plugin.c
parent59c3714a494c3b3765657c0551ad82842d98a7d2 (diff)
Imported Upstream version 0.9.10.0 upstream/0.9.10.0
Diffstat (limited to 'src/ppp-manager/nm-pppd-plugin.c')
-rw-r--r--src/ppp-manager/nm-pppd-plugin.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/ppp-manager/nm-pppd-plugin.c b/src/ppp-manager/nm-pppd-plugin.c
index e2e5c709..e6ee86f7 100644
--- a/src/ppp-manager/nm-pppd-plugin.c
+++ b/src/ppp-manager/nm-pppd-plugin.c
@@ -174,13 +174,13 @@ nm_ip_up (void *data, int arg)
 	}
 
 	hash = g_hash_table_new_full (g_str_hash, g_str_equal,
-							NULL, value_destroy);
+	                              NULL, value_destroy);
 
 	g_hash_table_insert (hash, NM_PPP_IP4_CONFIG_INTERFACE, 
-					 str_to_gvalue (ifname));
+	                     str_to_gvalue (ifname));
 
 	g_hash_table_insert (hash, NM_PPP_IP4_CONFIG_ADDRESS, 
-					 uint_to_gvalue (opts.ouraddr));
+	                     uint_to_gvalue (opts.ouraddr));
 
 	/* Prefer the peer options remote address first, _unless_ pppd made the
 	 * address up, at which point prefer the local options remote address,
@@ -259,22 +259,22 @@ get_credentials (char *username, char *password)
 	size_t len;
 	GError *err = NULL;
 
-	if (username && !password) {
+	if (!password) {
 		/* pppd is checking pap support; return 1 for supported */
+		g_return_val_if_fail (username, -1);
 		return 1;
 	}
 
+	g_return_val_if_fail (username, -1);
 	g_return_val_if_fail (DBUS_IS_G_PROXY (proxy), -1);
 
 	g_message ("nm-ppp-plugin: (%s): passwd-hook, requesting credentials...", __func__);
 
-	dbus_g_proxy_call (proxy, "NeedSecrets", &err,
-	                   G_TYPE_INVALID,
-	                   G_TYPE_STRING, &my_username,
-	                   G_TYPE_STRING, &my_password,
-	                   G_TYPE_INVALID);
-
-	if (err) {
+	if (!dbus_g_proxy_call (proxy, "NeedSecrets", &err,
+	                        G_TYPE_INVALID,
+	                        G_TYPE_STRING, &my_username,
+	                        G_TYPE_STRING, &my_password,
+	                        G_TYPE_INVALID)) {
 		g_warning ("nm-ppp-plugin: (%s): could not get secrets: (%d) %s",
 		           __func__,
 		           err ? err->code : -1,
@@ -325,7 +325,9 @@ plugin_init (void)
 	DBusGConnection *bus;
 	GError *err = NULL;
 
+#if !GLIB_CHECK_VERSION (2, 35, 0)
 	g_type_init ();
+#endif
 
 	g_message ("nm-ppp-plugin: (%s): initializing", __func__);