2 * External password backend
3 * Copyright (c) 2012, Jouni Malinen <j@w1.fi>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
12 #include "ext_password_i.h"
15 struct ext_password_test_data {
20 static void * ext_password_test_init(const char *params)
22 struct ext_password_test_data *data;
24 data = os_zalloc(sizeof(*data));
29 data->params = os_strdup(params);
35 static void ext_password_test_deinit(void *ctx)
37 struct ext_password_test_data *data = ctx;
39 os_free(data->params);
44 static struct wpabuf * ext_password_test_get(void *ctx, const char *name)
46 struct ext_password_test_data *data = ctx;
50 wpa_printf(MSG_DEBUG, "EXT PW TEST: get(%s)", name);
55 nlen = os_strlen(name);
58 if (os_strncmp(pos, name, nlen) == 0 && pos[nlen] == '=') {
62 while (*pos2 != '|' && *pos2 != '\0')
64 buf = ext_password_alloc(pos2 - pos);
67 wpabuf_put_data(buf, pos, pos2 - pos);
68 wpa_hexdump_ascii_key(MSG_DEBUG, "EXT PW TEST: value",
74 pos = os_strchr(pos + 1, '|');
79 wpa_printf(MSG_DEBUG, "EXT PW TEST: get(%s) - not found", name);
85 const struct ext_password_backend ext_password_test = {
87 .init = ext_password_test_init,
88 .deinit = ext_password_test_deinit,
89 .get = ext_password_test_get,