diff options
Diffstat (limited to 'src/testcurl/curl_version_check.c')
-rw-r--r-- | src/testcurl/curl_version_check.c | 108 |
1 files changed, 56 insertions, 52 deletions
diff --git a/src/testcurl/curl_version_check.c b/src/testcurl/curl_version_check.c index dff143f8..d1134f42 100644 --- a/src/testcurl/curl_version_check.c +++ b/src/testcurl/curl_version_check.c | |||
@@ -39,11 +39,11 @@ parse_version_number (const char **s) | |||
39 | char num[17]; | 39 | char num[17]; |
40 | 40 | ||
41 | while (i < 16 && ((**s >= '0') & (**s <= '9'))) | 41 | while (i < 16 && ((**s >= '0') & (**s <= '9'))) |
42 | { | 42 | { |
43 | num[i] = **s; | 43 | num[i] = **s; |
44 | (*s)++; | 44 | (*s)++; |
45 | i++; | 45 | i++; |
46 | } | 46 | } |
47 | 47 | ||
48 | num[i] = '\0'; | 48 | num[i] = '\0'; |
49 | 49 | ||
@@ -53,7 +53,7 @@ parse_version_number (const char **s) | |||
53 | const char * | 53 | const char * |
54 | parse_version_string (const char *s, int *major, int *minor, int *micro) | 54 | parse_version_string (const char *s, int *major, int *minor, int *micro) |
55 | { | 55 | { |
56 | if (!s) | 56 | if (! s) |
57 | return NULL; | 57 | return NULL; |
58 | *major = parse_version_number (&s); | 58 | *major = parse_version_number (&s); |
59 | if (*s != '.') | 59 | if (*s != '.') |
@@ -69,9 +69,9 @@ parse_version_string (const char *s, int *major, int *minor, int *micro) | |||
69 | 69 | ||
70 | #ifdef HTTPS_SUPPORT | 70 | #ifdef HTTPS_SUPPORT |
71 | int | 71 | int |
72 | curl_uses_nss_ssl() | 72 | curl_uses_nss_ssl () |
73 | { | 73 | { |
74 | return (strstr(curl_version(), " NSS/") != NULL) ? 0 : -1; | 74 | return (strstr (curl_version (), " NSS/") != NULL) ? 0 : -1; |
75 | } | 75 | } |
76 | #endif /* HTTPS_SUPPORT */ | 76 | #endif /* HTTPS_SUPPORT */ |
77 | 77 | ||
@@ -105,23 +105,25 @@ curl_check_version (const char *req_version) | |||
105 | return -1; | 105 | return -1; |
106 | curl_ver++; | 106 | curl_ver++; |
107 | /* Parse version numbers */ | 107 | /* Parse version numbers */ |
108 | if ( (NULL == parse_version_string (req_version, &rq_major, &rq_minor, &rq_micro)) || | 108 | if ( (NULL == parse_version_string (req_version, &rq_major, &rq_minor, |
109 | (NULL == parse_version_string (curl_ver, &loc_major, &loc_minor, &loc_micro)) ) | 109 | &rq_micro)) || |
110 | (NULL == parse_version_string (curl_ver, &loc_major, &loc_minor, | ||
111 | &loc_micro)) ) | ||
110 | return -1; | 112 | return -1; |
111 | 113 | ||
112 | /* Compare version numbers. */ | 114 | /* Compare version numbers. */ |
113 | if ((loc_major > rq_major | 115 | if (((loc_major > rq_major) |
114 | || (loc_major == rq_major && loc_minor > rq_minor) | 116 | || ((loc_major == rq_major)&&(loc_minor > rq_minor)) |
115 | || (loc_major == rq_major && loc_minor == rq_minor | 117 | || ((loc_major == rq_major)&&(loc_minor == rq_minor) |
116 | && loc_micro > rq_micro) || (loc_major == rq_major | 118 | &&(loc_micro > rq_micro)) || ((loc_major == rq_major) |
117 | && loc_minor == rq_minor | 119 | &&(loc_minor == rq_minor) |
118 | && loc_micro == rq_micro)) == 0) | 120 | &&(loc_micro == rq_micro) )) == 0) |
119 | { | 121 | { |
120 | fprintf (stderr, | 122 | fprintf (stderr, |
121 | "Error: running curl test depends on local libcurl version > %s\n", | 123 | "Error: running curl test depends on local libcurl version > %s\n", |
122 | req_version); | 124 | req_version); |
123 | return -1; | 125 | return -1; |
124 | } | 126 | } |
125 | 127 | ||
126 | /* | 128 | /* |
127 | * enforce required gnutls/openssl version. | 129 | * enforce required gnutls/openssl version. |
@@ -133,44 +135,46 @@ curl_check_version (const char *req_version) | |||
133 | return -1; | 135 | return -1; |
134 | ssl_ver++; | 136 | ssl_ver++; |
135 | if (strncmp ("GnuTLS", ssl_ver, strlen ("GNUtls")) == 0) | 137 | if (strncmp ("GnuTLS", ssl_ver, strlen ("GNUtls")) == 0) |
136 | { | 138 | { |
137 | ssl_ver = strchr (ssl_ver, '/'); | 139 | ssl_ver = strchr (ssl_ver, '/'); |
138 | req_ssl_ver = MHD_REQ_CURL_GNUTLS_VERSION; | 140 | req_ssl_ver = MHD_REQ_CURL_GNUTLS_VERSION; |
139 | } | 141 | } |
140 | else if (strncmp ("OpenSSL", ssl_ver, strlen ("OpenSSL")) == 0) | 142 | else if (strncmp ("OpenSSL", ssl_ver, strlen ("OpenSSL")) == 0) |
141 | { | 143 | { |
142 | ssl_ver = strchr (ssl_ver, '/'); | 144 | ssl_ver = strchr (ssl_ver, '/'); |
143 | req_ssl_ver = MHD_REQ_CURL_OPENSSL_VERSION; | 145 | req_ssl_ver = MHD_REQ_CURL_OPENSSL_VERSION; |
144 | } | 146 | } |
145 | else if (strncmp ("NSS", ssl_ver, strlen ("NSS")) == 0) | 147 | else if (strncmp ("NSS", ssl_ver, strlen ("NSS")) == 0) |
146 | { | 148 | { |
147 | ssl_ver = strchr (ssl_ver, '/'); | 149 | ssl_ver = strchr (ssl_ver, '/'); |
148 | req_ssl_ver = MHD_REQ_CURL_NSS_VERSION; | 150 | req_ssl_ver = MHD_REQ_CURL_NSS_VERSION; |
149 | } | 151 | } |
150 | else | 152 | else |
151 | { | 153 | { |
152 | fprintf (stderr, "Error: unrecognized curl ssl library\n"); | 154 | fprintf (stderr, "Error: unrecognized curl ssl library\n"); |
153 | return -1; | 155 | return -1; |
154 | } | 156 | } |
155 | if (ssl_ver == NULL) | 157 | if (ssl_ver == NULL) |
156 | return -1; | 158 | return -1; |
157 | ssl_ver++; | 159 | ssl_ver++; |
158 | if ( (NULL == parse_version_string (req_ssl_ver, &rq_major, &rq_minor, &rq_micro)) || | 160 | if ( (NULL == parse_version_string (req_ssl_ver, &rq_major, &rq_minor, |
159 | (NULL == parse_version_string (ssl_ver, &loc_major, &loc_minor, &loc_micro)) ) | 161 | &rq_micro)) || |
162 | (NULL == parse_version_string (ssl_ver, &loc_major, &loc_minor, | ||
163 | &loc_micro)) ) | ||
160 | return -1; | 164 | return -1; |
161 | 165 | ||
162 | if ((loc_major > rq_major | 166 | if (((loc_major > rq_major) |
163 | || (loc_major == rq_major && loc_minor > rq_minor) | 167 | || ((loc_major == rq_major)&&(loc_minor > rq_minor)) |
164 | || (loc_major == rq_major && loc_minor == rq_minor | 168 | || ((loc_major == rq_major)&&(loc_minor == rq_minor) |
165 | && loc_micro > rq_micro) || (loc_major == rq_major | 169 | &&(loc_micro > rq_micro)) || ((loc_major == rq_major) |
166 | && loc_minor == rq_minor | 170 | &&(loc_minor == rq_minor) |
167 | && loc_micro == rq_micro)) == 0) | 171 | &&(loc_micro == rq_micro) )) == 0) |
168 | { | 172 | { |
169 | fprintf (stderr, | 173 | fprintf (stderr, |
170 | "Error: running curl test depends on local libcurl SSL version > %s\n", | 174 | "Error: running curl test depends on local libcurl SSL version > %s\n", |
171 | req_ssl_ver); | 175 | req_ssl_ver); |
172 | return -1; | 176 | return -1; |
173 | } | 177 | } |
174 | #endif /* HTTPS_SUPPORT */ | 178 | #endif /* HTTPS_SUPPORT */ |
175 | return 0; | 179 | return 0; |
176 | } | 180 | } |