diff --git a/SRC/ChangeLog b/SRC/ChangeLog index e854214..a3b0f3b 100644 --- a/SRC/ChangeLog +++ b/SRC/ChangeLog @@ -5,6 +5,11 @@ supported via plugins. Consequences: - you now need an Unix with a working dlopen(3) - echoping now requires the popt parsing library + * popt: echoping now depends on popt. One main change: options + parsing is lightly different so some scripts *may* break. A + typical example is that "old-school" Unix aggreation of arguments + ("echoping -v4 localhost") is no longer accepted (use "echoping -v + -4 localhost"). 5.2.0 (2004-02-29) diff --git a/SRC/INSTALL b/SRC/INSTALL index d889175..eb89e15 100644 --- a/SRC/INSTALL +++ b/SRC/INSTALL @@ -58,6 +58,12 @@ check first that you use the FQDN of the server on the command line (this is a consequence of the HTTP 1.1 protocol, not a bug in echoping and this will show only if the HTTP server uses "virtual hosting"). +The SSL support (with OpenSSL *or* GNU TLS) is not established by +default, mostly because cryptography software's status is still +unclear in some countries. You have to use --with-ssl (which should be +--with--openssl, I know, there are two libraries, with incompatible +APIs) or --with-gnutls + ************* Bug reports *********************** To report a bug, email Stephane Bortzmeyer diff --git a/SRC/echoping.1.in b/SRC/echoping.1.in index 8b8a2a4..fa7b994 100644 --- a/SRC/echoping.1.in +++ b/SRC/echoping.1.in @@ -127,13 +127,15 @@ or (depending on your Unix). /usr/include/netinet/ip.h may contain interesting constants for setting Type Of Service. .IP -m\ plugin -Load the given plugin. Quite experimental. The plugin is first +Load the given plugin. The plugin is first searched in the normal library directories (see .BR ld.so(8) -) then in @plugins_dir@. The documentation for a +) then in @plugins_dir@. You can type +.BR ls +in @plugins_dir@ to get an idea of the available plugins. The documentation for a given plugin is in .BR echoping_PLUGINNAME(1) -. The plugin-specific options appear +The plugin-specific options appear .B after the hostname. .SH EXAMPLES diff --git a/SRC/echoping.c b/SRC/echoping.c index 546e422..f01eb3a 100644 --- a/SRC/echoping.c +++ b/SRC/echoping.c @@ -48,7 +48,7 @@ main (argc, argv) int remaining = argc; char **leftover; - int sockfd; + int sockfd = -1; struct addrinfo hints, hints_numeric, *res; int error; char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV]; @@ -76,17 +76,17 @@ main (argc, argv) void printstats (); #ifdef HAVE_USLEEP - double wait = 1.0; + float wait = 1.0; #else unsigned int wait = 1; #endif unsigned char fill = ' '; - unsigned int fill_i; - boolean fill_requested = 0; + char *fill_s; + boolean fill_requested = FALSE; unsigned int i = 0; char *plugin_name, *complete_plugin_name = NULL; char *ext; - void *plugin; + void *plugin = NULL; int plugin_result; void to_alarm (); /* our alarm() signal handler */ @@ -100,7 +100,7 @@ main (argc, argv) #endif char *plugin_port_name, *port_name; - boolean plugin_raw; + boolean plugin_raw = FALSE; boolean port_to_use = USE_ECHO; boolean http = 0; boolean smtp = 0; @@ -147,35 +147,41 @@ main (argc, argv) {"verbose", 'v', POPT_ARG_NONE, &verbose, 'v'}, {"help", '?', POPT_ARG_NONE, NULL, '?'}, {"size", 's', POPT_ARG_INT, &size, 's'}, - {"number", 'n', POPT_ARG_INT, &number, 'n'}, + {"number", 'n', POPT_ARG_INT, &number, 'n', "Number of iterations"}, #ifdef HAVE_USLEEP - {"wait", 'w', POPT_ARG_FLOAT, &wait, 'w'}, + {"wait", 'w', POPT_ARG_FLOAT, &wait, 'w', "Delay between iterations"}, #else - {"wait", 'w', POPT_ARG_INT, &wait, 'w'}, + {"wait", 'w', POPT_ARG_INT, &wait, 'w', "Delay between iterations"}, #endif {"discard", 'd', POPT_ARG_NONE, &discard, 'd'}, {"chargen", 'c', POPT_ARG_NONE, &chargen, 'c'}, {"http", 'h', POPT_ARG_STRING, &url, 'h'}, - {"icp", 'i', POPT_ARG_STRING, &url, 'i'}, - {"ttcp", 'r', POPT_ARG_NONE, &ttcp, 'r'}, + {"icp", 'i', POPT_ARG_STRING, &url, 'i', + "ICP protocol, for Web proxies/caches"}, + {"ttcp", 'r', POPT_ARG_NONE, &ttcp, 'r', + "Use the T/TCP protocol (Transaction TCP)"}, {"udp", 'u', POPT_ARG_NONE, &udp, 'u'}, {"timeout", 't', POPT_ARG_INT, &timeout, 't'}, - {"fill", 'f', POPT_ARG_INT, &fill_i, 'f'}, + {"fill", 'f', POPT_ARG_STRING, &fill_s, 'f'}, {"smtp", 'S', POPT_ARG_NONE, &smtp, 'S'}, {"ssl", 'C', POPT_ARG_NONE, &ssl, 'C'}, {"priority", 'p', POPT_ARG_INT, &priority, 'p'}, {"type-of-service", 'P', POPT_ARG_INT, &tos, 'P'}, - {"check-original", 'a', POPT_ARG_NONE, NULL, 'a'}, - {"ignore-cache", 'A', POPT_ARG_NONE, NULL, 'A'}, + {"check-original", 'a', POPT_ARG_NONE, NULL, 'a', + "For HTTP through a proxy/cache"}, + {"ignore-cache", 'A', POPT_ARG_NONE, NULL, 'A', + "For HTTP through a proxy/cache"}, {"ipv4", '4', POPT_ARG_NONE, NULL, '4'}, {"ipv6", '6', POPT_ARG_NONE, NULL, '6'}, - {"module", 'm', POPT_ARG_STRING, &plugin_name, 'm'}, + {"module", 'm', POPT_ARG_STRING, &plugin_name, 'm', + "Loads the given plugin"}, POPT_TABLEEND }; poptContext poptcon; - global_options.udp = 0; - global_options.verbose = 0; + global_options.udp = FALSE; + global_options.ttcp = FALSE; + global_options.verbose = FALSE; null_timeval.tv_sec = 0; null_timeval.tv_usec = 0; @@ -216,6 +222,9 @@ main (argc, argv) case '?': poptPrintHelp (poptcon, stdout, 0); fprintf (stdout, " hostname [plugin-options...]\n"); + fprintf (stdout, + " (You can get a list of available plugins with \"ls %s\")\n", + PLUGINS_DIR); exit (0); case 'v': break; @@ -255,7 +264,9 @@ main (argc, argv) break; case 'f': remaining--; - fill = (char) fill_i; + if (strlen (fill_s) > 1) + err_quit ("Argument --fill should be a one-character string"); + fill = fill_s[0]; fill_requested = 1; break; case 'S': @@ -444,7 +455,7 @@ main (argc, argv) sprintf (plugin_name, "%s.so", plugin_name); plugin = dlopen (plugin_name, RTLD_NOW); if (!plugin) - { + { /* Retries with the absolute name */ complete_plugin_name = (char *) malloc (MAX_LINE); sprintf (complete_plugin_name, "%s/%s", PLUGINS_DIR, plugin_name); @@ -462,6 +473,7 @@ main (argc, argv) err_sys ("Cannot find init in %s: %s", plugin_name, dlerror ()); } global_options.udp = udp; + global_options.ttcp = ttcp; global_options.verbose = verbose; if (family == AF_INET) global_options.only_ipv4 = 1; @@ -725,9 +737,10 @@ main (argc, argv) } else { - sendline = (char *) malloc (size); + sendline = (char *) malloc (size + 1); for (i = 0; i < size; i++) sendline[i] = fill; + sendline[size] = 0; } n = strlen (sendline); diff --git a/SRC/echoping.h b/SRC/echoping.h index 3d99dc0..d4561ab 100644 --- a/SRC/echoping.h +++ b/SRC/echoping.h @@ -128,6 +128,7 @@ boolean timeout_flag; struct echoping_struct { boolean udp; /* Use the UDP protocol (TCP is the default) */ + boolean ttcp; boolean only_ipv4; boolean only_ipv6; boolean verbose; diff --git a/SRC/http.c b/SRC/http.c index 66c580a..9d0563c 100644 --- a/SRC/http.c +++ b/SRC/http.c @@ -52,7 +52,7 @@ make_http_sendline (char *url, char *host, int port, int nocache) int read_from_server (CHANNEL fs, short ssl) { - int nr; + int nr = 0; int total = 0; char reply_code; int first_line = TRUE; diff --git a/SRC/util.c b/SRC/util.c index ead878c..c764018 100644 --- a/SRC/util.c +++ b/SRC/util.c @@ -14,7 +14,7 @@ random_string (unsigned length) { char *state = (char *) malloc (sizeof (char) * STATES); - char *result = (char *) malloc (length); + char *result = (char *) malloc (length + 1); int i, number; unsigned seed = (unsigned) time ((time_t *) NULL);