зеркало из https://github.com/mozilla/pjs.git
libmime updates: security cleansing
This commit is contained in:
Родитель
f82bae51c2
Коммит
9617e0a9f3
|
@ -19,6 +19,7 @@
|
|||
/* mimecont.c --- definition of the MimeContainer class (see mimei.h)
|
||||
*/
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimecont.h"
|
||||
|
||||
#define MIME_SUPERCLASS mimeObjectClass
|
||||
|
@ -31,7 +32,7 @@ static int MimeContainer_add_child (MimeObject *, MimeObject *);
|
|||
static int MimeContainer_parse_eof (MimeObject *, XP_Bool);
|
||||
static int MimeContainer_parse_end (MimeObject *, XP_Bool);
|
||||
static XP_Bool MimeContainer_displayable_inline_p (MimeObjectClass *class,
|
||||
MimeHeaders *hdrs);
|
||||
MimeHeaders *hdrs);
|
||||
|
||||
#if defined(DEBUG) && defined(XP_UNIX)
|
||||
static int MimeContainer_debug_print (MimeObject *, FILE *, int32 depth);
|
||||
|
|
|
@ -292,7 +292,7 @@ mime_parse_stream_complete (NET_StreamClass *stream)
|
|||
char *priority = 0;
|
||||
char *draftInfo = 0;
|
||||
|
||||
XP_Bool encrypt_p = FALSE; /* #### how do we determine this? */
|
||||
XP_Bool altform_p = FALSE; /* #### how do we determine this? */
|
||||
XP_Bool sign_p = FALSE; /* #### how do we determine this? */
|
||||
|
||||
XP_ASSERT (mdd);
|
||||
|
@ -305,7 +305,7 @@ mime_parse_stream_complete (NET_StreamClass *stream)
|
|||
status = mdd->obj->class->parse_eof ( mdd->obj, FALSE );
|
||||
mdd->obj->class->parse_end( mdd->obj, status < 0 ? TRUE : FALSE );
|
||||
|
||||
encrypt_p = mdd->options->decrypt_p;
|
||||
altform_p = HG09842 ;
|
||||
sign_p = mdd->options->signed_p;
|
||||
|
||||
XP_ASSERT ( mdd->options == mdd->obj->options );
|
||||
|
@ -370,7 +370,7 @@ mime_parse_stream_complete (NET_StreamClass *stream)
|
|||
|
||||
fields = MSG_CreateCompositionFields( from, repl, to, cc, bcc, fcc, grps, foll,
|
||||
org, subj, refs, 0, priority, 0, news_host,
|
||||
encrypt_p, sign_p);
|
||||
altform_p, sign_p);
|
||||
|
||||
draftInfo = MimeHeaders_get(mdd->headers, HEADER_X_MOZILLA_DRAFT_INFO, FALSE, FALSE);
|
||||
if (draftInfo && fields) {
|
||||
|
@ -501,8 +501,8 @@ mime_parse_stream_complete (NET_StreamClass *stream)
|
|||
{
|
||||
fields = MSG_CreateCompositionFields( from, repl, to, cc, bcc, fcc, grps, foll,
|
||||
org, subj, refs, 0, priority, 0, news_host,
|
||||
MSG_GetMailEncryptionPreference(),
|
||||
MSG_GetMailSigningPreference());
|
||||
HG09843,
|
||||
HG09844 );
|
||||
if (fields)
|
||||
cpane = FE_CreateCompositionPane(mdd->context, fields, NULL, MSG_DEFAULT);
|
||||
}
|
||||
|
@ -755,7 +755,7 @@ mime_decompose_file_init_fn ( void *stream_closure,
|
|||
|
||||
/* Initialize a decoder if necessary.
|
||||
*/
|
||||
if (!newAttachment->encoding || mdd->options->decrypt_p)
|
||||
if (!newAttachment->encoding || HG89332)
|
||||
;
|
||||
else if (!strcasecomp(newAttachment->encoding, ENCODING_BASE64))
|
||||
fn = &MimeB64DecoderInit;
|
||||
|
@ -818,7 +818,7 @@ mime_decompose_file_close_fn ( void *stream_closure )
|
|||
{
|
||||
struct mime_draft_data *mdd = (struct mime_draft_data *) stream_closure;
|
||||
|
||||
/* relax the rule in case we encountered invalid encrypted situation
|
||||
/* relax the rule in case we encountered invalid bigfun situation
|
||||
XP_ASSERT (mdd && mdd->tmp_file);
|
||||
*/
|
||||
if ( !mdd || !mdd->tmp_file )
|
||||
|
@ -880,11 +880,11 @@ MIME_ToDraftConverter ( int format_out,
|
|||
mdd->options->decompose_file_close_fn = mime_decompose_file_close_fn;
|
||||
#ifdef FO_MAIL_MESSAGE_TO
|
||||
/* If we're attaching a message (for forwarding) then we must eradicate all
|
||||
traces of encryption from it, since forwarding someone else a message
|
||||
that wasn't encrypted for them doesn't work. We have to decrypt it
|
||||
traces of bigfun from it, since forwarding someone else a message
|
||||
that wasn't bigfun for them doesn't work. We have to bigfun it
|
||||
before sending it.
|
||||
*/
|
||||
mdd->options->decrypt_p = TRUE;
|
||||
HG09878
|
||||
#endif /* FO_MAIL_MESSAGE_TO */
|
||||
|
||||
obj = mime_new ( (MimeObjectClass *) &mimeMessageClass,
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimeebod.h"
|
||||
#include "xpgetstr.h"
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimeenc.h"
|
||||
#include "mimei.h"
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimeeobj.h"
|
||||
#include "xpgetstr.h"
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
in fact, a raw HTTP response.)
|
||||
*/
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimemsg.h"
|
||||
#include "prglobal.h"
|
||||
|
||||
|
@ -103,12 +104,9 @@ test_file_type (const char *filename, void *stream_closure)
|
|||
return XP_STRDUP("audio/x-aiff");
|
||||
else if (!strcasecomp(suf, "ps"))
|
||||
return XP_STRDUP("application/postscript");
|
||||
else if (!strcasecomp(suf, "p7m"))
|
||||
return XP_STRDUP("application/x-pkcs7-mime");
|
||||
else if (!strcasecomp(suf, "p7c"))
|
||||
return XP_STRDUP("application/x-pkcs7-mime");
|
||||
else if (!strcasecomp(suf, "p7s"))
|
||||
return XP_STRDUP("application/x-pkcs7-signature");
|
||||
|
||||
HG43290
|
||||
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
@ -350,10 +348,7 @@ static char *
|
|||
test_cdb_name_cb (void *arg, int vers)
|
||||
{
|
||||
static char f[1024];
|
||||
if (vers <= 4)
|
||||
sprintf(f, "%s/.netscape/cert.db", getenv("HOME"));
|
||||
else
|
||||
sprintf(f, "%s/.netscape/cert%d.db", getenv("HOME"), vers);
|
||||
HG09845
|
||||
return f;
|
||||
}
|
||||
|
||||
|
@ -380,30 +375,8 @@ main (int argc, char **argv)
|
|||
XP_Bool outline_p = FALSE;
|
||||
XP_Bool decrypt_p = FALSE;
|
||||
char filename[1000];
|
||||
CERTCertDBHandle *cdb_handle;
|
||||
SECKEYKeyDBHandle *kdb_handle;
|
||||
|
||||
PR_Init("mimefilt", 24, 1, 0);
|
||||
|
||||
cdb_handle = (CERTCertDBHandle *) malloc(sizeof(*cdb_handle));
|
||||
memset(cdb_handle, 0, sizeof(*cdb_handle));
|
||||
|
||||
if (SECSuccess != CERT_OpenCertDB(cdb_handle, FALSE, test_cdb_name_cb, NULL))
|
||||
CERT_OpenVolatileCertDB(cdb_handle);
|
||||
CERT_SetDefaultCertDB(cdb_handle);
|
||||
|
||||
RNG_RNGInit();
|
||||
|
||||
kdb_handle = SECKEY_OpenKeyDB(PR_FALSE, test_kdb_name_cb, NULL);
|
||||
SECKEY_SetDefaultKeyDB(kdb_handle);
|
||||
|
||||
PK11_SetPasswordFunc(test_passwd_prompt);
|
||||
|
||||
sprintf(filename, "%s/.netscape/secmodule.db", getenv("HOME"));
|
||||
SECMOD_init(filename);
|
||||
|
||||
SEC_Init();
|
||||
|
||||
HG09846
|
||||
|
||||
if (i < argc)
|
||||
{
|
||||
|
@ -430,12 +403,11 @@ main (int argc, char **argv)
|
|||
html_p = FALSE;
|
||||
else if (!XP_STRCMP(argv[i], "-outline"))
|
||||
outline_p = TRUE;
|
||||
else if (!XP_STRCMP(argv[i], "-decrypt"))
|
||||
decrypt_p = TRUE;
|
||||
HG09847
|
||||
else
|
||||
{
|
||||
fprintf(stderr,
|
||||
"usage: %s [ URL [ -fancy | -no-fancy | -html | -raw | -outline | -decrypt ]]\n"
|
||||
HG09848 ,
|
||||
" < message/rfc822 > output\n",
|
||||
(XP_STRRCHR(argv[0], '/') ?
|
||||
XP_STRRCHR(argv[0], '/') + 1 :
|
||||
|
@ -452,8 +424,7 @@ main (int argc, char **argv)
|
|||
|
||||
FAIL:
|
||||
|
||||
CERT_ClosePermCertDB(cdb_handle);
|
||||
SECKEY_CloseKeyDB(kdb_handle);
|
||||
HG09849
|
||||
|
||||
exit(i);
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimei.h"
|
||||
#include "xpgetstr.h"
|
||||
#include "libi18n.h"
|
||||
|
@ -63,21 +64,11 @@ extern int MK_MIMEHTML_DISP_REFERENCES;
|
|||
extern int MK_MIMEHTML_DISP_MESSAGE_ID;
|
||||
extern int MK_MIMEHTML_DISP_RESENT_MESSAGE_ID;
|
||||
extern int MK_MIMEHTML_DISP_BCC;
|
||||
extern int MK_MIMEHTML_SHOW_SECURITY_ADVISOR;
|
||||
extern int MK_MIMEHTML_VERIFY_SIGNATURE;
|
||||
extern int MK_MIMEHTML_DOWNLOAD_STATUS_HEADER;
|
||||
extern int MK_MIMEHTML_DOWNLOAD_STATUS_NOT_DOWNLOADED;
|
||||
|
||||
extern int MK_MIMEHTML_ENC_AND_SIGNED;
|
||||
extern int MK_MIMEHTML_SIGNED;
|
||||
extern int MK_MIMEHTML_ENCRYPTED;
|
||||
extern int MK_MIMEHTML_CERTIFICATES;
|
||||
extern int MK_MIMEHTML_ENC_SIGNED_BAD;
|
||||
extern int MK_MIMEHTML_SIGNED_BAD;
|
||||
extern int MK_MIMEHTML_ENCRYPTED_BAD;
|
||||
extern int MK_MIMEHTML_CERTIFICATES_BAD;
|
||||
extern int MK_MIMEHTML_SIGNED_UNVERIFIED;
|
||||
|
||||
HG82991
|
||||
|
||||
char *
|
||||
strip_continuations(char *original);
|
||||
|
@ -2616,12 +2607,12 @@ MimeHeaders_write_attachment_box(MimeHeaders *hdrs,
|
|||
}
|
||||
|
||||
|
||||
/* Some crypto-related HTML-generated utility routines.
|
||||
/* Some bigfun-related HTML-generated utility routines.
|
||||
*/
|
||||
|
||||
|
||||
char *
|
||||
MimeHeaders_open_crypto_stamp(void)
|
||||
MimeHeaders_open_bigfun_stamp(void)
|
||||
{
|
||||
return XP_STRDUP("<TABLE CELLPADDING=0 CELLSPACING=0"
|
||||
" WIDTH=\"100%\" BORDER=0>"
|
||||
|
@ -2629,20 +2620,20 @@ MimeHeaders_open_crypto_stamp(void)
|
|||
}
|
||||
|
||||
char *
|
||||
MimeHeaders_finish_open_crypto_stamp(void)
|
||||
MimeHeaders_finish_open_bigfun_stamp(void)
|
||||
{
|
||||
return XP_STRDUP("</TD><TD ALIGN=RIGHT VALIGN=TOP>");
|
||||
}
|
||||
|
||||
char *
|
||||
MimeHeaders_close_crypto_stamp(void)
|
||||
MimeHeaders_close_bigfun_stamp(void)
|
||||
{
|
||||
return XP_STRDUP("</TD></TR></TABLE><P>");
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
MimeHeaders_make_crypto_stamp(XP_Bool encrypted_p,
|
||||
MimeHeaders_make_bigfun_stamp(XP_Bool bigfun_p,
|
||||
XP_Bool signed_p,
|
||||
XP_Bool good_p,
|
||||
XP_Bool unverified_p,
|
||||
|
@ -2650,16 +2641,16 @@ MimeHeaders_make_crypto_stamp(XP_Bool encrypted_p,
|
|||
const char *stamp_url)
|
||||
{
|
||||
const char *open = ("%s"
|
||||
"<P>"
|
||||
"<CENTER>"
|
||||
"<TABLE CELLPADDING=3 CELLSPACING=0 BORDER=1>"
|
||||
"<TR>"
|
||||
"<TD ALIGN=RIGHT VALIGN=BOTTOM BGCOLOR=\"white\">"
|
||||
"%s<IMG SRC=\"%s\" BORDER=0 ALT=\"S/MIME\">%s"
|
||||
"<B>"
|
||||
"<FONT COLOR=\"red\" SIZE=\"-1\">"
|
||||
"<BR>"
|
||||
"%s%s%s");
|
||||
"<P>"
|
||||
"<CENTER>"
|
||||
"<TABLE CELLPADDING=3 CELLSPACING=0 BORDER=1>"
|
||||
"<TR>"
|
||||
"<TD ALIGN=RIGHT VALIGN=BOTTOM BGCOLOR=\"white\">"
|
||||
HG82001
|
||||
"<B>"
|
||||
"<FONT COLOR=\"red\" SIZE=\"-1\">"
|
||||
"<BR>"
|
||||
"%s%s%s");
|
||||
int16 middle_key = 0;
|
||||
char *href_open = 0;
|
||||
const char *img_src = "";
|
||||
|
@ -2676,58 +2667,8 @@ MimeHeaders_make_crypto_stamp(XP_Bool encrypted_p,
|
|||
const char *parent_close_early = 0;
|
||||
const char *parent_close_late = 0;
|
||||
char *result = 0;
|
||||
/* Neither encrypted nor signed means "certs only". */
|
||||
|
||||
if (unverified_p)
|
||||
{
|
||||
/* an unverified signature can never occur with an encrypted
|
||||
message; by nature, an unverified signature implies
|
||||
that not all parts were downloaded. Therefore, the
|
||||
message could not have been encrypted. */
|
||||
middle_key = MK_MIMEHTML_SIGNED_UNVERIFIED;
|
||||
img_src = "internal-smime-signed-bad";
|
||||
}
|
||||
else if (encrypted_p && signed_p && good_p) /* 111 */
|
||||
{
|
||||
middle_key = MK_MIMEHTML_ENC_AND_SIGNED;
|
||||
img_src = "internal-smime-encrypted-signed";
|
||||
}
|
||||
else if (!encrypted_p && signed_p && good_p) /* 011 */
|
||||
{
|
||||
middle_key = MK_MIMEHTML_SIGNED;
|
||||
img_src = "internal-smime-signed";
|
||||
}
|
||||
else if (encrypted_p && !signed_p && good_p) /* 101 */
|
||||
{
|
||||
middle_key = MK_MIMEHTML_ENCRYPTED;
|
||||
img_src = "internal-smime-encrypted";
|
||||
}
|
||||
else if (!encrypted_p && !signed_p && good_p) /* 001 */
|
||||
{
|
||||
middle_key = MK_MIMEHTML_CERTIFICATES;
|
||||
img_src = "internal-smime-attached";
|
||||
}
|
||||
|
||||
else if (encrypted_p && signed_p && !good_p) /* 110 */
|
||||
{
|
||||
middle_key = MK_MIMEHTML_ENC_SIGNED_BAD;
|
||||
img_src = "internal-smime-encrypted-signed-bad";
|
||||
}
|
||||
else if (!encrypted_p && signed_p && !good_p) /* 010 */
|
||||
{
|
||||
middle_key = MK_MIMEHTML_SIGNED_BAD;
|
||||
img_src = "internal-smime-signed-bad";
|
||||
}
|
||||
else if (encrypted_p && !signed_p && !good_p) /* 100 */
|
||||
{
|
||||
middle_key = MK_MIMEHTML_ENCRYPTED_BAD;
|
||||
img_src = "internal-smime-encrypted-bad";
|
||||
}
|
||||
else /* (!encrypted_p && !signed_p && !good_p) */ /* 000 */
|
||||
{
|
||||
middle_key = MK_MIMEHTML_CERTIFICATES_BAD;
|
||||
img_src = "internal-smime-signed-bad";
|
||||
}
|
||||
HG89202
|
||||
|
||||
if (middle_key)
|
||||
{
|
||||
|
@ -2740,13 +2681,13 @@ MimeHeaders_make_crypto_stamp(XP_Bool encrypted_p,
|
|||
|
||||
if (close_parent_stamp_p)
|
||||
{
|
||||
parent_close = MimeHeaders_close_crypto_stamp();
|
||||
parent_close = MimeHeaders_close_bigfun_stamp();
|
||||
if (!parent_close) goto FAIL; /* MK_OUT_OF_MEMORY */
|
||||
}
|
||||
|
||||
parent_close_early = 0;
|
||||
parent_close_late = parent_close;
|
||||
if (!encrypted_p && !signed_p)
|
||||
if (!bigfun_p && !signed_p)
|
||||
{
|
||||
/* Kludge for certs-only messages -- close off the parent early
|
||||
so that the stamp goes in the body, not next to the headers. */
|
||||
|
@ -2754,21 +2695,7 @@ MimeHeaders_make_crypto_stamp(XP_Bool encrypted_p,
|
|||
parent_close_late = 0;
|
||||
}
|
||||
|
||||
if (stamp_url)
|
||||
{
|
||||
const char *stamp_text = 0;
|
||||
if (unverified_p)
|
||||
stamp_text = XP_GetString(MK_MIMEHTML_VERIFY_SIGNATURE);
|
||||
else
|
||||
stamp_text = XP_GetString(MK_MIMEHTML_SHOW_SECURITY_ADVISOR);
|
||||
href_open = PR_smprintf("<A HREF=\"%s\""
|
||||
" onMouseOver=\"window.status='%s';"
|
||||
" return true\">",
|
||||
stamp_url,
|
||||
stamp_text);
|
||||
href_close = "</A>";
|
||||
if (!href_open) goto FAIL; /* MK_OUT_OF_MEMORY */
|
||||
}
|
||||
HG28974
|
||||
|
||||
result = PR_smprintf(open,
|
||||
(parent_close_early ? parent_close_early : ""),
|
||||
|
|
|
@ -76,12 +76,12 @@ extern int MimeHeaders_write_attachment_box(MimeHeaders *hdrs,
|
|||
const char *name_url,
|
||||
const char *body);
|
||||
|
||||
/* Some crypto-related HTML-generated utility routines.
|
||||
/* Some bigfun-related HTML-generated utility routines.
|
||||
*/
|
||||
extern char *MimeHeaders_open_crypto_stamp(void);
|
||||
extern char *MimeHeaders_finish_open_crypto_stamp(void);
|
||||
extern char *MimeHeaders_close_crypto_stamp(void);
|
||||
extern char *MimeHeaders_make_crypto_stamp(XP_Bool encrypted_p,
|
||||
extern char *MimeHeaders_open_bigfun_stamp(void);
|
||||
extern char *MimeHeaders_finish_open_bigfun_stamp(void);
|
||||
extern char *MimeHeaders_close_bigfun_stamp(void);
|
||||
extern char *MimeHeaders_make_bigfun_stamp(XP_Bool bigfun_p,
|
||||
XP_Bool signed_p,
|
||||
XP_Bool good_p,
|
||||
XP_Bool unverified_p,
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
|
||||
*/
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mime.h"
|
||||
#include "mimeobj.h" /* MimeObject (abstract) */
|
||||
#include "mimecont.h" /* |--- MimeContainer (abstract) */
|
||||
|
@ -182,8 +183,7 @@ mime_find_class (const char *content_type, MimeHeaders *hdrs,
|
|||
class = (MimeObjectClass *)&mimeMultipartMixedClass;
|
||||
|
||||
#ifndef NO_SECURITY
|
||||
else if (!strcasecomp(content_type+10, "signed"))
|
||||
class = mime_find_signed_class_from_proto(hdrs);
|
||||
HG09850
|
||||
#endif /* NO_SECURITY */
|
||||
|
||||
if (!class && !exact_match_p)
|
||||
|
@ -230,7 +230,7 @@ mime_find_class (const char *content_type, MimeHeaders *hdrs,
|
|||
class = (MimeObjectClass *)&mimeSunAttachmentClass;
|
||||
|
||||
#ifndef NO_SECURITY
|
||||
/* check for other, possibly encrypted, types */
|
||||
HG09855
|
||||
else if ((class = mime_find_class_from_content_type(content_type)) != 0)
|
||||
;
|
||||
#endif /* NO_SECURITY */
|
||||
|
@ -580,91 +580,12 @@ mime_imap_part_address(MimeObject *obj)
|
|||
return imap_part;
|
||||
}
|
||||
|
||||
|
||||
/* Asks whether the given object is one of the cryptographically signed
|
||||
or encrypted objects that we know about. (MimeMessageClass uses this
|
||||
to decide if the headers need to be presented differently.)
|
||||
*/
|
||||
XP_Bool
|
||||
mime_crypto_object_p(MimeHeaders *hdrs, XP_Bool clearsigned_counts)
|
||||
{
|
||||
char *ct;
|
||||
MimeObjectClass *class;
|
||||
|
||||
if (!hdrs) return FALSE;
|
||||
|
||||
ct = MimeHeaders_get (hdrs, HEADER_CONTENT_TYPE, TRUE, FALSE);
|
||||
if (!ct) return FALSE;
|
||||
|
||||
/* Rough cut -- look at the string before doing a more complex comparison. */
|
||||
if (strcasecomp(ct, MULTIPART_SIGNED) &&
|
||||
strncasecomp(ct, "application/", 12))
|
||||
{
|
||||
XP_FREE(ct);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* It's a candidate for being a crypto object. Let's find out for sure... */
|
||||
class = mime_find_class (ct, hdrs, 0, TRUE);
|
||||
XP_FREE(ct);
|
||||
|
||||
HG09851
|
||||
#ifndef NO_SECURITY
|
||||
return mime_is_sec_class_p(class, clearsigned_counts);
|
||||
HG09852
|
||||
#endif /* NO_SECURITY */
|
||||
}
|
||||
|
||||
|
||||
/* Whether the given object has written out the HTML version of its headers
|
||||
in such a way that it will have a "crypto stamp" next to the headers. If
|
||||
this is true, then the child must write out its HTML slightly differently
|
||||
to take this into account...
|
||||
*/
|
||||
XP_Bool
|
||||
mime_crypto_stamped_p(MimeObject *obj)
|
||||
{
|
||||
XP_ASSERT(obj);
|
||||
if (!obj) return FALSE;
|
||||
if (mime_typep (obj, (MimeObjectClass *) &mimeMessageClass))
|
||||
return ((MimeMessage *) obj)->crypto_stamped_p;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* How the crypto code tells the MimeMessage object what the crypto stamp
|
||||
on it says. */
|
||||
void
|
||||
mime_set_crypto_stamp(MimeObject *obj, XP_Bool signed_p, XP_Bool encrypted_p)
|
||||
{
|
||||
if (!obj) return;
|
||||
if (mime_typep (obj, (MimeObjectClass *) &mimeMessageClass))
|
||||
{
|
||||
MimeMessage *msg = (MimeMessage *) obj;
|
||||
if (!msg->crypto_msg_signed_p)
|
||||
msg->crypto_msg_signed_p = signed_p;
|
||||
if (!msg->crypto_msg_encrypted_p)
|
||||
msg->crypto_msg_encrypted_p = encrypted_p;
|
||||
|
||||
/* If the `decrypt_p' option is on, record whether any decryption has
|
||||
actually occurred. */
|
||||
if (encrypted_p &&
|
||||
obj->options &&
|
||||
obj->options->decrypt_p &&
|
||||
obj->options->state)
|
||||
{
|
||||
/* decrypt_p and write_html_p are incompatible. */
|
||||
XP_ASSERT(!obj->options->write_html_p);
|
||||
obj->options->state->decrypted_p = TRUE;
|
||||
}
|
||||
|
||||
return; /* continue up the tree? I think that's not a good idea. */
|
||||
}
|
||||
|
||||
if (obj->parent)
|
||||
mime_set_crypto_stamp(obj->parent, signed_p, encrypted_p);
|
||||
}
|
||||
|
||||
HG09853
|
||||
HG09854
|
||||
|
||||
|
||||
/* Puts a part-number into a URL. If append_p is true, then the part number
|
||||
|
|
|
@ -220,10 +220,6 @@ typedef struct MimeObjectClass MimeObjectClass;
|
|||
# define mimeMultipartRelated mimeMultipartRelated16
|
||||
# define mimeMultipartAppleDouble mimeMultipartAppleDouble16
|
||||
# define mimeSunAttachment mimeSunAttachment16
|
||||
# define mimeMultipartSigned mimeMultipartSigned16
|
||||
# define mimeMultipartSignedPKCS7 mimeMultipartSignedPKCS716
|
||||
# define mimeEncrypted mimeEncrypted16
|
||||
# define mimeEncryptedPKCS7 mimeEncryptedPKCS716
|
||||
# define mimeMessage mimeMessage16
|
||||
# define mimeUntypedText mimeUntypedText16
|
||||
# define mimeLeaf mimeLeaf16
|
||||
|
@ -332,53 +328,13 @@ extern char *mime_find_suggested_name_of_part(const char *part,
|
|||
*/
|
||||
extern char *mime_find_content_type_of_part(const char *part, MimeObject *obj);
|
||||
|
||||
/* Given a part ID, looks through the MimeObject tree for a sub-part whose ID
|
||||
number matches; if one is found, and if it represents a PKCS7-encrypted
|
||||
object, returns information about the security status of that object.
|
||||
|
||||
`part' is not a URL -- it's of the form "1.3.5" and is interpreted relative
|
||||
to the `obj' argument.
|
||||
*/
|
||||
extern void mime_find_security_info_of_part(const char *part, MimeObject *obj,
|
||||
void **pkcs7_encrypt_content_info_return,
|
||||
void **pkcs7_sign_content_info_return,
|
||||
char **sender_email_addr_return,
|
||||
int32 *decode_error_return,
|
||||
int32 *verify_error_return);
|
||||
|
||||
HG09856
|
||||
|
||||
/* Parse the various "?" options off the URL and into the options struct.
|
||||
*/
|
||||
extern int mime_parse_url_options(const char *url, MimeDisplayOptions *);
|
||||
|
||||
|
||||
/* Asks whether the given object is one of the cryptographically signed
|
||||
or encrypted objects that we know about. (MimeMessageClass uses this
|
||||
to decide if the headers need to be presented differently.)
|
||||
*/
|
||||
extern XP_Bool mime_crypto_object_p(MimeHeaders *, XP_Bool clearsigned_counts);
|
||||
|
||||
/* Tells whether the given MimeObject is a message which has been encrypted
|
||||
or signed. (Helper for MIME_GetMessageCryptoState()).
|
||||
*/
|
||||
extern void mime_get_crypto_state (MimeObject *obj,
|
||||
XP_Bool *signed_p, XP_Bool *encrypted_p,
|
||||
XP_Bool *signed_ok, XP_Bool *encrypted_ok);
|
||||
|
||||
|
||||
/* Whether the given object has written out the HTML version of its headers
|
||||
in such a way that it will have a "crypto stamp" next to the headers. If
|
||||
this is true, then the child must write out its HTML slightly differently
|
||||
to take this into account...
|
||||
*/
|
||||
extern XP_Bool mime_crypto_stamped_p(MimeObject *obj);
|
||||
|
||||
/* How the crypto code tells the MimeMessage object what the crypto stamp
|
||||
on it says. */
|
||||
extern void mime_set_crypto_stamp(MimeObject *obj,
|
||||
XP_Bool signed_p, XP_Bool encrypted_p);
|
||||
|
||||
|
||||
struct MimeParseStateObject {
|
||||
|
||||
MimeObject *root; /* The outermost parser object. */
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
|
||||
*/
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimeiimg.h"
|
||||
|
||||
#define MIME_SUPERCLASS mimeLeafClass
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
|
||||
*/
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimeleaf.h"
|
||||
|
||||
#define MIME_SUPERCLASS mimeObjectClass
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
|
||||
*/
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimemalt.h"
|
||||
|
||||
#define MIME_SUPERCLASS mimeMultipartClass
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
|
||||
*/
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimemapl.h"
|
||||
#include "xpgetstr.h"
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
|
||||
*/
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimemdig.h"
|
||||
|
||||
#define MIME_SUPERCLASS mimeMultipartClass
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
|
||||
*/
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimemmix.h"
|
||||
|
||||
#define MIME_SUPERCLASS mimeMultipartClass
|
||||
|
|
|
@ -331,7 +331,7 @@ mime_display_stream_write_ready (NET_StreamClass *stream)
|
|||
}
|
||||
|
||||
|
||||
extern void MSG_MimeNotifyCryptoAttachmentKludge(NET_StreamClass *);
|
||||
HG09857
|
||||
|
||||
static void
|
||||
mime_display_stream_complete (NET_StreamClass *stream)
|
||||
|
@ -417,7 +417,7 @@ mime_display_stream_complete (NET_StreamClass *stream)
|
|||
obj->options &&
|
||||
obj->options->state &&
|
||||
obj->options->state->decrypted_p)
|
||||
MSG_MimeNotifyCryptoAttachmentKludge(msd->stream);
|
||||
HG09858 ;
|
||||
|
||||
/* Close the output stream. */
|
||||
msd->stream->complete (msd->stream);
|
||||
|
@ -1166,11 +1166,7 @@ MIME_MessageConverter (int format_out, void *closure,
|
|||
msd->options->headers = MimeHeadersSomeNoRef;
|
||||
|
||||
#ifdef FO_MAIL_MESSAGE_TO
|
||||
/* If we're attaching a message (for forwarding) then we must eradicate all
|
||||
traces of encryption from it, since forwarding someone else a message
|
||||
that wasn't encrypted for them doesn't work. We have to decrypt it
|
||||
before sending it.
|
||||
*/
|
||||
HG09859
|
||||
if ((format_out == FO_MAIL_TO || format_out == FO_CACHE_AND_MAIL_TO) &&
|
||||
msd->options->write_html_p == FALSE)
|
||||
msd->options->decrypt_p = TRUE;
|
||||
|
@ -1693,9 +1689,8 @@ mime_get_main_object(MimeObject* obj)
|
|||
#endif
|
||||
return obj;
|
||||
}
|
||||
/* Our main thing is a signed or encrypted object.
|
||||
We don't care about that; go on inside to the thing that we signed or
|
||||
encrypted. */
|
||||
|
||||
HG09860
|
||||
cobj = (MimeContainer*) obj;
|
||||
if (cobj->nchildren != 1) return obj;
|
||||
obj = cobj->children[0];
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
|
||||
*/
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimempar.h"
|
||||
|
||||
#define MIME_SUPERCLASS mimeMultipartClass
|
||||
|
|
|
@ -107,6 +107,7 @@
|
|||
|
||||
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimemrel.h"
|
||||
|
||||
extern int MK_UNABLE_TO_OPEN_TMP_FILE;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
|
||||
*/
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimemsg.h"
|
||||
|
||||
#define MIME_SUPERCLASS mimeContainerClass
|
||||
|
@ -105,16 +106,7 @@ MimeMessage_parse_line (char *line, int32 length, MimeObject *obj)
|
|||
XP_ASSERT(line && *line);
|
||||
if (!line || !*line) return -1;
|
||||
|
||||
/* If we're supposed to write this object, but aren't supposed to convert
|
||||
it to HTML, simply pass it through unaltered. (But, if we're supposed
|
||||
to decrypt... uh, do something else.)
|
||||
*/
|
||||
if (obj->output_p &&
|
||||
obj->options &&
|
||||
!obj->options->write_html_p &&
|
||||
!obj->options->decrypt_p &&
|
||||
obj->options->output_fn)
|
||||
return MimeObject_write(obj, line, length, TRUE);
|
||||
HG09869
|
||||
|
||||
/* If we already have a child object, then we're done parsing headers,
|
||||
and all subsequent lines get passed to the inferior object without
|
||||
|
@ -145,7 +137,8 @@ MimeMessage_parse_line (char *line, int32 length, MimeObject *obj)
|
|||
! obj->options->is_multipart_msg &&
|
||||
obj->options->decompose_file_output_fn )
|
||||
{
|
||||
if (!obj->options->decrypt_p) {
|
||||
HG09870
|
||||
{
|
||||
status = obj->options->decompose_file_output_fn (line,
|
||||
length,
|
||||
obj->options->stream_closure);
|
||||
|
@ -233,9 +226,7 @@ MimeMessage_close_headers (MimeObject *obj)
|
|||
obj->options->decompose_file_p &&
|
||||
obj->options->decompose_headers_info_fn)
|
||||
{
|
||||
if (obj->options->decrypt_p &&
|
||||
!mime_crypto_object_p (msg->hdrs, FALSE))
|
||||
obj->options->decrypt_p = FALSE;
|
||||
HG09868
|
||||
status = obj->options->decompose_headers_info_fn (
|
||||
obj->options->stream_closure,
|
||||
msg->hdrs );
|
||||
|
@ -323,24 +314,7 @@ MimeMessage_close_headers (MimeObject *obj)
|
|||
FREEIF(mv); /* done with this now. */
|
||||
}
|
||||
|
||||
|
||||
/* If this message has a body which is encrypted, and we're going to
|
||||
decrypt it (without converting it to HTML, since decrypt_p and
|
||||
write_html_p ar never true at the same time.)
|
||||
*/
|
||||
if (obj->output_p &&
|
||||
obj->options->decrypt_p &&
|
||||
!mime_crypto_object_p (msg->hdrs, FALSE))
|
||||
{
|
||||
/* The body of this message is not an encrypted object, so we need
|
||||
to turn off the decrypt_p flag (to prevent us from s#$%ing the
|
||||
body of the internal object up into this one.) In this case,
|
||||
our output will end up being identical to our input.
|
||||
*/
|
||||
if (obj->options)
|
||||
obj->options->decrypt_p = FALSE;
|
||||
}
|
||||
|
||||
HG09871
|
||||
|
||||
/* Emit the HTML for this message's headers. Do this before
|
||||
creating the object representing the body.
|
||||
|
@ -363,8 +337,7 @@ MimeMessage_close_headers (MimeObject *obj)
|
|||
/* Dump the headers, raw. */
|
||||
status = MimeObject_write(obj, "", 0, FALSE); /* initialize */
|
||||
if (status < 0) return status;
|
||||
status = MimeHeaders_write_raw_headers(msg->hdrs, obj->options,
|
||||
obj->options->decrypt_p);
|
||||
HG09872
|
||||
if (status < 0) return status;
|
||||
}
|
||||
|
||||
|
@ -498,7 +471,7 @@ static int
|
|||
MimeMessage_write_headers_html (MimeObject *obj)
|
||||
{
|
||||
MimeMessage *msg = (MimeMessage *) obj;
|
||||
XP_Bool crypto_p;
|
||||
XP_Bool altform_p;
|
||||
int status;
|
||||
if (!obj->options ||
|
||||
!obj->options->output_fn)
|
||||
|
@ -513,50 +486,20 @@ MimeMessage_write_headers_html (MimeObject *obj)
|
|||
XP_ASSERT(obj->options->state->first_data_written_p);
|
||||
}
|
||||
|
||||
crypto_p = (msg && msg->hdrs && mime_crypto_object_p(msg->hdrs, TRUE));
|
||||
HG09873
|
||||
HG43771
|
||||
|
||||
/* If this message contains crypto data, wrap the headers so that we can
|
||||
put a crypto stamp next to it. (But don't do this if in FO_QUOTE_MESSAGE
|
||||
mode.)
|
||||
*/
|
||||
if (crypto_p &&
|
||||
obj->options->headers != MimeHeadersCitation &&
|
||||
obj->options->write_html_p &&
|
||||
obj->options->output_fn)
|
||||
{
|
||||
/* This assumes that the code in the crypto-object classes will close
|
||||
off this table before writing out the body. */
|
||||
char *s = MimeHeaders_open_crypto_stamp();
|
||||
if (!s) return MK_OUT_OF_MEMORY;
|
||||
status = MimeObject_write(obj, s, XP_STRLEN(s), FALSE);
|
||||
XP_FREE(s);
|
||||
if (status < 0) return status;
|
||||
XP_ASSERT(!msg->crypto_stamped_p);
|
||||
msg->crypto_stamped_p = TRUE;
|
||||
}
|
||||
|
||||
status = MimeHeaders_write_headers_html (msg->hdrs, obj->options);
|
||||
if (status < 0) return status;
|
||||
|
||||
if (msg->crypto_stamped_p)
|
||||
if (HG56232)
|
||||
{
|
||||
/* This doesn't actually write the stamp, just prepares for it; the
|
||||
stamp itself can't be written until the crypto object is fully
|
||||
parsed, so that we know whether the sig checked out and so on. */
|
||||
char *s = MimeHeaders_finish_open_crypto_stamp();
|
||||
if (!s) return MK_OUT_OF_MEMORY;
|
||||
status = MimeObject_write(obj, s, XP_STRLEN(s), FALSE);
|
||||
XP_FREE(s);
|
||||
if (status < 0) return status;
|
||||
HG78388
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If we're not writing a crypto stamp, and this is the outermost
|
||||
message, then now is the time to run the post_header_html_fn.
|
||||
(Otherwise, it will be run when the crypto-stamp is finally
|
||||
closed off, in MimeFilter_emit_buffered_child() or
|
||||
MimeMultipartSigned_emit_child().)
|
||||
*/
|
||||
HG80200
|
||||
if (obj->options &&
|
||||
obj->options->state &&
|
||||
obj->options->generate_post_header_html_fn &&
|
||||
|
|
|
@ -42,12 +42,7 @@ struct MimeMessage {
|
|||
MimeContainer container; /* superclass variables */
|
||||
MimeHeaders *hdrs; /* headers of this message */
|
||||
XP_Bool newline_p; /* whether the last line ended in a newline */
|
||||
XP_Bool crypto_stamped_p; /* whether the header of this message has been
|
||||
emitted expecting its child to emit HTML
|
||||
which says that it is encrypted. */
|
||||
|
||||
XP_Bool crypto_msg_signed_p; /* What the emitted crypto-stamp *says*. */
|
||||
XP_Bool crypto_msg_encrypted_p;
|
||||
HG88918
|
||||
};
|
||||
|
||||
#endif /* _MIMEMSG_H_ */
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
Created: Jamie Zawinski <jwz@netscape.com>, 23-Sep-96.
|
||||
*/
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimemsig.h"
|
||||
#include "nspr.h"
|
||||
#include "xp_error.h"
|
||||
|
@ -94,15 +95,7 @@ MimeMultipartSigned_cleanup (MimeObject *obj, XP_Bool finalizing_p)
|
|||
mult->state = MimeMultipartEpilogue; /* #58075. Fix suggested by jwz */
|
||||
sig->state = MimeMultipartSignedEpilogue;
|
||||
|
||||
if (finalizing_p && sig->crypto_closure)
|
||||
{
|
||||
/* Don't free these until this object is really going away -- keep them
|
||||
around for the lifetime of the MIME object, so that we can get at the
|
||||
security info of sub-parts of the currently-displayed message. */
|
||||
((MimeMultipartSignedClass *) obj->class)
|
||||
->crypto_free (sig->crypto_closure);
|
||||
sig->crypto_closure = 0;
|
||||
}
|
||||
HG09862
|
||||
|
||||
if (sig->sig_decoder_data)
|
||||
{
|
||||
|
@ -127,9 +120,7 @@ MimeMultipartSigned_parse_eof (MimeObject *obj, XP_Bool abort_p)
|
|||
sig->state == MimeMultipartSignedSignatureLine ||
|
||||
sig->state == MimeMultipartSignedEpilogue)
|
||||
{
|
||||
status = (((MimeMultipartSignedClass *) obj->class)
|
||||
->crypto_signature_eof) (sig->crypto_closure, abort_p);
|
||||
if (status < 0) return status;
|
||||
HG09863
|
||||
}
|
||||
|
||||
if (!abort_p)
|
||||
|
@ -138,7 +129,7 @@ MimeMultipartSigned_parse_eof (MimeObject *obj, XP_Bool abort_p)
|
|||
have presumably verified the signature) write out a blurb, and then
|
||||
the signed object.
|
||||
*/
|
||||
XP_ASSERT(sig->crypto_closure);
|
||||
HG09864
|
||||
status = MimeMultipartSigned_emit_child(obj);
|
||||
if (status < 0) return status;
|
||||
}
|
||||
|
@ -175,8 +166,7 @@ MimeMultipartSigned_parse_line (char *line, int32 length, MimeObject *obj)
|
|||
if (status < 0) return status;
|
||||
|
||||
|
||||
/* Now we want to do various other crypto-related things to these lines.
|
||||
*/
|
||||
HG09865
|
||||
|
||||
|
||||
/* The instance variable MimeMultipartClass->state tracks motion through
|
||||
|
@ -275,20 +265,7 @@ MimeMultipartSigned_parse_line (char *line, int32 length, MimeObject *obj)
|
|||
case MimeMultipartSignedBodyHeaders:
|
||||
case MimeMultipartSignedBodyLine:
|
||||
|
||||
if (!sig->crypto_closure)
|
||||
{
|
||||
XP_SetError(0);
|
||||
/* Initialize the signature verification library. */
|
||||
sig->crypto_closure = (((MimeMultipartSignedClass *) obj->class)
|
||||
->crypto_init) (obj);
|
||||
if (!sig->crypto_closure)
|
||||
{
|
||||
status = PR_GetError();
|
||||
XP_ASSERT(status < 0);
|
||||
if (status >= 0) status = -1;
|
||||
return status;
|
||||
}
|
||||
}
|
||||
HG09866
|
||||
|
||||
if (hash_line_p)
|
||||
{
|
||||
|
@ -312,7 +289,7 @@ MimeMultipartSigned_parse_line (char *line, int32 length, MimeObject *obj)
|
|||
of after, except for the first line, which is not preceeded by a
|
||||
newline.
|
||||
|
||||
For purposes of cryptographic hashing, we always hash line
|
||||
For purposes of bigfun hashing, we always hash line
|
||||
breaks as CRLF -- the canonical, on-the-wire linebreaks, since
|
||||
we have no idea of knowing what line breaks were used on the
|
||||
originating system (SMTP rightly destroys that information.)
|
||||
|
@ -322,28 +299,29 @@ MimeMultipartSigned_parse_line (char *line, int32 length, MimeObject *obj)
|
|||
if (length > 0 && line[length-1] == LF) length--;
|
||||
if (length > 0 && line[length-1] == CR) length--;
|
||||
|
||||
XP_ASSERT(sig->crypto_closure);
|
||||
HG09867
|
||||
|
||||
if (!first_line_p)
|
||||
{
|
||||
/* Push out a preceeding newline... */
|
||||
char nl[] = CRLF;
|
||||
|
||||
status = (((MimeMultipartSignedClass *) obj->class)
|
||||
->crypto_data_hash (nl, 2, sig->crypto_closure));
|
||||
->bigfun_data_hash (nl, 2, sig->bigfun_closure));
|
||||
if (status < 0) return status;
|
||||
}
|
||||
|
||||
/* Now push out the line sans trailing newline. */
|
||||
if (length > 0)
|
||||
status = (((MimeMultipartSignedClass *) obj->class)
|
||||
->crypto_data_hash (line,length, sig->crypto_closure));
|
||||
->bigfun_data_hash (line,length, sig->bigfun_closure));
|
||||
if (status < 0) return status;
|
||||
}
|
||||
break;
|
||||
|
||||
case MimeMultipartSignedSignatureHeaders:
|
||||
|
||||
if (sig->crypto_closure &&
|
||||
if (sig->bigfun_closure &&
|
||||
old_state != mult->state)
|
||||
{
|
||||
/* We have just moved out of the MimeMultipartSignedBodyLine
|
||||
|
@ -351,7 +329,7 @@ MimeMultipartSigned_parse_line (char *line, int32 length, MimeObject *obj)
|
|||
reached the end of the signed data.
|
||||
*/
|
||||
status = (((MimeMultipartSignedClass *) obj->class)
|
||||
->crypto_data_eof) (sig->crypto_closure, FALSE);
|
||||
->bigfun_data_eof) (sig->bigfun_closure, FALSE);
|
||||
if (status < 0) return status;
|
||||
}
|
||||
break;
|
||||
|
@ -391,18 +369,18 @@ MimeMultipartSigned_parse_line (char *line, int32 length, MimeObject *obj)
|
|||
sig->sig_decoder_data =
|
||||
fn (((int (*) (const char *, int32, void *))
|
||||
(((MimeMultipartSignedClass *) obj->class)
|
||||
->crypto_signature_hash)),
|
||||
sig->crypto_closure);
|
||||
->bigfun_signature_hash)),
|
||||
sig->bigfun_closure);
|
||||
if (!sig->sig_decoder_data)
|
||||
return MK_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
/* Show these headers to the crypto module. */
|
||||
/* Show these headers to the bigfun module. */
|
||||
if (hash_line_p)
|
||||
{
|
||||
status = (((MimeMultipartSignedClass *) obj->class)
|
||||
->crypto_signature_init) (sig->crypto_closure,
|
||||
->bigfun_signature_init) (sig->bigfun_closure,
|
||||
obj, sig->sig_hdrs);
|
||||
if (status < 0) return status;
|
||||
}
|
||||
|
@ -418,8 +396,8 @@ MimeMultipartSigned_parse_line (char *line, int32 length, MimeObject *obj)
|
|||
status = MimeDecoderWrite (sig->sig_decoder_data, line, length);
|
||||
else
|
||||
status = (((MimeMultipartSignedClass *) obj->class)
|
||||
->crypto_signature_hash (line, length,
|
||||
sig->crypto_closure));
|
||||
->bigfun_signature_hash (line, length,
|
||||
sig->bigfun_closure));
|
||||
if (status < 0) return status;
|
||||
}
|
||||
break;
|
||||
|
@ -585,7 +563,7 @@ MimeMultipartSigned_emit_child (MimeObject *obj)
|
|||
int status = 0;
|
||||
MimeObject *body;
|
||||
|
||||
XP_ASSERT(sig->crypto_closure);
|
||||
XP_ASSERT(sig->bigfun_closure);
|
||||
|
||||
/* Emit some HTML saying whether the signature was cool.
|
||||
But don't emit anything if in FO_QUOTE_MESSAGE mode.
|
||||
|
@ -595,17 +573,17 @@ MimeMultipartSigned_emit_child (MimeObject *obj)
|
|||
obj->options->write_html_p &&
|
||||
obj->options->output_fn &&
|
||||
obj->options->headers != MimeHeadersCitation &&
|
||||
sig->crypto_closure)
|
||||
sig->bigfun_closure)
|
||||
{
|
||||
char *html = (((MimeMultipartSignedClass *) obj->class)
|
||||
->crypto_generate_html (sig->crypto_closure));
|
||||
->bigfun_generate_html (sig->bigfun_closure));
|
||||
if (!html) return -1; /* MK_OUT_OF_MEMORY? */
|
||||
|
||||
status = MimeObject_write(obj, html, XP_STRLEN(html), FALSE);
|
||||
XP_FREE(html);
|
||||
if (status < 0) return status;
|
||||
|
||||
/* Now that we have written out the crypto stamp, the outermost header
|
||||
/* Now that we have written out the bigfun stamp, the outermost header
|
||||
block is well and truly closed. If this is in fact the outermost
|
||||
message, then run the post_header_html_fn now.
|
||||
*/
|
||||
|
|
|
@ -28,63 +28,63 @@
|
|||
#include "mimeenc.h"
|
||||
|
||||
/* The MimeMultipartSigned class implements the multipart/signed MIME
|
||||
container, which provides a general method of associating a cryptographic
|
||||
container, which provides a general method of associating a bigfun
|
||||
signature to an arbitrary MIME object.
|
||||
|
||||
The MimeMultipartSigned class provides the following methods:
|
||||
|
||||
void *crypto_init (MimeObject *multipart_object)
|
||||
void *bigfun_init (MimeObject *multipart_object)
|
||||
|
||||
This is called with the object, the object->headers of which should be
|
||||
used to initialize the decryption engine. NULL indicates failure;
|
||||
otherwise, an opaque closure object should be returned.
|
||||
|
||||
int crypto_data_hash (char *data, int32 data_size,
|
||||
void *crypto_closure)
|
||||
int bigfun_data_hash (char *data, int32 data_size,
|
||||
void *bigfun_closure)
|
||||
|
||||
This is called with the raw data, for which a signature has been computed.
|
||||
The crypto module should examine this, and compute a signature for it.
|
||||
The bigfun module should examine this, and compute a signature for it.
|
||||
|
||||
int crypto_data_eof (void *crypto_closure, XP_Bool abort_p)
|
||||
int bigfun_data_eof (void *bigfun_closure, XP_Bool abort_p)
|
||||
|
||||
This is called when no more data remains. If `abort_p' is true, then the
|
||||
crypto module may choose to discard any data rather than processing it,
|
||||
bigfun module may choose to discard any data rather than processing it,
|
||||
as we're terminating abnormally.
|
||||
|
||||
int crypto_signature_init (void *crypto_closure,
|
||||
int bigfun_signature_init (void *bigfun_closure,
|
||||
MimeObject *multipart_object,
|
||||
MimeHeaders *signature_hdrs)
|
||||
|
||||
This is called after crypto_data_eof() and just before the first call to
|
||||
crypto_signature_hash(). The crypto module may wish to do some
|
||||
This is called after bigfun_data_eof() and just before the first call to
|
||||
bigfun_signature_hash(). The bigfun module may wish to do some
|
||||
initialization here, or may wish to examine the actual headers of the
|
||||
signature object itself.
|
||||
|
||||
int crypto_signature_hash (char *data, int32 data_size,
|
||||
void *crypto_closure)
|
||||
int bigfun_signature_hash (char *data, int32 data_size,
|
||||
void *bigfun_closure)
|
||||
|
||||
This is called with the raw data of the detached signature block. It will
|
||||
be called after crypto_data_eof() has been called to signify the end of
|
||||
be called after bigfun_data_eof() has been called to signify the end of
|
||||
the data which is signed. This data is the data of the signature itself.
|
||||
|
||||
int crypto_signature_eof (void *crypto_closure, XP_Bool abort_p)
|
||||
int bigfun_signature_eof (void *bigfun_closure, XP_Bool abort_p)
|
||||
|
||||
This is called when no more signature data remains. If `abort_p' is true,
|
||||
then the crypto module may choose to discard any data rather than
|
||||
then the bigfun module may choose to discard any data rather than
|
||||
processing it, as we're terminating abnormally.
|
||||
|
||||
char * crypto_generate_html (void *crypto_closure)
|
||||
char * bigfun_generate_html (void *bigfun_closure)
|
||||
|
||||
This is called after `crypto_signature_eof' but before `crypto_free'.
|
||||
The crypto module should return a newly-allocated string of HTML code
|
||||
This is called after `bigfun_signature_eof' but before `bigfun_free'.
|
||||
The bigfun module should return a newly-allocated string of HTML code
|
||||
which explains the status of the decryption to the user (whether the
|
||||
signature checks out, etc.)
|
||||
|
||||
void crypto_free (void *crypto_closure)
|
||||
void bigfun_free (void *bigfun_closure)
|
||||
|
||||
This will be called when we're all done, after `crypto_signature_eof' and
|
||||
`crypto_emit_html'. It is intended to free any data represented by the
|
||||
crypto_closure.
|
||||
This will be called when we're all done, after `bigfun_signature_eof' and
|
||||
`bigfun_emit_html'. It is intended to free any data represented by the
|
||||
bigfun_closure.
|
||||
*/
|
||||
|
||||
typedef struct MimeMultipartSignedClass MimeMultipartSignedClass;
|
||||
|
@ -106,23 +106,23 @@ struct MimeMultipartSignedClass {
|
|||
MimeMultipartClass multipart;
|
||||
|
||||
/* Callbacks used by decryption (really, signature verification) module. */
|
||||
void * (*crypto_init) (MimeObject *multipart_object);
|
||||
void * (*bigfun_init) (MimeObject *multipart_object);
|
||||
|
||||
int (*crypto_data_hash) (char *data, int32 data_size,
|
||||
void *crypto_closure);
|
||||
int (*crypto_signature_hash) (char *data, int32 data_size,
|
||||
void *crypto_closure);
|
||||
int (*bigfun_data_hash) (char *data, int32 data_size,
|
||||
void *bigfun_closure);
|
||||
int (*bigfun_signature_hash) (char *data, int32 data_size,
|
||||
void *bigfun_closure);
|
||||
|
||||
int (*crypto_data_eof) (void *crypto_closure, XP_Bool abort_p);
|
||||
int (*crypto_signature_eof) (void *crypto_closure, XP_Bool abort_p);
|
||||
int (*bigfun_data_eof) (void *bigfun_closure, XP_Bool abort_p);
|
||||
int (*bigfun_signature_eof) (void *bigfun_closure, XP_Bool abort_p);
|
||||
|
||||
int (*crypto_signature_init) (void *crypto_closure,
|
||||
int (*bigfun_signature_init) (void *bigfun_closure,
|
||||
MimeObject *multipart_object,
|
||||
MimeHeaders *signature_hdrs);
|
||||
|
||||
char * (*crypto_generate_html) (void *crypto_closure);
|
||||
char * (*bigfun_generate_html) (void *bigfun_closure);
|
||||
|
||||
void (*crypto_free) (void *crypto_closure);
|
||||
void (*bigfun_free) (void *bigfun_closure);
|
||||
};
|
||||
|
||||
extern MimeMultipartSignedClass mimeMultipartSignedClass;
|
||||
|
@ -131,7 +131,7 @@ struct MimeMultipartSigned {
|
|||
MimeMultipart multipart;
|
||||
MimeMultipartSignedParseState state; /* State of parser */
|
||||
|
||||
void *crypto_closure; /* Opaque data used by signature
|
||||
void *bigfun_closure; /* Opaque data used by signature
|
||||
verification module. */
|
||||
|
||||
MimeHeaders *body_hdrs; /* The headers of the signed object. */
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
|
||||
*/
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimemult.h"
|
||||
#include "mime.h"
|
||||
|
||||
|
@ -361,8 +362,7 @@ MimeMultipart_create_child(MimeObject *obj)
|
|||
showIcon = FALSE;
|
||||
else if (XP_STRSTR(body->content_type, "multipart/signed"))
|
||||
showIcon = FALSE;
|
||||
else if (XP_STRSTR(body->content_type, "application/x-pkcs7-signature"))
|
||||
showIcon = FALSE;
|
||||
HG09861
|
||||
else if (XP_STRSTR(body->content_type, "multipart/mixed"))
|
||||
showIcon = FALSE;
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
|
||||
*/
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimeobj.h"
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
Created: Jamie Zawinski <jwz@netscape.com>, 24-Sep-96.
|
||||
*/
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimepbuf.h"
|
||||
#include "xp_file.h"
|
||||
|
||||
|
|
|
@ -37,17 +37,9 @@
|
|||
until it finds a part which cannot be displayed; and then it displays
|
||||
the *previous* part (the last which *could* be displayed.) This code
|
||||
is used to hold the previous part until it is needed.
|
||||
*/
|
||||
|
||||
= The S/MIME code (both MimeEncryptedPKCS7 and MimeMultipartSignedPKCS7)
|
||||
use this code to delay presenting an object to the user until its
|
||||
signature has been verified. The signature cannot be completely verified
|
||||
by the underlying crypto code until the entire object has been read;
|
||||
however, it would be wrong to present a signed object to the user without
|
||||
first knowing whether the signature is correct (in other words, we want
|
||||
to present the "signature matches" or "signature does not match" blurb to
|
||||
the user *before* we show them the object which has been signed, rather
|
||||
than *after*.)
|
||||
*/
|
||||
HG89321
|
||||
|
||||
/* An opaque object used to represent the buffered data.
|
||||
*/
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
*/
|
||||
|
||||
#include "xp.h"
|
||||
#include "rosetta.h"
|
||||
|
||||
|
||||
#ifndef XP_UNIX
|
||||
|
@ -430,9 +431,8 @@ NET_URL_Type (CONST char *URL)
|
|||
switch(*URL) {
|
||||
case 'a':
|
||||
case 'A':
|
||||
if(!strncasecomp(URL,"about:security", 14))
|
||||
return(SECURITY_TYPE_URL);
|
||||
else if(!strncasecomp(URL,"about:",6))
|
||||
HG82921
|
||||
if(!strncasecomp(URL,"about:",6))
|
||||
return(ABOUT_TYPE_URL);
|
||||
break;
|
||||
case 'f':
|
||||
|
@ -468,8 +468,7 @@ NET_URL_Type (CONST char *URL)
|
|||
return(HTML_DIALOG_HANDLER_TYPE_URL);
|
||||
else if(!strncasecomp(URL,"internal-panel-handler",22))
|
||||
return(HTML_PANEL_HANDLER_TYPE_URL);
|
||||
else if(!strncasecomp(URL,"internal-security-",18))
|
||||
return(INTERNAL_SECLIB_TYPE_URL);
|
||||
HG87988
|
||||
break;
|
||||
case 'j':
|
||||
case 'J':
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
|
||||
*/
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimesun.h"
|
||||
|
||||
#define MIME_SUPERCLASS mimeMultipartClass
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
|
||||
*/
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimetenr.h"
|
||||
|
||||
/* All the magic for this class is in mimetric.c; since text/enriched and
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
|
||||
*/
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimetext.h"
|
||||
#include "libi18n.h"
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
|
||||
*/
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimethtm.h"
|
||||
|
||||
#define MIME_SUPERCLASS mimeInlineTextClass
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
|
||||
*/
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimetpla.h"
|
||||
|
||||
#define MIME_SUPERCLASS mimeInlineTextClass
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
|
||||
*/
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimetric.h"
|
||||
|
||||
#define MIME_SUPERCLASS mimeInlineTextClass
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
|
||||
*/
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimeunty.h"
|
||||
|
||||
#define MIME_SUPERCLASS mimeContainerClass
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
/* mimevcrd.c --- definition of the MimeInlineTextVCard class (see mimei.h)
|
||||
*/
|
||||
|
||||
#include "rosetta.h"
|
||||
#include "mimevcrd.h"
|
||||
#include "xpgetstr.h"
|
||||
#include "xp_core.h"
|
||||
|
|
Загрузка…
Ссылка в новой задаче