mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-13 15:56:23 +01:00
gdbusaddress: Validate the noncefile attribute of nonce-tcp addresses
Doing this mostly to fix a compiler warning about tautological assignments on Android. See the D-Bus specification: https://dbus.freedesktop.org/doc/dbus-specification.html#transports-nonce-tcp-sockets Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
e99003841a
commit
8492df9f34
@ -265,9 +265,17 @@ is_valid_nonce_tcp (const gchar *address_entry,
|
|||||||
/* TODO: validate host */
|
/* TODO: validate host */
|
||||||
}
|
}
|
||||||
|
|
||||||
nonce_file = nonce_file; /* To avoid -Wunused-but-set-variable */
|
if (nonce_file != NULL && *nonce_file == '\0')
|
||||||
|
{
|
||||||
|
g_set_error (error,
|
||||||
|
G_IO_ERROR,
|
||||||
|
G_IO_ERROR_INVALID_ARGUMENT,
|
||||||
|
_("Error in address “%s” — the “%s” attribute is malformed"),
|
||||||
|
address_entry, "noncefile");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
ret= TRUE;
|
ret = TRUE;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
g_list_free (keys);
|
g_list_free (keys);
|
||||||
|
@ -146,6 +146,7 @@ test_nonce_tcp_address (void)
|
|||||||
assert_not_supported_address ("nonce-tcp:host=localhost,port=420000");
|
assert_not_supported_address ("nonce-tcp:host=localhost,port=420000");
|
||||||
assert_not_supported_address ("nonce-tcp:host=localhost,port=42x");
|
assert_not_supported_address ("nonce-tcp:host=localhost,port=42x");
|
||||||
assert_not_supported_address ("nonce-tcp:host=localhost,port=");
|
assert_not_supported_address ("nonce-tcp:host=localhost,port=");
|
||||||
|
assert_not_supported_address ("nonce-tcp:host=localhost,port=42,noncefile=");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user