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
163 lines
4.6 KiB
#! /bin/sh /usr/share/dpatch/dpatch-run |
|
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
|
# |
|
# Filename: package/.../libdkim/enable-thread-safety.patch |
|
# Copyright (C) 2009 The OpenSDE Project |
|
# |
|
# More information can be found in the files COPYING and README. |
|
# |
|
# This patch file is dual-licensed. It is available under the license the |
|
# patched project is licensed under, as long as it is an OpenSource license |
|
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms |
|
# of the GNU General Public License as published by the Free Software |
|
# Foundation; either version 2 of the License, or (at your option) any later |
|
# version. |
|
# --- SDE-COPYRIGHT-NOTE-END --- |
|
|
|
## 01_strtok_r.dpatch by Russell Coker <russell@coker.com.au> |
|
## |
|
## DP: Use strtok_r() instead of strtok(). |
|
|
|
@DPATCH@ |
|
|
|
diff -ru libdkim-1.0.19/src/dkimverify.cpp libdkim-1.0.19-new/src/dkimverify.cpp |
|
--- ./dkimverify.cpp 2008-05-12 20:08:06.000000000 +1000 |
|
+++ ./dkimverify.cpp 2009-06-11 18:28:10.000000000 +1000 |
|
@@ -855,6 +855,9 @@ |
|
//////////////////////////////////////////////////////////////////////////////// |
|
int CDKIMVerify::ParseDKIMSignature( const string& sHeader, SignatureInfo &sig ) |
|
{ |
|
+ // for strtok_r() |
|
+ char *saveptr; |
|
+ |
|
// save header for later |
|
sig.Header = sHeader; |
|
|
|
@@ -1032,7 +1035,7 @@ |
|
{ |
|
// make sure "dns" is in the list |
|
bool HasDNS = false; |
|
- char *s = strtok(values[9], ":"); |
|
+ char *s = strtok_r(values[9], ":", &saveptr); |
|
while (s != NULL) |
|
{ |
|
if (strncmp(s, "dns", 3) == 0 && (s[3] == '\0' || s[3] == '/')) |
|
@@ -1040,7 +1043,7 @@ |
|
HasDNS = true; |
|
break; |
|
} |
|
- s = strtok(NULL, ": \t"); |
|
+ s = strtok_r(NULL, ": \t", &saveptr); |
|
} |
|
if (!HasDNS) |
|
return DKIM_BAD_SYNTAX; // todo: maybe create a new error code for unknown query method |
|
@@ -1080,7 +1083,7 @@ |
|
// parse the signed headers list |
|
bool HasFrom = false, HasSubject = false; |
|
RemoveSWSP(values[4]); // header names shouldn't have spaces in them so this should be ok... |
|
- char *s = strtok(values[4], ":"); |
|
+ char *s = strtok_r(values[4], ":", &saveptr); |
|
while (s != NULL) |
|
{ |
|
if (_stricmp(s, "From") == 0) |
|
@@ -1090,7 +1093,7 @@ |
|
|
|
sig.SignedHeaders.push_back(s); |
|
|
|
- s = strtok(NULL, ":"); |
|
+ s = strtok_r(NULL, ":", &saveptr); |
|
} |
|
|
|
if (!HasFrom) |
|
@@ -1194,6 +1197,9 @@ |
|
//////////////////////////////////////////////////////////////////////////////// |
|
int SelectorInfo::Parse( char* Buffer ) |
|
{ |
|
+ // for strtok_r() |
|
+ char *saveptr; |
|
+ |
|
static const char *tags[] = {"v","g","h","k","p","s","t","n",NULL}; |
|
char *values[sizeof(tags)/sizeof(tags[0])] = {NULL}; |
|
|
|
@@ -1235,14 +1241,14 @@ |
|
else |
|
{ |
|
// MUST include "sha1" or "sha256" |
|
- char *s = strtok(values[2], ":"); |
|
+ char *s = strtok_r(values[2], ":", &saveptr); |
|
while (s != NULL) |
|
{ |
|
if (strcmp(s, "sha1") == 0) |
|
AllowSHA1 = true; |
|
else if (strcmp(s, "sha256") == 0) |
|
AllowSHA256 = true; |
|
- s = strtok(NULL, ":"); |
|
+ s = strtok_r(NULL, ":", &saveptr); |
|
} |
|
if ( !(AllowSHA1 || AllowSHA256) ) |
|
return DKIM_SELECTOR_INVALID; // todo: maybe create a new error code for unsupported hash algorithm |
|
@@ -1261,7 +1267,7 @@ |
|
{ |
|
// make sure "*" or "email" is in the list |
|
bool ServiceTypeMatch = false; |
|
- char *s = strtok(values[5], ":"); |
|
+ char *s = strtok_r(values[5], ":", &saveptr); |
|
while (s != NULL) |
|
{ |
|
if (strcmp(s, "*") == 0 || strcmp(s, "email") == 0) |
|
@@ -1269,7 +1275,7 @@ |
|
ServiceTypeMatch = true; |
|
break; |
|
} |
|
- s = strtok(NULL, ":"); |
|
+ s = strtok_r(NULL, ":", &saveptr); |
|
} |
|
if (!ServiceTypeMatch) |
|
return DKIM_SELECTOR_INVALID; |
|
@@ -1278,7 +1284,7 @@ |
|
// flags |
|
if (values[6] != NULL) |
|
{ |
|
- char *s = strtok(values[6], ":"); |
|
+ char *s = strtok_r(values[6], ":", &saveptr); |
|
while (s != NULL) |
|
{ |
|
if (strcmp(s, "y") == 0) |
|
@@ -1289,7 +1295,7 @@ |
|
{ |
|
SameDomain = true; |
|
} |
|
- s = strtok(NULL, ":"); |
|
+ s = strtok_r(NULL, ":", &saveptr); |
|
} |
|
} |
|
|
|
@@ -1388,6 +1394,9 @@ |
|
//////////////////////////////////////////////////////////////////////////////// |
|
int CDKIMVerify::GetSSP( const string &sDomain, int &iSSP, bool &bTesting ) |
|
{ |
|
+ // for strtok_r() |
|
+ char *saveptr; |
|
+ |
|
string sFQDN = "_ssp._domainkey."; |
|
sFQDN += sDomain; |
|
|
|
@@ -1456,7 +1465,7 @@ |
|
// flags |
|
if (values[1] != NULL) |
|
{ |
|
- char *s = strtok(values[1], "|"); |
|
+ char *s = strtok_r(values[1], "|", &saveptr); |
|
while (s != NULL) |
|
{ |
|
if (strcmp(s, "y") == 0) |
|
@@ -1474,7 +1483,7 @@ |
|
return DKIM_SUCCESS; |
|
} |
|
} |
|
- s = strtok(NULL, "|"); |
|
+ s = strtok_r(NULL, "|", &saveptr); |
|
} |
|
} |
|
}
|
|
|