Nagy Karoly Gabriel
15 years ago
committed by
Alejandro Mery
7 changed files with 821 additions and 0 deletions
@ -0,0 +1,148 @@
|
||||
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
||||
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
||||
#
|
||||
# Filename: package/.../libdkim/enable-linux.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 ---
|
||||
|
||||
This patch modifies Alt-N's libdkim package to compile on Linux. This has only
|
||||
been tested on Gentoo linux.
|
||||
|
||||
Installation instructions:
|
||||
% wget http://downloads.sourceforge.net/libdkim/libdkim-1.0.19.zip
|
||||
% wget http://www.bltweb.net/qmail/libdkim-1.0.19-linux.patch
|
||||
% unzip libdkim-1.0.19
|
||||
% cd libdkim/src
|
||||
% patch -p2 < ../../libdkim-1.0.19-linux.patch
|
||||
|
||||
|
||||
diff -Naur libdkim.orig/src/Makefile libdkim/src/Makefile
|
||||
--- ./Makefile 2009-03-24 08:38:48.000000000 -0500
|
||||
+++ ./Makefile 2009-03-24 08:39:55.000000000 -0500
|
||||
@@ -1,15 +1,10 @@
|
||||
# libdkim makefile for UNIX
|
||||
#
|
||||
|
||||
-#ifdef LINUX
|
||||
-CFLAGS = -c
|
||||
-LFLAGS =
|
||||
+DESTDIR ?= /
|
||||
+
|
||||
+CFLAGS += -fPIC
|
||||
LIBS = -lcrypto -lresolv
|
||||
-#else
|
||||
-CFLAGS = -c
|
||||
-LFLAGS =
|
||||
-LIBS = -lcrypto
|
||||
-#endif
|
||||
|
||||
INCL = -I /usr/include/openssl/
|
||||
|
||||
@@ -19,23 +14,35 @@
|
||||
|
||||
HDRS = dkim.h dns.h dkimbase.h dkimsign.h dkimverify.h
|
||||
|
||||
-all: libdkim.a libdkimtest
|
||||
+all: libdkim.so.1 libdkimtest
|
||||
|
||||
libdkim.a: $(OBJS)
|
||||
rm -f libdkim.a
|
||||
ar cr libdkim.a $(OBJS)
|
||||
ranlib libdkim.a
|
||||
|
||||
-libdkimtest : libdkim.a libdkimtest.o
|
||||
- g++ -olibdkimtest $(LFLAGS) \
|
||||
- -L . libdkimtest.o $(LIBS) -ldkim
|
||||
+libdkim.so.1: $(OBJS)
|
||||
+ $(CXX) -shared -Wl,-soname,$@.1 $(LDFLAGS) $(OBJS) -o $@ $(LIBS)
|
||||
+ ln -s $@ libdkim.so
|
||||
+
|
||||
+.cpp.o:
|
||||
+ $(CXX) $(CFLAGS) -c $<
|
||||
+
|
||||
+libdkimtest : libdkim.so.1 libdkimtest.o
|
||||
+ $(CXX) -o$@ $(LDFLAGS) \
|
||||
+ -L. libdkimtest.o $(LIBS) -ldkim
|
||||
|
||||
libdkimtest.o: libdkimtest.cpp $(HDRS)
|
||||
|
||||
-.cpp.o:
|
||||
- g++ $(CFLAGS) -c $<
|
||||
|
||||
clean:
|
||||
- rm *.o libdkim.lib libdkimtest
|
||||
+ rm -f *.o libdkim.{a,so,so.1} libdkimtest
|
||||
+
|
||||
+install: all
|
||||
+ install -D -m 0755 libdkim.so.1 $(DESTDIR)/usr/lib/libdkim.so.1
|
||||
+ ln -s libdkim.so.1 $(DESTDIR)/usr/lib/libdkim.so
|
||||
+ ln -s libdkim.so.1 $(DESTDIR)/usr/lib/libdkim.so.1.1
|
||||
+ install -D -m 0644 dkim.h $(DESTDIR)/usr/include/dkim.h
|
||||
+ install -D -m 0755 libdkimtest $(DESTDIR)/usr/bin/libdkimtest
|
||||
|
||||
|
||||
diff -Naur libdkim.orig/src/dkim.h libdkim/src/dkim.h
|
||||
--- ./dkim.h 2009-03-24 08:38:48.000000000 -0500
|
||||
+++ ./dkim.h 2009-03-24 08:39:20.000000000 -0500
|
||||
@@ -22,7 +22,6 @@
|
||||
#define DKIM_CALL WINAPI
|
||||
#else
|
||||
#define DKIM_CALL
|
||||
-#define MAKELONG(a,b) ((long)(((unsigned)(a) & 0xffff) | (((unsigned)(b) & 0xffff) << 16)))
|
||||
#endif
|
||||
|
||||
|
||||
@@ -162,6 +161,32 @@
|
||||
|
||||
char *DKIM_CALL DKIMGetErrorString( int ErrorCode );
|
||||
|
||||
+#ifndef _WIN32
|
||||
+/*
|
||||
+ * macros.h: Useful macros
|
||||
+ *
|
||||
+ * Author:
|
||||
+ * Dick Porter (dick@ximian.com)
|
||||
+ *
|
||||
+ * (C) 2002 Ximian, Inc.
|
||||
+ */
|
||||
+#ifndef _WAPI_MACROS_H_
|
||||
+#define _WAPI_MACROS_H_
|
||||
+
|
||||
+#include <sys/types.h>
|
||||
+
|
||||
+#define MAKEWORD(low, high) ((__uint16_t)(((__uint8_t)(low)) | \
|
||||
+ ((__uint16_t)((__uint8_t)(high))) << 8))
|
||||
+#define MAKELONG(low, high) ((__uint32_t)(((__uint16_t)(low)) | \
|
||||
+ ((__uint32_t)((__uint16_t)(high))) << 16))
|
||||
+#define LOWORD(i32) ((__uint16_t)((i32) & 0xFFFF))
|
||||
+#define HIWORD(i32) ((__uint16_t)(((__uint32_t)(i32) >> 16) & 0xFFFF))
|
||||
+#define LOBYTE(i16) ((__uint8_t)((i16) & 0xFF))
|
||||
+#define HIBYTE(i16) ((__uint8_t)(((__uint16_t)(i16) >> 8) & 0xFF))
|
||||
+
|
||||
+#endif /* _WAPI_MACROS_H_ */
|
||||
+#endif
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
diff -Naur libdkim.orig/src/dkimsign.cpp libdkim/src/dkimsign.cpp
|
||||
--- ./dkimsign.cpp 2009-03-24 08:38:48.000000000 -0500
|
||||
+++ ./dkimsign.cpp 2009-03-24 08:39:20.000000000 -0500
|
||||
@@ -25,8 +25,6 @@
|
||||
#else
|
||||
#define _strnicmp strncasecmp
|
||||
#define _stricmp strcasecmp
|
||||
-#define LOWORD(l) ((unsigned)(l) & 0xffff)
|
||||
-#define HIWORD(l) ((unsigned)(l) >> 16)
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
@ -0,0 +1,163 @@
|
||||
#! /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);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
||||
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
||||
#
|
||||
# Filename: package/.../libdkim/extra-options.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 ---
|
||||
|
||||
This patch was taken from
|
||||
http://patchlog.com/security/qmail-and-dkim/
|
||||
|
||||
It adds usage text and a few extra options to the libdkimtest program that
|
||||
comes with Alt-N's libdkim library.
|
||||
|
||||
Installation instructions:
|
||||
% wget http://downloads.sourceforge.net/libdkim/libdkim-1.0.19.zip
|
||||
% wget http://www.bltweb.net/qmail/libdkim-1.0.19-extra-options.patch
|
||||
% unzip libdkim-1.0.19
|
||||
% cd libdkim/src
|
||||
% patch -p2 < ../../libdkim-1.0.19-extra-options.patch
|
||||
|
||||
|
||||
diff -Naur libdkim.orig/src/libdkimtest.cpp libdkim/src/libdkimtest.cpp
|
||||
--- ./libdkimtest.cpp 2009-03-13 16:17:45.000000000 -0500
|
||||
+++ ./libdkimtest.cpp 2009-03-13 16:26:02.000000000 -0500
|
||||
@@ -55,8 +55,23 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
+void usage()
|
||||
+{
|
||||
|
||||
-
|
||||
+ printf( "usage: libdkimtest [-b<allman|ietf|both>] [-c<r|s|t|u>] [-d<domain>] [-l] [-h] [-i<you@yourdomain.com>] [-q] [-s] [-t] [-v] [-x<expire time>] [-z<hash>] <msgfile> <privkeyfile> <outfile>\n");
|
||||
+ printf( "-b<standard> allman , ietf or both\n");
|
||||
+ printf( "-c<canonicalization> r for relaxed [DEFAULT], s - simple, t relaxed/simple, u - simple/relaxed\n");
|
||||
+ printf( "-d<domain> the domain tag, if not provided it will be determined from the sender/from header\n");
|
||||
+ printf( "-l include body length tag\n");
|
||||
+ printf( "-h this help\n");
|
||||
+ printf( "-i<identity> the identity, if not provided it will not be included\n");
|
||||
+ printf( "-s sign the message\n");
|
||||
+ printf( "-t include a timestamp tag\n");
|
||||
+ printf( "-v verify the message\n");
|
||||
+ printf( "-x<expire_time> the expire time in seconds since epoch ( DEFAULT = current time + 604800)\n\t if set to - then it will not be included");
|
||||
+ printf( "-z<hash> 1 for sha1, 2 for sha256, 3 for both\n");
|
||||
+ printf( "-y<selector> the selector tag DEFAULT=MDaemon\n");
|
||||
+}
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int n;
|
||||
@@ -77,7 +92,7 @@
|
||||
time(&t);
|
||||
|
||||
opts.nCanon = DKIM_SIGN_RELAXED;
|
||||
- opts.nIncludeBodyLengthTag = 1;
|
||||
+ opts.nIncludeBodyLengthTag = 0;
|
||||
opts.nIncludeQueryMethod = 0;
|
||||
opts.nIncludeTimeStamp = 0;
|
||||
opts.expireTime = t + 604800; // expires in 1 week
|
||||
@@ -92,6 +107,11 @@
|
||||
int nArgParseState = 0;
|
||||
bool bSign = true;
|
||||
|
||||
+ if(argc<2){
|
||||
+ usage();
|
||||
+ exit(1);
|
||||
+ }
|
||||
+
|
||||
for( n = 1; n < argc; n++ )
|
||||
{
|
||||
if( argv[n][0] == '-' && strlen(argv[n]) > 1 )
|
||||
@@ -121,14 +141,16 @@
|
||||
}
|
||||
break;
|
||||
|
||||
-
|
||||
+ case 'd':
|
||||
+ strncpy(opts.szDomain,(const char*)(argv[n]+2),sizeof(opts.szDomain)-1);
|
||||
+ break;
|
||||
case 'l': // body length tag
|
||||
opts.nIncludeBodyLengthTag = 1;
|
||||
break;
|
||||
|
||||
|
||||
case 'h':
|
||||
- printf( "usage: \n" );
|
||||
+ usage();
|
||||
return 0;
|
||||
|
||||
case 'i': // identity
|
||||
@@ -138,7 +160,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
- strcpy( opts.szIdentity, argv[n] + 2 );
|
||||
+ strncpy( opts.szIdentity, argv[n] + 2,sizeof(opts.szIdentity)-1 );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -169,6 +191,9 @@
|
||||
}
|
||||
break;
|
||||
|
||||
+ case 'y':
|
||||
+ strncpy( opts.szSelector, argv[n]+2, sizeof(opts.szSelector)-1);
|
||||
+ break;
|
||||
|
||||
case 'z': // sign w/ sha1, sha256 or both
|
||||
opts.nHash = atoi( &argv[n][2] );
|
@ -0,0 +1,320 @@
|
||||
#! /bin/sh /usr/share/dpatch/dpatch-run
|
||||
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
||||
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
||||
#
|
||||
# Filename: package/.../libdkim/fix-warnings.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 ---
|
||||
|
||||
## 02_fix_warnings.dpatch by Russell Coker <russell@coker.com.au>
|
||||
##
|
||||
## DP: Get rid of warnings through the use of const and more correct types
|
||||
|
||||
@DPATCH@
|
||||
|
||||
diff -ru libdkim-1.0.19.orig/src/dkim.cpp libdkim-1.0.19/src/dkim.cpp
|
||||
--- ./dkim.cpp 2008-05-12 20:07:32.000000000 +1000
|
||||
+++ ./dkim.cpp 2009-04-15 19:38:08.000000000 +1000
|
||||
@@ -172,7 +172,7 @@
|
||||
}
|
||||
|
||||
|
||||
-int DKIM_CALL DKIMVerifyProcess( DKIMContext* pVerifyContext, char* szBuffer, int nBufLength )
|
||||
+int DKIM_CALL DKIMVerifyProcess( DKIMContext* pVerifyContext, const char* const szBuffer, int nBufLength )
|
||||
{
|
||||
CDKIMVerify* pVerify = (CDKIMVerify*)ValidateContext( pVerifyContext, false );
|
||||
|
||||
@@ -226,13 +226,13 @@
|
||||
}
|
||||
|
||||
|
||||
-char* DKIM_CALL DKIMVersion()
|
||||
+const char* DKIM_CALL DKIMVersion()
|
||||
{
|
||||
return VERSION_STRING;
|
||||
}
|
||||
|
||||
|
||||
-static char* DKIMErrorStrings[-1-DKIM_MAX_ERROR] = {
|
||||
+static const char* DKIMErrorStrings[-1-DKIM_MAX_ERROR] = {
|
||||
"DKIM_FAIL",
|
||||
"DKIM_BAD_SYNTAX",
|
||||
"DKIM_SIGNATURE_BAD",
|
||||
@@ -254,7 +254,7 @@
|
||||
};
|
||||
|
||||
|
||||
-char* DKIM_CALL DKIMGetErrorString( int ErrorCode )
|
||||
+const char* DKIM_CALL DKIMGetErrorString( int ErrorCode )
|
||||
{
|
||||
if (ErrorCode >= 0 || ErrorCode <= DKIM_MAX_ERROR)
|
||||
return "Unknown";
|
||||
diff -ru libdkim-1.0.19.orig/src/dkim.h libdkim-1.0.19/src/dkim.h
|
||||
--- ./dkim.h 2009-04-15 19:37:48.000000000 +1000
|
||||
+++ ./dkim.h 2009-04-15 19:38:08.000000000 +1000
|
||||
@@ -155,14 +155,14 @@
|
||||
void DKIM_CALL DKIMSignFree( DKIMContext* pSignContext );
|
||||
|
||||
int DKIM_CALL DKIMVerifyInit( DKIMContext* pVerifyContext, DKIMVerifyOptions* pOptions );
|
||||
-int DKIM_CALL DKIMVerifyProcess( DKIMContext* pVerifyContext, char* szBuffer, int nBufLength );
|
||||
+int DKIM_CALL DKIMVerifyProcess( DKIMContext* pVerifyContext, const char* szBuffer, int nBufLength );
|
||||
int DKIM_CALL DKIMVerifyResults( DKIMContext* pVerifyContext );
|
||||
int DKIM_CALL DKIMVerifyGetDetails( DKIMContext* pVerifyContext, int* nSigCount, DKIMVerifyDetails** pDetails, char* szPractices );
|
||||
void DKIM_CALL DKIMVerifyFree( DKIMContext* pVerifyContext );
|
||||
|
||||
-char *DKIM_CALL DKIMVersion();
|
||||
+const char *DKIM_CALL DKIMVersion();
|
||||
|
||||
-char *DKIM_CALL DKIMGetErrorString( int ErrorCode );
|
||||
+const char *DKIM_CALL DKIMGetErrorString( int ErrorCode );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
diff -ru libdkim-1.0.19.orig/src/dkimbase.cpp libdkim-1.0.19/src/dkimbase.cpp
|
||||
--- ./dkimbase.cpp 2008-05-12 20:07:36.000000000 +1000
|
||||
+++ ./dkimbase.cpp 2009-04-15 19:49:32.000000000 +1000
|
||||
@@ -118,10 +118,10 @@
|
||||
// Process - split buffers into lines without any CRs or LFs at the end.
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
-int CDKIMBase::Process( char* szBuffer, int nBufLength, bool bEOF )
|
||||
+int CDKIMBase::Process( const char* szBuffer, int nBufLength, bool bEOF )
|
||||
{
|
||||
- char* p = szBuffer;
|
||||
- char* e = szBuffer + nBufLength;
|
||||
+ const char* p = szBuffer;
|
||||
+ const char* e = szBuffer + nBufLength;
|
||||
|
||||
while( p < e )
|
||||
{
|
||||
@@ -208,7 +208,8 @@
|
||||
{
|
||||
m_InHeaders = false;
|
||||
ProcessHeaders();
|
||||
- ProcessBody("", 0, true);
|
||||
+ /* type conversion should be safe as length is zero */
|
||||
+ ProcessBody((char *)"", 0, true);
|
||||
}
|
||||
|
||||
return DKIM_SUCCESS;
|
||||
@@ -338,9 +339,9 @@
|
||||
|
||||
CompressSWSP(sTemp);
|
||||
|
||||
- unsigned cpos = sTemp.find(':');
|
||||
+ string::size_type cpos = sTemp.find(':');
|
||||
|
||||
- if (cpos == -1)
|
||||
+ if (cpos == string::npos)
|
||||
{
|
||||
// no colon?!
|
||||
}
|
||||
diff -ru libdkim-1.0.19.orig/src/dkimbase.h libdkim-1.0.19/src/dkimbase.h
|
||||
--- ./dkimbase.h 2008-05-12 20:07:24.000000000 +1000
|
||||
+++ ./dkimbase.h 2009-04-15 19:49:32.000000000 +1000
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
int Init(void);
|
||||
|
||||
- int Process( char* szBuffer, int nBufLength, bool bEOF );
|
||||
+ int Process( const char* szBuffer, int nBufLength, bool bEOF );
|
||||
int ProcessFinal(void);
|
||||
|
||||
int Alloc( char*& szBuffer, int nRequiredSize );
|
||||
diff -ru libdkim-1.0.19.orig/src/dkimsign.cpp libdkim-1.0.19/src/dkimsign.cpp
|
||||
--- ./dkimsign.cpp 2008-05-12 20:07:46.000000000 +1000
|
||||
+++ ./dkimsign.cpp 2009-04-15 19:49:32.000000000 +1000
|
||||
@@ -144,7 +144,7 @@
|
||||
|
||||
fwrite( szBuffer, 1, nBufLength, fpdebug );
|
||||
|
||||
- /** END DEBUG CODE **/
|
||||
+ ** END DEBUG CODE **/
|
||||
|
||||
if( bAllmanOnly )
|
||||
{
|
||||
@@ -555,7 +555,7 @@
|
||||
// if bFold, fold at cbrk char
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
-void CDKIMSign::AddTagToSig( char* Tag, const string &sValue, char cbrk, bool bFold )
|
||||
+void CDKIMSign::AddTagToSig( const char* const Tag, const string &sValue, char cbrk, bool bFold )
|
||||
{
|
||||
int nTagLen = strlen(Tag);
|
||||
|
||||
@@ -583,10 +583,10 @@
|
||||
// AddTagToSig - add tag and numeric value to signature folding if necessary
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
-void CDKIMSign::AddTagToSig( char* Tag, unsigned long nValue )
|
||||
+void CDKIMSign::AddTagToSig( const char* const Tag, unsigned long nValue )
|
||||
{
|
||||
char szValue[64];
|
||||
- sprintf( szValue, "%u", nValue );
|
||||
+ sprintf( szValue, "%lu", nValue );
|
||||
AddTagToSig( Tag, szValue, 0, false );
|
||||
}
|
||||
|
||||
@@ -686,7 +686,7 @@
|
||||
// GetSig - compute hash and return signature header in szSignature
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
-int CDKIMSign::GetSig( char* szPrivKey, char* szSignature, int nSigLength )
|
||||
+int CDKIMSign::GetSig( char* szPrivKey, char* szSignature, unsigned nSigLength )
|
||||
{
|
||||
if( szPrivKey == NULL )
|
||||
{
|
||||
@@ -794,7 +794,6 @@
|
||||
int size;
|
||||
int len;
|
||||
char* buf;
|
||||
- int pos = 0;
|
||||
|
||||
// construct the DKIM-Signature: header and add to hash
|
||||
InitSig();
|
||||
@@ -879,7 +878,7 @@
|
||||
}
|
||||
BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
|
||||
BIO_push(b64, bio);
|
||||
- if (BIO_write(b64, Hash, nHashLen) < nHashLen)
|
||||
+ if (BIO_write(b64, Hash, nHashLen) < (int)nHashLen)
|
||||
{
|
||||
BIO_free_all(b64);
|
||||
return DKIM_OUT_OF_MEMORY;
|
||||
@@ -993,7 +992,7 @@
|
||||
}
|
||||
BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
|
||||
BIO_push(b64, bio);
|
||||
- if (BIO_write(b64, sig, siglen) < siglen)
|
||||
+ if (BIO_write(b64, sig, siglen) < (int)siglen)
|
||||
{
|
||||
OPENSSL_free(sig);
|
||||
BIO_free_all(b64);
|
||||
diff -ru libdkim-1.0.19.orig/src/dkimsign.h libdkim-1.0.19/src/dkimsign.h
|
||||
--- ./dkimsign.h 2008-05-12 20:07:58.000000000 +1000
|
||||
+++ ./dkimsign.h 2009-04-15 19:49:32.000000000 +1000
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
int Init( DKIMSignOptions* pOptions );
|
||||
|
||||
- int GetSig( char* szPrivKey, char* szSignature, int nSigLength );
|
||||
+ int GetSig( char* szPrivKey, char* szSignature, unsigned nSigLength );
|
||||
int GetSig2( char* szPrivKey, char** pszSignature );
|
||||
|
||||
virtual int ProcessHeaders(void);
|
||||
@@ -50,8 +50,8 @@
|
||||
bool ParseFromAddress( void );
|
||||
|
||||
void InitSig(void);
|
||||
- void AddTagToSig( char* Tag, const string &sValue, char cbrk, bool bFold );
|
||||
- void AddTagToSig( char* Tag, unsigned long nValue );
|
||||
+ void AddTagToSig( const char* const Tag, const string &sValue, char cbrk, bool bFold );
|
||||
+ void AddTagToSig( const char* const Tag, unsigned long nValue );
|
||||
void AddInterTagSpace( int nSizeOfNextTag );
|
||||
void AddFoldedValueToSig( const string &sValue, char cbrk );
|
||||
|
||||
diff -ru libdkim-1.0.19.orig/src/dkimverify.cpp libdkim-1.0.19/src/dkimverify.cpp
|
||||
--- ./dkimverify.cpp 2009-04-15 19:37:48.000000000 +1000
|
||||
+++ ./dkimverify.cpp 2009-04-15 19:49:32.000000000 +1000
|
||||
@@ -440,7 +440,7 @@
|
||||
{
|
||||
ProcessFinal();
|
||||
|
||||
- int SuccessCount=0;
|
||||
+ unsigned int SuccessCount=0;
|
||||
int TestingFailures=0;
|
||||
int RealFailures=0;
|
||||
|
||||
@@ -646,7 +646,7 @@
|
||||
/** END DEBUG CODE **/
|
||||
#endif
|
||||
|
||||
- if (IsBody && BodyLength != -1)
|
||||
+ if (IsBody && BodyLength != (unsigned)-1)
|
||||
{
|
||||
VerifiedBodyCount += nBufLength;
|
||||
if (VerifiedBodyCount > BodyLength)
|
||||
@@ -1019,7 +1019,7 @@
|
||||
// body count
|
||||
if (values[8] == NULL || !m_HonorBodyLengthTag)
|
||||
{
|
||||
- sig.BodyLength = -1;
|
||||
+ sig.BodyLength = (unsigned)-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1057,17 +1057,17 @@
|
||||
// expiration time
|
||||
if (values[11] == NULL)
|
||||
{
|
||||
- sig.ExpireTime = -1;
|
||||
+ sig.ExpireTime = (unsigned)-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ParseUnsigned(values[11], &sig.ExpireTime))
|
||||
return DKIM_BAD_SYNTAX;
|
||||
|
||||
- if (sig.ExpireTime != -1)
|
||||
+ if (sig.ExpireTime != (unsigned)-1)
|
||||
{
|
||||
// the value of x= MUST be greater than the value of t= if both are present
|
||||
- if (SignedTime != -1 && sig.ExpireTime <= SignedTime)
|
||||
+ if (SignedTime != (unsigned)-1 && sig.ExpireTime <= SignedTime)
|
||||
return DKIM_BAD_SYNTAX;
|
||||
|
||||
// todo: if possible, use the received date/time instead of the current time
|
||||
@@ -1169,7 +1169,7 @@
|
||||
}
|
||||
|
||||
|
||||
-SelectorInfo::SelectorInfo(const string &sSelector, const string &sDomain) : Selector(sSelector), Domain(sDomain)
|
||||
+SelectorInfo::SelectorInfo(const string &sSelector, const string &sDomain) : Domain(sDomain), Selector(sSelector)
|
||||
{
|
||||
AllowSHA1 = true;
|
||||
AllowSHA256 = true;
|
||||
@@ -1207,7 +1207,7 @@
|
||||
return DKIM_SELECTOR_INVALID; // todo: maybe create a new error code for unsupported selector version
|
||||
|
||||
// make sure v= is the first tag in the response // todo: maybe don't enforce this, it seems unnecessary
|
||||
- for (int j=1; j<sizeof(values)/sizeof(values[0]); j++)
|
||||
+ for (unsigned j=1; j<sizeof(values)/sizeof(values[0]); j++)
|
||||
{
|
||||
if (values[j] != NULL && values[j] < values[0])
|
||||
{
|
||||
@@ -1411,8 +1411,8 @@
|
||||
return DKIM_POLICY_DNS_PERM_FAILURE;
|
||||
}
|
||||
|
||||
- unsigned pos = sDomain.find('.');
|
||||
- if (pos == -1 || sDomain.find('.', pos+1) == -1)
|
||||
+ string::size_type pos = sDomain.find('.');
|
||||
+ if (pos == string::npos || sDomain.find('.', pos+1) == string::npos)
|
||||
{
|
||||
// SSP not found but the domain exists, it's non-suspicious
|
||||
iSSP = DKIM_SSP_UNKNOWN;
|
||||
diff -ru libdkim-1.0.19.orig/src/libdkimtest.cpp libdkim-1.0.19/src/libdkimtest.cpp
|
||||
--- ./libdkimtest.cpp 2008-05-12 20:08:54.000000000 +1000
|
||||
+++ ./libdkimtest.cpp 2009-04-15 19:38:08.000000000 +1000
|
||||
@@ -60,9 +60,9 @@
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int n;
|
||||
- char* PrivKeyFile = "test.pem";
|
||||
- char* MsgFile = "test.msg";
|
||||
- char* OutFile = "signed.msg";
|
||||
+ const char* PrivKeyFile = "test.pem";
|
||||
+ const char* MsgFile = "test.msg";
|
||||
+ const char* OutFile = "signed.msg";
|
||||
int nPrivKeyLen;
|
||||
char PrivKey[2048];
|
||||
char Buffer[1024];
|
@ -0,0 +1,22 @@
|
||||
|
||||
[TIMESTAMP] 1255607798 Thu Oct 15 14:56:38 2009 |
||||
[BUILDTIME] 0 (5) |
||||
[SIZE] 0.11 MB, 10 files |
||||
|
||||
[DEP] bash |
||||
[DEP] binutils |
||||
[DEP] coreutils |
||||
[DEP] diffutils |
||||
[DEP] fhs |
||||
[DEP] findutils |
||||
[DEP] gawk |
||||
[DEP] gcc |
||||
[DEP] glibc |
||||
[DEP] grep |
||||
[DEP] make |
||||
[DEP] openssl |
||||
[DEP] patch |
||||
[DEP] runit |
||||
[DEP] sed |
||||
[DEP] sysfiles |
||||
[DEP] unzip |
@ -0,0 +1,18 @@
|
||||
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
||||
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
||||
# |
||||
# Filename: package/.../libdkim/libdkim.conf |
||||
# Copyright (C) 2009 The OpenSDE Project |
||||
# |
||||
# More information can be found in the files COPYING and README. |
||||
# |
||||
# This program is free software; you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation; version 2 of the License. A copy of the |
||||
# GNU General Public License can be found in the file COPYING. |
||||
# --- SDE-COPYRIGHT-NOTE-END --- |
||||
|
||||
srcdir=libdkim/src |
||||
|
||||
runconf=0 |
||||
|
@ -0,0 +1,33 @@
|
||||
[COPY] --- SDE-COPYRIGHT-NOTE-BEGIN --- |
||||
[COPY] This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
||||
[COPY] |
||||
[COPY] Filename: package/.../libdkim/libdkim.desc |
||||
[COPY] Copyright (C) 2009 The OpenSDE Project |
||||
[COPY] |
||||
[COPY] More information can be found in the files COPYING and README. |
||||
[COPY] |
||||
[COPY] This program is free software; you can redistribute it and/or modify |
||||
[COPY] it under the terms of the GNU General Public License as published by |
||||
[COPY] the Free Software Foundation; version 2 of the License. A copy of the |
||||
[COPY] GNU General Public License can be found in the file COPYING. |
||||
[COPY] --- SDE-COPYRIGHT-NOTE-END --- |
||||
|
||||
[I] A DKIM implementation in C++ |
||||
|
||||
[T] A C++ library which allows incorporating DKIM into an existing MTA |
||||
[T] or other application. It provides full support for signing, verifying, |
||||
[T] and SSP. It is compliant with RFC 4871. |
||||
|
||||
[U] http://libdkim.sourceforge.net |
||||
|
||||
[A] Alt-N Technologies |
||||
[M] Nagy Karoly Gabriel <nagy.karoly@opensde.org> |
||||
|
||||
[C] extra/library |
||||
|
||||
[L] APL |
||||
[S] Beta |
||||
[V] 1.0.19 |
||||
[P] X -----5---9 800.000 |
||||
|
||||
[D] 2617769788 libdkim-1.0.19.zip http://dl.sourceforge.net/sourceforge/libdkim/ |
Loading…
Reference in new issue