From ff033c6a2fb7a6286e66b6ed89e24ea4c6cd22c9 Mon Sep 17 00:00:00 2001 From: Dario Lombardo Date: Mon, 18 Jan 2016 12:01:14 +0100 Subject: extcap: add masked to options. This allows an option to be masked (like a password), by using the argument-type password. Change-Id: I2eae1be2e6672bff28ba5f749d7a3f687ebd4631 Reviewed-on: https://code.wireshark.org/review/13385 Reviewed-by: Dario Lombardo Petri-Dish: Roland Knall Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall --- extcap_parser.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'extcap_parser.c') diff --git a/extcap_parser.c b/extcap_parser.c index 000dd6307c..a562ada52c 100644 --- a/extcap_parser.c +++ b/extcap_parser.c @@ -63,6 +63,7 @@ gchar *extcap_get_complex_as_string(extcap_complex *comp) { comp->complex_value.bool_value ? "true" : "false"); break; case EXTCAP_ARG_STRING: + case EXTCAP_ARG_PASSWORD: case EXTCAP_ARG_FILESELECT: g_free(ret); ret = g_strdup(comp->complex_value.string_value); @@ -121,6 +122,7 @@ extcap_complex *extcap_parse_complex(extcap_arg_type complex_type, success = TRUE; break; case EXTCAP_ARG_STRING: + case EXTCAP_ARG_PASSWORD: case EXTCAP_ARG_FILESELECT: rc->complex_value.string_value = g_strdup(data); success = TRUE; @@ -174,6 +176,7 @@ gboolean extcap_compare_is_default(extcap_arg *element, extcap_complex *test) { result = TRUE; break; case EXTCAP_ARG_STRING: + case EXTCAP_ARG_PASSWORD: if (strcmp(extcap_complex_get_string(test), extcap_complex_get_string(element->default_complex)) == 0) result = TRUE; @@ -188,6 +191,7 @@ gboolean extcap_compare_is_default(extcap_arg *element, extcap_complex *test) { void extcap_free_complex(extcap_complex *comp) { if (comp->complex_type == EXTCAP_ARG_STRING + || comp->complex_type == EXTCAP_ARG_PASSWORD || comp->complex_type == EXTCAP_ARG_FILESELECT) g_free(comp->complex_value.string_value); @@ -627,6 +631,8 @@ extcap_arg *extcap_parse_arg_sentence(GList * args, extcap_token_sentence *s) { target_arg->arg_type = EXTCAP_ARG_RADIO; } else if (g_ascii_strcasecmp(v->value, "string") == 0) { target_arg->arg_type = EXTCAP_ARG_STRING; + } else if (g_ascii_strcasecmp(v->value, "password") == 0) { + target_arg->arg_type = EXTCAP_ARG_PASSWORD; } else if (g_ascii_strcasecmp(v->value, "fileselect") == 0) { target_arg->arg_type = EXTCAP_ARG_FILESELECT; } else if (g_ascii_strcasecmp(v->value, "multicheck") == 0) { -- cgit v1.2.1