diff options
| author | Ted Zlatanov | 2012-04-09 08:46:16 -0400 |
|---|---|---|
| committer | Ted Zlatanov | 2012-04-09 08:46:16 -0400 |
| commit | a18ecafa99e7e7c3caa35ed68dd8a7b9b5d2b8e3 (patch) | |
| tree | 51714f1203b0b06d44591f57f245ca7c94acde48 /src/gnutls.h | |
| parent | b4d3bc10dc84f6b01a2b6b215d0e489555aa6edd (diff) | |
| download | emacs-a18ecafa99e7e7c3caa35ed68dd8a7b9b5d2b8e3.tar.gz emacs-a18ecafa99e7e7c3caa35ed68dd8a7b9b5d2b8e3.zip | |
Limit number of GnuTLS handshakes per connection.
* gnutls.c (gnutls_log_function2i): Convenience log function.
(emacs_gnutls_read): Use new log functions,
`gnutls_handshakes_tried' process member, and
`GNUTLS_EMACS_HANDSHAKES_LIMIT' to limit the number of handshake
attempts per process (connection).
* gnutls.h: Add `GNUTLS_EMACS_HANDSHAKES_LIMIT' upper limit. Add
convenience `GNUTLS_LOG2i' macro.
* process.c (make_process):
* process.h: Add integer `gnutls_handshakes_tried' member to
process struct.
Diffstat (limited to 'src/gnutls.h')
| -rw-r--r-- | src/gnutls.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gnutls.h b/src/gnutls.h index 474da77aec5..37b9a2eb4df 100644 --- a/src/gnutls.h +++ b/src/gnutls.h | |||
| @@ -23,6 +23,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 23 | #include <gnutls/gnutls.h> | 23 | #include <gnutls/gnutls.h> |
| 24 | #include <gnutls/x509.h> | 24 | #include <gnutls/x509.h> |
| 25 | 25 | ||
| 26 | /* This limits the attempts to handshake per process (connection). */ | ||
| 27 | #define GNUTLS_EMACS_HANDSHAKES_LIMIT 100 | ||
| 28 | |||
| 26 | typedef enum | 29 | typedef enum |
| 27 | { | 30 | { |
| 28 | /* Initialization stages. */ | 31 | /* Initialization stages. */ |
| @@ -53,6 +56,8 @@ typedef enum | |||
| 53 | 56 | ||
| 54 | #define GNUTLS_LOG2(level, max, string, extra) do { if (level <= max) { gnutls_log_function2 (level, "(Emacs) " string, extra); } } while (0) | 57 | #define GNUTLS_LOG2(level, max, string, extra) do { if (level <= max) { gnutls_log_function2 (level, "(Emacs) " string, extra); } } while (0) |
| 55 | 58 | ||
| 59 | #define GNUTLS_LOG2i(level, max, string, extra) do { if (level <= max) { gnutls_log_function2i (level, "(Emacs) " string, extra); } } while (0) | ||
| 60 | |||
| 56 | extern EMACS_INT | 61 | extern EMACS_INT |
| 57 | emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, EMACS_INT nbyte); | 62 | emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, EMACS_INT nbyte); |
| 58 | extern EMACS_INT | 63 | extern EMACS_INT |