OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

163 lines
4.6 KiB

  1. #! /bin/sh /usr/share/dpatch/dpatch-run
  2. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # Filename: package/.../libdkim/enable-thread-safety.patch
  6. # Copyright (C) 2009 The OpenSDE Project
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This patch file is dual-licensed. It is available under the license the
  11. # patched project is licensed under, as long as it is an OpenSource license
  12. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  13. # of the GNU General Public License as published by the Free Software
  14. # Foundation; either version 2 of the License, or (at your option) any later
  15. # version.
  16. # --- SDE-COPYRIGHT-NOTE-END ---
  17. ## 01_strtok_r.dpatch by Russell Coker <russell@coker.com.au>
  18. ##
  19. ## DP: Use strtok_r() instead of strtok().
  20. @DPATCH@
  21. diff -ru libdkim-1.0.19/src/dkimverify.cpp libdkim-1.0.19-new/src/dkimverify.cpp
  22. --- ./dkimverify.cpp 2008-05-12 20:08:06.000000000 +1000
  23. +++ ./dkimverify.cpp 2009-06-11 18:28:10.000000000 +1000
  24. @@ -855,6 +855,9 @@
  25. ////////////////////////////////////////////////////////////////////////////////
  26. int CDKIMVerify::ParseDKIMSignature( const string& sHeader, SignatureInfo &sig )
  27. {
  28. + // for strtok_r()
  29. + char *saveptr;
  30. +
  31. // save header for later
  32. sig.Header = sHeader;
  33. @@ -1032,7 +1035,7 @@
  34. {
  35. // make sure "dns" is in the list
  36. bool HasDNS = false;
  37. - char *s = strtok(values[9], ":");
  38. + char *s = strtok_r(values[9], ":", &saveptr);
  39. while (s != NULL)
  40. {
  41. if (strncmp(s, "dns", 3) == 0 && (s[3] == '\0' || s[3] == '/'))
  42. @@ -1040,7 +1043,7 @@
  43. HasDNS = true;
  44. break;
  45. }
  46. - s = strtok(NULL, ": \t");
  47. + s = strtok_r(NULL, ": \t", &saveptr);
  48. }
  49. if (!HasDNS)
  50. return DKIM_BAD_SYNTAX; // todo: maybe create a new error code for unknown query method
  51. @@ -1080,7 +1083,7 @@
  52. // parse the signed headers list
  53. bool HasFrom = false, HasSubject = false;
  54. RemoveSWSP(values[4]); // header names shouldn't have spaces in them so this should be ok...
  55. - char *s = strtok(values[4], ":");
  56. + char *s = strtok_r(values[4], ":", &saveptr);
  57. while (s != NULL)
  58. {
  59. if (_stricmp(s, "From") == 0)
  60. @@ -1090,7 +1093,7 @@
  61. sig.SignedHeaders.push_back(s);
  62. - s = strtok(NULL, ":");
  63. + s = strtok_r(NULL, ":", &saveptr);
  64. }
  65. if (!HasFrom)
  66. @@ -1194,6 +1197,9 @@
  67. ////////////////////////////////////////////////////////////////////////////////
  68. int SelectorInfo::Parse( char* Buffer )
  69. {
  70. + // for strtok_r()
  71. + char *saveptr;
  72. +
  73. static const char *tags[] = {"v","g","h","k","p","s","t","n",NULL};
  74. char *values[sizeof(tags)/sizeof(tags[0])] = {NULL};
  75. @@ -1235,14 +1241,14 @@
  76. else
  77. {
  78. // MUST include "sha1" or "sha256"
  79. - char *s = strtok(values[2], ":");
  80. + char *s = strtok_r(values[2], ":", &saveptr);
  81. while (s != NULL)
  82. {
  83. if (strcmp(s, "sha1") == 0)
  84. AllowSHA1 = true;
  85. else if (strcmp(s, "sha256") == 0)
  86. AllowSHA256 = true;
  87. - s = strtok(NULL, ":");
  88. + s = strtok_r(NULL, ":", &saveptr);
  89. }
  90. if ( !(AllowSHA1 || AllowSHA256) )
  91. return DKIM_SELECTOR_INVALID; // todo: maybe create a new error code for unsupported hash algorithm
  92. @@ -1261,7 +1267,7 @@
  93. {
  94. // make sure "*" or "email" is in the list
  95. bool ServiceTypeMatch = false;
  96. - char *s = strtok(values[5], ":");
  97. + char *s = strtok_r(values[5], ":", &saveptr);
  98. while (s != NULL)
  99. {
  100. if (strcmp(s, "*") == 0 || strcmp(s, "email") == 0)
  101. @@ -1269,7 +1275,7 @@
  102. ServiceTypeMatch = true;
  103. break;
  104. }
  105. - s = strtok(NULL, ":");
  106. + s = strtok_r(NULL, ":", &saveptr);
  107. }
  108. if (!ServiceTypeMatch)
  109. return DKIM_SELECTOR_INVALID;
  110. @@ -1278,7 +1284,7 @@
  111. // flags
  112. if (values[6] != NULL)
  113. {
  114. - char *s = strtok(values[6], ":");
  115. + char *s = strtok_r(values[6], ":", &saveptr);
  116. while (s != NULL)
  117. {
  118. if (strcmp(s, "y") == 0)
  119. @@ -1289,7 +1295,7 @@
  120. {
  121. SameDomain = true;
  122. }
  123. - s = strtok(NULL, ":");
  124. + s = strtok_r(NULL, ":", &saveptr);
  125. }
  126. }
  127. @@ -1388,6 +1394,9 @@
  128. ////////////////////////////////////////////////////////////////////////////////
  129. int CDKIMVerify::GetSSP( const string &sDomain, int &iSSP, bool &bTesting )
  130. {
  131. + // for strtok_r()
  132. + char *saveptr;
  133. +
  134. string sFQDN = "_ssp._domainkey.";
  135. sFQDN += sDomain;
  136. @@ -1456,7 +1465,7 @@
  137. // flags
  138. if (values[1] != NULL)
  139. {
  140. - char *s = strtok(values[1], "|");
  141. + char *s = strtok_r(values[1], "|", &saveptr);
  142. while (s != NULL)
  143. {
  144. if (strcmp(s, "y") == 0)
  145. @@ -1474,7 +1483,7 @@
  146. return DKIM_SUCCESS;
  147. }
  148. }
  149. - s = strtok(NULL, "|");
  150. + s = strtok_r(NULL, "|", &saveptr);
  151. }
  152. }
  153. }