diff --git a/depcomp b/depcomp index 6b39162..715e343 100755 --- a/depcomp +++ b/depcomp @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2020 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/install-sh b/install-sh index 20d8b2e..ec298b5 100755 --- a/install-sh +++ b/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2018-03-11.20; # UTC +scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -69,6 +69,11 @@ posix_mkdir= # Desired mode of installed file. mode=0755 +# Create dirs (including intermediate dirs) using mode 755. +# This is like GNU 'install' as of coreutils 8.32 (2020). +mkdir_umask=22 + +backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= @@ -99,18 +104,28 @@ Options: --version display version info and exit. -c (ignored) - -C install only if different (preserve the last data modification time) + -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. + -p pass -p to $cpprog. -s $stripprog installed files. + -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG + +By default, rm is invoked with -f; when overridden with RMPROG, +it's up to you to specify -f if you want it. + +If -S is not specified, no backups are attempted. + +Email bug reports to bug-automake@gnu.org. +Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do @@ -137,8 +152,13 @@ while test $# -ne 0; do -o) chowncmd="$chownprog $2" shift;; + -p) cpprog="$cpprog -p";; + -s) stripcmd=$stripprog;; + -S) backupsuffix="$2" + shift;; + -t) is_target_a_directory=always dst_arg=$2 @@ -255,6 +275,10 @@ do dstdir=$dst test -d "$dstdir" dstdir_status=$? + # Don't chown directories that already exist. + if test $dstdir_status = 0; then + chowncmd="" + fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command @@ -301,22 +325,6 @@ do if test $dstdir_status != 0; then case $posix_mkdir in '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then @@ -326,52 +334,49 @@ do fi posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - # Note that $RANDOM variable is not portable (e.g. dash); Use it - # here however when possible just to lower collision chance. - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - - trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 - - # Because "mkdir -p" follows existing symlinks and we likely work - # directly in world-writeable /tmp, make sure that the '$tmpdir' - # directory is successfully created first before we actually test - # 'mkdir -p' feature. - if (umask $mkdir_umask && - $mkdirprog $mkdir_mode "$tmpdir" && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - test_tmpdir="$tmpdir/a" - ls_ld_tmpdir=`ls -ld "$test_tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null - fi - trap '' 0;; - esac;; + # The $RANDOM variable is not portable (e.g., dash). Use it + # here however when possible just to lower collision chance. + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + + trap ' + ret=$? + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null + exit $ret + ' 0 + + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p'. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + fi + trap '' 0;; esac if @@ -382,7 +387,7 @@ do then : else - # The umask is ridiculous, or mkdir does not conform to POSIX, + # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. @@ -411,7 +416,7 @@ do prefixes= else if $posix_mkdir; then - (umask=$mkdir_umask && + (umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 @@ -488,6 +493,13 @@ do then rm -f "$dsttmp" else + # If $backupsuffix is set, and the file being installed + # already exists, attempt a backup. Don't worry if it fails, + # e.g., if mv doesn't support -f. + if test -n "$backupsuffix" && test -f "$dst"; then + $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null + fi + # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || @@ -502,9 +514,9 @@ do # file should still install successfully. { test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || + $doit $rmcmd "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 diff --git a/man/Makefile.in b/man/Makefile.in index f3da019..50812c2 100644 --- a/man/Makefile.in +++ b/man/Makefile.in @@ -258,9 +258,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign man/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu man/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign man/Makefile + $(AUTOMAKE) --gnu man/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ diff --git a/man/slowhttptest.1 b/man/slowhttptest.1 index 8be12fe..b94e0da 100644 --- a/man/slowhttptest.1 +++ b/man/slowhttptest.1 @@ -40,6 +40,7 @@ .Op Fl r Ar connection per second .Op Fl s Ar value of Content-Length header .Op Fl t Ar HTTP verb +.Op Fl 1 Ar HTTP header .Op Fl u Ar absolute URL .Op Fl v Ar output verbosity level .Op Fl w Ar advertised window size range start @@ -120,6 +121,8 @@ Specifies the connection rate. Specifies the value of Content-Length header for Slow POST test. .It Fl t Ar HTTP verb Specifies the verb to use in HTTP request. +.It Fl 1 Ar header +Specifies an HTTP header to use in HTTP request. .It Fl u Ar URL Specifies the URL. .It Fl v Ar level diff --git a/missing b/missing index 8d0eaad..1fe1611 100755 --- a/missing +++ b/missing @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2020 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify diff --git a/src/slowhttptest.cc b/src/slowhttptest.cc index 7872869..8b4612b 100644 --- a/src/slowhttptest.cc +++ b/src/slowhttptest.cc @@ -215,7 +215,7 @@ const char* SlowHTTPTest::get_random_extra() { bool SlowHTTPTest::init(const char* url, const char* verb, const char* path, const char* proxy, - const char* content_type, const char* accept, const char* cookie) { + const char* content_type, const char* accept, const char* cookie, const char* header) { if(!change_fd_limits()) { slowlog(LOG_INFO, "error setting open file limits\n"); @@ -340,6 +340,12 @@ bool SlowHTTPTest::init(const char* url, const char* verb, request_.append(cookie_); request_.append(crlf); } + // Header + if (header != 0 && strlen(header)) { + header_.append(header); + request_.append(header_); + request_.append(crlf); + } // method for probe is always GET probe_request_.append("GET"); if(eProbeProxy == proxy_type_) { @@ -400,6 +406,7 @@ bool SlowHTTPTest::init(const char* url, const char* verb, "Verb%s" "Content-Length header value%d" "Cookie%s" + "Header%s" "Extra data max length%d" "Interval between follow up data%d seconds" "Connections per seconds%d" @@ -412,6 +419,7 @@ bool SlowHTTPTest::init(const char* url, const char* verb, verb_.c_str(), content_length_, cookie, + header, extra_data_max_len_total_, followup_timing_, delay_, @@ -426,6 +434,7 @@ bool SlowHTTPTest::init(const char* url, const char* verb, "Test type%s" "Number of connections%d" "Cookie%s" + "Header%s" "Receive window range%d - %d" "Pipeline factor%d" "Read rate from receive buffer%d bytes / %d sec" @@ -437,6 +446,7 @@ bool SlowHTTPTest::init(const char* url, const char* verb, test_type_name[test_type_], num_connections_, cookie, + header, window_lower_limit_, window_upper_limit_, pipeline_factor_, @@ -497,6 +507,7 @@ void SlowHTTPTest::report_parameters() { cBLU "URL:" cLBL " %s\n" cBLU "verb:" cLBL " %s\n" cBLU "cookie:" cLBL " %s\n" + cBLU "header:" cLBL " %s\n" cBLU "Content-Length header value:" cLBL " %d\n" cBLU "follow up data max size:" cLBL " %d\n" cBLU "interval between follow up data:" cLBL " %d seconds\n" @@ -509,6 +520,7 @@ void SlowHTTPTest::report_parameters() { base_uri_.getData(), verb_.c_str(), cookie_.c_str(), + header_.c_str(), content_length_, extra_data_max_len_total_, followup_timing_, @@ -526,6 +538,7 @@ void SlowHTTPTest::report_parameters() { cBLU "URL:" cLBL " %s\n" cBLU "verb:" cLBL " %s\n" cBLU "cookie:" cLBL" %s\n" + cBLU "header:" cLBL " %s\n" cBLU "receive window range:" cLBL " %d - %d\n" cBLU "pipeline factor:" cLBL " %d\n" cBLU "read rate from receive buffer:" cLBL " %d bytes / %d sec\n" @@ -538,6 +551,7 @@ void SlowHTTPTest::report_parameters() { base_uri_.getData(), verb_.c_str(), cookie_.c_str(), + header_.c_str(), window_lower_limit_, window_upper_limit_, pipeline_factor_, diff --git a/src/slowhttptest.h b/src/slowhttptest.h index bcd25a8..f22805a 100644 --- a/src/slowhttptest.h +++ b/src/slowhttptest.h @@ -77,7 +77,7 @@ class SlowHTTPTest { bool init(const char* url, const char* verb, const char* path, const char* proxy, - const char* content_type, const char* accept, const char* cookie); + const char* content_type, const char* accept, const char* cookie, const char* header); void report_parameters(); void report_status(bool to_csv); void report_csv(); @@ -100,6 +100,7 @@ class SlowHTTPTest { std::string random_extra_; std::string verb_; std::string cookie_; + std::string header_; std::string user_agent_; std::string content_type_; std::string accept_; diff --git a/src/slowhttptestmain.cc b/src/slowhttptestmain.cc index 327578b..e3cfa80 100644 --- a/src/slowhttptestmain.cc +++ b/src/slowhttptestmain.cc @@ -85,6 +85,7 @@ static void usage() { " -p seconds timeout to wait for HTTP response on probe connection,\n" " after which server is considered inaccessible (5)\n" " -j cookies value of Cookie header (ex.: -j \"user_id=1001; timeout=9000\")\n" + " -1 header value of custom header (ex.: -1 \"X-Custom-Header: someheader123\")\n" "\nRange attack specific options:\n\n" " -a start left boundary of range in range header (5)\n" " -b bytes limit for range header right boundary values (2000)\n" @@ -153,6 +154,7 @@ int main(int argc, char **argv) { char content_type[1024] = { 0 }; char accept[1024] = { 0 }; char cookie[1024] = { 0 }; + char header[1024] = { 0 }; // default values int conn_cnt = 50; int content_length = 4096; @@ -174,7 +176,7 @@ int main(int argc, char **argv) { ProxyType proxy_type = slowhttptest::eNoProxy; long tmp; int o; - while((o = getopt(argc, argv, ":HBRXgha:b:c:d:e:f:i:j:k:l:m:n:o:p:r:s:t:u:v:w:x:y:z:")) != -1) { + while((o = getopt(argc, argv, ":HBRXgha:b:c:d:e:f:i:j:k:l:m:n:o:p:r:s:t:u:v:w:x:y:z:1:")) != -1) { switch (o) { case 'a': if(!parse_int(range_start, 65539)) @@ -229,6 +231,9 @@ int main(int argc, char **argv) { case 'j': strncpy(cookie, optarg, 1023); break; + case '1': + strncpy(header, optarg, 1023); + break; case 'k': if(!parse_int(pipeline_factor, 10)) return -1; @@ -323,7 +328,7 @@ int main(int argc, char **argv) { type, need_stats, pipeline_factor, probe_interval, range_start, range_limit, read_interval, read_len, window_lower_limit, window_upper_limit, proxy_type, debug_level)); - if(!slow_test->init(url, verb, path, proxy, content_type, accept, cookie)) { + if(!slow_test->init(url, verb, path, proxy, content_type, accept, cookie, header)) { slowlog(LOG_FATAL, "%s: error setting up slow HTTP test\n", __FUNCTION__); return -1; } else if(!slow_test->run_test()) {