Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 262919 | Differences between
and this patch

Collapse All | Expand All

(-)libdkim.orig/src/libdkimtest.cpp (-5 / +30 lines)
Lines 55-62 Link Here
55
	return 0;
55
	return 0;
56
}
56
}
57
57
58
void usage()
59
{
58
60
59
61
	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");
62
	printf( "-b<standard> allman , ietf or both\n");
63
	printf( "-c<canonicalization> r for relaxed [DEFAULT], s - simple, t relaxed/simple, u - simple/relaxed\n");
64
	printf( "-d<domain> the domain tag, if not provided it will be determined from the sender/from header\n");
65
	printf( "-l include body length tag\n");
66
	printf( "-h this help\n");
67
	printf( "-i<identity> the identity, if not provided it will not be included\n");
68
	printf( "-s sign the message\n");
69
	printf( "-t include a timestamp tag\n");
70
	printf( "-v verify the message\n");
71
	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");
72
	printf( "-z<hash>  1 for sha1, 2 for sha256, 3 for both\n");
73
	printf( "-y<selector> the selector tag DEFAULT=MDaemon\n");
74
}
60
int main(int argc, char* argv[])
75
int main(int argc, char* argv[])
61
{
76
{
62
	int n;
77
	int n;
Lines 77-83 Link Here
77
	time(&t);
92
	time(&t);
78
93
79
	opts.nCanon = DKIM_SIGN_RELAXED;
94
	opts.nCanon = DKIM_SIGN_RELAXED;
80
	opts.nIncludeBodyLengthTag = 1;
95
	opts.nIncludeBodyLengthTag = 0;
81
	opts.nIncludeQueryMethod = 0;
96
	opts.nIncludeQueryMethod = 0;
82
	opts.nIncludeTimeStamp = 0;
97
	opts.nIncludeTimeStamp = 0;
83
	opts.expireTime = t + 604800;		// expires in 1 week
98
	opts.expireTime = t + 604800;		// expires in 1 week
Lines 92-97 Link Here
92
	int nArgParseState = 0;
107
	int nArgParseState = 0;
93
	bool bSign = true;
108
	bool bSign = true;
94
109
110
	if(argc<2){
111
		usage();
112
		exit(1);
113
	}
114
95
	for( n = 1; n < argc; n++ )
115
	for( n = 1; n < argc; n++ )
96
	{
116
	{
97
		if( argv[n][0] == '-' && strlen(argv[n]) > 1 )
117
		if( argv[n][0] == '-' && strlen(argv[n]) > 1 )
Lines 121-134 Link Here
121
				}
141
				}
122
				break;
142
				break;
123
143
124
144
			case 'd': 
145
				strncpy(opts.szDomain,(const char*)(argv[n]+2),sizeof(opts.szDomain)-1);
146
				break;
125
			case 'l':		// body length tag
147
			case 'l':		// body length tag
126
				opts.nIncludeBodyLengthTag = 1;
148
				opts.nIncludeBodyLengthTag = 1;
127
				break;
149
				break;
128
150
129
151
130
			case 'h':
152
			case 'h':
131
				printf( "usage: \n" );
153
				usage();	
132
				return 0;
154
				return 0;
133
155
134
			case 'i':		// identity 
156
			case 'i':		// identity 
Lines 138-144 Link Here
138
				}
160
				}
139
				else
161
				else
140
				{
162
				{
141
					strcpy( opts.szIdentity, argv[n] + 2 );
163
					strncpy( opts.szIdentity, argv[n] + 2,sizeof(opts.szIdentity)-1 );
142
				}
164
				}
143
				break;
165
				break;
144
166
Lines 169-174 Link Here
169
				}
191
				}
170
				break;
192
				break;
171
193
194
			case 'y':
195
				strncpy( opts.szSelector, argv[n]+2, sizeof(opts.szSelector)-1);
196
				break;
172
197
173
			case 'z':		// sign w/ sha1, sha256 or both 
198
			case 'z':		// sign w/ sha1, sha256 or both 
174
				opts.nHash = atoi( &argv[n][2] );
199
				opts.nHash = atoi( &argv[n][2] );

Return to bug 262919