On miƩ, 2016-02-10 at 17:28 -0600, Rob Landley wrote: > > On 02/08/2016 06:45 PM, Alejandro Joya wrote: > > The current state only print question mark for all the cases, this > > would > > let in case of LSM Smack to show the labels. > > > > Signed-off-by: Alejandro Joya <[email protected]> > > --- > > toys/posix/ls.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/toys/posix/ls.c b/toys/posix/ls.c > > index 08ae695..982bc9f 100644 > > --- a/toys/posix/ls.c > > +++ b/toys/posix/ls.c > > @@ -187,7 +187,6 @@ static int filter(struct dirtree *new) > > > > if (flags & FLAG_Z) { > > if (!CFG_TOYBOX_LSM_NONE) { > > - > > // (Wouldn't it be nice if the lsm functions worked like > > openat(), > > // fchmodat(), mknodat(), readlinkat() so we could do this > > without > > // even O_PATH? But no, this is 1990's tech.) > > @@ -207,6 +206,9 @@ static int filter(struct dirtree *new) > > > > sprintf(hack, "/proc/self/fd/%d", fd); > > lsm_lget_context(hack, (char **)&new->extra); > > + if(CFG_TOYBOX_SMACK){ > > + lsm_lget_context(new->name, (char **)&new->extra); > > + } > > new->name is relative to the openat() dirfd. Try ls -ZR and see if > you > get -Z in subdirectories? (That's what the hack was about, see the > comment in the first hunk...) I guess it works properly see the output down. root@qemux86:~# ls -lashZR .: total 8.0K 2 drwxr-xr-x 3 root root _ 1.0K 2016-02-11 16:37 . 2 drwxr-xr-x 3 root root _ 1.0K 2016-02-08 23:50 .. 4 -rw------- 1 root root User 282 2016-02-11 16:37 .ash_history 4 drwxr-xr-x 2 root root User 1.0K 2016-02-11 16:37 dir_a 2 -rw-r--r-- 1 root root User 0 2016-02-11 16:36 file_a 2 -rw-r--r-- 1 root root User 0 2016-02-11 16:36 file_b
./dir_a: total 5.0K 4 drwxr-xr-x 2 root root _ 1.0K 2016-02-11 16:37 . 2 drwxr-xr-x 3 root root _ 1.0K 2016-02-11 16:37 .. 2 -rw-r--r-- 1 root root User 0 2016-02-11 16:37 file_a1 2 -rw-r--r-- 1 root root User 0 2016-02-11 16:37 file_a2 root@qemux86:~# ls -lashZR dir_a/ dir_a/: total 5.0K 4 drwxr-xr-x 2 root root _ 1.0K 2016-02-11 16:37 . 2 drwxr-xr-x 3 root root _ 1.0K 2016-02-11 16:37 .. 2 -rw-r--r-- 1 root root User 0 2016-02-11 16:37 file_a1 2 -rw-r--r-- 1 root root User 0 2016-02-11 16:37 file_a2 > > Rob > _______________________________________________ > Toybox mailing list > [email protected] > http://lists.landley.net/listinfo.cgi/toybox-landley.net _______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
