Bug 400921 - OOPS: reading non-root config file
OOPS: reading non-root config file
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: vsftpd (Show other bugs)
5.0
All Linux
low Severity high
: ---
: ---
Assigned To: Martin Nagy
: Patch
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-11-27 08:09 EST by Luigi Iotti
Modified: 2016-07-26 19:46 EDT (History)
1 user (show)

See Also:
Fixed In Version: RHSA-2008-0295
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-05-21 10:16:56 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
CVS patch (4.23 KB, patch)
2007-11-28 05:19 EST, Martin Nagy
no flags Details | Diff

  None (edit)
Description Luigi Iotti 2007-11-27 08:09:48 EST
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");
    }
  }
Comment 1 Martin Nagy 2007-11-28 05:19:18 EST
Created attachment 271151 [details]
CVS patch

Thanks Luigi, I reviewed your code and you are right.
Comment 2 RHEL Product and Program Management 2007-12-03 15:48:04 EST
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.
Comment 3 Martin Nagy 2007-12-04 07:31:59 EST
Fixed in fedora/rawhide (vsftpd-2.0.5-21.fc9).
Comment 4 Martin Nagy 2007-12-06 15:40:17 EST
Re-proposing for 5.2 since vsftpd was approved for 5.2.
Comment 5 RHEL Product and Program Management 2007-12-06 15:45:39 EST
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.
Comment 6 Nalin Dahyabhai 2007-12-06 15:56:48 EST
Re-proposing again, because vsftpd _is_ on the list of things we plan to update.
Comment 7 RHEL Product and Program Management 2007-12-06 16:04:32 EST
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.
Comment 8 RHEL Product and Program Management 2007-12-07 10:34:21 EST
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.
Comment 10 Martin Nagy 2007-12-12 02:54:34 EST
This issue will be fixed in: vsftpd-2.0.5-10.el5
Comment 11 Martin Nagy 2007-12-12 05:08:55 EST
Correction:
This will be fixed in vsftpd-2.0.5-11.el5
Comment 15 errata-xmlrpc 2008-05-21 10:16:56 EDT
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

Note You need to log in before you can comment on or make changes to this bug.