diff options
| author | Paul Eggert | 2011-05-03 23:13:23 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-05-03 23:13:23 -0700 |
| commit | 53a35e81c90cec67a21bbc8518bc516ed335d756 (patch) | |
| tree | bdf44bf84d4a2c11efdce99245da34e39cb17041 /src | |
| parent | 19548d0861ced228dd0598240a410bf6a720b59e (diff) | |
| parent | f330b642bb28e3b9ee5e14ac55c8103e6dcde412 (diff) | |
| download | emacs-53a35e81c90cec67a21bbc8518bc516ed335d756.tar.gz emacs-53a35e81c90cec67a21bbc8518bc516ed335d756.zip | |
Merge from mainline.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/gnutls.c | 65 |
2 files changed, 58 insertions, 13 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index c1f43f4313d..f8135ee2ab0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -108,6 +108,12 @@ | |||
| 108 | 108 | ||
| 109 | * fns.c (Frandom): Let EMACS_UINT be wider than unsigned long. | 109 | * fns.c (Frandom): Let EMACS_UINT be wider than unsigned long. |
| 110 | 110 | ||
| 111 | 2011-05-04 Teodor Zlatanov <tzz@lifelogs.com> | ||
| 112 | |||
| 113 | * gnutls.c (Fgnutls_boot): Support :keylist and :crlfiles options | ||
| 114 | instead of :keyfiles. Give GnuTLS the keylist and the CRL lists | ||
| 115 | as passed in. | ||
| 116 | |||
| 111 | 2011-05-03 Jan Djärv <jan.h.d@swipnet.se> | 117 | 2011-05-03 Jan Djärv <jan.h.d@swipnet.se> |
| 112 | 118 | ||
| 113 | * xterm.c (x_set_frame_alpha): Do not set property on anything | 119 | * xterm.c (x_set_frame_alpha): Do not set property on anything |
diff --git a/src/gnutls.c b/src/gnutls.c index 8e41be20505..fd970910d24 100644 --- a/src/gnutls.c +++ b/src/gnutls.c | |||
| @@ -44,7 +44,8 @@ static int gnutls_global_initialized; | |||
| 44 | /* The following are for the property list of `gnutls-boot'. */ | 44 | /* The following are for the property list of `gnutls-boot'. */ |
| 45 | static Lisp_Object Qgnutls_bootprop_priority; | 45 | static Lisp_Object Qgnutls_bootprop_priority; |
| 46 | static Lisp_Object Qgnutls_bootprop_trustfiles; | 46 | static Lisp_Object Qgnutls_bootprop_trustfiles; |
| 47 | static Lisp_Object Qgnutls_bootprop_keyfiles; | 47 | static Lisp_Object Qgnutls_bootprop_keylist; |
| 48 | static Lisp_Object Qgnutls_bootprop_crlfiles; | ||
| 48 | static Lisp_Object Qgnutls_bootprop_callbacks; | 49 | static Lisp_Object Qgnutls_bootprop_callbacks; |
| 49 | static Lisp_Object Qgnutls_bootprop_loglevel; | 50 | static Lisp_Object Qgnutls_bootprop_loglevel; |
| 50 | static Lisp_Object Qgnutls_bootprop_hostname; | 51 | static Lisp_Object Qgnutls_bootprop_hostname; |
| @@ -412,7 +413,10 @@ PROPLIST is a property list with the following keys: | |||
| 412 | 413 | ||
| 413 | :trustfiles is a list of PEM-encoded trust files for `gnutls-x509pki'. | 414 | :trustfiles is a list of PEM-encoded trust files for `gnutls-x509pki'. |
| 414 | 415 | ||
| 415 | :keyfiles is a list of PEM-encoded key files for `gnutls-x509pki'. | 416 | :crlfiles is a list of PEM-encoded CRL lists for `gnutls-x509pki'. |
| 417 | |||
| 418 | :keylist is an alist of PEM-encoded key files and PEM-encoded | ||
| 419 | certificates for `gnutls-x509pki'. | ||
| 416 | 420 | ||
| 417 | :callbacks is an alist of callback functions, see below. | 421 | :callbacks is an alist of callback functions, see below. |
| 418 | 422 | ||
| @@ -471,7 +475,8 @@ one trustfile (usually a CA bundle). */) | |||
| 471 | /* Placeholders for the property list elements. */ | 475 | /* Placeholders for the property list elements. */ |
| 472 | Lisp_Object priority_string; | 476 | Lisp_Object priority_string; |
| 473 | Lisp_Object trustfiles; | 477 | Lisp_Object trustfiles; |
| 474 | Lisp_Object keyfiles; | 478 | Lisp_Object crlfiles; |
| 479 | Lisp_Object keylist; | ||
| 475 | /* Lisp_Object callbacks; */ | 480 | /* Lisp_Object callbacks; */ |
| 476 | Lisp_Object loglevel; | 481 | Lisp_Object loglevel; |
| 477 | Lisp_Object hostname; | 482 | Lisp_Object hostname; |
| @@ -486,7 +491,8 @@ one trustfile (usually a CA bundle). */) | |||
| 486 | hostname = Fplist_get (proplist, Qgnutls_bootprop_hostname); | 491 | hostname = Fplist_get (proplist, Qgnutls_bootprop_hostname); |
| 487 | priority_string = Fplist_get (proplist, Qgnutls_bootprop_priority); | 492 | priority_string = Fplist_get (proplist, Qgnutls_bootprop_priority); |
| 488 | trustfiles = Fplist_get (proplist, Qgnutls_bootprop_trustfiles); | 493 | trustfiles = Fplist_get (proplist, Qgnutls_bootprop_trustfiles); |
| 489 | keyfiles = Fplist_get (proplist, Qgnutls_bootprop_keyfiles); | 494 | keylist = Fplist_get (proplist, Qgnutls_bootprop_keylist); |
| 495 | crlfiles = Fplist_get (proplist, Qgnutls_bootprop_crlfiles); | ||
| 490 | /* callbacks = Fplist_get (proplist, Qgnutls_bootprop_callbacks); */ | 496 | /* callbacks = Fplist_get (proplist, Qgnutls_bootprop_callbacks); */ |
| 491 | loglevel = Fplist_get (proplist, Qgnutls_bootprop_loglevel); | 497 | loglevel = Fplist_get (proplist, Qgnutls_bootprop_loglevel); |
| 492 | verify_flags = Fplist_get (proplist, Qgnutls_bootprop_verify_flags); | 498 | verify_flags = Fplist_get (proplist, Qgnutls_bootprop_verify_flags); |
| @@ -614,15 +620,41 @@ one trustfile (usually a CA bundle). */) | |||
| 614 | } | 620 | } |
| 615 | } | 621 | } |
| 616 | 622 | ||
| 617 | for (tail = keyfiles; !NILP (tail); tail = Fcdr (tail)) | 623 | for (tail = crlfiles; !NILP (tail); tail = Fcdr (tail)) |
| 618 | { | 624 | { |
| 619 | Lisp_Object keyfile = Fcar (tail); | 625 | Lisp_Object crlfile = Fcar (tail); |
| 620 | if (STRINGP (keyfile)) | 626 | if (STRINGP (crlfile)) |
| 621 | { | 627 | { |
| 622 | GNUTLS_LOG2 (1, max_log_level, "setting the keyfile: ", | 628 | GNUTLS_LOG2 (1, max_log_level, "setting the CRL file: ", |
| 623 | SSDATA (keyfile)); | 629 | SSDATA (crlfile)); |
| 624 | ret = gnutls_certificate_set_x509_crl_file | 630 | ret = gnutls_certificate_set_x509_crl_file |
| 625 | (x509_cred, | 631 | (x509_cred, |
| 632 | SSDATA (crlfile), | ||
| 633 | file_format); | ||
| 634 | |||
| 635 | if (ret < GNUTLS_E_SUCCESS) | ||
| 636 | return gnutls_make_error (ret); | ||
| 637 | } | ||
| 638 | else | ||
| 639 | { | ||
| 640 | error ("Sorry, GnuTLS can't use non-string CRL file %s", | ||
| 641 | SDATA (crlfile)); | ||
| 642 | } | ||
| 643 | } | ||
| 644 | |||
| 645 | for (tail = keylist; !NILP (tail); tail = Fcdr (tail)) | ||
| 646 | { | ||
| 647 | Lisp_Object keyfile = Fcar (Fcar (tail)); | ||
| 648 | Lisp_Object certfile = Fcar (Fcdr (tail)); | ||
| 649 | if (STRINGP (keyfile) && STRINGP (certfile)) | ||
| 650 | { | ||
| 651 | GNUTLS_LOG2 (1, max_log_level, "setting the client key file: ", | ||
| 652 | SSDATA (keyfile)); | ||
| 653 | GNUTLS_LOG2 (1, max_log_level, "setting the client cert file: ", | ||
| 654 | SSDATA (certfile)); | ||
| 655 | ret = gnutls_certificate_set_x509_key_file | ||
| 656 | (x509_cred, | ||
| 657 | SSDATA (certfile), | ||
| 626 | SSDATA (keyfile), | 658 | SSDATA (keyfile), |
| 627 | file_format); | 659 | file_format); |
| 628 | 660 | ||
| @@ -631,8 +663,12 @@ one trustfile (usually a CA bundle). */) | |||
| 631 | } | 663 | } |
| 632 | else | 664 | else |
| 633 | { | 665 | { |
| 634 | error ("Sorry, GnuTLS can't use non-string keyfile %s", | 666 | if (STRINGP (keyfile)) |
| 635 | SDATA (keyfile)); | 667 | error ("Sorry, GnuTLS can't use non-string client cert file %s", |
| 668 | SDATA (certfile)); | ||
| 669 | else | ||
| 670 | error ("Sorry, GnuTLS can't use non-string client key file %s", | ||
| 671 | SDATA (keyfile)); | ||
| 636 | } | 672 | } |
| 637 | } | 673 | } |
| 638 | } | 674 | } |
| @@ -868,8 +904,11 @@ syms_of_gnutls (void) | |||
| 868 | Qgnutls_bootprop_trustfiles = intern_c_string (":trustfiles"); | 904 | Qgnutls_bootprop_trustfiles = intern_c_string (":trustfiles"); |
| 869 | staticpro (&Qgnutls_bootprop_trustfiles); | 905 | staticpro (&Qgnutls_bootprop_trustfiles); |
| 870 | 906 | ||
| 871 | Qgnutls_bootprop_keyfiles = intern_c_string (":keyfiles"); | 907 | Qgnutls_bootprop_keylist = intern_c_string (":keylist"); |
| 872 | staticpro (&Qgnutls_bootprop_keyfiles); | 908 | staticpro (&Qgnutls_bootprop_keylist); |
| 909 | |||
| 910 | Qgnutls_bootprop_crlfiles = intern_c_string (":crlfiles"); | ||
| 911 | staticpro (&Qgnutls_bootprop_crlfiles); | ||
| 873 | 912 | ||
| 874 | Qgnutls_bootprop_callbacks = intern_c_string (":callbacks"); | 913 | Qgnutls_bootprop_callbacks = intern_c_string (":callbacks"); |
| 875 | staticpro (&Qgnutls_bootprop_callbacks); | 914 | staticpro (&Qgnutls_bootprop_callbacks); |