diff options
| author | Ted Zlatanov | 2010-09-26 01:06:28 -0500 |
|---|---|---|
| committer | Ted Zlatanov | 2010-09-26 01:06:28 -0500 |
| commit | 8af55556e6cc093641dde5205aa5e295039b809f (patch) | |
| tree | 2f0bebd6d170687acc470e4a1a030abd18daf651 /src/process.c | |
| parent | 8ccbef23ea624d892bada3c66ef2339ada342997 (diff) | |
| download | emacs-8af55556e6cc093641dde5205aa5e295039b809f.tar.gz emacs-8af55556e6cc093641dde5205aa5e295039b809f.zip | |
Set up GnuTLS support.
* configure.in: Set up GnuTLS.
* lisp/net/gnutls.el: GnuTLS glue code to set up a connection.
* src/Makefile.in (LIBGNUTLS_LIBS, LIBGNUTLS_CFLAGS, ALL_CFLAGS)
(obj, LIBES): Set up GnuTLS support.
* src/config.in: Set up GnuTLS support.
* src/emacs.c: Set up GnuTLS support and call syms_of_gnutls.
* src/gnutls.c: The source code for GnuTLS support in Emacs.
* src/gnutls.h: The GnuTLS glue for Emacs, macros and enums.
* src/process.c (make_process, Fstart_process)
(read_process_output, send_process): Set up GnuTLS support for
process input/output file descriptors.
* src/process.h: Set up GnuTLS support.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/src/process.c b/src/process.c index 048e2858e9f..ef086914704 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -105,6 +105,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 105 | #include "sysselect.h" | 105 | #include "sysselect.h" |
| 106 | #include "syssignal.h" | 106 | #include "syssignal.h" |
| 107 | #include "syswait.h" | 107 | #include "syswait.h" |
| 108 | #ifdef HAVE_GNUTLS | ||
| 109 | #include "gnutls.h" | ||
| 110 | #endif | ||
| 108 | 111 | ||
| 109 | #if defined (USE_GTK) || defined (HAVE_GCONF) | 112 | #if defined (USE_GTK) || defined (HAVE_GCONF) |
| 110 | #include "xgselect.h" | 113 | #include "xgselect.h" |
| @@ -583,6 +586,10 @@ make_process (Lisp_Object name) | |||
| 583 | p->read_output_skip = 0; | 586 | p->read_output_skip = 0; |
| 584 | #endif | 587 | #endif |
| 585 | 588 | ||
| 589 | #ifdef HAVE_GNUTLS | ||
| 590 | p->gnutls_initstage = GNUTLS_STAGE_EMPTY; | ||
| 591 | #endif | ||
| 592 | |||
| 586 | /* If name is already in use, modify it until it is unused. */ | 593 | /* If name is already in use, modify it until it is unused. */ |
| 587 | 594 | ||
| 588 | name1 = name; | 595 | name1 = name; |
| @@ -1526,6 +1533,12 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) | |||
| 1526 | XPROCESS (proc)->filter = Qnil; | 1533 | XPROCESS (proc)->filter = Qnil; |
| 1527 | XPROCESS (proc)->command = Flist (nargs - 2, args + 2); | 1534 | XPROCESS (proc)->command = Flist (nargs - 2, args + 2); |
| 1528 | 1535 | ||
| 1536 | #ifdef HAVE_GNUTLS | ||
| 1537 | /* AKA GNUTLS_INITSTAGE(proc). */ | ||
| 1538 | XPROCESS (proc)->gnutls_initstage = GNUTLS_STAGE_EMPTY; | ||
| 1539 | XPROCESS (proc)->gnutls_cred_type = Qnil; | ||
| 1540 | #endif | ||
| 1541 | |||
| 1529 | #ifdef ADAPTIVE_READ_BUFFERING | 1542 | #ifdef ADAPTIVE_READ_BUFFERING |
| 1530 | XPROCESS (proc)->adaptive_read_buffering | 1543 | XPROCESS (proc)->adaptive_read_buffering |
| 1531 | = (NILP (Vprocess_adaptive_read_buffering) ? 0 | 1544 | = (NILP (Vprocess_adaptive_read_buffering) ? 0 |
| @@ -5099,7 +5112,13 @@ read_process_output (Lisp_Object proc, register int channel) | |||
| 5099 | #endif | 5112 | #endif |
| 5100 | if (proc_buffered_char[channel] < 0) | 5113 | if (proc_buffered_char[channel] < 0) |
| 5101 | { | 5114 | { |
| 5102 | nbytes = emacs_read (channel, chars + carryover, readmax); | 5115 | #ifdef HAVE_GNUTLS |
| 5116 | if (NETCONN_P(proc) && GNUTLS_PROCESS_USABLE (proc)) | ||
| 5117 | nbytes = emacs_gnutls_read (channel, XPROCESS (proc)->gnutls_state, | ||
| 5118 | chars + carryover, readmax); | ||
| 5119 | else | ||
| 5120 | #endif | ||
| 5121 | nbytes = emacs_read (channel, chars + carryover, readmax); | ||
| 5103 | #ifdef ADAPTIVE_READ_BUFFERING | 5122 | #ifdef ADAPTIVE_READ_BUFFERING |
| 5104 | if (nbytes > 0 && p->adaptive_read_buffering) | 5123 | if (nbytes > 0 && p->adaptive_read_buffering) |
| 5105 | { | 5124 | { |
| @@ -5132,7 +5151,13 @@ read_process_output (Lisp_Object proc, register int channel) | |||
| 5132 | { | 5151 | { |
| 5133 | chars[carryover] = proc_buffered_char[channel]; | 5152 | chars[carryover] = proc_buffered_char[channel]; |
| 5134 | proc_buffered_char[channel] = -1; | 5153 | proc_buffered_char[channel] = -1; |
| 5135 | nbytes = emacs_read (channel, chars + carryover + 1, readmax - 1); | 5154 | #ifdef HAVE_GNUTLS |
| 5155 | if (NETCONN_P(proc) && GNUTLS_PROCESS_USABLE (proc)) | ||
| 5156 | nbytes = emacs_gnutls_read (channel, XPROCESS (proc)->gnutls_state, | ||
| 5157 | chars + carryover + 1, readmax - 1); | ||
| 5158 | else | ||
| 5159 | #endif | ||
| 5160 | nbytes = emacs_read (channel, chars + carryover + 1, readmax - 1); | ||
| 5136 | if (nbytes < 0) | 5161 | if (nbytes < 0) |
| 5137 | nbytes = 1; | 5162 | nbytes = 1; |
| 5138 | else | 5163 | else |
| @@ -5542,7 +5567,14 @@ send_process (volatile Lisp_Object proc, const unsigned char *volatile buf, | |||
| 5542 | else | 5567 | else |
| 5543 | #endif | 5568 | #endif |
| 5544 | { | 5569 | { |
| 5545 | rv = emacs_write (outfd, (char *) buf, this); | 5570 | #ifdef HAVE_GNUTLS |
| 5571 | if (NETCONN_P(proc) && GNUTLS_PROCESS_USABLE (proc)) | ||
| 5572 | rv = emacs_gnutls_write (outfd, | ||
| 5573 | XPROCESS (proc)->gnutls_state, | ||
| 5574 | (char *) buf, this); | ||
| 5575 | else | ||
| 5576 | #endif | ||
| 5577 | rv = emacs_write (outfd, (char *) buf, this); | ||
| 5546 | #ifdef ADAPTIVE_READ_BUFFERING | 5578 | #ifdef ADAPTIVE_READ_BUFFERING |
| 5547 | if (p->read_output_delay > 0 | 5579 | if (p->read_output_delay > 0 |
| 5548 | && p->adaptive_read_buffering == 1) | 5580 | && p->adaptive_read_buffering == 1) |