debian/0000775000000000000000000000000011723353153007173 5ustar debian/libdkim.ver0000664000000000000000000000004211025501747011317 0ustar { global: DKIM*; local: *; }; debian/libdkim-dev.examples0000664000000000000000000000002411253521425013113 0ustar src/libdkimtest.cpp debian/install0000664000000000000000000000002210744472207010562 0ustar usr/lib/lib*.so.* debian/source/0000775000000000000000000000000011575727055010506 5ustar debian/source/format0000664000000000000000000000001411574775456011723 0ustar 3.0 (quilt) debian/README.Debian0000664000000000000000000000133510677671742011254 0ustar Yahoo! Inc. claims patent rights concerning DomainKeys and DKIM. Details of the claim can be found at . Their licensing statement from that page reads as follows, as of 2007-02-30: "Yahoo! licenses its Necessary Patent Claims contained in the patent(s) and patent application(s) disclosed above under either of two separate license agreements, one of which is the DomainKeys Patent License Agreement (v1.2), and the other is the GNU General Public License v2.0 (and no other version)." It is believed that this will cause normal users no legal problems, but the packager can't guarantee anything. For more information about DKIM, see http://mipassoc.org/dkim/ debian/watch0000664000000000000000000000015610677671742010244 0ustar # Compulsory line, this is a version 3 file version=3 http://sf.net/libdkim/libdkim-(.*)\.zip debian uupdate debian/configure.ac0000664000000000000000000000166611331403077011466 0ustar # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) AC_INIT(libdkim, 1.0.21) AC_CONFIG_SRCDIR([dkim.cpp]) ##AC_CONFIG_HEADER([config.h]) # Checks for programs. AC_PROG_CXX PKG_PROG_PKG_CONFIG # Checks for libraries. #AC_CHECK_LIB([crypto], [PEM_read_PrivateKey]) PKG_CHECK_MODULES([libcrypto], [libcrypto]) AC_SEARCH_LIBS([res_query], [resolv c],, [AC_SEARCH_LIBS(__res_query,resolv bind)]) # Checks for header files. AC_HEADER_RESOLV AC_HEADER_STDC AC_CHECK_HEADERS([netdb.h netinet/in.h inttypes.h stdlib.h string.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL AC_C_CONST AC_C_INLINE AC_HEADER_TIME AC_TYPE_UINT16_T AC_TYPE_UINT32_T # Checks for library functions. AC_FUNC_MEMCMP AC_FUNC_SELECT_ARGTYPES AC_CHECK_FUNCS([select socket strchr]) AC_CONFIG_FILES([Makefile libdkim.pc]) AC_OUTPUT debian/libdkim-dev.README.Debian0000664000000000000000000000177011253521334013423 0ustar The libdkimtest program is currently not very user-friendly and only suitable for testing. Please refer to the source code, which can be found in /usr/share/doc/libdkim-dev/examples, for usage information. Yahoo! Inc. claims patent rights concerning DomainKeys and DKIM. Details of the claim can be found at . Their licensing statement from that page reads as follows, as of 2007-02-30: "Yahoo! licenses its Necessary Patent Claims contained in the patent(s) and patent application(s) disclosed above under either of two separate license agreements, one of which is the DomainKeys Patent License Agreement (v1.2), and the other is the GNU General Public License v2.0 (and no other version)." It is believed that this will cause normal users no legal problems, but the packager can't guarantee anything. For more information about DKIM, see http://mipassoc.org/dkim/ -- Magnus Holmgren , Mon, 14 Sep 2009 22:08:09 +0200 debian/Makefile.in0000664000000000000000000000457011575727044011257 0ustar # libdkim makefile for UNIX # srcdir = @srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ libdir = @libdir@ includedir = @includedir@ OBJEXT = @OBJEXT@ LIBS = @LIBS@ @libcrypto_LIBS@ CC = @CC@ CXX = @CXX@ CFLAGS = @CFLAGS@ CXXFLAGS = @CXXFLAGS@ CPPFLAGS = @CPPFLAGS@ INCL = LDFLAGS = @LDFLAGS@ libdkim_SOURCES = dkim.cpp dns.cpp dkimbase.cpp dkimsign.cpp dkimverify.cpp HEADERS = dkim.h dns.h dkimbase.h dkimsign.h dkimverify.h libdkim_OBJS = $(libdkim_SOURCES:.cpp=.$(OBJEXT)) libdkim_PURE_OBJS = $(libdkim_SOURCES:.cpp=.p$(OBJEXT)) libdkimtest_SOURCES = libdkimtest.cpp libdkimtest_OBJS = libdkimtest.$(OBJEXT) SHLIBFORLINK = libdkim.so SHLIBSONAME = $(SHLIBFORLINK).$(SHLIBMAJOR) SHLIBTARGET = $(SHLIBFORLINK) SHLIBLINK = $(CXX) $(LDFLAGS) -shared -Wl,-soname=$(SHLIBSONAME) -Wl,-version-script=debian/libdkim.ver SHLIBMAJOR = 1d SHLIBMINOR = 1 SHLIBFILE = $(SHLIBSONAME).$(SHLIBMINOR) SHLIBCFLAGS = -fPIC ARFLAGS = crs TARGETS = libdkim.a $(SHLIBTARGET) libdkimtest all: $(TARGETS) libdkim.a: $(libdkim_OBJS) -rm -f $@ $(AR) $(ARFLAGS) $@ $(libdkim_OBJS) $(SHLIBFORLINK): $(libdkim_PURE_OBJS) $(SHLIBLINK) -o $@ $(libdkim_PURE_OBJS) $(LIBS) -mkdir .lib 2>/dev/null [ -z "$(SHLIBSONAME)" ] || (cd .lib \ && ln -sf ../$(SHLIBFORLINK) $(SHLIBSONAME)) libdkimtest: $(libdkimtest_OBJS) $(SHLIBFORLINK) $(CXX) -L. -o $@ libdkimtest.o -ldkim $(LIBS) libdkimtest.o: $(libdkimtest_SOURCES) $(HDRS) $(CXX) $(CXXFLAGS) -o $@ -c $< %.$(OBJEXT): %.cpp $(HDRS) $(CXX) $(CXXFLAGS) -o $@ -c $< %.p$(OBJEXT): %.cpp $(HDRS) $(CXX) $(SHLIBCFLAGS) $(CXXFLAGS) -o $@ -c $< clean: -rm -f *.$(OBJEXT) *.p$(OBJEXT) $(TARGETS) -rm -rf .lib distclean: clean -rm -f config.status config.log Makefile libdkim.pc install: all install -m 755 -d $(DESTDIR)$(libdir) install -m 755 -d $(DESTDIR)$(libdir)/pkgconfig install -m 755 -d $(DESTDIR)$(includedir) install -m 644 libdkim.a $(DESTDIR)$(libdir) install -m 755 $(SHLIBFORLINK) $(DESTDIR)$(libdir)/$(SHLIBFILE) [ -z "$(SHLIBSONAME)" ] \ || (cd $(DESTDIR)$(libdir) \ && ln -sf $(SHLIBFILE) $(SHLIBSONAME) \ && ln -sf $(SHLIBFILE) $(SHLIBFORLINK) ) install -m 644 $(srcdir)/dkim.h $(DESTDIR)$(includedir) install -m 644 libdkim.pc $(DESTDIR)$(libdir)/pkgconfig install -m 755 -d $(DESTDIR)$(bindir) install -m 755 libdkimtest $(DESTDIR)$(bindir) .PHONY: all install clean distclean debian/libdkim1d.symbols0000664000000000000000000000050011331403077012434 0ustar libdkim.so.1d libdkim1d #MINVER# DKIMGetErrorString@Base 0 DKIMSignFree@Base 0 DKIMSignGetSig2@Base 0 DKIMSignGetSig@Base 0 DKIMSignInit@Base 0 DKIMSignProcess@Base 0 DKIMVerifyFree@Base 0 DKIMVerifyGetDetails@Base 0 DKIMVerifyInit@Base 0 DKIMVerifyProcess@Base 0 DKIMVerifyResults@Base 0 DKIMVersion@Base 0 debian/yahoo-patent-license-1.2.txt0000664000000000000000000002164711013646144014271 0ustar Yahoo! DomainKeys Patent License Agreement v1.2 Copyright (c) 2006, Yahoo! Inc. All rights reserved. This Yahoo! DomainKeys Patent License Agreement (this "Agreement") is between Yahoo! Inc. ("Yahoo!") and you ("Licensee"). By attempting to exercise any rights granted under this Agreement, Licensee agrees to be bound by all the terms and conditions set forth below, and subject to those terms and conditions, Licensee may use the intellectual property described below. 1. LICENSE GRANT. 1.1. Subject to the terms and conditions of this Agreement, Licensor hereby grants You a royalty-free, perpetual, worldwide, sublicensable, non-exclusive license under its rights to the Yahoo! Patent Claims to make, use, sell, offer for sale, and/or import Implementations. 2. DEFINITIONS. 2.1. "DomainKeys Developer(s)" means Yahoo, Inc. ("Yahoo!"), Licensor, and/or any other individual or entity who distributes Implementations under this Agreement. 2.2. "Implementations" means the specific portions of a hardware or software implementation expressly required to be compliant with the Specifications for the sole purpose of a sender verification solution in connection with e-mail. 2.3. "Licensor" means Yahoo! or any other individual or entity that elects to use this Agreement to license Yahoo! Patent Claims to any licensee. 2.4. "Specifications" means the specification having submission ID "draft-delany-domainkeys-base-01.txt" dated Aug 2004 published through the IETF (Internet Engineering Task Force). The Specifications may be found at the following link: http://antispam.yahoo.com/domainkeys/draft-delany-domainkeys-base-01.txt 2.5. "Yahoo! Patent Claims" shall mean those claims of all Yahoo! foreign and domestic patents and patent applications that base their priority on U.S. Provisional Patent Application Ser. Nos. 60/497,794, filed Aug. 26, 2003, or 60/553,300, filed Mar. 15, 2004, or U.S. Patent Application Ser. Nos. 10/671,319, filed Sep. 24, 2003, or 10/805,181, filed Mar. 19, 2004. 2.6. "You" or "Your" means an individual, company, or other legal entity exercising any rights under this Agreement. Any individual who accepts the terms and conditions of this Agreement on behalf of a company or other legal entity represents and warrants that the individual has the authority to enter into this Agreement on behalf of the company or other legal entity. 3. TERMS. 3.1. You agree not to assert against Yahoo!, any other DomainKeys Developer or any of their respective licensees under Section 3.4, a patent infringement claim based on the manufacture, use, sale, offer for sale and/or importation of any Implementations ("Implementation IP Claim"). 3.2. To indicate your assent to the terms and conditions of this Agreement and in order to obtain a license to make, use, sell, offer for sale, and/or import Implementations, You must include, attach or preserve the following prominently displayed statement in the source code and object code of any such Implementations: "This code incorporates intellectual property owned by Yahoo! and licensed pursuant to the Yahoo! DomainKeys Patent License Agreement.". 3.3. You will not use the name of Yahoo! to endorse or promote any products, services, or Implementations without specific prior written permission of Yahoo!. "DomainKeys" is a trademark of Yahoo!. However, You may state Your Implementations are "DomainKeys compliant", "supports DomainKeys", or is "DomainKeys-enabled", without citation to Yahoo!. You must create Your own product or service names or trademarks for Your Implementations and You agree not to use the term "DomainKeys" in or as part of a name or trademark for Your Implementations. 3.4. You may choose to distribute Implementations under this Agreement or a different agreement, provided that: (a) a copy of this Agreement or the different agreement is included with each Implementation along with the following prominently displayed statement: "By making, using, selling, offering for sale, importing, and/or sublicensing Implementations as permitted, you agree to the terms and conditions of the Yahoo! DomainKeys Patent License Agreement or other agreement contained herein."; and (b) if distributed under a different agreement, such different agreement contains terms and conditions that (i) provide no fewer rights, privileges and immunities to DomainKeys Developers than the terms and conditions of this Agreement, including, without limitation, Sections 1.1, 3.1, 3.4, 3.7, 4.1, 4.2, and 4.3. 3.5. You acknowledge that implementations of the Specifications may be subject to U.S. export restriction and other applicable national and international laws. You agree to comply with all export, re-export, or import restrictions, laws, or regulations. 3.6. Yahoo!, and only Yahoo!, may, from time to time and at its sole discretion, update or modify the terms of this Agreement. If Yahoo! makes any such modifications, You may continue under the terms and conditions of this Agreement or agree to the updated or modified terms and conditions. For the most recent version of this Agreement please contact Yahoo!. 3.7. This Agreement and the rights hereunder will terminate: (a) automatically without notice from Yahoo!, if You at any time during the term of this Agreement assert any Implementation IP Claim against Yahoo!; (b) upon written notice from Yahoo!, if You at any time during the term of this Agreement assert any Implementation IP Claim against any DomainKeys Developer (other than Yahoo!) or any licensees of any DomainKeys Developer; or (c) where (a) or (b) do not apply, automatically without notice from Yahoo!, if You fail to comply with any term(s) of this Agreement and fail to cure such breach within 30 days of You becoming aware of such breach. 3.8. This Agreement constitutes the entire agreement between the parties with respect to the subject matter hereof. This Agreement shall be governed by and construed under the laws of the United States and the State of California without giving effect to California conflict of law provisions or to construction provisions favoring either party. All actions arising out of or relating to this Agreement that involve Yahoo! as a party will be adjudicated exclusively by the Superior Court of the State of California for the County of Santa Clara or the United States District Court for the Northern District of California. 3.9. In the event that any provision of this Agreement is deemed to be invalid, such invalidity shall not affect the remainder of this Agreement. 4. LEGAL DISCLAIMERS. 4.1. THE YAHOO! PATENT CLAIMS, THIS AGREEMENT, THE DOMAINKEYS TRADEMARK, AND THE SPECIFICATIONS ARE PROVIDED ON AN "AS IS" BASIS, WITHOUT REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY REPRESENTATIONS, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of exercising any rights under this Agreement and using the Specifications and the DomainKeys trademark and assume all risks associated in connection therewith, including, but not limited to, the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. 4.2. You expressly acknowledge and agree that no assurances are provided by DomainKeys Developers with respect to the validity of the Yahoo! Patent Claims or that the Specifications, the DomainKeys trademark or any implementations related to the Specifications or the DomainKeys trademark do not infringe or misappropriate the patent, trademark or other intellectual property rights of any other entity. DomainKeys Developers disclaim any liability to You for claims brought by any other person or entity based on infringement or misappropriation of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, You hereby assume sole responsibility to secure any other intellectual property rights needed. 4.3. DOMAINKEYS DEVELOPERS SHALL NOT HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE EXERCISE OF ANY RIGHTS UNDER THIS AGREEMENT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, AND EVEN IF THE REMEDIES PROVIDED FOR IN THIS AGREEMENT FAIL OF THEIR ESSENTIAL PURPOSE. debian/compat0000664000000000000000000000000211574775562010411 0ustar 7 debian/patches/0000775000000000000000000000000011575727055010635 5ustar debian/patches/series0000664000000000000000000000004211574775456012055 0ustar strtok_r.patch fix_warnings.patch debian/patches/fix_warnings.patch0000664000000000000000000002347311574775456014374 0ustar #! /bin/sh /usr/share/dpatch/dpatch-run ## 02_fix_warnings.dpatch by Russell Coker ## ## 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 --- libdkim-1.0.19.orig/src/dkim.cpp 2008-05-12 20:07:32.000000000 +1000 +++ libdkim-1.0.19/src/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 --- libdkim-1.0.19.orig/src/dkim.h 2009-04-15 19:37:48.000000000 +1000 +++ libdkim-1.0.19/src/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 --- libdkim-1.0.19.orig/src/dkimbase.cpp 2008-05-12 20:07:36.000000000 +1000 +++ libdkim-1.0.19/src/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 --- libdkim-1.0.19.orig/src/dkimbase.h 2008-05-12 20:07:24.000000000 +1000 +++ libdkim-1.0.19/src/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 --- libdkim-1.0.19.orig/src/dkimsign.cpp 2008-05-12 20:07:46.000000000 +1000 +++ libdkim-1.0.19/src/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 --- libdkim-1.0.19.orig/src/dkimsign.h 2008-05-12 20:07:58.000000000 +1000 +++ libdkim-1.0.19/src/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 --- libdkim-1.0.19.orig/src/dkimverify.cpp 2009-04-15 19:37:48.000000000 +1000 +++ libdkim-1.0.19/src/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 ## ## 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 --- libdkim-1.0.19/src/dkimverify.cpp 2008-05-12 20:08:06.000000000 +1000 +++ libdkim-1.0.19-new/src/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); } } debian/rules0000775000000000000000000000327411574775562010301 0ustar #!/usr/bin/make -f # -*- makefile -*- # Sample debian/rules that uses debhelper. # This file was originally written by Joey Hess and Craig Small. # As a special exception, when this file is copied by dh-make into a # dh-make output file, you may use that output file without restriction. # This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 export CXXFLAGS = -Wall -g ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS))) CXXFLAGS += -O0 else CXXFLAGS += -O2 endif configure: config.status config.status: debian/configure.ac dh_testdir ln -sf $(CURDIR)/debian/*.in src/ cd debian && autoconf debian/configure --srcdir=src/ --prefix=/usr build: build-stamp build-stamp: config.status dh_testdir $(MAKE) touch $@ clean: dh_testdir dh_testroot rm -f build-stamp configure-stamp [ ! -f Makefile ] || $(MAKE) distclean rm -f src/*.in debian/configure rm -rf debian/autom4te.cache dh_clean install: build dh_testdir dh_testroot dh_prep dh_installdirs $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp # # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. # Build architecture-dependent files here. binary-arch: build install dh_testdir dh_testroot dh_install --sourcedir=debian/tmp dh_link dh_installchangelogs -k README dh_installdocs dh_installexamples # dh_installinfo # dh_installman dh_strip --dbg-package=libdkim1d-dbg dh_compress dh_fixperms dh_makeshlibs dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: patch unpatch build clean binary-indep binary-arch binary install configure debian/docs0000664000000000000000000000004411013646533010043 0ustar debian/yahoo-patent-license-1.2.txt debian/control0000664000000000000000000000424111574775626010620 0ustar Source: libdkim Priority: optional Maintainer: Magnus Holmgren Build-Depends: debhelper (>= 7), autoconf, libssl-dev, pkg-config Standards-Version: 3.9.2 Section: libs Homepage: http://libdkim.sourceforge.net Package: libdkim1d Section: libs Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description: cryptographically identify the sender of email DomainKeys Identified Mail (DKIM) defines a domain-level authentication framework for email using public-key cryptography and key server technology to permit verification of the source and contents of messages by either Mail Transport Agents (MTAs) or Mail User Agents (MUAs). . libdkim is a library, developed by Alt-N Technologies, that allows incorporating DKIM into an existing MTA or other application. It provides full support for signing, verifying, and SSP. See the changelogs for information on compliance with specifications. Package: libdkim-dev Section: libdevel Architecture: any Depends: libdkim1d (= ${binary:Version}), libssl-dev, ${shlibs:Depends}, ${misc:Depends} Description: cryptographically identify the sender of email DomainKeys Identified Mail (DKIM) defines a domain-level authentication framework for email using public-key cryptography and key server technology to permit verification of the source and contents of messages by either Mail Transport Agents (MTAs) or Mail User Agents (MUAs). . libdkim is a library, developed by Alt-N Technologies, that allows incorporating DKIM into an existing MTA or other application. It provides full support for signing, verifying, and SSP. See the changelogs for information on compliance with specifications. . This package contains the development files needed to compile and link programs with libdkim. Package: libdkim1d-dbg Section: debug Priority: extra Architecture: any Depends: libdkim1d (= ${binary:Version}), ${misc:Depends} Description: DomainKeys Identified Mail (DKIM) library - debug symbols This package contains the debug symbols for libdkim1d, a library for server-level signing of email using the DKIM standard, and verification of the signatures. See the description of that package for more information. debian/changelog0000644000000000000000000001042511723353153011045 0ustar libdkim (1:1.0.21-3build1) precise; urgency=low * No-change rebuild against current pkgbinarymangler to fix broken md5sums. (see LP #875466) -- Martin Pitt Wed, 29 Feb 2012 08:40:27 +0100 libdkim (1:1.0.21-3) unstable; urgency=low * Completely correct order of object files and libraries (Closes: #627387 again). -- Magnus Holmgren Tue, 14 Jun 2011 20:51:32 +0200 libdkim (1:1.0.21-2) unstable; urgency=low * debian/Makefile.in: Correct order of object files and libraries when linking so that --as-needed will work (Closes: #627387). * Convert to source package version 3.0 (quilt). * Upgrade to Debhelper compat level 7. * Bump Standards-Version to 3.9.2. -- Magnus Holmgren Sun, 12 Jun 2011 01:34:35 +0200 libdkim (1:1.0.21-1) unstable; urgency=low * New upstream version. * SSP (Sender Signing Practices) replaced by ADSP (Author Domain Signing Practices). * 30_extra_fields.dpatch: Dropped. The DKIMVerifyDetails structure now provides the formerly missing information in the szSignatureDomain and szIdentityDomain fields. * SONAME changed to libdkim.so.1d because of the above change. * Correct bug number (#524133) in the previous changelog entry. -- Magnus Holmgren Sun, 31 Jan 2010 23:39:24 +0100 libdkim (1:1.0.19-4) unstable; urgency=low * Add debug package (Closes: #532058). * Use strtok_r() instead of strtok() for thread safety (Closes: #532740). Patch by Russel Coker. * Include built libdkimtest (Closes: #524147). * Move examples from library to dev package. * Get rid of warnings through the use of const and more correct types (Closes: #524133). Patch by Russel Coker. * Upgrade package to Standards-Version 3.8.3: + Add README.source. -- Magnus Holmgren Mon, 14 Sep 2009 22:34:21 +0200 libdkim (1:1.0.19-3) unstable; urgency=low * Don't symlink libdkim-dev's doc directory to that of libdkim*, it only adds another place to update when the soname changes. * Update debian/copyright; mention the patent license and refer to common-licenses for the Apache 2.0 license. * Remove Debian revision from symbols file. -- Magnus Holmgren Sat, 28 Jun 2008 11:53:09 +0200 libdkim (1:1.0.19-2) unstable; urgency=low * Change the SOVERSION to 0d (d for Debian) to avoid potential future clashes. * Bring back the version script, but only to hide internal symbols. * Add initial symbols file. -- Magnus Holmgren Mon, 16 Jun 2008 17:37:06 +0200 libdkim (1:1.0.19-1exp1+eximdkim) experimental; urgency=low * Experimental version made specifically to work with potential DKIM support in Exim. * 30_extra_fields.dpatch (new): Add Domain and IdentityDomain fields to struct DKIMVerifyDetails (this is Tom Kistner's plan). -- Magnus Holmgren Sat, 17 May 2008 23:53:39 +0200 libdkim (1:1.0.19-1) unstable; urgency=low * New upstream release. - Drop remaining patches; issues fixed upstream. * New maintainer email address. * Include Yahoo! patent license as plain text. -- Magnus Holmgren Sat, 17 May 2008 23:13:03 +0200 libdkim (1:1.0.17-1) unstable; urgency=low * New upstream release. * Drop 20_winmacros.dpatch; fixed upstream. * Bump soname to libdkim1 because of incompatible struct changes. * 20_strict_includes.dpatch (new): Add "#include " as necessary to fix FTBFS with GCC 4.3 (Closes: #455145). * Add an epoch to reclaim binary packages "stolen" by dkim-milter. * Dump the linker version script - changing the soname when necessary is going to be hard enough. * Move homepage URL from description to control field. * Increase Standards-Version to 3.7.3 without changes. * Don't ignore distclean errors. -- Magnus Holmgren Fri, 15 Feb 2008 23:04:42 +0100 libdkim (1.0.14-1) unstable; urgency=low * New upstream release. * Build-depend on pkg-config. * Use dpatch to apply changes to upstream. -- Magnus Holmgren Wed, 02 May 2007 21:14:01 +0200 libdkim (1.0.13-1) unstable; urgency=low * Initial release (Closes: #410829). -- Magnus Holmgren Tue, 6 Mar 2007 21:08:04 +0100 debian/libdkim.pc.in0000664000000000000000000000044510677671742011560 0ustar prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: @PACKAGE_NAME@ Description: DomainKeys Identified Mail library from Alt-N Inc. Version: @PACKAGE_VERSION@ Requires.private: libcrypto Libs: -L${libdir} -ldkim Libs.private: @LIBS@ Cflags: -I${includedir} debian/libdkim-dev.install0000664000000000000000000000012311253521334012742 0ustar usr/include/* usr/lib/lib*.a usr/lib/lib*.so usr/lib/pkgconfig usr/bin/libdkimtest debian/aclocal.m40000664000000000000000000001326510677671742011060 0ustar # generated automatically by aclocal 1.9.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # # Copyright © 2004 Scott James Remnant . # # 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; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # # Similar to PKG_CHECK_MODULES, make sure that the first instance of # this or PKG_CHECK_MODULES is called, or make sure to call # PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_ifval([$2], [$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$PKG_CONFIG"; then if test -n "$$1"; then pkg_cv_[]$1="$$1" else PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], [pkg_failed=yes]) fi else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` else $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD ifelse([$4], , [AC_MSG_ERROR(dnl [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT ])], [AC_MSG_RESULT([no]) $4]) elif test $pkg_failed = untried; then ifelse([$4], , [AC_MSG_FAILURE(dnl [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])], [$4]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) ifelse([$3], , :, [$3]) fi[]dnl ])# PKG_CHECK_MODULES debian/copyright0000664000000000000000000000173111031403444011117 0ustar This package was debianized by Magnus Holmgren on 19 Feb 2007. It was downloaded from http://libdkim.sf.net (the easiest way to get the original zip file is via http://qa.debian.org/watch/sf.php/libdkim/). Upstream Author: Alt-N Technologies, http://www.altn.com Copyright © 2005-2008 Alt-N Technologies, Ltd. License: Licensed under the Apache License, Version 2.0 (the "License"); you may not use this [package] except in compliance with the License. This code incorporates intellectual property owned by Yahoo! and licensed pursuant to the Yahoo! DomainKeys Patent License Agreement. On Debian systems, the full text of the Apache 2.0 license can be found in /usr/share/common-licenses/Apache-2.0 The Yahoo! DomainKeys Patent License can be found in the file yahoo-patent-license-1.2.txt.gz. The Debian packaging is © 2007-2009 Magnus Holmgren and is, for the sake of simplicity, licensed under the same license.