2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 09:57:41 +00:00

o /etc/stmp -> /etc/sudoers.tmp since solaris uses stmp as shadow temp file

o _PATH_SUDO_SUDOERS -> _PATH_SUDOERS and _PATH_SUDO_STMP -> _PATH_SUDOERS_TMP
This commit is contained in:
Todd C. Miller 1999-08-06 09:37:03 +00:00
parent 7c53b74961
commit 145992dce2
10 changed files with 66 additions and 64 deletions

View File

@ -100,7 +100,7 @@ sudoers_gid = @SUDOERS_GID@
sudoers_mode = @SUDOERS_MODE@ sudoers_mode = @SUDOERS_MODE@
# Pass in paths and uid/gid + OS dependent defined # Pass in paths and uid/gid + OS dependent defined
DEFS = @OSDEFS@ -D_PATH_SUDO_SUDOERS=\"$(sudoersdir)/sudoers\" -D_PATH_SUDO_STMP=\"$(sudoersdir)/stmp\" -DSUDOERS_UID=$(sudoers_uid) -DSUDOERS_GID=$(sudoers_gid) -DSUDOERS_MODE=$(sudoers_mode) DEFS = @OSDEFS@ -D_PATH_SUDOERS=\"$(sudoersdir)/sudoers\" -D_PATH_SUDOERS_TMP=\"$(sudoersdir)/sudoers.tmp\" -DSUDOERS_UID=$(sudoers_uid) -DSUDOERS_GID=$(sudoers_gid) -DSUDOERS_MODE=$(sudoers_mode)
#### End of system configuration section. #### #### End of system configuration section. ####

View File

@ -121,7 +121,7 @@ A) You probably didn't install the gcc-fixed include files.
Q) When I run "visudo" it says "sudoers file busy, try again later." Q) When I run "visudo" it says "sudoers file busy, try again later."
and doesn't do anything. and doesn't do anything.
A) You have a stale sudoers temporary file. The default location is A) You have a stale sudoers temporary file. The default location is
/etc/stmp. If you delete this file visudo will be happy again, /etc/sudoers.tmp. If you delete this file visudo will be happy again,
but make sure to check that no one else is running visudo at but make sure to check that no one else is running visudo at
the time. the time.

View File

@ -119,7 +119,7 @@ sudoers_lookup(check_cmnd)
/* Become sudoers file owner */ /* Become sudoers file owner */
set_perms(PERM_SUDOERS, 0); set_perms(PERM_SUDOERS, 0);
/* We opened _PATH_SUDO_SUDOERS in check_sudoers() so just rewind it. */ /* We opened _PATH_SUDOERS in check_sudoers() so just rewind it. */
rewind(sudoers_fp); rewind(sudoers_fp);
yyin = sudoers_fp; yyin = sudoers_fp;
yyout = stdout; yyout = stdout;

View File

@ -51,20 +51,20 @@
#endif /* _PATH_TTY */ #endif /* _PATH_TTY */
/* /*
* NOTE: _PATH_SUDO_SUDOERS is usually overriden by the Makefile. * NOTE: _PATH_SUDOERS is usually overriden by the Makefile.
*/ */
#ifndef _PATH_SUDO_SUDOERS #ifndef _PATH_SUDOERS
#define _PATH_SUDO_SUDOERS "/etc/sudoers" #define _PATH_SUDOERS "/etc/sudoers"
#endif /* _PATH_SUDO_SUDOERS */ #endif /* _PATH_SUDOERS */
/* /*
* NOTE: _PATH_SUDO_STMP is usually overriden by the Makefile. * NOTE: _PATH_SUDOERS_TMP is usually overriden by the Makefile.
* _PATH_SUDO_STMP *MUST* be on the same partition * _PATH_SUDOERS_TMP *MUST* be on the same partition
* as _PATH_SUDO_SUDOERS! * as _PATH_SUDOERS!
*/ */
#ifndef _PATH_SUDO_STMP #ifndef _PATH_SUDOERS_TMP
#define _PATH_SUDO_STMP "/etc/stmp" #define _PATH_SUDOERS_TMP "/etc/sudoers.tmp"
#endif /* _PATH_SUDO_STMP */ #endif /* _PATH_SUDOERS_TMP */
/* /*
* The following paths are controlled via the configure script. * The following paths are controlled via the configure script.

34
sudo.c
View File

@ -251,7 +251,7 @@ main(argc, argv)
set_perms(PERM_USER, sudo_mode); set_perms(PERM_USER, sudo_mode);
check_sudoers(); /* check mode/owner on _PATH_SUDO_SUDOERS */ check_sudoers(); /* check mode/owner on _PATH_SUDOERS */
if (sudo_mode == MODE_KILL || sudo_mode == MODE_INVALIDATE) { if (sudo_mode == MODE_KILL || sudo_mode == MODE_INVALIDATE) {
remove_timestamp((sudo_mode == MODE_KILL)); remove_timestamp((sudo_mode == MODE_KILL));
@ -359,7 +359,7 @@ main(argc, argv)
#endif /* DONT_LEAK_PATH_INFO */ #endif /* DONT_LEAK_PATH_INFO */
case VALIDATE_ERROR: case VALIDATE_ERROR:
log_error(0, "parse error in %s around line %d", _PATH_SUDO_SUDOERS, log_error(0, "parse error in %s around line %d", _PATH_SUDOERS,
errorlineno); errorlineno);
break; break;
@ -765,26 +765,26 @@ check_sudoers()
* Only works if filesystem is readable/writable by root. * Only works if filesystem is readable/writable by root.
*/ */
set_perms(PERM_ROOT, 0); set_perms(PERM_ROOT, 0);
if ((rootstat = lstat(_PATH_SUDO_SUDOERS, &statbuf)) == 0 && if ((rootstat = lstat(_PATH_SUDOERS, &statbuf)) == 0 &&
SUDOERS_UID == statbuf.st_uid && SUDOERS_MODE != 0400 && SUDOERS_UID == statbuf.st_uid && SUDOERS_MODE != 0400 &&
(statbuf.st_mode & 0007777) == 0400) { (statbuf.st_mode & 0007777) == 0400) {
if (chmod(_PATH_SUDO_SUDOERS, SUDOERS_MODE) == 0) { if (chmod(_PATH_SUDOERS, SUDOERS_MODE) == 0) {
(void) fprintf(stderr, "%s: fixed mode on %s\n", (void) fprintf(stderr, "%s: fixed mode on %s\n",
Argv[0], _PATH_SUDO_SUDOERS); Argv[0], _PATH_SUDOERS);
if (statbuf.st_gid != SUDOERS_GID) { if (statbuf.st_gid != SUDOERS_GID) {
if (!chown(_PATH_SUDO_SUDOERS,(uid_t) -1,SUDOERS_GID)) { if (!chown(_PATH_SUDOERS,(uid_t) -1,SUDOERS_GID)) {
(void) fprintf(stderr, "%s: set group on %s\n", (void) fprintf(stderr, "%s: set group on %s\n",
Argv[0], _PATH_SUDO_SUDOERS); Argv[0], _PATH_SUDOERS);
statbuf.st_gid = SUDOERS_GID; statbuf.st_gid = SUDOERS_GID;
} else { } else {
(void) fprintf(stderr,"%s: Unable to set group on %s: %s\n", (void) fprintf(stderr,"%s: Unable to set group on %s: %s\n",
Argv[0], _PATH_SUDO_SUDOERS, strerror(errno)); Argv[0], _PATH_SUDOERS, strerror(errno));
} }
} }
} else { } else {
(void) fprintf(stderr, "%s: Unable to fix mode on %s: %s\n", (void) fprintf(stderr, "%s: Unable to fix mode on %s: %s\n",
Argv[0], _PATH_SUDO_SUDOERS, strerror(errno)); Argv[0], _PATH_SUDOERS, strerror(errno));
} }
} }
@ -795,24 +795,24 @@ check_sudoers()
*/ */
set_perms(PERM_SUDOERS, 0); set_perms(PERM_SUDOERS, 0);
if (rootstat != 0 && lstat(_PATH_SUDO_SUDOERS, &statbuf) != 0) if (rootstat != 0 && lstat(_PATH_SUDOERS, &statbuf) != 0)
log_error(USE_ERRNO, "can't stat %s", _PATH_SUDO_SUDOERS); log_error(USE_ERRNO, "can't stat %s", _PATH_SUDOERS);
else if (!S_ISREG(statbuf.st_mode)) else if (!S_ISREG(statbuf.st_mode))
log_error(0, "%s is not a regular file", _PATH_SUDO_SUDOERS); log_error(0, "%s is not a regular file", _PATH_SUDOERS);
else if ((statbuf.st_mode & 07777) != SUDOERS_MODE) else if ((statbuf.st_mode & 07777) != SUDOERS_MODE)
log_error(0, "%s is mode 0%o, should be 0%o", _PATH_SUDO_SUDOERS, log_error(0, "%s is mode 0%o, should be 0%o", _PATH_SUDOERS,
(statbuf.st_mode & 07777), SUDOERS_MODE); (statbuf.st_mode & 07777), SUDOERS_MODE);
else if (statbuf.st_uid != SUDOERS_UID) else if (statbuf.st_uid != SUDOERS_UID)
log_error(0, "%s is owned by uid %ld, should be %d", _PATH_SUDO_SUDOERS, log_error(0, "%s is owned by uid %ld, should be %d", _PATH_SUDOERS,
(long) statbuf.st_uid, SUDOERS_UID); (long) statbuf.st_uid, SUDOERS_UID);
else if (statbuf.st_gid != SUDOERS_GID) else if (statbuf.st_gid != SUDOERS_GID)
log_error(0, "%s is owned by gid %ld, should be %d", _PATH_SUDO_SUDOERS, log_error(0, "%s is owned by gid %ld, should be %d", _PATH_SUDOERS,
(long) statbuf.st_gid, SUDOERS_GID); (long) statbuf.st_gid, SUDOERS_GID);
else { else {
/* Solaris sometimes returns EAGAIN so try 10 times */ /* Solaris sometimes returns EAGAIN so try 10 times */
for (i = 0; i < 10 ; i++) { for (i = 0; i < 10 ; i++) {
errno = 0; errno = 0;
if ((sudoers_fp = fopen(_PATH_SUDO_SUDOERS, "r")) == NULL || if ((sudoers_fp = fopen(_PATH_SUDOERS, "r")) == NULL ||
fread(&c, sizeof(c), 1, sudoers_fp) != 1) { fread(&c, sizeof(c), 1, sudoers_fp) != 1) {
sudoers_fp = NULL; sudoers_fp = NULL;
if (errno != EAGAIN && errno != EWOULDBLOCK) if (errno != EAGAIN && errno != EWOULDBLOCK)
@ -822,7 +822,7 @@ check_sudoers()
sleep(1); sleep(1);
} }
if (sudoers_fp == NULL) if (sudoers_fp == NULL)
log_error(USE_ERRNO, "can't open %s", _PATH_SUDO_SUDOERS); log_error(USE_ERRNO, "can't open %s", _PATH_SUDOERS);
} }
set_perms(PERM_ROOT, 0); set_perms(PERM_ROOT, 0);

View File

@ -108,8 +108,8 @@ extern int errorlineno;
char **Argv; char **Argv;
char **NewArgv = NULL; char **NewArgv = NULL;
int NewArgc = 0; int NewArgc = 0;
char *sudoers = _PATH_SUDO_SUDOERS; char *sudoers = _PATH_SUDOERS;
char *stmp = _PATH_SUDO_STMP; char *stmp = _PATH_SUDOERS_TMP;
struct sudo_user sudo_user; struct sudo_user sudo_user;
int parse_error = FALSE; int parse_error = FALSE;

View File

@ -46,10 +46,10 @@ OOOOPPPPTTTTIIIIOOOONNNNSSSS
EEEERRRRRRRROOOORRRRSSSS EEEERRRRRRRROOOORRRRSSSS
sudoers file busy, try again later. sudoers file busy, try again later.
Either someone is currently editing the _s_u_d_o_e_r_s file Either someone is currently editing the _s_u_d_o_e_r_s file
or there is a stale sudoers lock file (/etc/stmp by or there is a stale sudoers lock file
default) that you need to delete. (/etc/sudoers.tmp by default) that you need to delete.
/etc/stmp: Permission denied /etc/sudoers.tmp: Permission denied
You didn't run vvvviiiissssuuuuddddoooo as root. You didn't run vvvviiiissssuuuuddddoooo as root.
Can't find you in the passwd database Can't find you in the passwd database
@ -57,11 +57,11 @@ EEEERRRRRRRROOOORRRRSSSS
FFFFIIIILLLLEEEESSSS FFFFIIIILLLLEEEESSSS
/etc/sudoers List of who can run what /etc/sudoers List of who can run what
/etc/stmp Lock file for visudo /etc/sudoers.tmp Lock file for visudo
1/Aug/1999 1.6 1 6/Aug/1999 1.6 1
@ -127,7 +127,7 @@ SSSSEEEEEEEE AAAALLLLSSSSOOOO
1/Aug/1999 1.6 2 6/Aug/1999 1.6 2
@ -193,6 +193,6 @@ VISUDO(8) MAINTENANCE COMMANDS VISUDO(8)
1/Aug/1999 1.6 3 6/Aug/1999 1.6 3

View File

@ -77,10 +77,10 @@ The <CODE>-V</CODE> (version) option causes <STRONG>visudo</STRONG> to print the
<DL> <DL>
<DT><STRONG><A NAME="item_sudoers">sudoers file busy, try again later.</A></STRONG><DD> <DT><STRONG><A NAME="item_sudoers">sudoers file busy, try again later.</A></STRONG><DD>
<P> <P>
Either someone is currently editing the <EM>sudoers</EM> file or there is a stale sudoers lock file (/etc/stmp by default) that you Either someone is currently editing the <EM>sudoers</EM> file or there is a stale sudoers lock file (/etc/sudoers.tmp by default)
need to delete. that you need to delete.
<DT><STRONG><A NAME="item__etc_stmp_">/etc/stmp: Permission denied</A></STRONG><DD> <DT><STRONG><A NAME="item__etc_sudoers_tmp_">/etc/sudoers.tmp: Permission denied</A></STRONG><DD>
<P> <P>
You didn't run <STRONG>visudo</STRONG> as root. You didn't run <STRONG>visudo</STRONG> as root.
@ -90,17 +90,17 @@ Your userid does not appear in the passwd file.
<H1><A NAME="FILES">FILES</A></H1> <H1><A NAME="FILES">FILES</A></H1>
<P> <P>
<PRE> /etc/sudoers file of authorized users. <PRE> /etc/sudoers List of who can run what
/etc/stmp lock file for visudo. /etc/sudoers.tmp Lock file for visudo
</PRE> </PRE>
<H1><A NAME="ENVIRONMENT_VARIABLES">ENVIRONMENT VARIABLES</A></H1> <H1><A NAME="ENVIRONMENT_VARIABLES">ENVIRONMENT VARIABLES</A></H1>
<P> <P>
The following are used only if <STRONG>visudo</STRONG> was compiled with the The following are used only if <STRONG>visudo</STRONG> was configured with the
<EM>ENV_EDITOR</EM> option: <EM>--with-env-editor</EM> option:
<P> <P>
<PRE> EDITOR Used by visudo as the editor to use. <PRE> EDITOR Used by visudo as the editor to use
VISUAL Used by visudo if EDITOR is not set. VISUAL Used by visudo if EDITOR is not set
</PRE> </PRE>
<H1><A NAME="AUTHOR">AUTHOR</A></H1> <H1><A NAME="AUTHOR">AUTHOR</A></H1>
<P> <P>
@ -115,18 +115,19 @@ See the HISTORY file in the sudo distribution for more details.
<P> <P>
Please send all bugs, comments, and changes to <A Please send all bugs, comments, and changes to <A
HREF="mailto:sudo-bugs@courtesan.com.">sudo-bugs@courtesan.com.</A> HREF="mailto:sudo-bugs@courtesan.com.">sudo-bugs@courtesan.com.</A> Be sure
to include the version of <STRONG>sudo</STRONG> you are using and the platform you are running it on.
<H1><A NAME="DISCLAIMER">DISCLAIMER</A></H1> <H1><A NAME="DISCLAIMER">DISCLAIMER</A></H1>
<P> <P>
This program is distributed in the hope that it will be useful, but WITHOUT <STRONG>Visudo</STRONG> is provided ``AS IS'' and any express or implied warranties, including, but
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or not limited to, the implied warranties of merchantability and fitness for a
FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE file distributed with particular purpose are disclaimed. See the LICENSE file distributed with <STRONG>sudo</STRONG> for complete details.
sudo for more details.
<H1><A NAME="CAVEATS">CAVEATS</A></H1> <H1><A NAME="CAVEATS">CAVEATS</A></H1>
<P> <P>
Due to the syntax of the <EM>sudoers</EM> file, there is no way for <STRONG>visudo</STRONG> to tell the difference between a mistyped {Host,User,Cmnd}_Alias and a user Due to the syntax of the <EM>sudoers</EM> file, there is no way for
<STRONG>visudo</STRONG> to tell the difference between a mistyped {Host,User,Cmnd}_Alias and a user
or host name. or host name.
<P> <P>

View File

@ -2,8 +2,9 @@
''' $RCSfile$$Revision$$Date$ ''' $RCSfile$$Revision$$Date$
''' '''
''' $Log$ ''' $Log$
''' Revision 1.8 1999/08/01 16:26:16 millert ''' Revision 1.9 1999/08/06 09:37:02 millert
''' regen ''' o /etc/stmp -> /etc/sudoers.tmp since solaris uses stmp as shadow temp file
''' o _PATH_SUDO_SUDOERS -> _PATH_SUDOERS and _PATH_SUDO_STMP -> _PATH_SUDOERS_TMP
''' '''
''' '''
.de Sh .de Sh
@ -96,7 +97,7 @@
.nr % 0 .nr % 0
.rr F .rr F
.\} .\}
.TH VISUDO 8 "1.6" "1/Aug/1999" "MAINTENANCE COMMANDS" .TH VISUDO 8 "1.6" "6/Aug/1999" "MAINTENANCE COMMANDS"
.UC .UC
.if n .hy 0 .if n .hy 0
.if n .na .if n .na
@ -226,9 +227,9 @@ and exit.
.SH "ERRORS" .SH "ERRORS"
.Ip "sudoers file busy, try again later." 4 .Ip "sudoers file busy, try again later." 4
Either someone is currently editing the \fIsudoers\fR file Either someone is currently editing the \fIsudoers\fR file
or there is a stale sudoers lock file (/etc/stmp by default) or there is a stale sudoers lock file (/etc/sudoers.tmp by default)
that you need to delete. that you need to delete.
.Ip "/etc/stmp: Permission denied" 4 .Ip "/etc/sudoers.tmp: Permission denied" 4
You didn't run \fBvisudo\fR as root. You didn't run \fBvisudo\fR as root.
.Ip "Can't find you in the passwd database" 4 .Ip "Can't find you in the passwd database" 4
Your userid does not appear in the passwd file. Your userid does not appear in the passwd file.
@ -236,7 +237,7 @@ Your userid does not appear in the passwd file.
.Sp .Sp
.Vb 2 .Vb 2
\& /etc/sudoers List of who can run what \& /etc/sudoers List of who can run what
\& /etc/stmp Lock file for visudo \& /etc/sudoers.tmp Lock file for visudo
.Ve .Ve
.SH "ENVIRONMENT VARIABLES" .SH "ENVIRONMENT VARIABLES"
The following are used only if \fBvisudo\fR was configured with the The following are used only if \fBvisudo\fR was configured with the
@ -294,7 +295,7 @@ the individual \fBvisudo\fR program.
.IX Item "sudoers file busy, try again later." .IX Item "sudoers file busy, try again later."
.IX Item "/etc/stmp: Permission denied" .IX Item "/etc/sudoers.tmp: Permission denied"
.IX Item "Can't find you in the passwd database" .IX Item "Can't find you in the passwd database"

View File

@ -89,10 +89,10 @@ and exit.
=item sudoers file busy, try again later. =item sudoers file busy, try again later.
Either someone is currently editing the I<sudoers> file Either someone is currently editing the I<sudoers> file
or there is a stale sudoers lock file (/etc/stmp by default) or there is a stale sudoers lock file (/etc/sudoers.tmp by default)
that you need to delete. that you need to delete.
=item /etc/stmp: Permission denied =item /etc/sudoers.tmp: Permission denied
You didn't run B<visudo> as root. You didn't run B<visudo> as root.
@ -103,7 +103,7 @@ Your userid does not appear in the passwd file.
=head1 FILES =head1 FILES
/etc/sudoers List of who can run what /etc/sudoers List of who can run what
/etc/stmp Lock file for visudo /etc/sudoers.tmp Lock file for visudo
=head1 ENVIRONMENT VARIABLES =head1 ENVIRONMENT VARIABLES