Mercurial > hg > nginx-quic
annotate auto/feature @ 8460:3974f4e56a4e
Mail: fixed s->arg_start clearing on invalid IMAP commands.
Previously, s->arg_start was left intact after invalid IMAP commands,
and this might result in an argument incorrectly added to the following
command. Similarly, s->backslash was left intact as well, leading
to unneeded backslash removal.
For example (LFs from the client are explicitly shown as "<LF>"):
S: * OK IMAP4 ready
C: a01 login "\<LF>
S: a01 BAD invalid command
C: a0000000000\2 authenticate <LF>
S: a00000000002 aBAD invalid command
The backslash followed by LF generates invalid command with s->arg_start
and s->backslash set, the following command incorrectly treats anything
from the old s->arg_start to the space after the command as an argument,
and removes the backslash from the tag. If there is no space, s->arg_end
will be NULL.
Both things seem to be harmless though. In particular:
- This can be used to provide an incorrect argument to a command without
arguments. The only command which seems to look at the single argument
is AUTHENTICATE, and it checks the argument length before trying to
access it.
- Backslash removal uses the "end" pointer, and stops due to "src < end"
condition instead of scanning all the process memory if s->arg_end is
NULL (and arg[0].len is huge).
- There should be no backslashes in unquoted strings.
An obvious fix is to clear s->arg_start and s->backslash on invalid commands,
similarly to how it is done in POP3 parsing (added in 810:e3aa8f305d21) and
SMTP parsing.
This, however, makes it clear that s->arg_start handling in the "done"
label is wrong: s->arg_start cannot be legitimately set there, as it
is expected to be cleared in all possible cases when the "done" label is
reached. The relevant code is dead and will be removed by the following
change.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 19 May 2021 03:13:20 +0300 |
parents | e3faa5fb7772 |
children |
rev | line source |
---|---|
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
358
diff
changeset
|
1 |
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
358
diff
changeset
|
2 # Copyright (C) Igor Sysoev |
4412 | 3 # Copyright (C) Nginx, Inc. |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
358
diff
changeset
|
4 |
358
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
5 |
455 | 6 echo $ngx_n "checking for $ngx_feature ...$ngx_c" |
7 | |
8 cat << END >> $NGX_AUTOCONF_ERR | |
9 | |
10 ---------------------------------------- | |
11 checking for $ngx_feature | |
12 | |
13 END | |
358
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
14 |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
15 ngx_found=no |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
16 |
455 | 17 if test -n "$ngx_feature_name"; then |
645 | 18 ngx_have_feature=`echo $ngx_feature_name \ |
19 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` | |
455 | 20 fi |
358
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
21 |
875
7af8276b1c2f
test PCRE in FreeBSD, Linux, and NetBSD
Igor Sysoev <igor@sysoev.ru>
parents:
705
diff
changeset
|
22 if test -n "$ngx_feature_path"; then |
2139 | 23 for ngx_temp in $ngx_feature_path; do |
24 ngx_feature_inc_path="$ngx_feature_inc_path -I $ngx_temp" | |
25 done | |
875
7af8276b1c2f
test PCRE in FreeBSD, Linux, and NetBSD
Igor Sysoev <igor@sysoev.ru>
parents:
705
diff
changeset
|
26 fi |
7af8276b1c2f
test PCRE in FreeBSD, Linux, and NetBSD
Igor Sysoev <igor@sysoev.ru>
parents:
705
diff
changeset
|
27 |
358
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
28 cat << END > $NGX_AUTOTEST.c |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
29 |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
30 #include <sys/types.h> |
455 | 31 $NGX_INCLUDE_UNISTD_H |
32 $ngx_feature_incs | |
358
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
33 |
6624
e3faa5fb7772
Configure: fix build with -Werror=old-style-definition.
Piotr Sikora <piotrsikora@google.com>
parents:
5309
diff
changeset
|
34 int main(void) { |
358
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
35 $ngx_feature_test; |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
36 return 0; |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
37 } |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
38 |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
39 END |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
40 |
455 | 41 |
875
7af8276b1c2f
test PCRE in FreeBSD, Linux, and NetBSD
Igor Sysoev <igor@sysoev.ru>
parents:
705
diff
changeset
|
42 ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS $ngx_feature_inc_path \ |
3367
568a854383f9
test invalid --with-ld-opt in right place
Igor Sysoev <igor@sysoev.ru>
parents:
2139
diff
changeset
|
43 -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_TEST_LD_OPT $ngx_feature_libs" |
461 | 44 |
875
7af8276b1c2f
test PCRE in FreeBSD, Linux, and NetBSD
Igor Sysoev <igor@sysoev.ru>
parents:
705
diff
changeset
|
45 ngx_feature_inc_path= |
7af8276b1c2f
test PCRE in FreeBSD, Linux, and NetBSD
Igor Sysoev <igor@sysoev.ru>
parents:
705
diff
changeset
|
46 |
946 | 47 eval "/bin/sh -c \"$ngx_test\" >> $NGX_AUTOCONF_ERR 2>&1" |
455 | 48 |
358
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
49 |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
50 if [ -x $NGX_AUTOTEST ]; then |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
51 |
619 | 52 case "$ngx_feature_run" in |
53 | |
54 yes) | |
702
67deba330372
auto/configure [ PAUSE ] hwcap bug
Igor Sysoev <igor@sysoev.ru>
parents:
645
diff
changeset
|
55 # /bin/sh is used to intercept "Killed" or "Abort trap" messages |
3916
0ec738f18346
log "Abort trap" or similar messages
Igor Sysoev <igor@sysoev.ru>
parents:
3787
diff
changeset
|
56 if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then |
619 | 57 echo " found" |
58 ngx_found=yes | |
455 | 59 |
619 | 60 if test -n "$ngx_feature_name"; then |
61 have=$ngx_have_feature . auto/have | |
62 fi | |
455 | 63 |
619 | 64 else |
65 echo " found but is not working" | |
66 fi | |
67 ;; | |
68 | |
3787
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
69 value) |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
70 # /bin/sh is used to intercept "Killed" or "Abort trap" messages |
3916
0ec738f18346
log "Abort trap" or similar messages
Igor Sysoev <igor@sysoev.ru>
parents:
3787
diff
changeset
|
71 if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then |
3787
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
72 echo " found" |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
73 ngx_found=yes |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
74 |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
75 cat << END >> $NGX_AUTO_CONFIG_H |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
76 |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
77 #ifndef $ngx_feature_name |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
78 #define $ngx_feature_name `$NGX_AUTOTEST` |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
79 #endif |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
80 |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
81 END |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
82 else |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
83 echo " found but is not working" |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
84 fi |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
85 ;; |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
86 |
619 | 87 bug) |
702
67deba330372
auto/configure [ PAUSE ] hwcap bug
Igor Sysoev <igor@sysoev.ru>
parents:
645
diff
changeset
|
88 # /bin/sh is used to intercept "Killed" or "Abort trap" messages |
3916
0ec738f18346
log "Abort trap" or similar messages
Igor Sysoev <igor@sysoev.ru>
parents:
3787
diff
changeset
|
89 if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then |
619 | 90 echo " not found" |
455 | 91 |
619 | 92 else |
93 echo " found" | |
94 ngx_found=yes | |
95 | |
96 if test -n "$ngx_feature_name"; then | |
97 have=$ngx_have_feature . auto/have | |
98 fi | |
99 fi | |
100 ;; | |
358
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
101 |
619 | 102 *) |
103 echo " found" | |
104 ngx_found=yes | |
455 | 105 |
619 | 106 if test -n "$ngx_feature_name"; then |
107 have=$ngx_have_feature . auto/have | |
108 fi | |
109 ;; | |
455 | 110 |
619 | 111 esac |
358
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
112 |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
113 else |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
114 echo " not found" |
455 | 115 |
116 echo "----------" >> $NGX_AUTOCONF_ERR | |
117 cat $NGX_AUTOTEST.c >> $NGX_AUTOCONF_ERR | |
118 echo "----------" >> $NGX_AUTOCONF_ERR | |
119 echo $ngx_test >> $NGX_AUTOCONF_ERR | |
120 echo "----------" >> $NGX_AUTOCONF_ERR | |
358
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
121 fi |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
122 |
5309
434548349838
Configure: fixed autotest cleanup commands.
Sergey Kandaurov <pluknet@nginx.com>
parents:
4412
diff
changeset
|
123 rm -rf $NGX_AUTOTEST* |