bug-coreutils
[Top][All Lists]
Advanced

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

bug#10305: coreutils-8.21, some changes needed


From: Joachim Schmitz
Subject: bug#10305: coreutils-8.21, some changes needed
Date: Tue, 19 Feb 2013 11:54:00 +0100

> From: Pádraig Brady [mailto:address@hidden
> Sent: Tuesday, February 19, 2013 11:29 AM
> To: Joachim Schmitz
> Cc: address@hidden; address@hidden
> Subject: Re: bug#10305: coreutils-8.21, some changes needed
> 
> On 02/19/2013 09:08 AM, Joachim Schmitz wrote:
> >> -----Original Message-----
> >> From: Joachim Schmitz [mailto:address@hidden
> >> Sent: Tuesday, February 19, 2013 9:18 AM
> >> To: 'address@hidden'; 'address@hidden'
> >> Subject: coreutils-8.21, some changes needed
> >>
> >> Hi folks
> >>
> >> In an attempt to port coreutils 8.21 to HP-NonStop I stumbled accross a 
> >> couple problems, here are my fixes to them:
> >>
> >> Here another file needs to get adjusted to using the new root-uid.h
> >>
> >> diff -EBbu ./src/copy.c.orig ./src/copy.c
> >> --- ./src/copy.c.orig   2013-02-07 03:37:05 -0600
> >> +++ ./src/copy.c        2013-02-18 09:29:22 -0600
> >> @@ -51,6 +51,7 @@
> >>   #include "ignore-value.h"
> >>   #include "ioblksize.h"
> >>   #include "quote.h"
> >> +#include "root-uid.h"
> >>   #include "same.h"
> >>   #include "savedir.h"
> >>   #include "stat-size.h"
> >> @@ -1127,7 +1128,7 @@
> >>       {
> >>         bool access_changed = false;
> >>
> >> -      if (!(sb.st_mode & S_IWUSR) && geteuid () != 0)
> >> +      if (!(sb.st_mode & S_IWUSR) && geteuid () != ROOT_UID)
> >>           access_changed = fchmod_or_lchmod (dest_desc, dst_name, 0600) == 
> >> 0;
> >>
> >>         if (!copy_attr (src_name, source_desc, dst_name, dest_desc, x)
> >> @@ -2718,7 +2719,7 @@
> >>       priv_freeset (pset);
> >>     }
> >>   #else
> >> -  x->chown_privileges = x->owner_privileges = (geteuid () == 0);
> >> +  x->chown_privileges = x->owner_privileges = (geteuid () == ROOT_UID);
> >>   #endif
> >>   }
> 
> I'll apply this in your name.

Thanks

> >> On HP-NonStop we use  0x80000000 instead of -1 for getuid(), getgid() and 
> >> friends to indicate NO_UID rsp. NO_GID
> >> Guess that difference could go into gnulibs root-uid.h?

Additional info, here's what the manual says:

     RETURN VALUES
          The getuid() function returns the requested user ID. It is
          always successful.

          When the authentication information for a process is
          uninitialized, the "uninitialized" user ID (hexadecimal
          80000000) is returned.

So it not exactly NO_UID, but close enough? 
(and similar for getgid().
 
> You could wrap get[gu]id() to return -1 in that case,
> or alternatively define NO_UID and NO_GID in root-uid.h
> and use that everywhere. Probably the easiest approach
> for coreutils at least since it already users NO_GID since:
> http://bugs.gnu.org/10021

That's why I think it to be best suited there

> Though I note that root-uid.h would be an inaccurate
> name if we did that.

Well, yes, but does this matter a lot? It is about mapping a userid after all.
 
> BTW, Is 0 a valid "non root" user id on nonstop?

It is. Sort of 'nobody' in the rest of the UNIX world

> If not then we could use the wrapper approach to
> hide the ROOT_UID issue also.

I thought about this a long time, but couldn't come up with a 'water proof' 
method.
And after all we're dealing with a system's security here, so better stay on 
the safe side...

> In the meantime we should at least document these differences
> in gnulib in doc/posix-functions/getuid.texi.
> 
> >> Such a change would affect coreutils in 
> >> ...src/{groups,id,install,test,whoami}.c (in addition to root-uid.h of 
> >> course)
> >>
> 
> >> Here two trailing _ seem missing?
> >>
> >> diff -EBbu ./src/numfmt.c.orig ./src/numfmt.c
> >> --- ./src/numfmt.c.orig 2013-02-14 08:49:30 -0600
> >> +++ ./src/numfmt.c      2013-02-18 10:58:27 -0600
> >> @@ -1195,7 +1195,7 @@
> >>      Returns a pointer to the *delimiter* of the requested field,
> >>      or a pointer to NUL (if reached the end of the string).  */
> >>   static inline char *
> >> -__attribute ((pure))
> >> +__attribute__ ((pure))
> 
> Oops. I'll fix this up with a more extensive patch in coreutils.
> 
> Thanks,
> Pádraig.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]