* website/download.htm4, website/download-de.htm4: Added
[gpg4win.git] / patches / claws-mail-2.9.2 / 04-smime-plugin.patch
1 #! /bin/sh
2 patch -p1 -f $* < $0
3 exit $?
4
5 2007-06-30  Marcus Brinkmann  <marcus@g10code.de>
6
7         * Add the SMIME plugin straight to the source.  This makes
8           building it so much simpler.
9
10 diff -ruN claws-mail-2.9.2-p03/configure.ac claws-mail-2.9.2/configure.ac
11 --- claws-mail-2.9.2-p03/configure.ac   2007-07-02 20:53:34.000000000 +0200
12 +++ claws-mail-2.9.2/configure.ac       2007-07-02 20:54:13.000000000 +0200
13 @@ -888,6 +888,7 @@
14  src/plugins/pgpcore/Makefile
15  src/plugins/pgpmime/Makefile
16  src/plugins/pgpinline/Makefile
17 +src/plugins/smime/Makefile
18  doc/Makefile
19  doc/man/Makefile
20  tools/Makefile
21 diff -ruN claws-mail-2.9.2-p03/src/plugins/Makefile.am claws-mail-2.9.2/src/plugins/Makefile.am
22 --- claws-mail-2.9.2-p03/src/plugins/Makefile.am        2007-07-02 20:53:34.000000000 +0200
23 +++ claws-mail-2.9.2/src/plugins/Makefile.am    2007-07-02 20:54:14.000000000 +0200
24 @@ -40,4 +40,5 @@
25         $(clamav_dir) \
26         $(pgpcore_dir) \
27         $(pgpmime_dir) \
28 -       $(pgpinline_dir)
29 +       $(pgpinline_dir) \
30 +       smime
31 diff -ruN claws-mail-2.9.2-p03/src/plugins/smime/claws.def claws-mail-2.9.2/src/plugins/smime/claws.def
32 --- claws-mail-2.9.2-p03/src/plugins/smime/claws.def    1970-01-01 01:00:00.000000000 +0100
33 +++ claws-mail-2.9.2/src/plugins/smime/claws.def        2007-07-02 20:54:14.000000000 +0200
34 @@ -0,0 +1,28 @@
35 +LIBRARY CLAWS-MAIL.EXE
36 +EXPORTS
37 +alertpanel_error
38 +canonicalize_file_replace
39 +canonicalize_str
40 +check_plugin_version
41 +debug_print_real
42 +debug_srcname
43 +file_read_stream_to_str
44 +file_read_to_str
45 +generate_mime_boundary
46 +get_mime_tmp_dir
47 +get_tmp_file
48 +my_tmpfile
49 +privacy_register_system
50 +privacy_set_error
51 +privacy_unregister_system
52 +procmime_decode_content
53 +procmime_encode_content
54 +procmime_get_part
55 +procmime_mimeinfo_free_all
56 +procmime_mimeinfo_get_parameter
57 +procmime_mimeinfo_new
58 +procmime_mimeinfo_parent
59 +procmime_scan_file
60 +procmime_write_mime_header
61 +procmime_write_mimeinfo
62 +str_write_to_file
63 diff -ruN claws-mail-2.9.2-p03/src/plugins/smime/Makefile.am claws-mail-2.9.2/src/plugins/smime/Makefile.am
64 --- claws-mail-2.9.2-p03/src/plugins/smime/Makefile.am  1970-01-01 01:00:00.000000000 +0100
65 +++ claws-mail-2.9.2/src/plugins/smime/Makefile.am      2007-07-02 20:54:14.000000000 +0200
66 @@ -0,0 +1,82 @@
67 +EXTRA_DIST = version.rc plugin.def claws.def mypgpcore.def smime.deps
68 +
69 +if OS_WIN32
70 +
71 +LTRCCOMPILE = $(LIBTOOL) --mode=compile $(RC) \
72 +     `echo $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) | \
73 +     sed -e 's/-I/--include-dir /g;s/-D/--define /g'`
74 +
75 +%.lo : %.rc
76 +       $(LTRCCOMPILE) -i $< -o $@
77 +
78 +plugin_res = version.lo
79 +plugin_res_ldflag = -Wl,.libs/version.o
80 +
81 +export_symbols = -export-symbols $(srcdir)/plugin.def
82 +
83 +plugin_deps = libclaws.a libmypgpcore.a $(plugin_res) plugin.def
84 +
85 +libclaws.a: claws.def
86 +       $(DLLTOOL) --output-lib $@ --def $<
87 +
88 +libmypgpcore.a: mypgpcore.def
89 +       $(DLLTOOL) --output-lib $@ --def $<
90 +
91 +plugin_ldadd = -L . -lclaws -lmypgpcore
92 +
93 +else
94 +plugin_res =
95 +plugin_res_ldflag =
96 +export_symbols =
97 +plugin_deps =
98 +plugin_ldadd =
99 +endif
100 +
101 +if PLATFORM_WIN32
102 +no_undefined = -no-undefined
103 +else
104 +no_undefined =
105 +endif
106 +
107 +if CYGWIN
108 +cygwin_export_lib = -L$(top_builddir)/src -lclaws-mail
109 +else
110 +cygwin_export_lib =
111 +endif
112 +
113 +plugindir = $(pkglibdir)/plugins
114 +plugin_DATA = smime.deps
115 +
116 +plugin_LTLIBRARIES = smime.la
117 +
118 +smime_la_SOURCES = \
119 +       plugin.c \
120 +       smime.c
121 +
122 +pluginincludedir = $(pkgincludedir)/plugins/smime
123 +plugininclude_HEADERS = \
124 +       smime.h
125 +
126 +smime_la_LDFLAGS = \
127 +       $(plugin_res_ldflag) $(no_undefined) $(export_symbols) \
128 +       -avoid-version -module 
129 +smime_la_DEPENDENCIES = $(plugin_deps)
130 +smime_la_LIBADD = $(cygwin_export_lib) $(plugin_ldadd) $(pgpcore_lib) \
131 +        $(GTK_LIBS) \
132 +       $(GPGME_LIBS)
133 +
134 +INCLUDES = \
135 +       -I$(top_srcdir)/src \
136 +       -I$(top_srcdir)/src/common \
137 +       -I$(top_builddir)/src/common \
138 +       -I$(top_srcdir)/src/gtk
139 +
140 +AM_CPPFLAGS = \
141 +       $(GLIB_CFLAGS) \
142 +       $(GTK_CFLAGS) \
143 +       $(GPGME_CFLAGS) \
144 +       -Wno-deprecated-declarations
145 +
146 +clean-local:
147 +       rm -f libclaws.a
148 +       rm -f libmypgpcore.a
149 diff -ruN claws-mail-2.9.2-p03/src/plugins/smime/mypgpcore.def claws-mail-2.9.2/src/plugins/smime/mypgpcore.def
150 --- claws-mail-2.9.2-p03/src/plugins/smime/mypgpcore.def        1970-01-01 01:00:00.000000000 +0100
151 +++ claws-mail-2.9.2/src/plugins/smime/mypgpcore.def    2007-07-02 20:54:14.000000000 +0200
152 @@ -0,0 +1,13 @@
153 +LIBRARY PGPCORE.DLL
154 +EXPORTS
155 +prefs_gpg_enable_agent
156 +prefs_gpg_get_config
157 +sgpgme_data_from_mimeinfo
158 +sgpgme_data_release_and_get_mem
159 +sgpgme_decrypt_verify
160 +sgpgme_get_encrypt_data
161 +sgpgme_setup_signers
162 +sgpgme_sigstat_gpgme_to_privacy
163 +sgpgme_sigstat_info_full
164 +sgpgme_sigstat_info_short
165 +sgpgme_verify_signature
166 diff -ruN claws-mail-2.9.2-p03/src/plugins/smime/plugin.c claws-mail-2.9.2/src/plugins/smime/plugin.c
167 --- claws-mail-2.9.2-p03/src/plugins/smime/plugin.c     1970-01-01 01:00:00.000000000 +0100
168 +++ claws-mail-2.9.2/src/plugins/smime/plugin.c 2007-07-02 20:54:14.000000000 +0200
169 @@ -0,0 +1,89 @@
170 +/*
171 + * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
172 + * Copyright (C) 1999-2007 Colin Leroy <colin@colino.net> and 
173 + * the Claws Mail team
174 + *
175 + * This program is free software; you can redistribute it and/or modify
176 + * it under the terms of the GNU General Public License as published by
177 + * the Free Software Foundation; either version 2 of the License, or
178 + * (at your option) any later version.
179 + *
180 + * This program is distributed in the hope that it will be useful,
181 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
182 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
183 + * GNU General Public License for more details.
184 + *
185 + * You should have received a copy of the GNU General Public License
186 + * along with this program; if not, write to the Free Software
187 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
188 + */
189 +
190 +#ifdef HAVE_CONFIG_H
191 +#  include "config.h"
192 +#endif
193 +
194 +#include <stddef.h>
195 +#include <glib.h>
196 +#include <glib/gi18n.h>
197 +
198 +#include "version.h"
199 +#include "common/claws.h"
200 +#include "smime.h"
201 +#include "plugin.h"
202 +
203 +gint plugin_init(gchar **error)
204 +{
205 +       if (!check_plugin_version(MAKE_NUMERIC_VERSION(2, 7, 2, 63), 
206 +                               VERSION_NUMERIC, _("S/MIME"), error))
207 +               return -1;
208 +
209 +       smime_init();
210 +
211 +       return 0;       
212 +}
213 +
214 +void plugin_done(void)
215 +{
216 +       smime_done();
217 +}
218 +
219 +const gchar *plugin_name(void)
220 +{
221 +       return _("S/MIME");
222 +}
223 +
224 +const gchar *plugin_desc(void)
225 +{
226 +       return _("This plugin handles S/MIME signed and/or encrypted "
227 +                "mails. You can decrypt mails, verify signatures or "
228 +                 "sign and encrypt your own mails.\n"
229 +                "\n"
230 +                "It can be selected as the Default Privacy System in "
231 +                "/Configuration/[Account Preferences]/Privacy and when "
232 +                "composing a message from /Options/Privacy System\n"
233 +                "\n"
234 +                "This plugin uses the GPGME library as a wrapper for GnuPG.\n"
235 +                "This plugin also needs gpgsm, gnupg-agent and dirmngr "
236 +                "installed and configured.\n"
237 +                "\n"
238 +                "Information about how to get S/MIME certificates working "
239 +                "with GPGSM can be found at:\n"
240 +                "http://www.claws-mail.org/faq/index.php/S/MIME_howto\n"
241 +                "\n"
242 +                "GPGME is copyright 2001 by Werner Koch <dd9jn@gnu.org>");
243 +}
244 +
245 +const gchar *plugin_type(void)
246 +{
247 +       return "GTK2";
248 +}
249 +
250 +const gchar *plugin_licence(void)
251 +{
252 +       return "GPL";
253 +}
254 +
255 +const gchar *plugin_version(void)
256 +{
257 +       return VERSION;
258 +}
259 diff -ruN claws-mail-2.9.2-p03/src/plugins/smime/plugin.def claws-mail-2.9.2/src/plugins/smime/plugin.def
260 --- claws-mail-2.9.2-p03/src/plugins/smime/plugin.def   1970-01-01 01:00:00.000000000 +0100
261 +++ claws-mail-2.9.2/src/plugins/smime/plugin.def       2007-07-02 20:54:14.000000000 +0200
262 @@ -0,0 +1,9 @@
263 +EXPORTS
264 +        plugin_desc
265 +        plugin_done
266 +        plugin_init
267 +        plugin_licence
268 +        plugin_name
269 +        plugin_type
270 +       plugin_provides
271 +        plugin_version
272 diff -ruN claws-mail-2.9.2-p03/src/plugins/smime/smime.c claws-mail-2.9.2/src/plugins/smime/smime.c
273 --- claws-mail-2.9.2-p03/src/plugins/smime/smime.c      1970-01-01 01:00:00.000000000 +0100
274 +++ claws-mail-2.9.2/src/plugins/smime/smime.c  2007-07-02 20:54:14.000000000 +0200
275 @@ -0,0 +1,860 @@
276 +/* 
277 + * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
278 + * Copyright (C) 1999-2007 Colin Leroy <colin@colino.net> and 
279 + * the Claws Mail team
280 + *
281 + * This program is free software; you can redistribute it and/or modify
282 + * it under the terms of the GNU General Public License as published by
283 + * the Free Software Foundation; either version 2 of the License, or
284 + * (at your option) any later version.
285 + *
286 + * This program is distributed in the hope that it will be useful,
287 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
288 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
289 + * GNU General Public License for more details.
290 + *
291 + * You should have received a copy of the GNU General Public License
292 + * along with this program; if not, write to the Free Software
293 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
294 + */
295 +
296 +#ifdef HAVE_CONFIG_H
297 +#  include "config.h"
298 +#endif
299 +
300 +#ifdef USE_GPGME
301 +
302 +#include "defs.h"
303 +#include <glib.h>
304 +#include <gpgme.h>
305 +#include <ctype.h>
306 +#include <glib/gi18n.h>
307 +
308 +#include "utils.h"
309 +#include "privacy.h"
310 +#include "procmime.h"
311 +
312 +#include "smime.h"
313 +#include <plugins/pgpcore/sgpgme.h>
314 +#include <plugins/pgpcore/prefs_gpg.h>
315 +#include <plugins/pgpcore/passphrase.h>
316 +
317 +#include "alertpanel.h"
318 +#include "prefs_common.h"
319 +#include "procmime.h"
320 +#include "plugin.h"
321 +
322 +typedef struct _PrivacyDataPGP PrivacyDataPGP;
323 +
324 +struct _PrivacyDataPGP
325 +{
326 +       PrivacyData     data;
327 +       
328 +       gboolean        done_sigtest;
329 +       gboolean        is_signed;
330 +       gpgme_verify_result_t   sigstatus;
331 +       gpgme_ctx_t     ctx;
332 +};
333 +
334 +static PrivacySystem smime_system;
335 +
336 +static gint smime_check_signature(MimeInfo *mimeinfo);
337 +
338 +static PrivacyDataPGP *smime_new_privacydata()
339 +{
340 +       PrivacyDataPGP *data;
341 +
342 +       data = g_new0(PrivacyDataPGP, 1);
343 +       data->data.system = &smime_system;
344 +       data->done_sigtest = FALSE;
345 +       data->is_signed = FALSE;
346 +       data->sigstatus = NULL;
347 +       gpgme_new(&data->ctx);
348 +       
349 +       return data;
350 +}
351 +
352 +static void smime_free_privacydata(PrivacyData *_data)
353 +{
354 +       PrivacyDataPGP *data = (PrivacyDataPGP *) _data;
355 +       gpgme_release(data->ctx);
356 +       g_free(data);
357 +}
358 +
359 +static gboolean smime_is_signed(MimeInfo *mimeinfo)
360 +{
361 +       MimeInfo *parent;
362 +       MimeInfo *signature;
363 +       const gchar *protocol, *tmpstr;
364 +       PrivacyDataPGP *data = NULL;
365 +       
366 +       g_return_val_if_fail(mimeinfo != NULL, FALSE);
367 +       if (mimeinfo->privacy != NULL) {
368 +               data = (PrivacyDataPGP *) mimeinfo->privacy;
369 +               if (data->done_sigtest)
370 +                       return data->is_signed;
371 +       }
372 +       
373 +       if (!g_ascii_strcasecmp(mimeinfo->subtype, "pkcs7-mime") ||
374 +           !g_ascii_strcasecmp(mimeinfo->subtype, "x-pkcs7-mime")) {
375 +               tmpstr = procmime_mimeinfo_get_parameter(mimeinfo, "smime-type");
376 +               if (tmpstr && !g_ascii_strcasecmp(tmpstr, "signed-data")) {
377 +                       if (data == NULL) {
378 +                               data = smime_new_privacydata();
379 +                               mimeinfo->privacy = (PrivacyData *) data;
380 +                       }
381 +
382 +                       data->done_sigtest = TRUE;
383 +                       data->is_signed = TRUE;
384 +                       smime_check_signature(mimeinfo);
385 +                       return TRUE;
386 +               }
387 +       }
388 +
389 +       /* check parent */
390 +       parent = procmime_mimeinfo_parent(mimeinfo);
391 +       if (parent == NULL)
392 +               return FALSE;
393 +       
394 +       if ((parent->type != MIMETYPE_MULTIPART) ||
395 +           g_ascii_strcasecmp(parent->subtype, "signed"))
396 +               return FALSE;
397 +       protocol = procmime_mimeinfo_get_parameter(parent, "protocol");
398 +       if ((protocol == NULL) || 
399 +           (g_ascii_strcasecmp(protocol, "application/pkcs7-signature") &&
400 +            g_ascii_strcasecmp(protocol, "application/x-pkcs7-signature")))
401 +               return FALSE;
402 +
403 +       /* check if mimeinfo is the first child */
404 +       if (parent->node->children->data != mimeinfo)
405 +               return FALSE;
406 +
407 +
408 +       /* check signature */
409 +       signature = parent->node->children->next != NULL ? 
410 +           (MimeInfo *) parent->node->children->next->data : NULL;
411 +       if (signature == NULL)
412 +               return FALSE;
413 +       if ((signature->type != MIMETYPE_APPLICATION) ||
414 +           (g_ascii_strcasecmp(signature->subtype, "pkcs7-signature") &&
415 +            g_ascii_strcasecmp(signature->subtype, "x-pkcs7-signature")))
416 +               return FALSE;
417 +
418 +is_signed:
419 +       if (data == NULL) {
420 +               data = smime_new_privacydata();
421 +               mimeinfo->privacy = (PrivacyData *) data;
422 +       }
423 +       
424 +       data->done_sigtest = TRUE;
425 +       data->is_signed = TRUE;
426 +
427 +       return TRUE;
428 +}
429 +
430 +static gchar *get_canonical_content(FILE *fp, const gchar *boundary)
431 +{
432 +       gchar *ret;
433 +       GString *textbuffer;
434 +       guint boundary_len = 0;
435 +       gchar buf[BUFFSIZE];
436 +
437 +       if (boundary) {
438 +               boundary_len = strlen(boundary);
439 +               while (fgets(buf, sizeof(buf), fp) != NULL)
440 +                       if (IS_BOUNDARY(buf, boundary, boundary_len))
441 +                               break;
442 +       }
443 +       
444 +       textbuffer = g_string_new("");
445 +       while (fgets(buf, sizeof(buf), fp) != NULL) {
446 +               gchar *buf2;
447 +
448 +               if (boundary && IS_BOUNDARY(buf, boundary, boundary_len))
449 +                       break;
450 +               
451 +               buf2 = canonicalize_str(buf);
452 +               g_string_append(textbuffer, buf2);
453 +               g_free(buf2);
454 +       }
455 +       g_string_truncate(textbuffer, textbuffer->len - 2);
456 +               
457 +       ret = textbuffer->str;
458 +       g_string_free(textbuffer, FALSE);
459 +
460 +       return ret;
461 +}
462 +
463 +static gint smime_check_signature(MimeInfo *mimeinfo)
464 +{
465 +       PrivacyDataPGP *data;
466 +       MimeInfo *parent, *signature;
467 +       FILE *fp;
468 +       gchar *boundary;
469 +       gchar *textstr;
470 +       const gchar *tmpstr;
471 +       gpgme_data_t sigdata = NULL, textdata = NULL;
472 +       gpgme_error_t err;
473 +       g_return_val_if_fail(mimeinfo != NULL, -1);
474 +       g_return_val_if_fail(mimeinfo->privacy != NULL, -1);
475 +       data = (PrivacyDataPGP *) mimeinfo->privacy;
476 +       gpgme_new(&data->ctx);
477 +       EncodingType oldenc = ENC_BINARY;
478 +       
479 +       debug_print("Checking S/MIME signature\n");
480 +
481 +       err = gpgme_set_protocol(data->ctx, GPGME_PROTOCOL_CMS);
482 +
483 +       if (err) {
484 +               debug_print ("gpgme_set_protocol failed: %s\n",
485 +                   gpgme_strerror (err));
486 +       }
487 +       parent = procmime_mimeinfo_parent(mimeinfo);
488 +
489 +       fp = g_fopen(parent->data.filename, "rb");
490 +       g_return_val_if_fail(fp != NULL, SIGNATURE_INVALID);
491 +       
492 +       boundary = g_hash_table_lookup(parent->typeparameters, "boundary");
493 +       if (!boundary) {
494 +               gchar *tmpfile = get_tmp_file();
495 +               debug_print("no boundary\n");
496 +               if (tmpfile) {
497 +                       if (mimeinfo->encoding_type != ENC_BASE64) {
498 +                               procmime_encode_content(mimeinfo, ENC_BASE64);
499 +                       }
500 +                       oldenc = mimeinfo->encoding_type;
501 +                       if (mimeinfo->encoding_type == ENC_BASE64)
502 +                               mimeinfo->encoding_type = ENC_BINARY;
503 +                       if (procmime_get_part(tmpfile, mimeinfo) == 0) {
504 +                               textstr = file_read_to_str(tmpfile);
505 +                       } else {
506 +                               textstr = NULL;
507 +                       }
508 +                       if (mimeinfo->encoding_type != oldenc)
509 +                               mimeinfo->encoding_type = oldenc;
510 +               }
511 +               g_free(tmpfile);
512 +       } else {
513 +               textstr = get_canonical_content(fp, boundary);
514 +       }
515 +       err = gpgme_data_new_from_mem(&textdata, textstr, strlen(textstr), 0);
516 +       
517 +       if (err) {
518 +               debug_print ("gpgme_data_new_from_mem failed: %s\n",
519 +                   gpgme_strerror (err));
520 +       }
521 +
522 +       if (!g_ascii_strcasecmp(mimeinfo->subtype, "pkcs7-mime") ||
523 +           !g_ascii_strcasecmp(mimeinfo->subtype, "x-pkcs7-mime")) {
524 +               tmpstr = procmime_mimeinfo_get_parameter(mimeinfo, "smime-type");
525 +               if (tmpstr && !g_ascii_strcasecmp(tmpstr, "signed-data")) {
526 +                       gpgme_data_t cipher, plain;
527 +                       int len;
528 +                       if (oldenc == ENC_BASE64)
529 +                               gpgme_data_set_encoding (textdata, GPGME_DATA_ENCODING_BASE64);
530 +                       gpgme_data_new(&cipher);
531 +                       data->sigstatus =
532 +                               sgpgme_verify_signature (data->ctx, textdata, NULL, cipher);
533 +                       gpgme_data_release(textdata);
534 +                       g_free(textstr);
535 +                       gpgme_data_rewind(cipher);
536 +                       textstr = sgpgme_data_release_and_get_mem(cipher, &len);
537 +                       fclose(fp);
538 +                       if (textstr && len > 0)
539 +                               textstr[len-1]='\0';
540 +
541 +                       if (textstr && len) {
542 +                               gchar *tmp_file = get_tmp_file();
543 +                               MimeInfo *newinfo = NULL, *decinfo = NULL, *parentinfo = NULL;
544 +                               gint childnumber = 0;
545 +                                                               
546 +                               str_write_to_file(textstr, tmp_file);
547 +                               newinfo = procmime_scan_file(tmp_file);
548 +                               decinfo = g_node_first_child(newinfo->node) != NULL ?
549 +                                       g_node_first_child(newinfo->node)->data : NULL;
550 +                               g_node_unlink(decinfo->node);
551 +                               procmime_mimeinfo_free_all(newinfo);
552 +                               decinfo->tmp = TRUE;
553 +                               parentinfo = procmime_mimeinfo_parent(mimeinfo);
554 +                               childnumber = g_node_child_index(parentinfo->node, mimeinfo);
555 +                               if (parentinfo->type == MIMETYPE_MESSAGE && 
556 +                                   !strcmp(parentinfo->subtype, "rfc822")) {
557 +                                       procmime_decode_content(parentinfo);
558 +                                       procmime_encode_content(parentinfo, ENC_BASE64);
559 +                                       procmime_encode_content(parentinfo, ENC_8BIT);
560 +                                       if (parentinfo->content == MIMECONTENT_MEM) {
561 +                                               gint newlen = 
562 +                                                       (gint)(strstr(parentinfo->data.mem, "\n\n") - parentinfo->data.mem);
563 +                                               if (newlen > 0)
564 +                                                       parentinfo->length = newlen;
565 +                                       }
566 +                               }
567 +                               g_node_prepend(parentinfo->node, decinfo->node);
568 +                               return 0;
569 +                       } else {
570 +                               return -1;
571 +                       }
572 +               }
573 +       }
574 +
575 +       signature = (MimeInfo *) mimeinfo->node->next->data;
576 +       sigdata = sgpgme_data_from_mimeinfo(signature);
577 +
578 +       err = 0;
579 +       if (signature->encoding_type == ENC_BASE64) {
580 +               err = gpgme_data_set_encoding (sigdata, GPGME_DATA_ENCODING_BASE64);
581 +       }
582 +       
583 +       if (err) {
584 +               debug_print ("gpgme_data_set_encoding failed: %s\n",
585 +                       gpgme_strerror (err));
586 +       }
587 +
588 +       data->sigstatus =
589 +               sgpgme_verify_signature (data->ctx, sigdata, textdata, NULL);
590 +
591 +       gpgme_data_release(sigdata);
592 +       gpgme_data_release(textdata);
593 +       g_free(textstr);
594 +       fclose(fp);
595 +       
596 +       return 0;
597 +}
598 +
599 +static SignatureStatus smime_get_sig_status(MimeInfo *mimeinfo)
600 +{
601 +       PrivacyDataPGP *data = (PrivacyDataPGP *) mimeinfo->privacy;
602 +       
603 +       g_return_val_if_fail(data != NULL, SIGNATURE_INVALID);
604 +
605 +       if (data->sigstatus == NULL && 
606 +           prefs_gpg_get_config()->auto_check_signatures)
607 +               smime_check_signature(mimeinfo);
608 +       
609 +       return sgpgme_sigstat_gpgme_to_privacy(data->ctx, data->sigstatus);
610 +}
611 +
612 +static gchar *smime_get_sig_info_short(MimeInfo *mimeinfo)
613 +{
614 +       PrivacyDataPGP *data = (PrivacyDataPGP *) mimeinfo->privacy;
615 +       
616 +       g_return_val_if_fail(data != NULL, g_strdup("Error"));
617 +
618 +       if (data->sigstatus == NULL && 
619 +           prefs_gpg_get_config()->auto_check_signatures)
620 +               smime_check_signature(mimeinfo);
621 +       
622 +       return sgpgme_sigstat_info_short(data->ctx, data->sigstatus);
623 +}
624 +
625 +static gchar *smime_get_sig_info_full(MimeInfo *mimeinfo)
626 +{
627 +       PrivacyDataPGP *data = (PrivacyDataPGP *) mimeinfo->privacy;
628 +       
629 +       g_return_val_if_fail(data != NULL, g_strdup("Error"));
630 +
631 +       if (data->sigstatus == NULL && 
632 +           prefs_gpg_get_config()->auto_check_signatures)
633 +               smime_check_signature(mimeinfo);
634 +       
635 +       return sgpgme_sigstat_info_full(data->ctx, data->sigstatus);
636 +}
637 +
638 +static gboolean smime_is_encrypted(MimeInfo *mimeinfo)
639 +{
640 +       MimeInfo *tmpinfo;
641 +       const gchar *tmpstr;
642 +       
643 +       if (mimeinfo->type != MIMETYPE_APPLICATION)
644 +               return FALSE;
645 +       if (!g_ascii_strcasecmp(mimeinfo->subtype, "pkcs7-mime")) {
646 +               tmpstr = procmime_mimeinfo_get_parameter(mimeinfo, "smime-type");
647 +               if (tmpstr && g_ascii_strcasecmp(tmpstr, "enveloped-data"))
648 +                       return FALSE;
649 +               else 
650 +                       return TRUE;
651 +
652 +       } else if (!g_ascii_strcasecmp(mimeinfo->subtype, "x-pkcs7-mime")) {
653 +               tmpstr = procmime_mimeinfo_get_parameter(mimeinfo, "smime-type");
654 +               if (tmpstr && g_ascii_strcasecmp(tmpstr, "enveloped-data"))
655 +                       return FALSE;
656 +               else 
657 +                       return TRUE;
658 +       }
659 +       return FALSE;
660 +}
661 +
662 +static MimeInfo *smime_decrypt(MimeInfo *mimeinfo)
663 +{
664 +       MimeInfo *encinfo, *decinfo, *parseinfo;
665 +       gpgme_data_t cipher = NULL, plain = NULL;
666 +       static gint id = 0;
667 +       FILE *dstfp;
668 +       gchar *fname;
669 +       gpgme_verify_result_t sigstat = NULL;
670 +       PrivacyDataPGP *data = NULL;
671 +       gpgme_ctx_t ctx;
672 +       gpgme_error_t err;
673 +       gchar *chars;
674 +       size_t len;
675 +
676 +       g_return_val_if_fail(smime_is_encrypted(mimeinfo), NULL);
677 +       
678 +       if ((err = gpgme_new(&ctx)) != GPG_ERR_NO_ERROR) {
679 +               privacy_set_error(_("Couldn't initialize GPG context, %s"), gpgme_strerror(err));
680 +               return NULL;
681 +       }
682 +
683 +       err = gpgme_set_protocol(ctx, GPGME_PROTOCOL_CMS);
684 +       if (err) {
685 +               debug_print ("gpgme_set_protocol failed: %s\n",
686 +                   gpgme_strerror (err));
687 +               privacy_set_error(_("Couldn't set GPG protocol, %s"), gpgme_strerror(err));
688 +               gpgme_release(ctx);
689 +               return NULL;
690 +       }
691 +       gpgme_set_armor(ctx, TRUE);
692 +
693 +       encinfo = mimeinfo;
694 +
695 +       cipher = sgpgme_data_from_mimeinfo(encinfo);
696 +       gpgme_data_set_encoding(cipher, GPGME_DATA_ENCODING_BASE64);
697 +       plain = sgpgme_decrypt_verify(cipher, &sigstat, ctx);
698 +
699 +       gpgme_data_release(cipher);
700 +       if (plain == NULL) {
701 +               debug_print("plain is null!\n");
702 +               gpgme_release(ctx);
703 +               return NULL;
704 +       }
705 +
706 +       fname = g_strdup_printf("%s%cplaintext.%08x",
707 +               get_mime_tmp_dir(), G_DIR_SEPARATOR, ++id);
708 +
709 +       if ((dstfp = g_fopen(fname, "wb")) == NULL) {
710 +               FILE_OP_ERROR(fname, "fopen");
711 +               g_free(fname);
712 +               gpgme_data_release(plain);
713 +               gpgme_release(ctx);
714 +               debug_print("can't open!\n");
715 +               privacy_set_error(_("Couldn't open temporary file"));
716 +               return NULL;
717 +       }
718 +
719 +       fprintf(dstfp, "MIME-Version: 1.0\n");
720 +
721 +       chars = sgpgme_data_release_and_get_mem(plain, &len);
722 +
723 +       if (len > 0) {
724 +               fwrite(chars, len, 1, dstfp);
725 +       }
726 +       fclose(dstfp);
727 +       g_free(chars);
728 +
729 +       parseinfo = procmime_scan_file(fname);
730 +       g_free(fname);
731 +       if (parseinfo == NULL) {
732 +               privacy_set_error(_("Couldn't parse decrypted file."));
733 +               gpgme_release(ctx);
734 +               return NULL;
735 +       }
736 +       decinfo = g_node_first_child(parseinfo->node) != NULL ?
737 +               g_node_first_child(parseinfo->node)->data : NULL;
738 +       if (decinfo == NULL) {
739 +               privacy_set_error(_("Couldn't parse decrypted file parts."));
740 +               gpgme_release(ctx);
741 +               return NULL;
742 +       }
743 +
744 +       g_node_unlink(decinfo->node);
745 +       procmime_mimeinfo_free_all(parseinfo);
746 +
747 +       decinfo->tmp = TRUE;
748 +
749 +       if (sigstat != NULL && sigstat->signatures != NULL) {
750 +               if (decinfo->privacy != NULL) {
751 +                       data = (PrivacyDataPGP *) decinfo->privacy;
752 +               } else {
753 +                       data = smime_new_privacydata();
754 +                       decinfo->privacy = (PrivacyData *) data;        
755 +               }
756 +               data->done_sigtest = TRUE;
757 +               data->is_signed = TRUE;
758 +               data->sigstatus = sigstat;
759 +               if (data->ctx)
760 +                       gpgme_release(data->ctx);
761 +               data->ctx = ctx;
762 +       } else
763 +               gpgme_release(ctx);
764 +       
765 +       
766 +       
767 +       return decinfo;
768 +}
769 +
770 +gboolean smime_sign(MimeInfo *mimeinfo, PrefsAccount *account)
771 +{
772 +       MimeInfo *msgcontent, *sigmultipart, *newinfo;
773 +       gchar *textstr, *micalg;
774 +       FILE *fp;
775 +       gchar *boundary = NULL;
776 +       gchar *sigcontent;
777 +       gpgme_ctx_t ctx;
778 +       gpgme_data_t gpgtext, gpgsig;
779 +       gpgme_error_t err;
780 +       size_t len;
781 +       struct passphrase_cb_info_s info;
782 +       gpgme_sign_result_t result = NULL;
783 +       gchar *test_msg;
784 +       gchar *real_content = NULL;
785 +       
786 +       fp = my_tmpfile();
787 +       if (fp == NULL) {
788 +               perror("my_tmpfile");
789 +               return FALSE;
790 +       }
791 +       procmime_write_mimeinfo(mimeinfo, fp);
792 +       rewind(fp);
793 +
794 +       /* read temporary file into memory */
795 +       test_msg = file_read_stream_to_str(fp);
796 +       fclose(fp);
797 +       
798 +       memset (&info, 0, sizeof info);
799 +
800 +       /* remove content node from message */
801 +       msgcontent = (MimeInfo *) mimeinfo->node->children->data;
802 +       g_node_unlink(msgcontent->node);
803 +
804 +       /* create temporary multipart for content */
805 +       sigmultipart = procmime_mimeinfo_new();
806 +       sigmultipart->type = MIMETYPE_MULTIPART;
807 +       sigmultipart->subtype = g_strdup("signed");
808 +       
809 +       do {
810 +               if (boundary)
811 +                       g_free(boundary);
812 +               boundary = generate_mime_boundary("Sig");
813 +       } while (strstr(test_msg, boundary) != NULL);
814 +       
815 +       g_free(test_msg);
816 +
817 +       g_hash_table_insert(sigmultipart->typeparameters, g_strdup("boundary"),
818 +                            g_strdup(boundary));
819 +       g_hash_table_insert(sigmultipart->typeparameters, g_strdup("protocol"),
820 +                            g_strdup("application/pkcs7-signature"));
821 +       g_node_append(sigmultipart->node, msgcontent->node);
822 +       g_node_append(mimeinfo->node, sigmultipart->node);
823 +
824 +       /* write message content to temporary file */
825 +       fp = my_tmpfile();
826 +       if (fp == NULL) {
827 +               perror("my_tmpfile");
828 +               return FALSE;
829 +       }
830 +       procmime_write_mimeinfo(sigmultipart, fp);
831 +       rewind(fp);
832 +
833 +       /* read temporary file into memory */
834 +       textstr = get_canonical_content(fp, boundary);
835 +
836 +       g_free(boundary);
837 +
838 +       fclose(fp);
839 +
840 +       gpgme_data_new_from_mem(&gpgtext, textstr, strlen(textstr), 0);
841 +       gpgme_data_new(&gpgsig);
842 +       gpgme_new(&ctx);
843 +       gpgme_set_armor(ctx, TRUE);
844 +       gpgme_signers_clear (ctx);
845 +
846 +       err = gpgme_set_protocol(ctx, GPGME_PROTOCOL_CMS);
847 +
848 +       if (err) {
849 +               debug_print ("gpgme_set_protocol failed: %s\n",
850 +                   gpgme_strerror (err));
851 +               gpgme_data_release(gpgtext);
852 +               gpgme_release(ctx);
853 +               return FALSE;
854 +       }
855 +
856 +       if (!sgpgme_setup_signers(ctx, account)) {
857 +               debug_print("setup_signers failed\n");
858 +               gpgme_data_release(gpgtext);
859 +               gpgme_release(ctx);
860 +               return FALSE;
861 +       }
862 +
863 +       info.c = ctx;
864 +       prefs_gpg_enable_agent(TRUE);
865 +       gpgme_set_passphrase_cb (ctx, NULL, &info);
866 +       
867 +       err = gpgme_op_sign(ctx, gpgtext, gpgsig, GPGME_SIG_MODE_DETACH);
868 +       if (err != GPG_ERR_NO_ERROR) {
869 +               alertpanel_error("S/MIME : Cannot sign, %s (%d)", gpg_strerror(err), gpg_err_code(err));
870 +               gpgme_data_release(gpgtext);
871 +               gpgme_release(ctx);
872 +               return FALSE;
873 +       }
874 +       result = gpgme_op_sign_result(ctx);
875 +       if (result && result->signatures) {
876 +           if (gpgme_get_protocol(ctx) == GPGME_PROTOCOL_OpenPGP) {
877 +               micalg = g_strdup_printf("PGP-%s", gpgme_hash_algo_name(
878 +                           result->signatures->hash_algo));
879 +           } else {
880 +               micalg = g_strdup(gpgme_hash_algo_name(
881 +                           result->signatures->hash_algo));
882 +           }
883 +       } else {
884 +           /* can't get result (maybe no signing key?) */
885 +           debug_print("gpgme_op_sign_result error\n");
886 +           return FALSE;
887 +       }
888 +
889 +       gpgme_release(ctx);
890 +       sigcontent = sgpgme_data_release_and_get_mem(gpgsig, &len);
891 +       gpgme_data_release(gpgtext);
892 +       g_free(textstr);
893 +
894 +       if (!sigcontent) {
895 +               gpgme_release(ctx);
896 +               return FALSE;
897 +       }
898 +       real_content = sigcontent+strlen("-----BEGIN SIGNED MESSAGE-----\n");
899 +       if (!strstr(real_content, "-----END SIGNED MESSAGE-----")) {
900 +               debug_print("missing end\n");
901 +               gpgme_release(ctx);
902 +               return FALSE;
903 +       }
904 +       *strstr(real_content, "-----END SIGNED MESSAGE-----") = '\0';
905 +       /* add signature */
906 +       g_hash_table_insert(sigmultipart->typeparameters, g_strdup("micalg"),
907 +                            micalg);
908 +
909 +       newinfo = procmime_mimeinfo_new();
910 +       newinfo->type = MIMETYPE_APPLICATION;
911 +       newinfo->subtype = g_strdup("pkcs7-signature");
912 +       g_hash_table_insert(newinfo->typeparameters, g_strdup("name"),
913 +                            g_strdup("smime.p7s"));
914 +       newinfo->content = MIMECONTENT_MEM;
915 +       newinfo->disposition = DISPOSITIONTYPE_ATTACHMENT;
916 +       g_hash_table_insert(newinfo->dispositionparameters, g_strdup("filename"),
917 +                           g_strdup("smime.p7s"));
918 +       newinfo->data.mem = g_malloc(len + 1);
919 +       g_memmove(newinfo->data.mem, real_content, len);
920 +       newinfo->data.mem[len] = '\0';
921 +       newinfo->encoding_type = ENC_BASE64;
922 +       g_node_append(sigmultipart->node, newinfo->node);
923 +
924 +       g_free(sigcontent);
925 +
926 +       return TRUE;
927 +}
928 +gchar *smime_get_encrypt_data(GSList *recp_names)
929 +{
930 +       return sgpgme_get_encrypt_data(recp_names, GPGME_PROTOCOL_CMS);
931 +}
932 +
933 +static gchar *fp_read_noconv(FILE *fp)
934 +{
935 +       GByteArray *array;
936 +       guchar buf[BUFSIZ];
937 +       gint n_read;
938 +       gchar *result = NULL;
939 +
940 +       if (!fp)
941 +               return NULL;
942 +       array = g_byte_array_new();
943 +
944 +       while ((n_read = fread(buf, sizeof(gchar), sizeof(buf), fp)) > 0) {
945 +               if (n_read < sizeof(buf) && ferror(fp))
946 +                       break;
947 +               g_byte_array_append(array, buf, n_read);
948 +       }
949 +
950 +       if (ferror(fp)) {
951 +               FILE_OP_ERROR("file stream", "fread");
952 +               g_byte_array_free(array, TRUE);
953 +               return NULL;
954 +       }
955 +
956 +       buf[0] = '\0';
957 +       g_byte_array_append(array, buf, 1);
958 +       result = (gchar *)array->data;
959 +       g_byte_array_free(array, FALSE);
960 +       
961 +       return result;
962 +}
963 +
964 +gboolean smime_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
965 +{
966 +       MimeInfo *msgcontent, *encmultipart;
967 +       FILE *fp;
968 +       gchar *enccontent;
969 +       size_t len;
970 +       gchar *textstr = NULL;
971 +       gpgme_data_t gpgtext = NULL, gpgenc = NULL;
972 +       gpgme_ctx_t ctx = NULL;
973 +       gpgme_key_t *kset = NULL;
974 +       gchar **fprs = g_strsplit(encrypt_data, " ", -1);
975 +       gint i = 0;
976 +       gpgme_error_t err;
977 +       gchar *tmpfile = NULL;
978 +
979 +       while (fprs[i] && strlen(fprs[i])) {
980 +               i++;
981 +       }
982 +       
983 +       gpgme_new(&ctx);
984 +
985 +       err = gpgme_set_protocol(ctx, GPGME_PROTOCOL_CMS);
986 +
987 +       if (err) {
988 +               debug_print ("gpgme_set_protocol failed: %s\n",
989 +                   gpgme_strerror (err));
990 +               return FALSE;   
991 +       }
992 +
993 +       kset = g_malloc(sizeof(gpgme_key_t)*(i+1));
994 +       memset(kset, 0, sizeof(gpgme_key_t)*(i+1));
995 +       i = 0;
996 +
997 +       while (fprs[i] && strlen(fprs[i])) {
998 +               gpgme_key_t key;
999 +               gpgme_error_t err;
1000 +               err = gpgme_get_key(ctx, fprs[i], &key, 0);
1001 +               if (err) {
1002 +                       debug_print("can't add key '%s'[%d] (%s)\n", fprs[i],i, gpgme_strerror(err));
1003 +                       break;
1004 +               }
1005 +               debug_print("found %s at %d\n", fprs[i], i);
1006 +               kset[i] = key;
1007 +               i++;
1008 +       }
1009 +       
1010 +       debug_print("Encrypting message content\n");
1011 +
1012 +       /* remove content node from message */
1013 +       msgcontent = (MimeInfo *) mimeinfo->node->children->data;
1014 +       g_node_unlink(msgcontent->node);
1015 +
1016 +
1017 +       /* create temporary multipart for content */
1018 +       encmultipart = procmime_mimeinfo_new();
1019 +       encmultipart->type = MIMETYPE_APPLICATION;
1020 +       encmultipart->subtype = g_strdup("x-pkcs7-mime");
1021 +       g_hash_table_insert(encmultipart->typeparameters, g_strdup("name"),
1022 +                            g_strdup("smime.p7m"));
1023 +       
1024 +       encmultipart->disposition = DISPOSITIONTYPE_ATTACHMENT;
1025 +       g_hash_table_insert(encmultipart->dispositionparameters, g_strdup("filename"),
1026 +                            g_strdup("smime.p7m"));
1027 +
1028 +       g_node_append(encmultipart->node, msgcontent->node);
1029 +
1030 +       /* write message content to temporary file */
1031 +       tmpfile = get_tmp_file();
1032 +       fp = fopen(tmpfile, "wb");
1033 +       if (fp == NULL) {
1034 +               perror("get_tmp_file");
1035 +               return FALSE;
1036 +       }
1037 +       procmime_decode_content(msgcontent);
1038 +       procmime_write_mime_header(msgcontent, fp);
1039 +       procmime_write_mimeinfo(msgcontent, fp);
1040 +       fclose(fp);
1041 +       canonicalize_file_replace(tmpfile);
1042 +       fp = fopen(tmpfile, "rb");
1043 +       if (fp == NULL) {
1044 +               perror("get_tmp_file");
1045 +               return FALSE;
1046 +       }
1047 +       g_free(tmpfile);
1048 +
1049 +       /* read temporary file into memory */
1050 +       textstr = fp_read_noconv(fp);
1051 +
1052 +       fclose(fp);
1053 +
1054 +       /* encrypt data */
1055 +       gpgme_data_new_from_mem(&gpgtext, textstr, strlen(textstr), 0);
1056 +       gpgme_data_new(&gpgenc);
1057 +       gpgme_data_rewind(gpgtext);
1058 +       
1059 +       gpgme_data_set_encoding(gpgenc, GPGME_DATA_ENCODING_BASE64);
1060 +       gpgme_op_encrypt(ctx, kset, GPGME_ENCRYPT_ALWAYS_TRUST, gpgtext, gpgenc);
1061 +
1062 +       gpgme_release(ctx);
1063 +       enccontent = sgpgme_data_release_and_get_mem(gpgenc, &len);
1064 +
1065 +       if (!enccontent) {
1066 +               g_warning("no enccontent\n");
1067 +               return FALSE;
1068 +       }
1069 +
1070 +       tmpfile = get_tmp_file();
1071 +       fp = fopen(tmpfile, "wb");
1072 +       if (fp) {
1073 +               fwrite(enccontent, 1, len, fp);
1074 +               fclose(fp);
1075 +       } else {
1076 +               perror("get_tmp_file");
1077 +               return FALSE;
1078 +       }
1079 +       gpgme_data_release(gpgtext);
1080 +       g_free(textstr);
1081 +
1082 +       /* create encrypted multipart */
1083 +       procmime_mimeinfo_free_all(msgcontent);
1084 +       g_node_append(mimeinfo->node, encmultipart->node);
1085 +
1086 +       encmultipart->content = MIMECONTENT_FILE;
1087 +       encmultipart->data.filename = tmpfile;
1088 +       procmime_encode_content(encmultipart, ENC_BASE64);
1089 +
1090 +       g_free(enccontent);
1091 +
1092 +       return TRUE;
1093 +}
1094 +
1095 +static PrivacySystem smime_system = {
1096 +       "smime",                        /* id */
1097 +       "S-MIME",                       /* name */
1098 +
1099 +       smime_free_privacydata, /* free_privacydata */
1100 +
1101 +       smime_is_signed,                /* is_signed(MimeInfo *) */
1102 +       smime_check_signature,  /* check_signature(MimeInfo *) */
1103 +       smime_get_sig_status,           /* get_sig_status(MimeInfo *) */
1104 +       smime_get_sig_info_short,       /* get_sig_info_short(MimeInfo *) */
1105 +       smime_get_sig_info_full,        /* get_sig_info_full(MimeInfo *) */
1106 +
1107 +       smime_is_encrypted,             /* is_encrypted(MimeInfo *) */
1108 +       smime_decrypt,                  /* decrypt(MimeInfo *) */
1109 +
1110 +       TRUE,
1111 +       smime_sign,
1112 +
1113 +       TRUE,
1114 +       smime_get_encrypt_data,
1115 +       smime_encrypt,
1116 +};
1117 +
1118 +void smime_init()
1119 +{
1120 +       privacy_register_system(&smime_system);
1121 +}
1122 +
1123 +void smime_done()
1124 +{
1125 +       privacy_unregister_system(&smime_system);
1126 +}
1127 +
1128 +struct PluginFeature *plugin_provides(void)
1129 +{
1130 +       static struct PluginFeature features[] = 
1131 +               { {PLUGIN_PRIVACY, N_("S/MIME")},
1132 +                 {PLUGIN_NOTHING, NULL}};
1133 +       return features;
1134 +}
1135 +#endif /* USE_GPGME */
1136 diff -ruN claws-mail-2.9.2-p03/src/plugins/smime/smime.deps claws-mail-2.9.2/src/plugins/smime/smime.deps
1137 --- claws-mail-2.9.2-p03/src/plugins/smime/smime.deps   1970-01-01 01:00:00.000000000 +0100
1138 +++ claws-mail-2.9.2/src/plugins/smime/smime.deps       2007-07-02 20:54:14.000000000 +0200
1139 @@ -0,0 +1 @@
1140 +pgpcore
1141 diff -ruN claws-mail-2.9.2-p03/src/plugins/smime/smime.h claws-mail-2.9.2/src/plugins/smime/smime.h
1142 --- claws-mail-2.9.2-p03/src/plugins/smime/smime.h      1970-01-01 01:00:00.000000000 +0100
1143 +++ claws-mail-2.9.2/src/plugins/smime/smime.h  2007-07-02 20:54:14.000000000 +0200
1144 @@ -0,0 +1,27 @@
1145 +/*
1146 + * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
1147 + * Copyright (C) 1999-2007 Colin Leroy <colin@colino.net> and 
1148 + * the Claws Mail team
1149 + *
1150 + * This program is free software; you can redistribute it and/or modify
1151 + * it under the terms of the GNU General Public License as published by
1152 + * the Free Software Foundation; either version 2 of the License, or
1153 + * (at your option) any later version.
1154 + *
1155 + * This program is distributed in the hope that it will be useful,
1156 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1157 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1158 + * GNU General Public License for more details.
1159 + *
1160 + * You should have received a copy of the GNU General Public License
1161 + * along with this program; if not, write to the Free Software
1162 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1163 + */
1164 +
1165 +#ifndef PGPMIME_H
1166 +#define PGPMIME_H 1
1167 +
1168 +void smime_init(void);
1169 +void smime_done(void);
1170 +
1171 +#endif /* PGPMIME_H */
1172 diff -ruN claws-mail-2.9.2-p03/src/plugins/smime/version.rc claws-mail-2.9.2/src/plugins/smime/version.rc
1173 --- claws-mail-2.9.2-p03/src/plugins/smime/version.rc   1970-01-01 01:00:00.000000000 +0100
1174 +++ claws-mail-2.9.2/src/plugins/smime/version.rc       2007-07-02 20:54:15.000000000 +0200
1175 @@ -0,0 +1,36 @@
1176 +1 VERSIONINFO
1177 + FILEVERSION 0, 0, 0, 0
1178 + PRODUCTVERSION 0, 0, 0, 0
1179 + FILEFLAGSMASK 0x3fL
1180 +#ifdef _DEBUG
1181 + FILEFLAGS 0x1L
1182 +#else
1183 + FILEFLAGS 0x0L
1184 +#endif
1185 + FILEOS 0x40004L
1186 + FILETYPE 0x2L
1187 + FILESUBTYPE 0x0L
1188 +BEGIN
1189 +    BLOCK "StringFileInfo"
1190 +    BEGIN
1191 +        BLOCK "000004b0"
1192 +        BEGIN
1193 +            VALUE "FileDescription", "smime Plugin\0"
1194 +            VALUE "FileVersion", "0.0.0.0\0"
1195 +            VALUE "ProductVersion", "0.0.0.0 Win32\0"
1196 +            VALUE "LegalCopyright", "GPL / \81© 1999-2007 Colin Leroy <colin@colino.net>\0"
1197 +            VALUE "CompanyName", "GNU / Free Software Foundation\0"
1198 +            VALUE "ProductName", "Claws Mail\0"
1199 +//            VALUE "Comments", "\0"
1200 +//            VALUE "InternalName", "\0"
1201 +//            VALUE "LegalTrademarks", "\0"
1202 +//            VALUE "OriginalFilename", "\0"
1203 +//            VALUE "PrivateBuild", "\0"
1204 +//            VALUE "SpecialBuild", "\0"
1205 +        END
1206 +    END
1207 +    BLOCK "VarFileInfo"
1208 +    BEGIN
1209 +        VALUE "Translation", 0x0, 1200
1210 +    END
1211 +END