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@
# 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. ####

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."
and doesn't do anything.
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
the time.

View File

@ -119,7 +119,7 @@ sudoers_lookup(check_cmnd)
/* Become sudoers file owner */
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);
yyin = sudoers_fp;
yyout = stdout;

View File

@ -51,20 +51,20 @@
#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
#define _PATH_SUDO_SUDOERS "/etc/sudoers"
#endif /* _PATH_SUDO_SUDOERS */
#ifndef _PATH_SUDOERS
#define _PATH_SUDOERS "/etc/sudoers"
#endif /* _PATH_SUDOERS */
/*
* NOTE: _PATH_SUDO_STMP is usually overriden by the Makefile.
* _PATH_SUDO_STMP *MUST* be on the same partition
* as _PATH_SUDO_SUDOERS!
* NOTE: _PATH_SUDOERS_TMP is usually overriden by the Makefile.
* _PATH_SUDOERS_TMP *MUST* be on the same partition
* as _PATH_SUDOERS!
*/
#ifndef _PATH_SUDO_STMP
#define _PATH_SUDO_STMP "/etc/stmp"
#endif /* _PATH_SUDO_STMP */
#ifndef _PATH_SUDOERS_TMP
#define _PATH_SUDOERS_TMP "/etc/sudoers.tmp"
#endif /* _PATH_SUDOERS_TMP */
/*
* 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);
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) {
remove_timestamp((sudo_mode == MODE_KILL));
@ -359,7 +359,7 @@ main(argc, argv)
#endif /* DONT_LEAK_PATH_INFO */
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);
break;
@ -765,26 +765,26 @@ check_sudoers()
* Only works if filesystem is readable/writable by root.
*/
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 &&
(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",
Argv[0], _PATH_SUDO_SUDOERS);
Argv[0], _PATH_SUDOERS);
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",
Argv[0], _PATH_SUDO_SUDOERS);
Argv[0], _PATH_SUDOERS);
statbuf.st_gid = SUDOERS_GID;
} else {
(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 {
(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);
if (rootstat != 0 && lstat(_PATH_SUDO_SUDOERS, &statbuf) != 0)
log_error(USE_ERRNO, "can't stat %s", _PATH_SUDO_SUDOERS);
if (rootstat != 0 && lstat(_PATH_SUDOERS, &statbuf) != 0)
log_error(USE_ERRNO, "can't stat %s", _PATH_SUDOERS);
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)
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);
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);
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);
else {
/* Solaris sometimes returns EAGAIN so try 10 times */
for (i = 0; i < 10 ; i++) {
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) {
sudoers_fp = NULL;
if (errno != EAGAIN && errno != EWOULDBLOCK)
@ -822,7 +822,7 @@ check_sudoers()
sleep(1);
}
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);

View File

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

View File

@ -46,10 +46,10 @@ OOOOPPPPTTTTIIIIOOOONNNNSSSS
EEEERRRRRRRROOOORRRRSSSS
sudoers file busy, try again later.
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
default) that you need to delete.
or there is a stale sudoers lock file
(/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.
Can't find you in the passwd database
@ -57,11 +57,11 @@ EEEERRRRRRRROOOORRRRSSSS
FFFFIIIILLLLEEEESSSS
/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>
<DT><STRONG><A NAME="item_sudoers">sudoers file busy, try again later.</A></STRONG><DD>
<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
need to delete.
Either someone is currently editing the <EM>sudoers</EM> file or there is a stale sudoers lock file (/etc/sudoers.tmp by default)
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>
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>
<P>
<PRE> /etc/sudoers file of authorized users.
/etc/stmp lock file for visudo.
<PRE> /etc/sudoers List of who can run what
/etc/sudoers.tmp Lock file for visudo
</PRE>
<H1><A NAME="ENVIRONMENT_VARIABLES">ENVIRONMENT VARIABLES</A></H1>
<P>
The following are used only if <STRONG>visudo</STRONG> was compiled with the
<EM>ENV_EDITOR</EM> option:
The following are used only if <STRONG>visudo</STRONG> was configured with the
<EM>--with-env-editor</EM> option:
<P>
<PRE> EDITOR Used by visudo as the editor to use.
VISUAL Used by visudo if EDITOR is not set.
<PRE> EDITOR Used by visudo as the editor to use
VISUAL Used by visudo if EDITOR is not set
</PRE>
<H1><A NAME="AUTHOR">AUTHOR</A></H1>
<P>
@ -115,18 +115,19 @@ See the HISTORY file in the sudo distribution for more details.
<P>
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>
<P>
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE file distributed with
sudo for more details.
<STRONG>Visudo</STRONG> is provided ``AS IS'' and any express or implied warranties, including, but
not limited to, the implied warranties of merchantability and fitness for a
particular purpose are disclaimed. See the LICENSE file distributed with <STRONG>sudo</STRONG> for complete details.
<H1><A NAME="CAVEATS">CAVEATS</A></H1>
<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.
<P>

View File

@ -2,8 +2,9 @@
''' $RCSfile$$Revision$$Date$
'''
''' $Log$
''' Revision 1.8 1999/08/01 16:26:16 millert
''' regen
''' Revision 1.9 1999/08/06 09:37:02 millert
''' 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
@ -96,7 +97,7 @@
.nr % 0
.rr F
.\}
.TH VISUDO 8 "1.6" "1/Aug/1999" "MAINTENANCE COMMANDS"
.TH VISUDO 8 "1.6" "6/Aug/1999" "MAINTENANCE COMMANDS"
.UC
.if n .hy 0
.if n .na
@ -226,9 +227,9 @@ and exit.
.SH "ERRORS"
.Ip "sudoers file busy, try again later." 4
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.
.Ip "/etc/stmp: Permission denied" 4
.Ip "/etc/sudoers.tmp: Permission denied" 4
You didn't run \fBvisudo\fR as root.
.Ip "Can't find you in the passwd database" 4
Your userid does not appear in the passwd file.
@ -236,7 +237,7 @@ Your userid does not appear in the passwd file.
.Sp
.Vb 2
\& /etc/sudoers List of who can run what
\& /etc/stmp Lock file for visudo
\& /etc/sudoers.tmp Lock file for visudo
.Ve
.SH "ENVIRONMENT VARIABLES"
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 "/etc/stmp: Permission denied"
.IX Item "/etc/sudoers.tmp: Permission denied"
.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.
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.
=item /etc/stmp: Permission denied
=item /etc/sudoers.tmp: Permission denied
You didn't run B<visudo> as root.
@ -103,7 +103,7 @@ Your userid does not appear in the passwd file.
=head1 FILES
/etc/sudoers List of who can run what
/etc/stmp Lock file for visudo
/etc/sudoers.tmp Lock file for visudo
=head1 ENVIRONMENT VARIABLES