Patch for 2.0b2

From: Daniel Stenberg <Daniel.Stenberg_at_sth.frontec.se_at_hypermail-project.org>
Date: Wed, 10 Jun 1998 10:03:06 +0200
Message-ID: <357E3DBA.A12C6736_at_sth.frontec.se>


Hi

I've corrected one bug and added functionality:

This seems to work fine on my tests.

-- 
          Daniel Stenberg  -  Software, Network and Unix
    GSM: +46 - 708 - 31 77 42   http://www.fts.frontec.se/~dast

diff -c hypermail-20b2/src//base64.c hypermail-mymod/src//base64.c
*** hypermail-20b2/src//base64.c Mon Jun 8 05:09:56 1998
--- hypermail-mymod/src//base64.c Wed Jun 10 09:47:23 1998 ***************
*** 48,53 ****
--- 48,56 ---- if (endtext) break; endtext = TRUE; + index--; + if(index<0) + index=3; } else if (ch == '/') ch = 63; Only in hypermail-mymod/src/: base64.c~ Binary files hypermail-20b2/src//base64.o and hypermail-mymod/src//base64.o differ Binary files hypermail-20b2/src//date.o and hypermail-mymod/src//date.o differ Binary files hypermail-20b2/src//file.o and hypermail-mymod/src//file.o differ Binary files hypermail-20b2/src//hypermail and hypermail-mymod/src//hypermail differ Binary files hypermail-20b2/src//hypermail.o and hypermail-mymod/src//hypermail.o differ Binary files hypermail-20b2/src//mem.o and hypermail-mymod/src//mem.o differ diff -c hypermail-20b2/src//parse.c hypermail-mymod/src//parse.c
*** hypermail-20b2/src//parse.c Mon Jun 8 05:09:56 1998
--- hypermail-mymod/src//parse.c Wed Jun 10 10:00:12 1998 ***************
*** 1029,1043 ****
*/ char type[129]; char attachname[129]; char *name; char *file = NULL; name = (char *)strstr(ptr, "name="); if (name) { sscanf(name+6, "%128[^\"]", attachname); name = attachname; } ! /* ** Saving of the attachments is being done inline ** as they are encountered. The directories must --- 1029,1068 ---- */ char type[129]; char attachname[129]; + char checkpath[256]; char *name; char *file = NULL; + char nameisuniq=FALSE; name = (char *)strstr(ptr, "name="); if (name) { sscanf(name+6, "%128[^\"]", attachname); name = attachname; + + /* Check if we can use this attached name for + storing: */ + if(strlen(name) + strlen(dir) <= 254) { + /* yes, we have room in our array */ + struct stat fileinfo; + char alter[2]=""; + int counter='a'; + nameisuniq=TRUE; + do { + sprintf(checkpath, "%s/%s%s", + dir, alter, name); + /* loop while the file exist and try a few + alternative file names before giving up */ + if(counter>='z') { + /* we didn't find a unique file name */ + nameisuniq=FALSE; + break; + } + sprintf(alter, "%c", counter++); + } while(0 == lstat(checkpath, &fileinfo)); + + } } ! /* ** Saving of the attachments is being done inline ** as they are encountered. The directories must ***************
*** 1044,1056 ****
** exist first... */ ! binname = tmpname(dir, "bin"); if (binname) { ! binfile=fopen(binname, "w"); ! file=(char *)strrchr(binname, PATH_SEPARATOR); ! if (file) ! file++; /* pass the separator */ } sscanf(ptr, "%128[^;]", type); --- 1069,1086 ---- ** exist first... */ ! if(!nameisuniq) ! /* get a random name */ ! binname = tmpname(dir, "bin"); ! else ! binname = checkpath; ! if (binname) { ! binfile=fopen(binname, "w"); ! file=(char *)strrchr(binname, PATH_SEPARATOR); ! if (file) ! file++; /* pass the separator */ } sscanf(ptr, "%128[^;]", type); Only in hypermail-mymod/src/: parse.c~ Binary files hypermail-20b2/src//parse.o and hypermail-mymod/src//parse.o differ Binary files hypermail-20b2/src//print.o and hypermail-mymod/src//print.o differ Binary files hypermail-20b2/src//printfile.o and hypermail-mymod/src//printfile.o differ Binary files hypermail-20b2/src//string.o and hypermail-mymod/src//string.o differ Binary files hypermail-20b2/src//struct.o and hypermail-mymod/src//struct.o differ Binary files hypermail-20b2/src//uudecode.o and hypermail-mymod/src//uudecode.o differ

Received on Wed 10 Jun 1998 10:05:52 AM GMT

This archive was generated by hypermail 2.2.0 : Thu 22 Feb 2007 07:33:49 PM GMT GMT