Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.unix.programmer > #8209 > unrolled thread
| Started by | spud@potato.field |
|---|---|
| First post | 2016-03-23 15:21 +0000 |
| Last post | 2016-03-24 13:19 +0100 |
| Articles | 18 — 10 participants |
Back to article view | Back to comp.unix.programmer
Getting the saved set uid spud@potato.field - 2016-03-23 15:21 +0000
Re: Getting the saved set uid Philip Guenther <guenther@gmail.com> - 2016-03-23 10:01 -0700
Re: Getting the saved set uid spud@potato.field - 2016-03-24 09:40 +0000
Re: Getting the saved set uid Philip Guenther <guenther@gmail.com> - 2016-03-24 09:10 -0700
Re: Getting the saved set uid spud-u-dont-like@potato.field - 2016-03-25 12:50 +0000
Re: Getting the saved set uid Barry Margolin <barmar@alum.mit.edu> - 2016-03-25 10:28 -0400
Sarcasm in Usenet posts (Was: Getting the saved set uid) gazelle@shell.xmission.com (Kenny McCormack) - 2016-03-25 14:29 +0000
Re: Sarcasm in Usenet posts (Was: Getting the saved set uid) Barry Margolin <barmar@alum.mit.edu> - 2016-03-25 11:49 -0400
Re: Sarcasm in Usenet posts (Was: Getting the saved set uid) Ian Zimmerman <itz@buug.org> - 2016-03-26 09:41 -0700
Re: Sarcasm in Usenet posts (Was: Getting the saved set uid) Philip Guenther <guenther@gmail.com> - 2016-03-25 10:10 -0700
Re: Getting the saved set uid <william@wilbur.25thandClement.com> - 2016-03-24 13:16 -0700
Re: Getting the saved set uid boon <fred900rbc@gmail.com> - 2016-04-01 04:42 -0700
Re: Getting the saved set uid Noob <root@127.0.0.1> - 2016-04-01 19:16 +0200
Re: Getting the saved set uid Barry Margolin <barmar@alum.mit.edu> - 2016-04-01 17:23 -0400
Re: Getting the saved set uid boon <fred900rbc@gmail.com> - 2016-04-01 17:27 -0700
Re: Getting the saved set uid boon <root@127.10.10.1> - 2016-03-24 12:08 +0100
Re: Getting the saved set uid spud@potato.field - 2016-03-24 11:59 +0000
Re: Getting the saved set uid boon <root@127.10.10.1> - 2016-03-24 13:19 +0100
| From | spud@potato.field |
|---|---|
| Date | 2016-03-23 15:21 +0000 |
| Subject | Getting the saved set uid |
| Message-ID | <ncucac$9ke$1@gioia.aioe.org> |
Is there a way in C of getting the current saved set user id (as set by seteuid()) ? -- Spud
[toc] | [next] | [standalone]
| From | Philip Guenther <guenther@gmail.com> |
|---|---|
| Date | 2016-03-23 10:01 -0700 |
| Message-ID | <ed114e77-047a-4c12-804a-6634339ed45f@googlegroups.com> |
| In reply to | #8209 |
On Wednesday, March 23, 2016 at 8:21:55 AM UTC-7, sp...@potato.field wrote:
> Is there a way in C of getting the current saved set user id (as set by
> seteuid()) ?
Does your system have useful manpages? If so, "man -k" (also called "apropos") can be a quick start to these questions:
$ man -k saved
FvwmSaveDesk(1) - another FVWM desktop-layout saving module
gif2rgb(1) - convert images saved as GIF to 24-bit RGB triplets
getresgid, getresuid, setresgid, setresuid(2) - get or set real, effective and saved user or group ID
$ man getresuid
...
SYNOPSIS
#include <sys/types.h>
#include <unistd.h>
int
getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid);
int
getresuid(uid_t *ruid, uid_t *euid, uid_t *suid);
...
The getresgid() and getresuid() calls retrieve the real, effective, and
saved group and user IDs of the current process, respectively.
...
[toc] | [prev] | [next] | [standalone]
| From | spud@potato.field |
|---|---|
| Date | 2016-03-24 09:40 +0000 |
| Message-ID | <nd0cml$1iq6$1@gioia.aioe.org> |
| In reply to | #8211 |
On Wed, 23 Mar 2016 10:01:14 -0700 (PDT) Philip Guenther <guenther@gmail.com> wrote: >On Wednesday, March 23, 2016 at 8:21:55 AM UTC-7, sp...@potato.field wrote: >> Is there a way in C of getting the current saved set user id (as set by >> seteuid()) ? > >Does your system have useful manpages? If so, "man -k" (also called >"apropos") can be a quick start to these questions: $ man getresgid No manual entry for getresgid $ man getresuid No manual entry for getresuid So, hows that sarcasm working out for you? Turns out those functions are non standard. Supported on Linux and hp-ux but thats about it. Not OS/X as you can see above. Are there posix functions that do the same? And yes I have googled already otherwise I wouldn't asking. -- Spud
[toc] | [prev] | [next] | [standalone]
| From | Philip Guenther <guenther@gmail.com> |
|---|---|
| Date | 2016-03-24 09:10 -0700 |
| Message-ID | <ed9e79c7-d27e-4cc7-8b2c-0dac3763cfce@googlegroups.com> |
| In reply to | #8226 |
On Thursday, March 24, 2016 at 2:40:45 AM UTC-7, sp...@potato.field wrote: > On Wed, 23 Mar 2016 10:01:14 -0700 (PDT) > Philip Guenther <guenther@gmail.com> wrote: > >On Wednesday, March 23, 2016 at 8:21:55 AM UTC-7, sp...@potato.field wrote: > >> Is there a way in C of getting the current saved set user id (as set by > >> seteuid()) ? > > > >Does your system have useful manpages? If so, "man -k" (also called > >"apropos") can be a quick start to these questions: > > $ man getresgid > No manual entry for getresgid > $ man getresuid > No manual entry for getresuid > > So, hows that sarcasm working out for you? No sarcasm intended: if you want to know what works on your system, then its own documentation is the place to start. (If you're reacting to the word "useful", well, there have been many systems which completely lacked documentation, or where it was not installed by default, or was completely out of date; a caveat seemed necessary.) > Turns out those functions are non standard. Supported on Linux and hp-ux > but thats about it. Not OS/X as you can see above. > > Are there posix functions that do the same? And yes I have googled already > otherwise I wouldn't asking. Nope, there's nothing in POSIX for doing this. Philip Guenther
[toc] | [prev] | [next] | [standalone]
| From | spud-u-dont-like@potato.field |
|---|---|
| Date | 2016-03-25 12:50 +0000 |
| Message-ID | <BuaJy.88011$bx.57078@fx35.am4> |
| In reply to | #8233 |
On Thu, 24 Mar 2016 09:10:36 -0700 (PDT) Philip Guenther <guenther@gmail.com> wrote: >On Thursday, March 24, 2016 at 2:40:45 AM UTC-7, sp...@potato.field wrote: >> On Wed, 23 Mar 2016 10:01:14 -0700 (PDT) >> Philip Guenther <guenther@gmail.com> wrote: >> >On Wednesday, March 23, 2016 at 8:21:55 AM UTC-7, sp...@potato.field wrote: >> >> Is there a way in C of getting the current saved set user id (as set by >> >> seteuid()) ? >> > >> >Does your system have useful manpages? If so, "man -k" (also called >> >"apropos") can be a quick start to these questions: >> >> $ man getresgid >> No manual entry for getresgid >> $ man getresuid >> No manual entry for getresuid >> >> So, hows that sarcasm working out for you? > >No sarcasm intended: if you want to know what works on your system, then its >own documentation is the place to start. No shit. Obviously it didn't occur to you that someone posting to a usenet unix group asking about some obscure low level system functionality has probably heard of man pages and already tried them. -- Spud
[toc] | [prev] | [next] | [standalone]
| From | Barry Margolin <barmar@alum.mit.edu> |
|---|---|
| Date | 2016-03-25 10:28 -0400 |
| Message-ID | <barmar-2CA8C6.10281625032016@88-209-239-213.giganet.hu> |
| In reply to | #8235 |
In article <BuaJy.88011$bx.57078@fx35.am4>, spud-u-dont-like@potato.field wrote: > On Thu, 24 Mar 2016 09:10:36 -0700 (PDT) > Philip Guenther <guenther@gmail.com> wrote: > >On Thursday, March 24, 2016 at 2:40:45 AM UTC-7, sp...@potato.field wrote: > >> On Wed, 23 Mar 2016 10:01:14 -0700 (PDT) > >> Philip Guenther <guenther@gmail.com> wrote: > >> >On Wednesday, March 23, 2016 at 8:21:55 AM UTC-7, sp...@potato.field > >> >wrote: > >> >> Is there a way in C of getting the current saved set user id (as set by > >> >> seteuid()) ? > >> > > >> >Does your system have useful manpages? If so, "man -k" (also called > >> >"apropos") can be a quick start to these questions: > >> > >> $ man getresgid > >> No manual entry for getresgid > >> $ man getresuid > >> No manual entry for getresuid > >> > >> So, hows that sarcasm working out for you? > > > >No sarcasm intended: if you want to know what works on your system, then its > >own documentation is the place to start. > > No shit. Obviously it didn't occur to you that someone posting to a usenet > unix group asking about some obscure low level system functionality has > probably heard of man pages and already tried them. The problem with the infamous "RTFM" recommendation is that you have to know which FM to R. And if you knew that, you wouldn't be asking how to do what you want. The Unix man pages aren't really designed well for learning from, they're mostly useful as references for the details (what are the command options, what order are the function arguments, etc.). -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me ***
[toc] | [prev] | [next] | [standalone]
| From | gazelle@shell.xmission.com (Kenny McCormack) |
|---|---|
| Date | 2016-03-25 14:29 +0000 |
| Subject | Sarcasm in Usenet posts (Was: Getting the saved set uid) |
| Message-ID | <nd3i0u$53q$3@news.xmission.com> |
| In reply to | #8235 |
In article <BuaJy.88011$bx.57078@fx35.am4>,
<spud-u-dont-like@potato.field> wrote:
...
>>> So, hows that sarcasm working out for you?
>>
>>No sarcasm intended: if you want to know what works on your system, then its
>>own documentation is the place to start.
>
>No shit. Obviously it didn't occur to you that someone posting to a usenet
>unix group asking about some obscure low level system functionality has
>probably heard of man pages and already tried them.
Yeah, I'm with you, spud.
To be fair, it is just about (but not quite) possible to read the other
posters post and not feel like you're being slimed. If you really bend
over backwards and give him every benefit of the doubt, yes, it is possible
it was intended as "straight".
But, given the usual Usenet culture, that's all straining credulity.
And, yes, it is also an integral part of the Usenet culture to:
a) Assume that the posters you're preaching to are total morons (an
assumption which is, sad to say, usually valid - but not always)
b) Assume that the posters you're preaching to don't know about the
basic stuff - like man pages and so on. Again, this assumption is
usually, but not always, valid.
--
"The God of the Old Testament is arguably the most unpleasant character
in all fiction: jealous and proud of it; a petty, unjust, unforgiving
control-freak; a vindictive, bloodthirsty ethnic cleanser; a misogynistic,
homophobic, racist, infanticidal, genocidal, filicidal, pestilential,
megalomaniacal, sadomasochistic, capriciously malevolent bully."
- Richard Dawkins, The God Delusion -
[toc] | [prev] | [next] | [standalone]
| From | Barry Margolin <barmar@alum.mit.edu> |
|---|---|
| Date | 2016-03-25 11:49 -0400 |
| Subject | Re: Sarcasm in Usenet posts (Was: Getting the saved set uid) |
| Message-ID | <barmar-7D2F3E.11492625032016@88-209-239-213.giganet.hu> |
| In reply to | #8237 |
In article <nd3i0u$53q$3@news.xmission.com>, gazelle@shell.xmission.com (Kenny McCormack) wrote: > In article <BuaJy.88011$bx.57078@fx35.am4>, > <spud-u-dont-like@potato.field> wrote: > ... > >>> So, hows that sarcasm working out for you? > >> > >>No sarcasm intended: if you want to know what works on your system, then its > >>own documentation is the place to start. > > > >No shit. Obviously it didn't occur to you that someone posting to a usenet > >unix group asking about some obscure low level system functionality has > >probably heard of man pages and already tried them. > > Yeah, I'm with you, spud. > > To be fair, it is just about (but not quite) possible to read the other > posters post and not feel like you're being slimed. If you really bend > over backwards and give him every benefit of the doubt, yes, it is possible > it was intended as "straight". > > But, given the usual Usenet culture, that's all straining credulity. > > And, yes, it is also an integral part of the Usenet culture to: > > a) Assume that the posters you're preaching to are total morons (an > assumption which is, sad to say, usually valid - but not always) > > b) Assume that the posters you're preaching to don't know about the > basic stuff - like man pages and so on. Again, this assumption is > usually, but not always, valid. If it's not sarcasm, it's passive-aggressiveness. Either way, it's condescending and annoying. I'm embarassed to admit that sometimes I succumb to the temptation on StackOverflow, asking things like "Is Google broken for you?" Usually this is when I simply plug their error message into the search engine and it takes me immediately to another SO question that's directly on point. -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me ***
[toc] | [prev] | [next] | [standalone]
| From | Ian Zimmerman <itz@buug.org> |
|---|---|
| Date | 2016-03-26 09:41 -0700 |
| Subject | Re: Sarcasm in Usenet posts (Was: Getting the saved set uid) |
| Message-ID | <20160326163503.20188.0E9E24DB@ahiker.mooo.com> |
| In reply to | #8238 |
On 2016-03-25 11:49 -0400, Barry Margolin wrote: > I'm embarassed to admit that sometimes I succumb to the temptation on > StackOverflow, asking things like "Is Google broken for you?" Usually > this is when I simply plug their error message into the search engine > and it takes me immediately to another SO question that's directly on > point. If Google got big before the questing person was 40, you've the "dog old, trick new" problem. I still find myself starting to compose Usenet or Stack Overflow questions and only stopping right before I push the commit button/hit the Enter key, suddenly remembering search engines exist. More impulsive natures may not remember until it's too late. -- Please *no* private copies of mailing list or newsgroup messages. Rule 420: All persons more than eight miles high to leave the court.
[toc] | [prev] | [next] | [standalone]
| From | Philip Guenther <guenther@gmail.com> |
|---|---|
| Date | 2016-03-25 10:10 -0700 |
| Subject | Re: Sarcasm in Usenet posts (Was: Getting the saved set uid) |
| Message-ID | <a3445ac7-7dbd-4076-8d92-d56d079a5e22@googlegroups.com> |
| In reply to | #8237 |
On Friday, March 25, 2016 at 7:29:53 AM UTC-7, Kenny McCormack wrote: > In article <BuaJy.88011$bx.57078@fx35.am4>, > <spud-u-dont-like@potato.field> wrote: > ... > >>> So, hows that sarcasm working out for you? > >> > >>No sarcasm intended: if you want to know what works on your system, then its > >>own documentation is the place to start. > > > >No shit. Obviously it didn't occur to you that someone posting to a usenet > >unix group asking about some obscure low level system functionality has > >probably heard of man pages and already tried them. Spud, my apologies to you for phrasing my response in a condescending way. I feel this thread would have been many messages shorter if the clarification in your second post (that you were interested in methods that were POSIX compliant and/or usable on OSX) had been mentioned earlier. That doesn't excuse the tone of my response though. ... > And, yes, it is also an integral part of the Usenet culture to: > > a) Assume that the posters you're preaching to are total morons (an > assumption which is, sad to say, usually valid - but not always) > > b) Assume that the posters you're preaching to don't know about the > basic stuff - like man pages and so on. Again, this assumption is > usually, but not always, valid. c) take more interest in the meta discussion about *how* questions were asked and answered then in discussing the actual question and answer. As you recently said in another thread, Kenny: # You just gotta love this thread. Usenet at its finest. # # 30+ responses and not one single post having anything to do with the BASIC # language (which is what this thread is supposed to be about). Of course, my original reply was only 5% "here's the answer" and 95% "here's how you might have gotten the answer". Oh well. Philip Guenther
[toc] | [prev] | [next] | [standalone]
| From | <william@wilbur.25thandClement.com> |
|---|---|
| Date | 2016-03-24 13:16 -0700 |
| Message-ID | <6hudsc-q2f.ln1@wilbur.25thandClement.com> |
| In reply to | #8226 |
spud@potato.field wrote:
> On Wed, 23 Mar 2016 10:01:14 -0700 (PDT)
> Philip Guenther <guenther@gmail.com> wrote:
>>On Wednesday, March 23, 2016 at 8:21:55 AM UTC-7, sp...@potato.field wrote:
>>> Is there a way in C of getting the current saved set user id (as set by
>>> seteuid()) ?
>>
>>Does your system have useful manpages? If so, "man -k" (also called
>>"apropos") can be a quick start to these questions:
>
> $ man getresgid
> No manual entry for getresgid
> $ man getresuid
> No manual entry for getresuid
>
> So, hows that sarcasm working out for you?
>
> Turns out those functions are non standard. Supported on Linux and hp-ux
> but thats about it. Not OS/X as you can see above.
>
> Are there posix functions that do the same? And yes I have googled already
> otherwise I wouldn't asking.
You can download the POSIX specification for free from
https://www2.opengroup.org/ogsys/catalog/c138
or just visit it online at
http://pubs.opengroup.org/onlinepubs/9699919799/
The index of system interfaces is incomparably useful. Select "System
Interfaces" from the top-left frame, then "System Interfaces" in the
bottom-left frame. That gives you the full list of system interfaces (aka
syscalls and libc routines), and AFAICT there's nothing like getreuid
available.
The history and rationale sections of related interface definitions often
provide useful information. As do other chapters in the Base Definitions and
System Interfaces volumes. For example, section 3.331 Saved Set-User-ID
directs you to the setuid and exec-family definitions for more information,
and indeed the rationale section of setuid contains much information about
the semantics of uids.
If you're serious about C or Unix programming it would be prudent to have
local copies of the POSIX and C standards.[1] Once you become familiar with
them I think you'll find them much more convenient and reliable in general
than either man pages (especially the inconsistent Linux man pages),
Googling, or technical forums. Only once I know or suspect I'm dealing with
vendor extensions do I bother with anything else, and by then the standards
have framed things such that I'm much more productive when searching and
analyzing other sources.
[1] The draft C99 and C11 standards are freely available, and but for
inconsequential typos identical to the published standards. See
http://www.open-std.org/jtc1/sc22/wg14/www/standards
[toc] | [prev] | [next] | [standalone]
| From | boon <fred900rbc@gmail.com> |
|---|---|
| Date | 2016-04-01 04:42 -0700 |
| Message-ID | <02167dc4-c010-48b0-ad2e-059794456005@googlegroups.com> |
| In reply to | #8234 |
On Thursday, March 24, 2016 at 9:30:07 PM UTC+1, wil...@wilbur.25thandclement.com wrote: > spud@potato.field wrote: > > On Wed, 23 Mar 2016 10:01:14 -0700 (PDT) > > Philip Guenther <guenther@gmail.com> wrote: > >>On Wednesday, March 23, 2016 at 8:21:55 AM UTC-7, sp...@potato.field wrote: > >>> Is there a way in C of getting the current saved set user id (as set by > >>> seteuid()) ? > >> > >>Does your system have useful manpages? If so, "man -k" (also called > >>"apropos") can be a quick start to these questions: > > > > $ man getresgid > > No manual entry for getresgid > > $ man getresuid > > No manual entry for getresuid > > > > So, hows that sarcasm working out for you? > > > > Turns out those functions are non standard. Supported on Linux and hp-ux > > but thats about it. Not OS/X as you can see above. > > > > Are there posix functions that do the same? And yes I have googled already > > otherwise I wouldn't asking. > > You can download the POSIX specification for free from > > https://www2.opengroup.org/ogsys/catalog/c138 > > or just visit it online at > > http://pubs.opengroup.org/onlinepubs/9699919799/ > > The index of system interfaces is incomparably useful. Select "System > Interfaces" from the top-left frame, then "System Interfaces" in the > bottom-left frame. That gives you the full list of system interfaces (aka > syscalls and libc routines), and AFAICT there's nothing like getreuid > available. > > The history and rationale sections of related interface definitions often > provide useful information. As do other chapters in the Base Definitions and > System Interfaces volumes. For example, section 3.331 Saved Set-User-ID > directs you to the setuid and exec-family definitions for more information, > and indeed the rationale section of setuid contains much information about > the semantics of uids. > > If you're serious about C or Unix programming it would be prudent to have > local copies of the POSIX and C standards.[1] Once you become familiar with > them I think you'll find them much more convenient and reliable in general > than either man pages (especially the inconsistent Linux man pages), > Googling, or technical forums. Only once I know or suspect I'm dealing with > vendor extensions do I bother with anything else, and by then the standards > have framed things such that I'm much more productive when searching and > analyzing other sources. > > > [1] The draft C99 and C11 standards are freely available, and but for > inconsequential typos identical to the published standards. See > > http://www.open-std.org/jtc1/sc22/wg14/www/standards According to my manual page, sendto() conforms to POSIX.1-2001. Is this normal?
[toc] | [prev] | [next] | [standalone]
| From | Noob <root@127.0.0.1> |
|---|---|
| Date | 2016-04-01 19:16 +0200 |
| Message-ID | <ndma7f$nur$1@dont-email.me> |
| In reply to | #8291 |
On 01/04/2016 13:42, boon wrote: > According to my manual page, sendto() conforms to POSIX.1-2001. Is this normal? Are you posting to the wrong thread by any chance? This is the latest man page: http://man7.org/linux/man-pages/man2/send.2.html This is the latest spec: http://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html Regards
[toc] | [prev] | [next] | [standalone]
| From | Barry Margolin <barmar@alum.mit.edu> |
|---|---|
| Date | 2016-04-01 17:23 -0400 |
| Message-ID | <barmar-43CFA1.17230101042016@88-209-239-213.giganet.hu> |
| In reply to | #8300 |
In article <ndma7f$nur$1@dont-email.me>, Noob <root@127.0.0.1> wrote: > On 01/04/2016 13:42, boon wrote: > > > According to my manual page, sendto() conforms to POSIX.1-2001. Is this > > normal? > > Are you posting to the wrong thread by any chance? I was wondering the same thing -- it seems like this is more related to the "unix socket exercise" thread. -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me ***
[toc] | [prev] | [next] | [standalone]
| From | boon <fred900rbc@gmail.com> |
|---|---|
| Date | 2016-04-01 17:27 -0700 |
| Message-ID | <f334aeb5-4c4c-4f2f-8e5a-4aa0740a9a30@googlegroups.com> |
| In reply to | #8303 |
Yes. I posted to the wrong thread. I apologize.
[toc] | [prev] | [next] | [standalone]
| From | boon <root@127.10.10.1> |
|---|---|
| Date | 2016-03-24 12:08 +0100 |
| Message-ID | <nd0hqk$1m8t$1@adenine.netfront.net> |
| In reply to | #8209 |
On 03/23/2016 04:21 PM, spud@potato.field wrote: > Is there a way in C of getting the current saved set user id (as set by > seteuid()) ? why not calling geteuid() to save the effective uid before calling seteuid()? > -- > Spud > --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
[toc] | [prev] | [next] | [standalone]
| From | spud@potato.field |
|---|---|
| Date | 2016-03-24 11:59 +0000 |
| Message-ID | <nd0kqo$2ac$1@gioia.aioe.org> |
| In reply to | #8227 |
On Thu, 24 Mar 2016 12:08:03 +0100 boon <root@127.10.10.1> wrote: >On 03/23/2016 04:21 PM, spud@potato.field wrote: >> Is there a way in C of getting the current saved set user id (as set by >> seteuid()) ? > >why not calling geteuid() to save the effective uid before calling >seteuid()? I was asking more out of curiousity than for any practical reason since, yes, you could just save the original one yourself. Though it might be potentially useful for a child process if its parent calls seteuid() then does a fork-exec though I don't know if the saved set uid would be passed to the child in this case. -- Spud
[toc] | [prev] | [next] | [standalone]
| From | boon <root@127.10.10.1> |
|---|---|
| Date | 2016-03-24 13:19 +0100 |
| Message-ID | <nd0lvq$24tt$1@adenine.netfront.net> |
| In reply to | #8230 |
On 03/24/2016 12:59 PM, spud@potato.field wrote: > On Thu, 24 Mar 2016 12:08:03 +0100 > boon <root@127.10.10.1> wrote: >> On 03/23/2016 04:21 PM, spud@potato.field wrote: >>> Is there a way in C of getting the current saved set user id (as set by >>> seteuid()) ? >> >> why not calling geteuid() to save the effective uid before calling >> seteuid()? > > I was asking more out of curiousity than for any practical reason since, yes, > you could just save the original one yourself. Though it might be potentially > useful for a child process if its parent calls seteuid() then does a fork-exec > though I don't know if the saved set uid would be passed to the child in this > case. AFAIK, the parent have not to call seteuid() to drop some privileges. This has to be done by the child process. On Linux: man credentials (7) A child process created by fork(2) inherits copies of its parent's user and groups IDs. During an execve(2), a process's real user and group ID and supplementary group IDs are preserved; the effective and saved set IDs may be changed, as described in execve(2). man execve (2) If the set-user-ID bit is set on the program file pointed to by filename, and the underlying filesystem is not mounted nosuid (the MS_NOSUID flag for mount(2)), and the calling process is not being ptraced, then the effective user ID of the calling process is changed to that of the owner of the program file. Similarly, when the set-group-ID bit of the program file is set the effective group ID of the calling process is set to the group of the program file. The effective user ID of the process is copied to the saved set-user-ID; similarly, the effective group ID is copied to the saved set-group-ID. This copying takes place after any effective ID changes that occur because of the set-user-ID and set-group-ID permission bits. > -- > Spud > --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
[toc] | [prev] | [standalone]
Back to top | Article view | comp.unix.programmer
csiph-web