Article delegate-en/13 of [1-5169] on the server localhost:119
  upper oldest olders older1 this newer1 newers latest
search
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]
[Reference:<_A12@delegate-en.ML_>]
Newsgroups: mail-lists.delegate-en

[DeleGate-En] Re: POP3 & Large Messages
07 Aug 1998 22:59:03 GMT ysato@etl.go.jp (Yutaka Sato 佐藤豊)


In message <_A12@delegate-en.ML_> on 08/08/98(06:09:59) I wrote:
 |In message <_A11@delegate-en.ML_> on 08/08/98(04:20:19)
 |you bel <pbmaabdyi-ytjem43ngilr.ml@ml.delegate.org> wrote:
 | |I can't get large message (more then 5 Mbytes) with POP3 Delegate.
 | |Anybody knows what's it?
 | |
 | |P.S.
 | |Delegate 5.6.0, FreeBSD 2.2.5, qpopper 2.4b2
 |
 |Maybe I can help you if you would give us some more information:

Fortunately :-) I could reproduce the problem.
The error was caused because memory could not be allocated for a
buffer to read too large message.  You will be able to reduce the
consumption of memory with enclosed patch for mimekit/mime.c (or
the patched file temporarily placed at
ftp://ftp.etl.go.jp/pub/DeleGate/tmp/mime.c).
Replace the mime.c, remove lib/libmimekit.a if it exists, and do
make.


 |1) detailed log produced by
 |   % delegated -vv -P8110 SERVER=pop://server ...

08/08 06:31:25.86 [14215] 1+0: POP C-S: list^M
08/08 06:31:25.86 [14215] 1+0: POP S-C[4:5]: +OK 1 messages (8949805 octets)^M
08/08 06:31:25.96 [14215] 1+0: POP C-S: retr 1^M
08/08 06:31:25.96 [14215] 1+0: POP S-C[5:3]: +OK 8949805 octets^M
08/08 06:32:17.13 [14215] 1+0: E-A: ABORT: caught SIGSEGV [11]

 |2) stack trace produced by
 |   % gdb delegated delegated.core
 |   (gdb) where
 |   (gdb) quit

(gdb) where
#0  0x20134571 in ?? ()
#1  0x20133de3 in ?? ()
#2  0x17e8 in ?? ()
#3  0xefbfdfdc in ?? ()
#4  0xad4fe in decodeBODYpart ()
#5  0xadca9 in decodeMIMEpart ()
#6  0xae363 in decodeMIME ()
#7  0xaf93f in PGPdecodeMIME ()
#8  0x6f722 in service_pop1 ()
#9  0x6ece1 in service_pop ()
#10 0x239d1 in execSpecialist ()
#11 0x2313a in execGeneralist ()
#12 0x518a in ExecGeneralist ()
#13 0x4f52 in call_client1 ()
#14 0x560d in EXEC_client ()
#15 0x7e2e in forkOnetimeServer ()
#16 0x7c7f in _main ()
#17 0x668d in main ()


Cheers,
Yutaka
--
Yutaka Sato <ysato@etl.go.jp> http://www.etl.go.jp/~ysato/   @ @ 
Computer Science Division, Electrotechnical Laboratory      ( - )
1-1-4 Umezono, Tsukuba, Ibaraki, 305-8568 Japan            _<   >_


*** ../dist/delegate5.6.1/mimekit/mime.c	Thu Jul  2 09:57:39 1998
--- mime.c	Sat Aug  8 07:43:04 1998
***************
*** 418,432 ****
  	int *codep,*lengp;
  {	int rcode;
  	int leng,len1,reqsize;
! 	char *buff;
! 	int bsize;
  
  	rcode = 0;
  	leng = 0;
- 	bsize = 0x2000;
- 
- 	buff = malloc(bsize);
  	buff[0] = 0;
  
  	for(;;){
  		line[0] = 0;
--- 418,431 ----
  	int *codep,*lengp;
  {	int rcode;
  	int leng,len1,reqsize;
! 	char buff[0x10000];
! 	FILE *bfile;
! 	char *tmp;
  
  	rcode = 0;
  	leng = 0;
  	buff[0] = 0;
+ 	bfile = NULL;
  
  	for(;;){
  		line[0] = 0;
***************
*** 437,456 ****
  		}
  		len1 = strlen(line);
  		reqsize = leng + len1 + 1;
! 		if( bsize <= reqsize ){
! 			while( bsize <= reqsize )
! 				bsize = bsize * 2;
! 			buff = realloc(buff,bsize);
! 		}
  		if( rcode = pop_boundary(boundaries,line) )
  			break;
  
! 		strcpy(buff+leng,line);
  		leng += len1;
  	}
  	*lengp = leng;
  	*codep = rcode;
! 	return buff;
  }
  
  #define JBSIZE(leng)	(leng*2+128)
--- 436,468 ----
  		}
  		len1 = strlen(line);
  		reqsize = leng + len1 + 1;
! 
  		if( rcode = pop_boundary(boundaries,line) )
  			break;
  
! 		if( bfile == NULL && sizeof(buff) <= reqsize ){
! 			bfile = TMPFILE("readPart");
! 			fputs(buff,bfile);
! 		}
! 		if( bfile )
! 			fputs(line,bfile);
! 		else	strcpy(buff+leng,line);
  		leng += len1;
  	}
  	*lengp = leng;
  	*codep = rcode;
! 	if( bfile ){
! 		sv1log("### readPart: got large message (%d)\n",leng);
! 		fflush(bfile);
! 		fseek(bfile,0,0);
! 		tmp = malloc(leng+1);
! 		fread(tmp,1,leng,bfile);
! 		tmp[leng] = 0;
! 		fclose(bfile);
! 		return tmp;
! 	}else{
! 		return strdup(buff);
! 	}
  }
  
  #define JBSIZE(leng)	(leng*2+128)
***************
*** 541,546 ****
--- 553,560 ----
  
  	*endline = 0;
  	tmpa = readPart(fs,cache,boundaries,endline,&rcode,&leng);
+ 	if( tmpa == NULL )
+ 		return -1;
  	if( leng == 0 )
  		goto EXIT;
  

  admin search upper oldest olders older1 this newer1 newers latest
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]
@_@V