200-usign_support.patch 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. --- a/configure.ac
  2. +++ b/configure.ac
  3. @@ -169,6 +169,15 @@ if test "x$want_gpgme" = "xyes"; then
  4. fi
  5. fi
  6. +AC_ARG_ENABLE(usign,
  7. + AC_HELP_STRING([--enable-usign], [Enable signature checking with usign
  8. + [[default=yes]] ]),
  9. + [want_usign="$enableval"], [want_usign="yes"])
  10. +
  11. +if test "x$want_usign" = "xyes"; then
  12. + AC_DEFINE(HAVE_USIGN, 1, [Define if you want usign support])
  13. +fi
  14. +
  15. AC_SUBST(GPGME_CFLAGS)
  16. AC_SUBST(GPGME_LIBS)
  17. --- a/libopkg/opkg.c
  18. +++ b/libopkg/opkg.c
  19. @@ -599,7 +599,7 @@ opkg_update_package_lists(opkg_progress_
  20. }
  21. free(url);
  22. -#if defined(HAVE_GPGME) || defined(HAVE_OPENSSL)
  23. +#if defined(HAVE_GPGME) || defined(HAVE_OPENSSL) || defined(HAVE_USIGN)
  24. if (conf->check_signature) {
  25. char *sig_file_name;
  26. /* download detached signitures to verify the package lists */
  27. --- a/libopkg/opkg_cmd.c
  28. +++ b/libopkg/opkg_cmd.c
  29. @@ -169,7 +169,7 @@ opkg_update_cmd(int argc, char **argv)
  30. list_file_name);
  31. }
  32. free(url);
  33. -#if defined(HAVE_GPGME) || defined(HAVE_OPENSSL)
  34. +#if defined(HAVE_GPGME) || defined(HAVE_OPENSSL) || defined(HAVE_USIGN)
  35. if (conf->check_signature) {
  36. /* download detached signitures to verify the package lists */
  37. /* get the url for the sig file */
  38. --- a/libopkg/opkg_install.c
  39. +++ b/libopkg/opkg_install.c
  40. @@ -1288,7 +1288,7 @@ opkg_install_pkg(pkg_t *pkg, int from_up
  41. }
  42. /* check that the repository is valid */
  43. - #if defined(HAVE_GPGME) || defined(HAVE_OPENSSL)
  44. + #if defined(HAVE_GPGME) || defined(HAVE_OPENSSL) || defined(HAVE_USIGN)
  45. char *list_file_name, *sig_file_name, *lists_dir;
  46. /* check to ensure the package has come from a repository */
  47. --- a/libopkg/opkg_download.c
  48. +++ b/libopkg/opkg_download.c
  49. @@ -19,6 +19,7 @@
  50. #include "config.h"
  51. +#include <sys/wait.h>
  52. #include <stdio.h>
  53. #include <unistd.h>
  54. #include <libgen.h>
  55. @@ -342,7 +343,28 @@ opkg_prepare_url_for_install(const char
  56. int
  57. opkg_verify_file (char *text_file, char *sig_file)
  58. {
  59. -#if defined HAVE_GPGME
  60. +#if defined HAVE_USIGN
  61. + int status = -1;
  62. + int pid;
  63. +
  64. + if (conf->check_signature == 0 )
  65. + return 0;
  66. +
  67. + pid = fork();
  68. + if (pid < 0)
  69. + return -1;
  70. +
  71. + if (!pid) {
  72. + execl("/usr/sbin/opkg-key", "opkg-key", "verify", sig_file, text_file, NULL);
  73. + exit(255);
  74. + }
  75. +
  76. + waitpid(pid, &status, 0);
  77. + if (!WIFEXITED(status) || WEXITSTATUS(status))
  78. + return -1;
  79. +
  80. + return 0;
  81. +#elif defined HAVE_GPGME
  82. if (conf->check_signature == 0 )
  83. return 0;
  84. int status = -1;