Mercurial > hg > nginx-quic
annotate src/core/ngx_md5.h @ 6462:fd4b52e74f96
Fixed socket inheritance on reload and binary upgrade.
On nginx reload or binary upgrade, an attempt is made to inherit listen sockets
from the previous configuration. Previously, no check for socket type was made
and the inherited socket could have the wrong type. On binary upgrade, socket
type was not detected at all. Wrong socket type could lead to errors on that
socket due to different logic and unsupported syscalls. For example, a UDP
socket, inherited as TCP, lead to the following error after arrival of a
datagram: "accept() failed (102: Operation not supported on socket)".
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Fri, 25 Mar 2016 14:10:38 +0300 |
parents | d620f497c50f |
children | 9eefb38f0005 |
rev | line source |
---|---|
1572 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4412 | 4 * Copyright (C) Nginx, Inc. |
1572 | 5 */ |
6 | |
7 | |
8 #ifndef _NGX_MD5_H_INCLUDED_ | |
9 #define _NGX_MD5_H_INCLUDED_ | |
10 | |
11 | |
12 #include <ngx_config.h> | |
13 #include <ngx_core.h> | |
14 | |
15 | |
3895
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
16 #if (NGX_HAVE_MD5) |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
17 |
1572 | 18 #if (NGX_HAVE_OPENSSL_MD5_H) |
19 #include <openssl/md5.h> | |
20 #else | |
21 #include <md5.h> | |
22 #endif | |
23 | |
24 | |
25 typedef MD5_CTX ngx_md5_t; | |
26 | |
27 | |
28 #if (NGX_OPENSSL_MD5) | |
29 | |
1598 | 30 #define ngx_md5_init MD5_Init |
31 #define ngx_md5_update MD5_Update | |
32 #define ngx_md5_final MD5_Final | |
1572 | 33 |
34 #else | |
35 | |
1598 | 36 #define ngx_md5_init MD5Init |
37 #define ngx_md5_update MD5Update | |
38 #define ngx_md5_final MD5Final | |
1572 | 39 |
40 #endif | |
41 | |
42 | |
3895
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
43 #else /* !NGX_HAVE_MD5 */ |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
44 |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
45 |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
46 typedef struct { |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
47 uint64_t bytes; |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
48 uint32_t a, b, c, d; |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
49 u_char buffer[64]; |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
50 } ngx_md5_t; |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
51 |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
52 |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
53 void ngx_md5_init(ngx_md5_t *ctx); |
3927
38e6f45c5e3d
make built-in ngx_md5_update() interface consistent with other implemenations
Igor Sysoev <igor@sysoev.ru>
parents:
3895
diff
changeset
|
54 void ngx_md5_update(ngx_md5_t *ctx, const void *data, size_t size); |
3895
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
55 void ngx_md5_final(u_char result[16], ngx_md5_t *ctx); |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
56 |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
57 |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
58 #endif |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
59 |
1572 | 60 #endif /* _NGX_MD5_H_INCLUDED_ */ |