Files libdkim/src/.libdkimtest.cpp.swp and libdkim-patched/src/.libdkimtest.cpp.swp differ diff -ur --new-file libdkim/src/dkimbase.cpp libdkim-patched/src/dkimbase.cpp --- libdkim/src/dkimbase.cpp 2007-02-22 13:40:30.000000000 +0200 +++ libdkim-patched/src/dkimbase.cpp 2007-05-04 00:33:12.000000000 +0300 @@ -27,7 +27,6 @@ #include - CDKIMBase::CDKIMBase() { m_From = NULL; @@ -122,7 +121,7 @@ while( p < e ) { - if( *p != '\n' || m_LinePos == 0 || m_Line[m_LinePos-1] != '\r' ) + if(*p != '\n' && *p != '\r' ) { // add char to line if (m_LinePos >= m_LineSize) @@ -135,13 +134,13 @@ } else { - // back up past the CR - m_LinePos--; - - if( m_LinePos == 0 ) + if(*p == '\r' && p+1] [-c] [-d] [-l] [-h] [-i] [-q] [-s] [-t] [-v] [-x] [-z] \n"); + printf( "-b allman , ietf or both\n"); + printf( "-c r for relaxed [DEFAULT], s - simple, t relaxed/simple, u - simple/relaxed\n"); + printf( "-d 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 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 the expire time in seconds since epoch ( DEFAULT = current time + 604800)\n\t if set to - then it will not be included"); + printf( "-z 1 for sha1, 2 for sha256, 3 for both\n"); + printf( "-y the selector tag DEFAULT=MDaemon\n"); +} int main(int argc, char* argv[]) { int n; @@ -57,13 +72,11 @@ 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 strcpy( opts.szSelector, "MDaemon" ); - strcpy( opts.szDomain, "bardenhagen.com" ); - strcpy( opts.szIdentity, "dkimtest@bardenhagen.com" ); opts.pfnHeaderCallback = SignThisHeader; strcpy( opts.szRequiredHeaders, "NonExistant" ); opts.nIncludeCopiedHeaders = 0; @@ -72,6 +85,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 ) @@ -101,14 +119,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 @@ -118,7 +138,7 @@ } else { - strcpy( opts.szIdentity, argv[n] + 2 ); + strncpy( opts.szIdentity, argv[n] + 2,sizeof(opts.szIdentity)-1 ); } break; @@ -149,6 +169,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] );