diff options
Diffstat (limited to 'src/testcurl/https/tls_test_common.c')
-rw-r--r-- | src/testcurl/https/tls_test_common.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/testcurl/https/tls_test_common.c b/src/testcurl/https/tls_test_common.c index 044394b9..f28f2fb2 100644 --- a/src/testcurl/https/tls_test_common.c +++ b/src/testcurl/https/tls_test_common.c | |||
@@ -23,7 +23,9 @@ | |||
23 | * @file tls_test_common.c | 23 | * @file tls_test_common.c |
24 | * @brief Common tls test functions | 24 | * @brief Common tls test functions |
25 | * @author Sagie Amir | 25 | * @author Sagie Amir |
26 | * @author Karlson2k (Evgeny Grin) | ||
26 | */ | 27 | */ |
28 | #include <string.h> | ||
27 | #include "tls_test_common.h" | 29 | #include "tls_test_common.h" |
28 | #include "tls_test_keys.h" | 30 | #include "tls_test_keys.h" |
29 | 31 | ||
@@ -51,6 +53,18 @@ const char *priorities_map[KNOW_TLS_IDS_COUNT] = { | |||
51 | "NORMAL:!VERS-ALL:+VERS-TLS1.3" | 53 | "NORMAL:!VERS-ALL:+VERS-TLS1.3" |
52 | }; | 54 | }; |
53 | 55 | ||
56 | /** | ||
57 | * Map @a know_gnutls_tls_ids values to GnuTLS priorities append strings. | ||
58 | */ | ||
59 | const char *priorities_append_map[KNOW_TLS_IDS_COUNT] = { | ||
60 | "NONE", | ||
61 | "!VERS-ALL:+VERS-SSL3.0", | ||
62 | "!VERS-ALL:+VERS-TLS1.0", | ||
63 | "!VERS-ALL:+VERS-TLS1.1", | ||
64 | "!VERS-ALL:+VERS-TLS1.2", | ||
65 | "!VERS-ALL:+VERS-TLS1.3" | ||
66 | }; | ||
67 | |||
54 | 68 | ||
55 | /** | 69 | /** |
56 | * Map @a know_gnutls_tls_ids values to libcurl @a CURLOPT_SSLVERSION value. | 70 | * Map @a know_gnutls_tls_ids values to libcurl @a CURLOPT_SSLVERSION value. |
@@ -726,3 +740,43 @@ testsuite_curl_global_init (void) | |||
726 | } | 740 | } |
727 | return 1; | 741 | return 1; |
728 | } | 742 | } |
743 | |||
744 | |||
745 | /** | ||
746 | * Check whether program name contains specific @a marker string. | ||
747 | * Only last component in pathname is checked for marker presence, | ||
748 | * all leading directories names (if any) are ignored. Directories | ||
749 | * separators are handled correctly on both non-W32 and W32 | ||
750 | * platforms. | ||
751 | * @param prog_name program name, may include path | ||
752 | * @param marker marker to look for. | ||
753 | * @return zero if any parameter is NULL or empty string or | ||
754 | * @prog_name ends with slash or @marker is not found in | ||
755 | * program name, non-zero if @maker is found in program | ||
756 | * name. | ||
757 | */ | ||
758 | int | ||
759 | has_in_name (const char *prog_name, const char *marker) | ||
760 | { | ||
761 | size_t name_pos; | ||
762 | size_t pos; | ||
763 | |||
764 | if (! prog_name || ! marker || ! prog_name[0] || ! marker[0]) | ||
765 | return 0; | ||
766 | |||
767 | pos = 0; | ||
768 | name_pos = 0; | ||
769 | while (prog_name[pos]) | ||
770 | { | ||
771 | if ('/' == prog_name[pos]) | ||
772 | name_pos = pos + 1; | ||
773 | #if defined(_WIN32) || defined(__CYGWIN__) | ||
774 | else if ('\\' == prog_name[pos]) | ||
775 | name_pos = pos + 1; | ||
776 | #endif /* _WIN32 || __CYGWIN__ */ | ||
777 | pos++; | ||
778 | } | ||
779 | if (name_pos == pos) | ||
780 | return 0; | ||
781 | return strstr (prog_name + name_pos, marker) != (char *) 0; | ||
782 | } | ||