Todd C. Miller [Thu, 10 May 2001 18:55:12 +0000 (18:55 +0000)]
Use setpwent()/endpwent() + all the shadow variants to make sure
we don't inadvertantly leak an fd to the child. Apparently Linux's
shadow routines leave the fd open even if you don't call setspent().
Reported by mike@gistnet.com; different patch used.
Todd C. Miller [Fri, 30 Mar 2001 13:54:27 +0000 (13:54 +0000)]
Use stashed user_gid when checking against exempt gid since sudo
sets its gid to a a value that makes sudoers readable. Previously
if you used gid 0 as the exempt group everyone would be exempt.
From Paul Kranenburg <pk@cs.few.eur.nl>
Todd C. Miller [Sat, 30 Dec 2000 03:59:40 +0000 (03:59 +0000)]
Don't try and build saved uid version of set_perms on systems w/o them.
Rename set_perms_saved_uid() -> set_perms_posix()
Make set_perms_setreuid simply be set_perms_fallback() and simply include
the appropriate function at compile time (setreuid() vs. setuid()).
Todd C. Miller [Sat, 30 Dec 2000 03:29:47 +0000 (03:29 +0000)]
New Defaults options:
o stay_setuid - sudo will remain setuid if system has saved uids or setreuid(2)
o env_reset - reset the environment to a sane default
o env_keep - preserve environment variables that would otherwise be cleared
No longer use getenv/putenv/setenv functions--do environment munging by hand.
Potentially dangerous environment variables can be cleared only if they
contain '/' pr '%' characters to protect buggy programs.
Moved environment routines into env.c (new file)
Todd C. Miller [Fri, 3 Nov 2000 05:37:44 +0000 (05:37 +0000)]
Move set_perms() to its own file and use POSIX saved uid or setreuid()
if available.
Added stay_setuid option for systems that have libraries that perform
extra paranoia checks in system libraries for setuid programs (ie:
anything with issetugid(2)).
Todd C. Miller [Fri, 3 Nov 2000 01:28:54 +0000 (01:28 +0000)]
strip more bits from the environment and add a facility for stripping
things only if they contain '/' or '%' to address printf format string
vulnerabilities in other programs.
Todd C. Miller [Thu, 7 Sep 2000 14:43:26 +0000 (14:43 +0000)]
Don't use vsyslog(3) since HP-UX (and others?) lack it. This means
that "%m" won't be expanded but we don't use that anyway since the
logging routines may splat to stderr as well.
Todd C. Miller [Thu, 31 Aug 2000 17:08:35 +0000 (17:08 +0000)]
Allow special characters (including '#') to be embedded in pathnames
if quoted by a '\\'. The quoted chars will be dealt with by fnmatch().
Unfortunately, 'sudo -l' still prints the '\\'.
Todd C. Miller [Sat, 12 Aug 2000 20:48:29 +0000 (20:48 +0000)]
The listpw and verifypw sudoers options would not take effect because
the value of the default was checked *before* sudoers was parsed.
Instead of passing in the value of PWCHECK_* to sudoers_lookup(),
pass in the arg for def_ival() so the check can be deferred until
after sudoers is parsed.
Todd C. Miller [Mon, 5 Jun 2000 02:57:10 +0000 (02:57 +0000)]
Remove extraneous call to init_defaults() and set runas_user to NULL
betweem parses so init_defaults will reset it each time, thus avoiding
a reference to free()d data.
Todd C. Miller [Wed, 10 May 2000 04:56:28 +0000 (04:56 +0000)]
If the targetpw flag is set, use target username as part of the timestamp path.
If tty tickets are in effect cat the tty and the target username with a
':' as the separator.
Todd C. Miller [Mon, 17 Apr 2000 18:01:14 +0000 (18:01 +0000)]
Bracket calls to syslog with an openlog() and closelog() since some
authentication methods (like PAM) may do their own logging via
syslog. Since we don't use syslog much (usually just once per
session) this doesn't really incur a performance penalty.
It also Fixes a SEGV with pam_kafs.