[Toybox] [PATCH] ls: add flag-Z Smack support.

Joya Cruz, Alejandro alejandro.joya.cruz at intel.com
Fri Feb 12 10:55:14 PST 2016


On jue, 2016-02-11 at 14:15 -0600, Rob Landley wrote:
> 
> On 02/11/2016 10:43 AM, Joya Cruz, Alejandro wrote:
> > 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.
> ...
> > > >            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 at 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
> 
> Could you comment out the sprintf and first lsm_lget_context, so I
> can
> be sure the first one isn't succeeding and the second isn't silently
> erroring out and not modifying new->extra at all, leaving the value
> fetched the first time?
yes the hack is working... for some reason at the beginning  it wasn't
working, please disregard this patch...
> 
> Because I really don't see how that lsm_get is figuring out what
> directory to look in.
> 
> Sigh, I need a smack test environment...
> 
> Rob
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net


More information about the Toybox mailing list