Todd C. Miller [Tue, 7 Jan 2003 00:02:33 +0000 (00:02 +0000)]
Better fix for sudoers files w/o a newline before EOF. It looks
like the issue is that yyrestart() does not reset the start condition
to INITIAL which is an issue since we parse sudoers multiple times.
Todd C. Miller [Mon, 6 Jan 2003 23:47:04 +0000 (23:47 +0000)]
Work around what appears to be a flex bug when dealing with files
that lack a final newline before EOF. This adds a rule to match
EOF in the non-initial states which resets the state to INITIAL and
throws an error.
Todd C. Miller [Mon, 6 Jan 2003 20:06:12 +0000 (20:06 +0000)]
o The parser needs sudoers to end with a newline but some editors (emacs) may
not add one. Check for a missing newline at EOF and add one if needed.
o Set quiet flag during initial sudoers parse (to get options)
o Move yyrestart() call and always use freopen() to open yyin after
initial sudoers parse.
Todd C. Miller [Sat, 14 Dec 2002 19:15:30 +0000 (19:15 +0000)]
Add %U and %H escapes and redo prompt rewriting. "%%" now gets collapsed
to "%" as was originally intended. This also gets rid of lastchar (does
lookahead instead of lookback) which should simplify the logic slightly.
Todd C. Miller [Fri, 22 Nov 2002 19:09:49 +0000 (19:09 +0000)]
Revamp set_perms. We now use a version based on setresuid() or setreuid()
when possible since that allows us to support the stay_setuid option and
we always know exactly what the semantics will be (various Linux kernels
have broken POSIX saved uid support).
Todd C. Miller [Fri, 22 Nov 2002 18:33:47 +0000 (18:33 +0000)]
Before exec, restore state of signal handlers to be the same as
when we were initialy invoked instead of just reseting to SIG_DFL.
Fixes a problem when using sudo with nohup. Based on a patch from
Paul Markham.
Todd C. Miller [Thu, 2 May 2002 19:40:25 +0000 (19:40 +0000)]
Don't try to pre-compute the size of the new envp, just allocate
space up front and realloc as needed. Changes to the new env pointer
must all be made through insert_env() which now keeps track of
spaced used and allocates as needed.
Todd C. Miller [Thu, 25 Apr 2002 15:30:12 +0000 (15:30 +0000)]
The the loop used to expand %h and %u, the lastchar variable was not being
initialized. This means that if the last char in the prompt is '%' and the
first char is 'h' or 'u' a extra copy of the host or user name would be
copied, for which space had not been allocated.
Todd C. Miller [Fri, 25 Jan 2002 18:38:22 +0000 (18:38 +0000)]
HP-UX 9.x has RLIMIT_* but no RLIM_INFINITY. If there is no
RLIM_INFINITY, just pretend it is -1. This works because we only
check for RLIM_INFINITY and do not set anything to that value.
Todd C. Miller [Sun, 20 Jan 2002 19:21:33 +0000 (19:21 +0000)]
Avoid giving PAM a NULL password response, use the empty string instead.
This avoids a log warning when the user hits ^C at the password prompt
when PAM is in use.
Todd C. Miller [Sun, 20 Jan 2002 00:46:44 +0000 (00:46 +0000)]
Don't check the return value of pam_setcred(). In Linux-PAM 0.75
pam_setcred() returns the last saved return code, not the return
code for the setcred module. Because we haven't called pam_authenticate(),
this is not set and so pam_setcred() returns PAM_PERM_DENIED.
Todd C. Miller [Fri, 18 Jan 2002 19:18:39 +0000 (19:18 +0000)]
o BSDi also has a bogus setreuid()
o Old FreeBSD has a bogus setreuid()
o new NetBSD has a real setreuid()
o add check for freeifaddrs() if getifaddrs() exists.