...
 
Commits (3)
......@@ -331,6 +331,23 @@ gsupplicant_interface_reattach(
GSupplicantInterfaceResultFunc fn,
void* data);
GCancellable*
gsupplicant_interface_add_blob(
GSupplicantInterface* self,
GCancellable* cancel,
const char* name,
GBytes* blob,
GSupplicantInterfaceResultFunc fn,
void* data); /* Since 1.0.12 */
GCancellable*
gsupplicant_interface_remove_blob(
GSupplicantInterface* iface,
GCancellable* cancel,
const char* name,
GSupplicantInterfaceResultFunc fn,
void* data); /* Since 1.0.12 */
#define GSUPPLICANT_ADD_NETWORK_DELETE_OTHER (0x01)
#define GSUPPLICANT_ADD_NETWORK_SELECT (0x02)
#define GSUPPLICANT_ADD_NETWORK_ENABLE (0x04)
......@@ -353,6 +370,17 @@ gsupplicant_interface_add_network_full(
GDestroyNotify destroy,
void* data);
GCancellable*
gsupplicant_interface_add_network_full2(
GSupplicantInterface* iface,
GCancellable* cancel,
const GSupplicantNetworkParams* params,
guint flags, /* See above */
GHashTable* blobs, /* char * => gbytes * */
GSupplicantInterfaceStringResultFunc fn,
GDestroyNotify destroy,
void* data); /* Since 1.0.12 */
GCancellable*
gsupplicant_interface_select_network(
GSupplicantInterface* iface,
......
......@@ -137,9 +137,11 @@ typedef enum gsupplicant_eap_method {
GSUPPLICANT_EAP_METHOD_PWD = (0x00040000)
} GSUPPLICANT_EAP_METHOD;
typedef enum gsupplicant_auth_fags {
typedef enum gsupplicant_auth_flags {
GSUPPLICANT_AUTH_DEFAULT = (0x00000000),
GSUPPLICANT_AUTH_PHASE2_AUTHEAP = (0x00000001)
GSUPPLICANT_AUTH_PHASE2_AUTHEAP = (0x00000001),
GSUPPLICANT_AUTH_PHASE1_PEAPV0 = (0x00000002), /* Since 1.0.12 */
GSUPPLICANT_AUTH_PHASE1_PEAPV1 = (0x00000004) /* Since 1.0.12 */
} GSUPPLICANT_AUTH_FLAGS;
typedef enum gsupplicant_op_mode {
......
......@@ -31,7 +31,9 @@
</method>
<method name="AddBlob">
<arg name="name" type="s" direction="in"/>
<arg name="data" type="ay" direction="in"/>
<arg name="data" type="ay" direction="in">
<annotation name="org.gtk.GDBus.C.ForceGVariant" value="true"/>
</arg>
</method>
<method name="GetBlob">
<arg name="name" type="s" direction="in"/>
......
This diff is collapsed.
......@@ -290,6 +290,27 @@ gsupplicant_check_abs_path(
return NULL;
}
const char*
gsupplicant_check_blob_or_abs_path(
const char* path,
GHashTable* blobs)
{
if (path && path[0]) {
const char* blob_prefix = "blob://";
if (!g_str_has_prefix(path, blob_prefix)) {
return gsupplicant_check_abs_path(path);
} else if (blobs) {
if (g_hash_table_contains(blobs, path + strlen(blob_prefix))) {
return path;
} else {
GWARN("No such blob: %s", path);
return NULL;
}
}
}
return NULL;
}
int
gsupplicant_dict_parse(
GVariant* dict,
......
......@@ -120,6 +120,11 @@ const char*
gsupplicant_check_abs_path(
const char* path);
const char*
gsupplicant_check_blob_or_abs_path(
const char* path,
GHashTable* blobs);
int
gsupplicant_dict_parse(
GVariant* dict,
......
......@@ -351,6 +351,47 @@ test_util_abs_path(
g_free(name);
}
/*==========================================================================*
* blob_or_abs_path
*==========================================================================*/
static
void
test_util_blob_or_abs_path(
void)
{
char* name = NULL;
int fd;
GHashTable *ht = g_hash_table_new(g_str_hash, g_str_equal);
g_assert(!gsupplicant_check_blob_or_abs_path(NULL, ht));
g_assert(!gsupplicant_check_blob_or_abs_path(NULL, NULL));
g_assert(!gsupplicant_check_blob_or_abs_path("", ht));
g_assert(!gsupplicant_check_blob_or_abs_path("foo", ht));
g_assert(!gsupplicant_check_blob_or_abs_path("blob://foo", NULL));
g_assert(!gsupplicant_check_blob_or_abs_path("blob://foo", ht));
g_hash_table_insert(ht, "foo", "bar");
g_assert(gsupplicant_check_blob_or_abs_path("blob://foo", ht));
g_assert(!gsupplicant_check_blob_or_abs_path("blob://bar", ht));
fd = g_file_open_tmp("test-abspath-XXXXXX", &name, NULL);
g_assert(fd >= 0);
GDEBUG_("%s", name);
g_assert(close(fd) == 0);
/* Now a file should exist (albeit empty), the check should pass */
g_assert(gsupplicant_check_blob_or_abs_path(name, NULL));
g_assert(gsupplicant_check_blob_or_abs_path(name, ht));
/* When the file is missing, the check should fail */
g_assert(g_unlink(name) == 0);
g_assert(!gsupplicant_check_blob_or_abs_path(name, NULL));
g_assert(!gsupplicant_check_blob_or_abs_path(name, ht));
g_free(name);
g_hash_table_unref(ht);
}
/*==========================================================================*
* dict_parse
*==========================================================================*/
......@@ -557,6 +598,7 @@ int main(int argc, char* argv[])
g_test_add_func(TEST_PREFIX "call_later", test_util_call_later);
g_test_add_func(TEST_PREFIX "cancel_later", test_util_cancel_later);
g_test_add_func(TEST_PREFIX "abs_path", test_util_abs_path);
g_test_add_func(TEST_PREFIX "blob_or_abs_path", test_util_blob_or_abs_path);
g_test_add_func(TEST_PREFIX "dict_parse", test_util_dict_parse);
g_test_add_func(TEST_PREFIX "utf8_from_bytes", test_util_utf8_from_bytes);
for (i = 0; i < G_N_ELEMENTS(test_util_utf8_data); i++) {
......