Re: system call for saved uid

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

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, Jul 18, 2007 at 10:44:57PM -0400, Julian TC Bui wrote:
> First of all this is my first post so please be nice if I'm not using 
> proper mailing list etiquette or if I ask a stupid question.
>
> I was wondering if anyone knew of how to retrieve a SAVED UID.  I know that 
> you can set/get a real and effective UID.  I know you can set a SAVED UID, 
> but I do not know how to get a saved uid.  There is no getsuid() sys call.
>
> The getresuid() system call gets the real, effective, and saved UIDs, but 
> doesn't return them - so I'm wondering how to actually access the saved 
> UID.

What do you mean "doesn't return them"? My test program just works:

        rv = getresuid(&ruid, &euid, &suid);
        if(rv < 0) {
                perror("getresuid()");
                return -1;
        }

        printf("ruid %d, euid %d, suid %d\n", ruid, euid, suid);

Which prints:

  ruid 1000, euid 1000, suid 1000

And if I chown root and chmod +s the test program, it prints:

  ruid 1000, euid 0, suid 0

> setresuid() puts the saved uid into current->suid, but I can't access 
> that through user space applications, can I?

No you can't get there directly. Only indirectly through system calls,
and the getresuid() call is the correct way to get current->suid,

> It's possible I'm just missing something fundamental about the UID system. 
> Also, I'm using linux 2.6.16 and really I'm not even sure that this Fedora 
> Core 5 system even uses saved UIDs.

I'm using stock linux 2.6.22 without selinux (which FC enables by
default). It looks like it just works over here, maybe selinux makes
things different?


Erik

- -- 
They're all fools. Don't worry. Darwin may be slow, but he'll
eventually get them. -- Matthew Lammers in alt.sysadmin.recovery
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFGnxRG/PlVHJtIto0RAtJMAJ0eRMY4ETXg79dklgkWjM61yL5LYQCfekJX
QrkSVxdji4jEezOY0zODXrY=
=G98A
-----END PGP SIGNATURE-----

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux