Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ripMIME: general

ripMIME decoding of ISO encoded filenames

 

 

ripMIME general RSS feed   Index | Next | Previous | View Threaded


pldaniels at pldaniels

Jan 24, 2003, 1:16 AM

Post #1 of 6 (1841 views)
Permalink
ripMIME decoding of ISO encoded filenames

Good day all,

I have uploaded ( not linked yet ) the latest ripMIME subversion to:

http://www.pldaniels.com/ripmime/ripmime-1.2.16.23.tar.gz

It should resolve a number of issues with high-ASCII chars in the filenames ( I finally read the RFC's a bit more about the decoding process of filenames ).

Additionally I have altered some of the internal function names ( not really of matter to people as I don't know of anyone directly using the internal function calls ).

I've also deprecated the use of --no_paranoid and rather provided the opposing --paranoid parameter. The reason for this is beacause previously the default setting was to strip out any high-ASCII characters, hence rendering most of the non US char to underscores by default.

Anyhow, if some people can test this new release for me ( Im obviously testing myself too ) I'd greatly appreciate some feedback. If this all goes well, I'll actually release it as 1.2.17.0 ( finally !!! ).

Regards.

--
Paul L Daniels http://www.pldaniels.com
Linux/Unix systems Internet Development
ICQ#103642862,AOL:cinflex,IRC:inflex
A.B.N. 19 500 721 806


cph at oce

Jan 24, 2003, 10:49 AM

Post #2 of 6 (1819 views)
Permalink
RE: ripMIME decoding of ISO encoded filenames [In reply to]

Hi Paul,

I sent a patch a while back to fix a couple of problems I was having, and I
noticed the section of code in this new release still has the same problem.
The original patch I sent still applies, with an offset, so I have attached
it and the original message below.

Also, I get a warning when compiling 1.2.16.23:
mime.c: In function `MIME_decode_ISO':
mime.c:1061: warning: `encoding_type' might be used uninitialized in this
function
I'm sure it's nothing to worry about, but I thought I'd let you know.
Let me know if you need any more details about my system.

Chris Hine


-----Original Message-----
From: Hine,Chris [mailto:cph [at] oce]
Sent: 19 November 2002 18:19
To: ripmime-general [at] pldaniels
Subject: RE: [Ripmime-general] problem with mht files


> I discovered a problem with ripmime recusively decoding emails
> containing an mht file that had a space in the name.
> It renamed the file correctly, replacing the space with _, but
> passed the original filename to be decoded.
>
> Attached should be a patch against ripmime-1.2.16.21/mime.c
> which seems to fix the problem here.
>
> Let me know if I've done anything stupid.
> Chris Hine

I just noticed in the same section of code there is a print to
stdout which causes a problem with qmail-scanner.

Attached should be an updated patch which fixes that as well.
Chris Hine
Attachments: mht-fix.patch (0.66 KB)


pldaniels at pldaniels

Jan 24, 2003, 3:37 PM

Post #3 of 6 (1779 views)
Permalink
Re: ripMIME decoding of ISO encoded filenames [In reply to]

> I sent a patch a while back to fix a couple of problems I was having,
> and I noticed the section of code in this new release still has the same
> problem. The original patch I sent still applies, with an offset, so I
> have attached it and the original message below.

Chris, can you resend those patches? I've scoured through my email here and can't seem to find them ( Must be my day of losing things ).

By the way, this isn't yet an official release ;-) So I'll put those in.


> mime.c:1061: warning: `encoding_type' might be used uninitialized in
> this function

Hrmm... rather strange, what compiler are you using?

I say strange because nothing comes up on my compiler here. I like to remove all possible warnings from the compiling of my source code.

Regards.

--
Paul L Daniels http://www.pldaniels.com
Linux/Unix systems Internet Development
ICQ#103642862,AOL:cinflex,IRC:inflex
A.B.N. 19 500 721 806


cph at oce

Jan 25, 2003, 10:33 AM

Post #4 of 6 (1794 views)
Permalink
RE: ripMIME decoding of ISO encoded filenames [In reply to]

> Chris, can you resend those patches? I've scoured through my
> email here and can't seem to find them ( Must be my day of
> losing things ).
Ok, it appears that you might not have received the patch which I attached
to the previous message.
I'll include it inline below:
--- ripmime-1.2.16.21-orig/mime.c Tue Nov 12 03:05:26 2002
+++ ripmime-1.2.16.21/mime.c Tue Nov 19 18:09:12 2002
@@ -2411,8 +2411,8 @@

if ( (result != -1) && (
(strstr(hinfo->filename,".mht"))||(strstr(hinfo->name,".mht"))) )
{
- fprintf(stdout,"MIME_decode_encoding: Last filename was :
%s\n",hinfo->name);
-
snprintf(hinfo->scratch,sizeof(hinfo->scratch),"%s/%s",unpackdir,hinfo->name
);
+ if (MIME_DNORMAL) fprintf(stdout,"MIME_decode_encoding: Last
filename was : %s\n",hinfo->filename);
+
snprintf(hinfo->scratch,sizeof(hinfo->scratch),"%s/%s",unpackdir,hinfo->file
name);
MIME_unpack( unpackdir, hinfo->scratch,
(hinfo->current_recursion_level+1) );
}

> By the way, this isn't yet an official release ;-) So I'll
> put those in.
Excellent.

> > mime.c:1061: warning: `encoding_type' might be used uninitialized in
> > this function
>
> Hrmm... rather strange, what compiler are you using?
This machine is running Redhat 7.3, kernel 2.4.18, gcc-2.96 and glibc-2.2.5.

When I posted the last email I hadn't tested the new version, other than
compiling it. I've now found a couple of problems.
First, I get a segmentation fault whenever I run ripmime -d with no output
directory specified.

Secondly, I get the following error:
---
MIME_headers:694:MIME_headers.c: In attachment name parsing, was expecting a
'=' in the start of ': cph; local time: sat jan 25 15:20:40
2003; local host: pmweb7.uk1.bibliotech.net; remote host: 193.123.80.2;
referer site: www.postmaster.co.uk
x-complaints-to: administrator [at] postmaster
message-id: <pm.2945.1043508040 [at] pmweb7>

'
---
The message is:
---
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
MIME-Version: 1.0
X-Mailer: MIME-tools 5.41 (Entity 5.404)
From: "Chris Hine" <cph [at] postmaster>
Subject: test
To: cph [at] oce
Date: Sat, 25 Jan 2003 15:20:40 +0000
X-Postmaster: Sent from Postmaster http://www.postmaster.co.uk/, the
world's premier free web-based email service, based in London, England.
X-Postmaster-Trace: Account name: cph; Local time: Sat Jan 25 15:20:40
2003; Local host: pmweb7.uk1.bibliotech.net; Remote host: 10.10.10.10;
Referer site: www.postmaster.co.uk
X-Complaints-To: Administrator [at] postmaster
Message-Id: <PM.2945.1043508040 [at] pmweb7>

test
---
Ripmime does correctly create a textfile0 with just 'test' in it.

If you need any more details, just ask.
Chris


pldaniels at pldaniels

Jan 25, 2003, 7:50 PM

Post #5 of 6 (1798 views)
Permalink
Re: ripMIME decoding of ISO encoded filenames [In reply to]

> Ok, it appears that you might not have received the patch which I
> attached to the previous message.

Got it, has now been applied.



> First, I get a segmentation fault whenever I run ripmime -d with no
> output directory specified.

Okay, I'll have to check this out too.


> Secondly, I get the following error:
> ---
> MIME_headers:694:MIME_headers.c: In attachment name parsing, was
> expecting a'=' in the start of ': cph; local time: sat jan 25 15:20:40
> 2003; local host: pmweb7.uk1.bibliotech.net; remote host:

Looks like I've got a bit more work to do on the filtering of the data.

Currently i'm dealing with a rather wierd mailpack and wondering where i'm going wrong. The BASE64 data has been 'wrapped' so that things are rather interesting to parse ie,

--------------------
Content-Type: image/gif
Content-Transfer-Encoding: base64
Content-Location:
http://www.btinternet.com/~b3ta/femaleorshemale/man.gif

R0lGODlhVgA+AMQAAP/b2/9WVv+qqv+7u/8XF/9oaP+MjP9HR//ExP93d//19f8AAP/5+f+
gv8J
Cf8pKf+bm//T0/+ysv80NP/Ly//h4f/x8f88PP/8/P8FBf/p6f/l5f+Tk//t7f8CAv///yH
BAAA
--------------------

For some reason the BASE64 decoding doesn't seem to generate the right binary data ( although 'file' does report the filetype correct, including the pixel sizes, but the image won't load ). Am now going through the BASE64 decoding routine looking for a glitch.

I'm not sure if this is even a 'valid' BASE64 file, but, I'll suspect for now that it is ( even if strange ).


Regards.




--
Paul L Daniels http://www.pldaniels.com
Linux/Unix systems Internet Development
ICQ#103642862,AOL:cinflex,IRC:inflex
A.B.N. 19 500 721 806


pldaniels at pldaniels

Jan 26, 2003, 12:21 AM

Post #6 of 6 (1778 views)
Permalink
Re: ripMIME decoding of ISO encoded filenames [In reply to]

G'day all,

Hope you're not all fighting the MS-SQL worm.


> > > mime.c:1061: warning: `encoding_type' might be used uninitialized in
> > > this function
> >
> > Hrmm... rather strange, what compiler are you using?

Should be now corrected. It was complaning because I was using the variable based on a condition of another one ( the tokenising ), understandably the compiler could not relate the two.


> First, I get a segmentation fault whenever I run ripmime -d with no
> output directory specified.

I'm still working on that one - I know what's the 'problem', but I need to rewrite the parameter parsing code to rectify it.


> MIME_headers:694:MIME_headers.c: In attachment name parsing, was
> expecting a'=' in the start of ': cph; local time: sat jan 25 15:20:40

Should be all fixed up now.

I think I really need to rewrite my header parsing code at some stage to deal with situations like this more 'cleanly'.


Source code is at (as previously):

http://www.pldaniels.com/ripmime/ripmime-1.2.16.23.tar.gz

Regards.

--
Paul L Daniels http://www.pldaniels.com
Linux/Unix systems Internet Development
ICQ#103642862,AOL:cinflex,IRC:inflex
A.B.N. 19 500 721 806

ripMIME general RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.