[Home]

Summary:ASTERISK-13318: POST files are not truncated
Reporter:Tim King (timking)Labels:
Date Opened:2009-01-07 11:14:24.000-0600Date Closed:2009-01-13 17:14:30.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/HTTP
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:If you use the POST files facility in 1.6.0.3-rc1 (in pbx/http.c), or 1.6.1-beta4 or the latest revision (in res/res_http_post.c) then the file to be written is opened O_CREAT | O_WRONLY.

Surely this is wrong - don't you mean O_CREAT | O_WRONLY | O_TRUNC ? As it is, replacing a long file with a shorter one ends up with the previous contents on the end.
Comments:By: James Golovich (jamesgolovich) 2009-01-12 17:01:57.000-0600

I can confirm this behavior and that it should be changed.  I can throw a patch together for this but don't believe that should be necessary since it is such a simple change.

I can't imagine why this would be the intended behavior

By: Leif Madsen (lmadsen) 2009-01-13 12:50:25.000-0600

Assigning this to otherwiseguy as svn blame tells me he was the last to modify this, but that could just be because he was the one who moved the file :)

By: Digium Subversion (svnbot) 2009-01-13 17:05:44.000-0600

Repository: asterisk
Revision: 168588

U   trunk/res/res_http_post.c

------------------------------------------------------------------------
r168588 | twilson | 2009-01-13 17:05:44 -0600 (Tue, 13 Jan 2009) | 5 lines

Don't append to a file that already exists on upload

(closes issue ASTERISK-13318)
Reported by: timking

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=168588

By: Digium Subversion (svnbot) 2009-01-13 17:08:40.000-0600

Repository: asterisk
Revision: 168588

U   trunk/res/res_http_post.c

------------------------------------------------------------------------
r168588 | twilson | 2009-01-13 17:05:43 -0600 (Tue, 13 Jan 2009) | 5 lines

Fully overwrite a same-named file when uploading

(closes issue ASTERISK-13318)
Reported by: timking

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=168588

By: Digium Subversion (svnbot) 2009-01-13 17:11:19.000-0600

Repository: asterisk
Revision: 168589

_U  branches/1.6.0/
U   branches/1.6.0/main/http.c

------------------------------------------------------------------------
r168589 | twilson | 2009-01-13 17:11:19 -0600 (Tue, 13 Jan 2009) | 12 lines

Merged revisions 168588 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r168588 | twilson | 2009-01-13 17:05:43 -0600 (Tue, 13 Jan 2009) | 5 lines
 
 Fully overwrite a same-named file when uploading
 
 (closes issue ASTERISK-13318)
 Reported by: timking
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=168589

By: Digium Subversion (svnbot) 2009-01-13 17:14:30.000-0600

Repository: asterisk
Revision: 168590

_U  branches/1.6.1/
U   branches/1.6.1/res/res_http_post.c

------------------------------------------------------------------------
r168590 | twilson | 2009-01-13 17:14:30 -0600 (Tue, 13 Jan 2009) | 12 lines

Merged revisions 168588 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r168588 | twilson | 2009-01-13 17:05:43 -0600 (Tue, 13 Jan 2009) | 5 lines
 
 Fully overwrite a same-named file when uploading
 
 (closes issue ASTERISK-13318)
 Reported by: timking
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=168590