Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Mar 2001 13:58:50 -0800
From:      Mike Smith <msmith@freebsd.org>
To:        Bill Moran <wmoran@iowna.com>
Cc:        Greg Black <gjb@gbch.net>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: Security problems with access(2)? - off topic 
Message-ID:  <200103312158.f2VLwo301522@mass.dis.org>
In-Reply-To: Your message of "Sat, 31 Mar 2001 17:53:09 EST." <3AC65FD5.F91717BB@iowna.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
> Sorry ... didn't think anyone was interested, and it's off topic, but
> here it is in a nutshell:
> 
> The client I'm working with is moving from a Novell server to a FreeBSD
> server using Samba. They're very unhappy with Samba's behaviour in only
> 1 respect: on the Novell server, files/directories that were not
> readible by the user did not appear in the directory listing. For legacy
> reasons, they have a single shared directory that contains hundreds of
> directories, most of which are not accessibly to the majority of
> groups/users on the system.
> Samba has no option for this that I can find, and I have not been able
> to produce this effect with manipulation of the filesystem permissions.
> So I dug into the source code and found that the code that produces a
> directory listing is relatively simple. It's simply a loop that iterates
> through all the files(directories) in a directory and presents them to
> the client. So, ignoring these files/directories is simply a matter of a
> test for access() at the beginning of the loop that does a "continue" if
> it fails on read access.
> So you see ... this is probably one of the few situations where access()
> is safe, since a mistake in this case does not provide any access the
> object (that's handled later, in a completely seperate block of code)
> 
> If I'm wrong, please feel free to correct me.

This is actually an interesting case.

The canonical answer is that you're wrong, and you should use stat(2) for 
this purpose.

However it's fair to assume that with ACLs entering the picture, 
access(2) may actually given you a better answer.  I would poke the 
TrustedBSD people to be certain about this, though.

-- 
... every activity meets with opposition, everyone who acts has his
rivals and unfortunately opponents also.  But not because people want
to be opponents, rather because the tasks and relationships force
people to take different points of view.  [Dr. Fritz Todt]
           V I C T O R Y   N O T   V E N G E A N C E



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200103312158.f2VLwo301522>