1
0
mirror of https://github.com/InfrastructureServices/vsftpd.git synced 2025-04-19 01:24:02 +03:00

Updated to v2.3.1

This commit is contained in:
Dag Wieers 2010-08-19 00:00:00 +02:00
parent 12626ed616
commit 62085e211e
7 changed files with 29 additions and 31 deletions

View File

@ -1234,3 +1234,9 @@ fixups.
At this point: v2.3.0 released!
===============================
- Fix silly regression re: log files being overwritten from the start.
- Rename a few file-open functions to make it clearer what they do.
At this point: v2.3.1 released!
===============================

View File

@ -41,7 +41,7 @@ vsf_log_init(struct vsf_session* p_sess)
}
if (tunable_dual_log_enable || tunable_xferlog_std_format)
{
retval = vsf_sysutil_create_or_open_file(tunable_xferlog_file, 0600);
retval = vsf_sysutil_create_or_open_file_append(tunable_xferlog_file, 0600);
if (vsf_sysutil_retval_is_error(retval))
{
die2("failed to open xferlog log file:", tunable_xferlog_file);
@ -52,7 +52,8 @@ vsf_log_init(struct vsf_session* p_sess)
{
if (!tunable_syslog_enable)
{
retval = vsf_sysutil_create_or_open_file(tunable_vsftpd_log_file, 0600);
retval = vsf_sysutil_create_or_open_file_append(tunable_vsftpd_log_file,
0600);
if (vsf_sysutil_retval_is_error(retval))
{
die2("failed to open vsftpd log file:", tunable_vsftpd_log_file);

View File

@ -1026,12 +1026,12 @@ handle_upload_common(struct vsf_session* p_sess, int is_append, int is_unique)
*/
if (is_unique || (p_sess->is_anonymous && !tunable_anon_other_write_enable))
{
new_file_fd = str_create(p_filename);
new_file_fd = str_create_exclusive(p_filename);
}
else
{
/* For non-anonymous, allow open() to overwrite or append existing files */
new_file_fd = str_create_append(p_filename);
new_file_fd = str_create(p_filename);
if (!is_append && offset == 0)
{
do_truncate = 1;

View File

@ -99,20 +99,14 @@ str_lstat(const struct mystr* p_str, struct vsf_sysutil_statbuf** p_ptr)
return vsf_sysutil_lstat(str_getbuf(p_str), p_ptr);
}
int
str_create_exclusive(const struct mystr* p_str)
{
return vsf_sysutil_create_file_exclusive(str_getbuf(p_str));
}
int
str_create(const struct mystr* p_str)
{
return vsf_sysutil_create_file(str_getbuf(p_str));
}
int
str_create_overwrite(const struct mystr* p_str)
{
return vsf_sysutil_create_overwrite_file(str_getbuf(p_str));
}
int
str_create_append(const struct mystr* p_str)
{
return vsf_sysutil_create_or_open_file(
str_getbuf(p_str), tunable_file_open_mode);

View File

@ -21,9 +21,8 @@ enum EVSFSysStrOpenMode
kVSFSysStrOpenReadOnly = 1
};
int str_open(const struct mystr* p_str, const enum EVSFSysStrOpenMode mode);
int str_create_append(const struct mystr* p_str);
int str_create(const struct mystr* p_str);
int str_create_overwrite(const struct mystr* p_str);
int str_create_exclusive(const struct mystr* p_str);
int str_chmod(const struct mystr* p_str, unsigned int mode);
int str_stat(const struct mystr* p_str, struct vsf_sysutil_statbuf** p_ptr);
int str_lstat(const struct mystr* p_str, struct vsf_sysutil_statbuf** p_ptr);

View File

@ -1176,27 +1176,26 @@ vsf_sysutil_open_file(const char* p_filename,
}
int
vsf_sysutil_create_file(const char* p_filename)
vsf_sysutil_create_file_exclusive(const char* p_filename)
{
/* umask() also contributes to end mode */
return open(p_filename, O_CREAT | O_EXCL | O_WRONLY | O_APPEND,
tunable_file_open_mode);
}
int
vsf_sysutil_create_overwrite_file(const char* p_filename)
{
return open(p_filename, O_CREAT | O_TRUNC | O_WRONLY |
O_APPEND | O_NONBLOCK,
tunable_file_open_mode);
}
int
vsf_sysutil_create_or_open_file(const char* p_filename, unsigned int mode)
{
return open(p_filename, O_CREAT | O_WRONLY | O_NONBLOCK, mode);
}
int
vsf_sysutil_create_or_open_file_append(const char* p_filename,
unsigned int mode)
{
return open(p_filename, O_CREAT | O_WRONLY | O_NONBLOCK | O_APPEND, mode);
}
void
vsf_sysutil_dupfd2(int old_fd, int new_fd)
{

View File

@ -82,11 +82,10 @@ enum EVSFSysUtilOpenMode
int vsf_sysutil_open_file(const char* p_filename,
const enum EVSFSysUtilOpenMode);
/* Fails if file already exists */
int vsf_sysutil_create_file(const char* p_filename);
/* Overwrites if file already exists */
int vsf_sysutil_create_overwrite_file(const char* p_filename);
int vsf_sysutil_create_file_exclusive(const char* p_filename);
/* Creates file or appends if already exists */
int vsf_sysutil_create_append_file(const char* p_filename);
int vsf_sysutil_create_or_open_file_append(const char* p_filename,
unsigned int mode);
/* Creates or appends */
int vsf_sysutil_create_or_open_file(const char* p_filename, unsigned int mode);
void vsf_sysutil_dupfd2(int old_fd, int new_fd);