Description of problem: Thi is basically the re-edition on RHEL5 of bug# 241725. when specifying the 'user_config_dir' directive in vsftpd.conf, vsftpd will fail when there is no user config file in the specified directory. Version-Release number of selected component (if applicable): vsftpd-2.0.5-10.el5 How reproducible: almost always (see description below) Steps to Reproduce: 1. install vsftpd 2. add line to vsftpd.conf: user_config_dir=/etc/vsftpd/user_conf 3. login as a local or anonymous user without creating a config file for the user Actual results: 500 OOPS: reading non-root config file Expected results: should be able to login even when user config file for a specific user doesn't exist (i.e. user config files should not be mandatory for all users when enabled) Additional info: touch a file in user_config_dir with the name of the ftp user to workaround this issue In twoprocess.c, we have the lines of code: retval = str_stat(&filename_str, &p_statbuf); /* Security - die unless owned by root */ if (!vsf_sysutil_retval_is_error(retval) && vsf_sysutil_statbuf_get_uid(p_statbuf) == VSFTP_ROOT_UID) { vsf_parseconf_load_file(str_getbuf(&filename_str), 1); } else if (vsf_sysutil_statbuf_get_uid(p_statbuf) != VSFTP_ROOT_UID) { die("reading non-root config file"); } If the file does not exist, the "else if" branch is taken and the test if (vsf_sysutil_statbuf_get_uid(p_statbuf) != VSFTP_ROOT_UID) is performed. But when the file does not exist, the whole structure pointed by p_statbuf has uncertain content. I think that the value of retval should be again chacked, to be sure that we're referring to a struct with valid data in it: comparing the UID of a non-existent file is a nonsense. When I make tests, most of the time ftp access fails, but sometimes it does not. I think this is due to the fact that when the user config file does not exist, p_statbuf points to random data, so sometimes the test yelds true. I think that the above code should be something like (please review the code): retval = str_stat(&filename_str, &p_statbuf); /* Security - die unless owned by root */ if (!vsf_sysutil_retval_is_error(retval)) { if (vsf_sysutil_statbuf_get_uid(p_statbuf) == VSFTP_ROOT_UID) { vsf_parseconf_load_file(str_getbuf(&filename_str), 1); } else { die("reading non-root config file"); } }
Created attachment 271151 [details] CVS patch Thanks Luigi, I reviewed your code and you are right.
This request was evaluated by Red Hat Product Management for inclusion, but this component is not scheduled to be updated in the current Red Hat Enterprise Linux release. This request will be reviewed for a future Red Hat Enterprise Linux release.
Fixed in fedora/rawhide (vsftpd-2.0.5-21.fc9).
Re-proposing for 5.2 since vsftpd was approved for 5.2.
Re-proposing again, because vsftpd _is_ on the list of things we plan to update.
This request was evaluated by Red Hat Product Management for inclusion in a Red Hat Enterprise Linux maintenance release. Product Management has requested further review of this request by Red Hat Engineering, for potential inclusion in a Red Hat Enterprise Linux Update release for currently deployed products. This request is not yet committed for inclusion in an Update release.
This issue will be fixed in: vsftpd-2.0.5-10.el5
Correction: This will be fixed in vsftpd-2.0.5-11.el5
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on the solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHSA-2008-0295.html