glibc + uid ?

V13 v13 at priest.com
Wed Aug 28 03:02:01 EEST 2002


On Wednesday 28 August 2002 01:23, Nikos Mavroyanopoulos wrote:
> On Tue, Aug 27, 2002 at 10:30:58PM +0300, V13 wrote:
> > Mporei na moy eksigisei kapoios an ayto einai sfalma ths glibc h kapoioy
> > alloy?
> > Sto /usr/include/bits/types.h exei:
> > typedef __u_int __uid_t;                /* Type of user identifications. 
> > */ typedef __u_int __gid_t;                /* Type of group
> > identifications.  */ Eno sto man ths chown(2) leei kathara:
> > int chown(const char *path, uid_t owner, gid_t group);
> >
> >        If  the owner or group is specified as -1, then that ID is
> >        not changed.
>
> Είναι λάθος του manual. Επρεπε να αναφέρει όχι -1, αλλά ((uid_t)-1)
> ωστε να μην υπάρχει παρανόηση.

isxyei.. alla.. meta apo mia proxeiri ereyna fanike oti:
(milontas panta gia kernel)

se linux to uid einai unsigned 32bit
se bsd einai signed 32bit
se irix einai signed 32bit
se solaris einai signed 32bit

ta symperasmata dika sas.. apla meta apo kapies dokimes me ton Keramida bgikan 
ta eksis koyfa..

Sto linux panta: mporeis na exeis xristi me uid==(uid_t)-1 kai gid==(gid_t)-1 
alla symbainoyn kapoia paradoksa : (note: UINT_MAX=4294967295)

hell:/$ id
uid=4294967295(test) gid=4294967295 groups=4294967295,4294967294(koko)

hell:/tmp$ touch tata
hell:/tmp$ ls -ln tata
-rw-r--r--    1 4294967295 4294967295        0 Aug 27 23:49 tata
(h ora einai lathos logo timezone toy xristi)

hell:/tmp$ su
hell:/tmp# touch mpompo 
hell:/tmp# chown test mpompo
hell:/tmp# ls -ln mpompo
-rw-r-----    1 0        0               0 Aug 28 02:50 mpompo

ta parapano einai apolyta logika symfona me to unsigned int, to opoio omos 
dixnei na einai lathos ylopoihsh (??????).

ektos apo ayta, sto 
http://www.opengroup.org/onlinepubs/007904975/functions/chown.html
leei to ekseis koyfo:

The value for owner of ( uid_t)-1 allows the use of -1 by the owner of a file 
to change the group ID only. A corresponding change is made for group.

to opoio den mporesame na to apokryptografysoyme.. isos na ftaiei kai h ora..
(prepei na enoei oti o xristis me uid to -1 mporei na alaksei to group se -1, 
pragma to opoio den epalitheyetai sto linux)

<<V13>>

p.s. Perito na po oti gia uid==(uid_t)-2 ola einai mia xara.
p.s.2. kernel 2.4.19



More information about the Linux-greek-users mailing list