Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Nov 1996 09:31:03 +1000 (EST)
From:      Clary Harridge <clary@elec.uq.edu.au>
To:        karpen@ocean.campus.luth.se (Mikael Karpberg)
Cc:        freebsd-security@FreeBSD.org
Subject:   Re: /etc/security
Message-ID:  <199611032331.JAA07164@s4.elec.uq.edu.au>
In-Reply-To: <199611011141.MAA08439@ocean.campus.luth.se> from "Mikael Karpberg" at Nov 1, 96 12:41:41 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> ----
> 
> According to Garrett Wollman:
> > <<On Thu, 31 Oct 1996 08:18:58 +0100, sthaug@nethelp.no said:
> [... on the find job not handling ' characters either ...]
> > >> checking setuid files and devices:
> > >> find: /doscopy/sb16/pro_org/i'vebeen.org: illegal path
> > >> find: /doscopy/sb16/pro_org/she'llbe.org: illegal path
> > 
> > The best way to deal with this is probably using the `-print0' primary
> > to `find' and using a `perl -n0' script to process the results, like:
> > 
> > 	find ..... -print0 | perl -n0e 'exec "/bin/ls", "-lFgod", <>;'
> 
> Would this solve the spaces problem too, and any other eventualities?
> 
It may do but I don't think it is necessary.

The problem is the -X switch of find, why use xargs anyway.

The task of the find is to just ls any suid/sgid files. Why complicate it?

from the find manual page

-X      The -X option is a modification to permit find to be safely used
        in conjunction with xargs(1).  If a file name contains any of the
        delimiting characters used by xargs,  a diagnostic message is
        displayed on standard error, and the file is skipped.  The delim-
        iting characters include single (`` ' '') and double (`` " '')
        quotes, backslash (``\''), space, tab and newline characters.

I read this to say that any suid file with a blank, or other delimiter,
in the name will create an error but be skipped from the output.

For example

s5:/tmp # touch "Name with space"
s5:/tmp # chmod 4777 !$
chmod 4777 "Name with space"
s5:/tmp # ll !$
ll "Name with space"
0 -rwsrwxrwx  1 root  bin  0 Nov  1 09:00 Name with space
s5:/tmp #         find -X . -xdev -type f \
                \( -perm -u+x -or -perm -g+x -or -perm -o+x \) \
                \( -perm -u+s -or -perm -g+s \)
?                 \( -perm -u+x -or -perm -g+x -or -perm -o+x \) \
?                 \( -perm -u+s -or -perm -g+s \)
find: ./Name with space: illegal path
s5:/tmp # 
s5:/tmp #         find . -xdev -type f \
                \( -perm -u+x -or -perm -g+x -or -perm -o+x \) \
                \( -perm -u+s -or -perm -g+s \) -a -exec ls -lgTd {} ";"
?                 \( -perm -u+x -or -perm -g+x -or -perm -o+x \) \
?                 \( -perm -u+s -or -perm -g+s \) -a -exec ls -lgTd {} ";"
-rwsrwxrwx  1 root  bin  0 Nov  1 09:00:04 1996 ./Name with space

So let's keep it simple.

-- 
regards			Dept. of Electrical Engineering,
Clary Harridge		University of Queensland, QLD, Australia, 4072
			Phone: +61-7-3365-3636	Fax:   +61-7-3365-4999
			INTERNET: clary@elec.uq.edu.au



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