TNG 0.7 - can't join domain
Cole, Timothy D.
timothy_d_cole at md.northgrum.com
Tue Feb 29 18:56:14 GMT 2000
> -----Original Message-----
> From: Sander Striker [SMTP:s.striker at striker.nl]
> Sent: Tuesday, February 29, 2000 13:17
> To: Multiple recipients of list SAMBA-NTDOM
> Subject: RE: TNG 0.7 - can't join domain
>
> I guess people are suggesting running as root and when doing file access
> checking something like:
> become_user(); check_access(file); unbecome_user();
>
*cough* race conditions *cough*
[ btw ... access(2) does NOT necessarily reflect the actual access
you will get under all circumstances anyway ]
Anyway, if you take the root-unless-doing-file-access route, you
really should do:
become_user(); do_stuff_to_file_here_and_now(); unbecome_user();
Honestly, though, in a daemon that very rarely actually does
anything on behalf of a particular user, it might make more sense to just
run as some no-access user most of the time (still have to start as root,
though), and treat root as just another user to become (externally).
internally, it'd be something like (pseudocode):
void push_security_context(uid_t uid) {
do_push_security_context(); /* saves old uid, groups, etc */
setuid(0); /* switch back to root */
do_init_security_context(uid); /* initgroups, setuid(), etc */
}
void pop_security_context() {
setuid(0); /* switch back to root */
do_pop_security_context(); /* restores old uid, groups, etc
*/
}
More information about the samba-ntdom
mailing list