[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] tools: make virt-pki-validate work with acls and xattrs



Hello,

I find parsing the output of "ls -l" very suspect and fragile, since its 
output heaviely depends on the environment: SELinux, ACLs, locale.
Perhaps using /usr/bin/stat would be better, but I don't know how 
available /usr/bin/stat" is on non-Linux-platforms (on my Debian system it's 
in coreutils).

On Thursday 31 May 2012 11:02:51 Martin Kletzander wrote:
> diff --git a/tools/virt-pki-validate.in b/tools/virt-pki-validate.in
> index 01825d1..4164758 100755
> --- a/tools/virt-pki-validate.in
> +++ b/tools/virt-pki-validate.in
>              OWN=`ls -l "$LIBVIRTP/clientkey.pem" | awk '{ print $3 }'`
OWN=`stat -c %U "$LIBVIRTP/clientkey.pem"`

> -            MOD=`ls -l "$LIBVIRTP/clientkey.pem" | awk '{ print $1 }'`
> +            # The substr($1, 1, 10) gets rid of acl and xattr markers
> +            MOD=`ls -l "$LIBVIRTP/clientkey.pem" | awk '{ print substr($1, 
1, 10) }'`
MOD=`stat -c %s "$LIBVIRTP/clientkey.pem"`

Sincerely
Philipp
-- 
Philipp Hahn           Open Source Software Engineer      hahn univention de
Univention GmbH        be open.                       fon: +49 421 22 232- 0
Mary-Somerville-Str.1  D-28359 Bremen                 fax: +49 421 22 232-99
                                                   http://www.univention.de/

Attachment: signature.asc
Description: This is a digitally signed message part.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]