projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove extra bang
[oweals/openssl.git]
/
apps
/
s_time.c
diff --git
a/apps/s_time.c
b/apps/s_time.c
index ecab515b1f65f3e8c48d76012edaed648512ac40..263502c753ea16d272ada6c453eac7ae024b8764 100644
(file)
--- a/
apps/s_time.c
+++ b/
apps/s_time.c
@@
-38,11
+38,6
@@
* #define TEST_CERT "client.pem"
*/
* #define TEST_CERT "client.pem"
*/
-#undef BUFSIZZ
-#define BUFSIZZ 1024*10
-
-#define MYBUFSIZ 1024*8
-
#undef min
#undef max
#define min(a,b) (((a) < (b)) ? (a) : (b))
#undef min
#undef max
#define min(a,b) (((a) < (b)) ? (a) : (b))
@@
-52,11
+47,10
@@
#define SECONDS 30
#define SECONDSSTR "30"
#define SECONDS 30
#define SECONDSSTR "30"
-extern int verify_depth;
-extern int verify_error;
-
static SSL *doConnection(SSL *scon, const char *host, SSL_CTX *ctx);
static SSL *doConnection(SSL *scon, const char *host, SSL_CTX *ctx);
+static const char fmt_http_get_cmd[] = "GET %s HTTP/1.0\r\n\r\n";
+
typedef enum OPTION_choice {
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
OPT_CONNECT, OPT_CIPHER, OPT_CERT, OPT_KEY, OPT_CAPATH,
typedef enum OPTION_choice {
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
OPT_CONNECT, OPT_CIPHER, OPT_CERT, OPT_KEY, OPT_CAPATH,
@@
-109,15
+103,13
@@
int s_time_main(int argc, char **argv)
char *host = SSL_CONNECT_NAME, *certfile = NULL, *keyfile = NULL, *prog;
double totalTime = 0.0;
int noCApath = 0, noCAfile = 0;
char *host = SSL_CONNECT_NAME, *certfile = NULL, *keyfile = NULL, *prog;
double totalTime = 0.0;
int noCApath = 0, noCAfile = 0;
- int maxtime = SECONDS, nConn = 0, perform = 3, ret = 1, i, st_bugs =
- 0, ver;
+ int maxtime = SECONDS, nConn = 0, perform = 3, ret = 1, i, st_bugs = 0;
long bytes_read = 0, finishtime = 0;
OPTION_CHOICE o;
long bytes_read = 0, finishtime = 0;
OPTION_CHOICE o;
- int max_version = 0;
+ int max_version = 0, ver, buf_len;
+ size_t buf_size;
meth = TLS_client_method();
meth = TLS_client_method();
- verify_depth = 0;
- verify_error = X509_V_OK;
prog = opt_init(argc, argv, s_time_options);
while ((o = opt_next()) != OPT_EOF) {
prog = opt_init(argc, argv, s_time_options);
while ((o = opt_next()) != OPT_EOF) {
@@
-141,10
+133,10
@@
int s_time_main(int argc, char **argv)
perform = 1;
break;
case OPT_VERIFY:
perform = 1;
break;
case OPT_VERIFY:
- if (!opt_int(opt_arg(), &verify_depth))
+ if (!opt_int(opt_arg(), &verify_
args.
depth))
goto opthelp;
BIO_printf(bio_err, "%s: verify depth is %d\n",
goto opthelp;
BIO_printf(bio_err, "%s: verify depth is %d\n",
- prog, verify_depth);
+ prog, verify_
args.
depth);
break;
case OPT_CERT:
certfile = opt_arg();
break;
case OPT_CERT:
certfile = opt_arg();
@@
-176,8
+168,9
@@
int s_time_main(int argc, char **argv)
break;
case OPT_WWW:
www_path = opt_arg();
break;
case OPT_WWW:
www_path = opt_arg();
- if (strlen(www_path) > MYBUFSIZ - 100) {
- BIO_printf(bio_err, "%s: -www option too long\n", prog);
+ buf_size = strlen(www_path) + sizeof(fmt_http_get_cmd) - 2; /* 2 is for %s */
+ if (buf_size > sizeof(buf)) {
+ BIO_printf(bio_err, "%s: -www option is too long\n", prog);
goto end;
}
break;
goto end;
}
break;
@@
-232,9
+225,9
@@
int s_time_main(int argc, char **argv)
goto end;
if (www_path != NULL) {
goto end;
if (www_path != NULL) {
-
BIO_snprintf(buf, sizeof buf, "GET %s HTTP/1.0\r\n\r\n"
,
- www_path);
- if (SSL_write(scon, buf,
strlen(buf)
) <= 0)
+
buf_len = BIO_snprintf(buf, sizeof buf
,
+
fmt_http_get_cmd,
www_path);
+ if (SSL_write(scon, buf,
buf_len
) <= 0)
goto end;
while ((i = SSL_read(scon, buf, sizeof(buf))) > 0)
bytes_read += i;
goto end;
while ((i = SSL_read(scon, buf, sizeof(buf))) > 0)
bytes_read += i;
@@
-290,8
+283,9
@@
int s_time_main(int argc, char **argv)
}
if (www_path != NULL) {
}
if (www_path != NULL) {
- BIO_snprintf(buf, sizeof buf, "GET %s HTTP/1.0\r\n\r\n", www_path);
- if (SSL_write(scon, buf, strlen(buf)) <= 0)
+ buf_len = BIO_snprintf(buf, sizeof buf,
+ fmt_http_get_cmd, www_path);
+ if (SSL_write(scon, buf, buf_len) <= 0)
goto end;
while (SSL_read(scon, buf, sizeof(buf)) > 0)
continue;
goto end;
while (SSL_read(scon, buf, sizeof(buf)) > 0)
continue;
@@
-413,9
+407,9
@@
static SSL *doConnection(SSL *scon, const char *host, SSL_CTX *ctx)
}
if (i <= 0) {
BIO_printf(bio_err, "ERROR\n");
}
if (i <= 0) {
BIO_printf(bio_err, "ERROR\n");
- if (verify_error != X509_V_OK)
+ if (verify_
args.
error != X509_V_OK)
BIO_printf(bio_err, "verify error:%s\n",
BIO_printf(bio_err, "verify error:%s\n",
- X509_verify_cert_error_string(verify_error));
+ X509_verify_cert_error_string(verify_
args.
error));
else
ERR_print_errors(bio_err);
if (scon == NULL)
else
ERR_print_errors(bio_err);
if (scon == NULL)