summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-09-15 02:42:46 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-09-15 02:42:46 +0000
commit8da95adb020f1ac6a64a15889f274ad032f62f58 (patch)
treeda6720ca44e73a31fa146b3cff13893d89babc9b /gnu
parent5c307f137b9ab5db28a35cfd1ec5be58bae697bd (diff)
sudo 1.5.6
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/sudo/README2
-rw-r--r--gnu/usr.bin/sudo/sudo/Makefile10
-rw-r--r--gnu/usr.bin/sudo/sudo/check.c84
-rw-r--r--gnu/usr.bin/sudo/sudo/compat.h13
-rw-r--r--gnu/usr.bin/sudo/sudo/config.h46
-rw-r--r--gnu/usr.bin/sudo/sudo/find_path.c10
-rw-r--r--gnu/usr.bin/sudo/sudo/getspwuid.c6
-rw-r--r--gnu/usr.bin/sudo/sudo/goodpath.c6
-rw-r--r--gnu/usr.bin/sudo/sudo/ins_2001.h6
-rw-r--r--gnu/usr.bin/sudo/sudo/ins_classic.h6
-rw-r--r--gnu/usr.bin/sudo/sudo/ins_csops.h6
-rw-r--r--gnu/usr.bin/sudo/sudo/ins_goons.h6
-rw-r--r--gnu/usr.bin/sudo/sudo/insults.h6
-rw-r--r--gnu/usr.bin/sudo/sudo/interfaces.c82
-rw-r--r--gnu/usr.bin/sudo/sudo/logging.c48
-rw-r--r--gnu/usr.bin/sudo/sudo/options.h7
-rw-r--r--gnu/usr.bin/sudo/sudo/parse.c18
-rw-r--r--gnu/usr.bin/sudo/sudo/parse.lex10
-rw-r--r--gnu/usr.bin/sudo/sudo/parse.yacc9
-rw-r--r--gnu/usr.bin/sudo/sudo/pathnames.h6
-rw-r--r--gnu/usr.bin/sudo/sudo/sudo.810
-rw-r--r--gnu/usr.bin/sudo/sudo/sudo.c27
-rw-r--r--gnu/usr.bin/sudo/sudo/sudo.h10
-rw-r--r--gnu/usr.bin/sudo/sudo/sudo_setenv.c6
-rw-r--r--gnu/usr.bin/sudo/sudo/sudoers.510
-rw-r--r--gnu/usr.bin/sudo/sudo/tgetpass.c7
-rw-r--r--gnu/usr.bin/sudo/sudo/version.h8
-rw-r--r--gnu/usr.bin/sudo/visudo/Makefile10
-rw-r--r--gnu/usr.bin/sudo/visudo/visudo.810
-rw-r--r--gnu/usr.bin/sudo/visudo/visudo.c12
30 files changed, 307 insertions, 190 deletions
diff --git a/gnu/usr.bin/sudo/README b/gnu/usr.bin/sudo/README
index baf19eef582..3e714dc1be0 100644
--- a/gnu/usr.bin/sudo/README
+++ b/gnu/usr.bin/sudo/README
@@ -1,3 +1,3 @@
This is a minimal sudo distribution for OpenBSD. You can get the
-full package at ftp://ftp.courtesan.com/pub/sudo/. For info on
+full package at ftp://ftp.cs.colorado.edu/pub/sudo/. For info on
sudo please see http://www.courtesan.com/sudo/.
diff --git a/gnu/usr.bin/sudo/sudo/Makefile b/gnu/usr.bin/sudo/sudo/Makefile
index 04721f883aa..dbb94bbe8b7 100644
--- a/gnu/usr.bin/sudo/sudo/Makefile
+++ b/gnu/usr.bin/sudo/sudo/Makefile
@@ -1,10 +1,10 @@
-# $OpenBSD: Makefile,v 1.4 1997/04/19 21:26:13 millert Exp $
+# $OpenBSD: Makefile,v 1.5 1998/09/15 02:42:43 millert Exp $
PROG= sudo
MAN= sudo.8 sudoers.5
CFLAGS+=-I${.CURDIR} -I.
-SRCS= check.c find_path.c getspwuid.c goodpath.c interfaces.c logging.c parse.c sudo.c sudo_setenv.c tgetpass.c y.tab.c lex.yy.c
-CLEANFILES+=y.tab.c y.tab.h lex.yy.c
+SRCS= check.c find_path.c getspwuid.c goodpath.c interfaces.c logging.c parse.c sudo.c sudo_setenv.c tgetpass.c sudo.tab.c lex.yy.c
+CLEANFILES+=sudo.tab.c sudo.tab.h lex.yy.c
LDADD= -lcompat
DPADD= ${LIBCOMPAT}
@@ -37,5 +37,5 @@ lex.yy.c: parse.lex
rm -f lex.yy.c
$(LEX) ${.CURDIR}/parse.lex
-y.tab.c y.tab.h: parse.yacc
- $(YACC) -d ${.CURDIR}/parse.yacc
+sudo.tab.c sudo.tab.h: parse.yacc
+ $(YACC) -b sudo -d ${.CURDIR}/parse.yacc
diff --git a/gnu/usr.bin/sudo/sudo/check.c b/gnu/usr.bin/sudo/sudo/check.c
index e3a63bda39c..9ecda12c749 100644
--- a/gnu/usr.bin/sudo/sudo/check.c
+++ b/gnu/usr.bin/sudo/sudo/check.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: check.c,v 1.9 1998/04/08 02:53:00 millert Exp $ */
+/* $OpenBSD: check.c,v 1.10 1998/09/15 02:42:43 millert Exp $ */
/*
- * CU sudo version 1.5.5 (based on Root Group sudo version 1.1)
+ * CU sudo version 1.5.6 (based on Root Group sudo version 1.1)
*
* This software comes with no waranty whatsoever, use at your own risk.
*
@@ -38,7 +38,7 @@
*/
#ifndef lint
-static char rcsid[] = "Id: check.c,v 1.133 1998/03/31 05:05:28 millert Exp $";
+static char rcsid[] = "$From: check.c,v 1.140 1998/09/11 23:19:53 millert Exp $";
#endif /* lint */
#include "config.h"
@@ -79,6 +79,10 @@ static char rcsid[] = "Id: check.c,v 1.133 1998/03/31 05:05:28 millert Exp $";
#ifdef HAVE_KERB4
# include <krb.h>
#endif /* HAVE_KERB4 */
+#ifdef HAVE_PAM
+# include <security/pam_appl.h>
+# include <security/pam_misc.h>
+#endif /* HAVE_PAM */
#ifdef HAVE_AFS
# include <afs/stds.h>
# include <afs/kautils.h>
@@ -114,6 +118,9 @@ static void reminder __P((void));
#ifdef HAVE_KERB4
static int sudo_krb_validate_user __P((struct passwd *, char *));
#endif /* HAVE_KERB4 */
+#ifdef HAVE_PAM
+static void pam_attempt_auth __P((void));
+#endif /* HAVE_PAM */
#ifdef HAVE_SKEY
static char *sudo_skeyprompt __P((struct skey *, char *));
#endif /* HAVE_SKEY */
@@ -126,13 +133,19 @@ int user_is_exempt __P((void));
* Globals
*/
static int timedir_is_good;
-static char timestampfile[MAXPATHLEN + 1];
+static char timestampfile[MAXPATHLEN];
#ifdef HAVE_SECURID
union config_record configure;
#endif /* HAVE_SECURID */
#ifdef HAVE_SKEY
struct skey skey;
#endif
+#ifdef HAVE_PAM
+static struct pam_conv conv = {
+ misc_conv,
+ NULL
+};
+#endif
#ifdef HAVE_OPIE
struct opie opie;
#endif
@@ -166,7 +179,11 @@ void check_user()
if (rtn == 2)
reminder(); /* do the reminder if ticket file is new */
#endif /* NO_MESSAGE */
+#ifdef HAVE_PAM
+ pam_attempt_auth();
+#else /* !HAVE_PAM */
check_passwd();
+#endif /* HAVE_PAM */
}
update_timestamp();
@@ -572,7 +589,7 @@ static void check_passwd()
set_perms(PERM_USER, 0);
}
# endif /* HAVE_OPIE */
-# if !defined(HAVE_SKEY) || !defined(SKEY_ONLY)
+# if !defined(OTP_ONLY) || (!defined(HAVE_SKEY) && !defined(HAVE_OPIE))
/*
* If we use shadow passwords with a different crypt(3)
* check that here, else use standard crypt(3).
@@ -641,7 +658,7 @@ static void check_passwd()
if (dce_pwent(user_name, pass))
return;
# endif /* HAVE_DCE */
-# endif /* !HAVE_SKEY || !SKEY_ONLY */
+# endif /* !OTP_ONLY || (!HAVE_SKEY && !HAVE_OPIE) */
#endif /* HAVE_AUTHENTICATE */
--counter; /* otherwise, try again */
@@ -717,6 +734,53 @@ static int sudo_krb_validate_user(pw_ent, pass)
}
#endif /* HAVE_KERB4 */
+#ifdef HAVE_PAM
+/********************************************************************
+ * pam_attempt_auth()
+ *
+ * Try to authenticate the user using Pluggable Authentication
+ * Modules (PAM). Added 9/11/98 by Gary J. Calvin
+ */
+static void pam_attempt_auth()
+{
+ pam_handle_t *pamh=NULL;
+ int retval;
+ register int counter = TRIES_FOR_PASSWORD;
+
+ /* printf("PAM Authentication\n"); */
+ retval = pam_start("sudo", user_name, &conv, &pamh);
+ if (retval != PAM_SUCCESS) {
+ pam_end(pamh, retval);
+ exit(1);
+ }
+ while (counter > 0) {
+ retval = pam_authenticate(pamh, 0);
+ if (retval == PAM_SUCCESS) {
+ set_perms(PERM_USER, 0);
+ pam_end(pamh, retval);
+ return;
+ }
+
+ --counter;
+#ifdef USE_INSULTS
+ (void) fprintf(stderr, "%s\n", INSULT);
+#else
+ (void) fprintf(stderr, "%s\n", INCORRECT_PASSWORD);
+#endif /* USE_INSULTS */
+ }
+ set_perms(PERM_USER, 0);
+
+ if (counter > 0) {
+ log_error(PASSWORD_NOT_CORRECT);
+ inform_user(PASSWORD_NOT_CORRECT);
+ } else {
+ log_error(PASSWORDS_NOT_CORRECT);
+ inform_user(PASSWORDS_NOT_CORRECT);
+ }
+ pam_end(pamh, retval);
+ exit(1);
+}
+#endif /* HAVE_PAM */
#ifdef HAVE_SKEY
/********************************************************************
@@ -829,16 +893,16 @@ static char *sudo_opieprompt(user_opie, p)
if ((rval = opiechallenge(user_opie, user_name, challenge)) != 0) {
#ifdef OTP_ONLY
(void) fprintf(stderr,
- "%s: You do not exist in the s/key database.\n",
+ "%s: You do not exist in the opie database.\n",
Argv[0]);
exit(1);
#else
- /* return the original prompt if we cannot get s/key info */
+ /* return the original prompt if we cannot get opie info */
return(orig_prompt);
#endif /* OTP_ONLY */
}
- /* get space for new prompt with embedded s/key challenge */
+ /* get space for new prompt with embedded opie challenge */
if (new_prompt == NULL) {
/* allocate space for new prompt */
np_size = op_len + strlen(challenge) + 7;
@@ -886,7 +950,7 @@ static void reminder()
(void) fprintf(stderr, "\n%s\n%s\n\n%s\n%s\n\n",
#else
(void) fprintf(stderr, "\n%s\n%s\n%s\n%s\n\n%s\n%s\n\n%s\n%s\n\n",
- " CU sudo version 1.5.5, based on Root Group sudo version 1.1",
+ " CU sudo version , based on Root Group sudo version 1.1",
" sudo version 1.1, Copyright (C) 1991 The Root Group, Inc.",
" sudo comes with ABSOLUTELY NO WARRANTY. This is free software,",
" and you are welcome to redistribute it under certain conditions.",
diff --git a/gnu/usr.bin/sudo/sudo/compat.h b/gnu/usr.bin/sudo/sudo/compat.h
index 2ce5a5e093a..2c8231a426f 100644
--- a/gnu/usr.bin/sudo/sudo/compat.h
+++ b/gnu/usr.bin/sudo/sudo/compat.h
@@ -1,7 +1,7 @@
-/* $OpenBSD: compat.h,v 1.5 1998/03/31 06:40:50 millert Exp $ */
+/* $OpenBSD: compat.h,v 1.6 1998/09/15 02:42:43 millert Exp $ */
/*
- * CU sudo version 1.5.5
+ * CU sudo version 1.5.6
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
*
* Please send bugs, changes, problems to sudo-bugs@courtesan.com
*
- * Id: compat.h,v 1.36 1998/03/31 05:05:29 millert Exp $
+ * $From: compat.h,v 1.39 1998/09/09 00:45:17 millert Exp $
*/
#ifndef _SUDO_COMPAT_H
@@ -87,6 +87,13 @@
#endif /* S_IRWXU */
/*
+ * Some OS's may not have this.
+ */
+#ifndef howmany
+#define howmany(x, y) (((x) + ((y) - 1)) / (y))
+#endif
+
+/*
* We need to know how long the longest password may be.
* For alternate password schemes we need longer passwords.
* This is a bit, ummm, gross but necesary.
diff --git a/gnu/usr.bin/sudo/sudo/config.h b/gnu/usr.bin/sudo/sudo/config.h
index 6dd39adfe49..33a2494ea68 100644
--- a/gnu/usr.bin/sudo/sudo/config.h
+++ b/gnu/usr.bin/sudo/sudo/config.h
@@ -1,8 +1,8 @@
-/* $OpenBSD: config.h,v 1.4 1998/03/31 06:40:51 millert Exp $ */
+/* $OpenBSD: config.h,v 1.5 1998/09/15 02:42:43 millert Exp $ */
/* config.h. Generated automatically by configure. */
/*
- * CU sudo version 1.5.5
+ * CU sudo version 1.5.6
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
*
* Please send bugs, changes, problems to sudo-bugs@courtesan.com
*
- * Id: config.h.in,v 1.87 1998/03/31 05:05:30 millert Exp $
+ * $From: config.h.in,v 1.95 1998/09/11 23:23:33 millert Exp $
*/
/*
@@ -73,6 +73,12 @@
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef ssize_t */
+/* Define to `int' if <sys/types.h> doesn't define. */
+/* #undef dev_t */
+
+/* Define to `unsigned int' if <sys/types.h> doesn't define. */
+/* #undef ino_t */
+
/* Define to be nil if C compiler doesn't support "const." */
/* #undef const */
@@ -108,6 +114,9 @@
# define HAVE_KERB4
#endif /* HAVE_KERB5 */
+/* Define if you use PAM. */
+/* #undef HAVE_PAM */
+
/* Define if you use AFS. */
/* #undef HAVE_AFS */
@@ -124,10 +133,7 @@
#define HAVE_TZSET 1
/* Define if you have getcwd(3). */
-/* #undef HAVE_GETCWD */
-
-/* Define if you have getwd(3). */
-#define HAVE_GETWD 1
+#define HAVE_GETCWD 1
/* Define if you have strdup(3). */
#define HAVE_STRDUP 1
@@ -195,9 +201,18 @@
/* Define if you have bigcrypt(3). */
/* #undef HAVE_BIGCRYPT */
+/* Define if you have set_auth_parameters(3). */
+/* #undef HAVE_SET_AUTH_PARAMETERS */
+
/* Define if you have seteuid(3). */
#define HAVE_SETEUID 1
+/* Define if you have waitpid(2). */
+#define HAVE_WAITPID 1
+
+/* Define if you have wait3(2). */
+/* #undef HAVE_WAIT3 */
+
/* Define if you have the <malloc.h> header file. */
/* #undef HAVE_MALLOC_H */
@@ -276,6 +291,23 @@
/* #undef BROKEN_SYSLOG */
/*
+ * Emulate a subset of waitpid() if we don't have it.
+ */
+#ifdef HAVE_WAITPID
+#define sudo_waitpid(p, s, o) waitpid(p, s, o)
+#else
+#ifdef HAVE_WAIT3
+#define sudo_waitpid(p, s, o) wait3(s, o, NULL)
+#endif
+#endif
+
+/* Define if you want the hostname to be entered into the log file */
+/* #undef HOST_IN_LOG */
+
+/* Define if you want the log file line to be wrapped */
+#define WRAP_LOG 1
+
+/*
* Paths to commands used by sudo. There are used by pathnames.h.
* If you want to override these values, do so in pathnames.h, not here!
*/
diff --git a/gnu/usr.bin/sudo/sudo/find_path.c b/gnu/usr.bin/sudo/sudo/find_path.c
index d679e71944c..285166fc18e 100644
--- a/gnu/usr.bin/sudo/sudo/find_path.c
+++ b/gnu/usr.bin/sudo/sudo/find_path.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: find_path.c,v 1.5 1998/03/31 06:40:53 millert Exp $ */
+/* $OpenBSD: find_path.c,v 1.6 1998/09/15 02:42:44 millert Exp $ */
/*
- * CU sudo version 1.5.5
+ * CU sudo version 1.5.6
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@
*/
#ifndef lint
-static char rcsid[] = "Id: find_path.c,v 1.72 1998/03/31 05:05:31 millert Exp $";
+static char rcsid[] = "$From: find_path.c,v 1.74 1998/04/06 03:35:34 millert Exp $";
#endif /* lint */
#include "config.h"
@@ -96,7 +96,7 @@ extern char *strdup __P((const char *));
char * find_path(file)
char *file; /* file to find */
{
- static char command[MAXPATHLEN + 1]; /* qualified filename */
+ static char command[MAXPATHLEN]; /* qualified filename */
register char *n; /* for traversing path */
char *path = NULL; /* contents of PATH env var */
char *origpath; /* so we can free path later */
@@ -107,7 +107,7 @@ char * find_path(file)
command[0] = '\0';
- if (strlen(file) > MAXPATHLEN) {
+ if (strlen(file) >= MAXPATHLEN) {
errno = ENAMETOOLONG;
(void) fprintf(stderr, "%s: path too long: %s\n", Argv[0], file);
exit(1);
diff --git a/gnu/usr.bin/sudo/sudo/getspwuid.c b/gnu/usr.bin/sudo/sudo/getspwuid.c
index 8ba130d1b3a..49032f0725e 100644
--- a/gnu/usr.bin/sudo/sudo/getspwuid.c
+++ b/gnu/usr.bin/sudo/sudo/getspwuid.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: getspwuid.c,v 1.5 1998/03/31 06:40:54 millert Exp $ */
+/* $OpenBSD: getspwuid.c,v 1.6 1998/09/15 02:42:44 millert Exp $ */
/*
- * CU sudo version 1.5.5
+ * CU sudo version 1.5.6
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@
*/
#ifndef lint
-static char rcsid[] = "Id: getspwuid.c,v 1.28 1998/03/31 05:05:32 millert Exp $";
+static char rcsid[] = "$From: getspwuid.c,v 1.29 1998/04/06 03:35:34 millert Exp $";
#endif /* lint */
#include "config.h"
diff --git a/gnu/usr.bin/sudo/sudo/goodpath.c b/gnu/usr.bin/sudo/sudo/goodpath.c
index c09920caa81..e61d547cb6a 100644
--- a/gnu/usr.bin/sudo/sudo/goodpath.c
+++ b/gnu/usr.bin/sudo/sudo/goodpath.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: goodpath.c,v 1.5 1998/03/31 06:40:55 millert Exp $ */
+/* $OpenBSD: goodpath.c,v 1.6 1998/09/15 02:42:44 millert Exp $ */
/*
- * CU sudo version 1.5.5
+ * CU sudo version 1.5.6
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@
*/
#ifndef lint
-static char rcsid[] = "Id: goodpath.c,v 1.21 1998/03/31 05:05:33 millert Exp $";
+static char rcsid[] = "$From: goodpath.c,v 1.22 1998/04/06 03:35:35 millert Exp $";
#endif /* lint */
#include "config.h"
diff --git a/gnu/usr.bin/sudo/sudo/ins_2001.h b/gnu/usr.bin/sudo/sudo/ins_2001.h
index 43ca8fe689f..edb83a9361c 100644
--- a/gnu/usr.bin/sudo/sudo/ins_2001.h
+++ b/gnu/usr.bin/sudo/sudo/ins_2001.h
@@ -1,7 +1,7 @@
-/* $OpenBSD: ins_2001.h,v 1.5 1998/03/31 06:40:56 millert Exp $ */
+/* $OpenBSD: ins_2001.h,v 1.6 1998/09/15 02:42:44 millert Exp $ */
/*
- * CU sudo version 1.5.5
+ * CU sudo version 1.5.6
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
*
* Please send bugs, changes, problems to sudo-bugs@courtesan.com
*
- * Id: ins_2001.h,v 1.18 1998/03/31 05:05:34 millert Exp $
+ * $From: ins_2001.h,v 1.20 1998/09/07 02:59:06 millert Exp $
*/
#ifndef _SUDO_INS_2001_H
diff --git a/gnu/usr.bin/sudo/sudo/ins_classic.h b/gnu/usr.bin/sudo/sudo/ins_classic.h
index 815cd3a2e89..55f134b49f4 100644
--- a/gnu/usr.bin/sudo/sudo/ins_classic.h
+++ b/gnu/usr.bin/sudo/sudo/ins_classic.h
@@ -1,7 +1,7 @@
-/* $OpenBSD: ins_classic.h,v 1.5 1998/03/31 06:40:57 millert Exp $ */
+/* $OpenBSD: ins_classic.h,v 1.6 1998/09/15 02:42:44 millert Exp $ */
/*
- * CU sudo version 1.5.5
+ * CU sudo version 1.5.6
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
*
* Please send bugs, changes, problems to sudo-bugs@courtesan.com
*
- * Id: ins_classic.h,v 1.18 1998/03/31 05:05:34 millert Exp $
+ * $From: ins_classic.h,v 1.20 1998/09/07 02:59:06 millert Exp $
*/
#ifndef _SUDO_INS_CLASSIC_H
diff --git a/gnu/usr.bin/sudo/sudo/ins_csops.h b/gnu/usr.bin/sudo/sudo/ins_csops.h
index 2f833ff8967..ed5adf4387c 100644
--- a/gnu/usr.bin/sudo/sudo/ins_csops.h
+++ b/gnu/usr.bin/sudo/sudo/ins_csops.h
@@ -1,7 +1,7 @@
-/* $OpenBSD: ins_csops.h,v 1.5 1998/03/31 06:40:58 millert Exp $ */
+/* $OpenBSD: ins_csops.h,v 1.6 1998/09/15 02:42:44 millert Exp $ */
/*
- * CU sudo version 1.5.5
+ * CU sudo version 1.5.6
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
*
* Please send bugs, changes, problems to sudo-bugs@courtesan.com
*
- * Id: ins_csops.h,v 1.17 1998/03/31 05:05:35 millert Exp $
+ * $From: ins_csops.h,v 1.19 1998/09/07 02:59:06 millert Exp $
*/
#ifndef _SUDO_INS_CSOPS_H
diff --git a/gnu/usr.bin/sudo/sudo/ins_goons.h b/gnu/usr.bin/sudo/sudo/ins_goons.h
index fb759b43a1d..6fc1dfb0f1a 100644
--- a/gnu/usr.bin/sudo/sudo/ins_goons.h
+++ b/gnu/usr.bin/sudo/sudo/ins_goons.h
@@ -1,7 +1,7 @@
-/* $OpenBSD: ins_goons.h,v 1.5 1998/03/31 06:40:59 millert Exp $ */
+/* $OpenBSD: ins_goons.h,v 1.6 1998/09/15 02:42:44 millert Exp $ */
/*
- * CU sudo version 1.5.5
+ * CU sudo version 1.5.6
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
*
* Please send bugs, changes, problems to sudo-bugs@courtesan.com
*
- * Id: ins_goons.h,v 1.18 1998/03/31 05:05:36 millert Exp $
+ * $From: ins_goons.h,v 1.20 1998/09/07 02:59:06 millert Exp $
*/
#ifndef _SUDO_INS_GOONS_H
diff --git a/gnu/usr.bin/sudo/sudo/insults.h b/gnu/usr.bin/sudo/sudo/insults.h
index 2954537fd61..79610564d37 100644
--- a/gnu/usr.bin/sudo/sudo/insults.h
+++ b/gnu/usr.bin/sudo/sudo/insults.h
@@ -1,7 +1,7 @@
-/* $OpenBSD: insults.h,v 1.5 1998/03/31 06:41:01 millert Exp $ */
+/* $OpenBSD: insults.h,v 1.6 1998/09/15 02:42:44 millert Exp $ */
/*
- * CU sudo version 1.5.5
+ * CU sudo version 1.5.6
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
*
* Please send bugs, changes, problems to sudo-bugs@courtesan.com
*
- * Id: insults.h,v 1.30 1998/03/31 05:05:37 millert Exp $
+ * $From: insults.h,v 1.32 1998/09/07 02:59:36 millert Exp $
*/
#ifndef _SUDO_INSULTS_H
diff --git a/gnu/usr.bin/sudo/sudo/interfaces.c b/gnu/usr.bin/sudo/sudo/interfaces.c
index 119dbdf7aaa..3ef4047838f 100644
--- a/gnu/usr.bin/sudo/sudo/interfaces.c
+++ b/gnu/usr.bin/sudo/sudo/interfaces.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: interfaces.c,v 1.5 1998/03/31 06:41:02 millert Exp $ */
+/* $OpenBSD: interfaces.c,v 1.6 1998/09/15 02:42:44 millert Exp $ */
/*
- * CU sudo version 1.5.5
+ * CU sudo version 1.5.6
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@
*/
#ifndef lint
-static char rcsid[] = "Id: interfaces.c,v 1.34 1998/03/31 05:05:37 millert Exp $";
+static char rcsid[] = "$From: interfaces.c,v 1.38 1998/09/14 15:48:05 millert Exp $";
#endif /* lint */
#include "config.h"
@@ -108,19 +108,15 @@ extern char **Argv;
void load_interfaces()
{
struct ifconf *ifconf;
- struct ifreq ifreq, *ifr;
+ struct ifreq *ifr, ifr_tmp;
struct sockaddr_in *sin;
- unsigned int localhost_mask;
int sock, n, i;
size_t len = sizeof(struct ifconf) + BUFSIZ;
- char *ifconf_buf = NULL;
+ char *previfname = "", *ifconf_buf = NULL;
#ifdef _ISC
struct strioctl strioctl;
#endif /* _ISC */
- /* so we can skip localhost and its ilk */
- localhost_mask = inet_addr("127.0.0.0");
-
sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock < 0) {
perror("socket");
@@ -131,10 +127,7 @@ void load_interfaces()
* get interface configuration or return (leaving interfaces NULL)
*/
for (;;) {
- if (ifconf_buf == NULL)
- ifconf_buf = (char *) malloc(len);
- else
- ifconf_buf = (char *) realloc(ifconf_buf, len);
+ ifconf_buf = ifconf_buf ? realloc(ifconf_buf, len) : malloc(len);
if (ifconf_buf == NULL) {
perror("malloc");
exit(1);
@@ -176,58 +169,61 @@ void load_interfaces()
}
/*
- * for each interface, get the ip address and netmask
+ * for each interface, store the ip address and netmask
*/
- for (ifreq.ifr_name[0] = '\0', i = 0; i < ifconf->ifc_len; ) {
+ for (i = 0; i < ifconf->ifc_len; ) {
/* get a pointer to the current interface */
- ifr = (struct ifreq *) ((caddr_t) ifconf->ifc_req + i);
+ ifr = (struct ifreq *) &ifconf->ifc_buf[i];
/* set i to the subscript of the next interface */
+ i += sizeof(struct ifreq);
#ifdef HAVE_SA_LEN
if (ifr->ifr_addr.sa_len > sizeof(ifr->ifr_addr))
- i += sizeof(ifr->ifr_name) + ifr->ifr_addr.sa_len;
- else
+ i += ifr->ifr_addr.sa_len - sizeof(struct sockaddr);
#endif /* HAVE_SA_LEN */
- i += sizeof(struct ifreq);
/* skip duplicates and interfaces with NULL addresses */
sin = (struct sockaddr_in *) &ifr->ifr_addr;
if (sin->sin_addr.s_addr == 0 ||
- strncmp(ifr->ifr_name, ifreq.ifr_name, sizeof(ifr->ifr_name)) == 0)
+ strncmp(previfname, ifr->ifr_name, sizeof(ifr->ifr_name) - 1) == 0)
continue;
- /* make a working copy... */
- ifreq = *ifr;
-
- /* get the ip address */
-#ifdef _ISC
- STRSET(SIOCGIFADDR, (caddr_t) &ifreq, sizeof(ifreq));
- if (ioctl(sock, I_STR, (caddr_t) &strioctl) < 0) {
-#else
- if (ioctl(sock, SIOCGIFADDR, (caddr_t) &ifreq)) {
-#endif /* _ISC */
- /* non-fatal error if interface is down or not supported */
- if (errno == EADDRNOTAVAIL || errno == ENXIO || errno == EAFNOSUPPORT)
+ /* skip non-ip things */
+ if (ifr->ifr_addr.sa_family != AF_INET)
continue;
- (void) fprintf(stderr, "%s: Error, ioctl: SIOCGIFADDR ", Argv[0]);
- perror("");
- exit(1);
- }
- sin = (struct sockaddr_in *) &ifreq.ifr_addr;
+ /*
+ * make sure the interface is up, skip if not.
+ */
+#ifdef SIOCGIFFLAGS
+ memset(&ifr_tmp, 0, sizeof(ifr_tmp));
+ strncpy(ifr_tmp.ifr_name, ifr->ifr_name, sizeof(ifr_tmp.ifr_name) - 1);
+ if (ioctl(sock, SIOCGIFFLAGS, (caddr_t) &ifr_tmp) < 0)
+#endif
+ ifr_tmp = *ifr;
+
+ /* skip interfaces marked "down" and "loopback" */
+ if (!(ifr_tmp.ifr_flags & IFF_UP) || (ifr_tmp.ifr_flags & IFF_LOOPBACK))
+ continue;
/* store the ip address */
+ sin = (struct sockaddr_in *) &ifr->ifr_addr;
interfaces[num_interfaces].addr.s_addr = sin->sin_addr.s_addr;
+ /* stash the name of the interface we saved */
+ previfname = ifr->ifr_name;
+
/* get the netmask */
+ (void) memset(&ifr_tmp, 0, sizeof(ifr_tmp));
+ strncpy(ifr_tmp.ifr_name, ifr->ifr_name, sizeof(ifr_tmp.ifr_name) - 1);
#ifdef SIOCGIFNETMASK
#ifdef _ISC
- STRSET(SIOCGIFNETMASK, (caddr_t) &ifreq, sizeof(ifreq));
+ STRSET(SIOCGIFNETMASK, (caddr_t) &ifr_tmp, sizeof(ifr_tmp));
if (ioctl(sock, I_STR, (caddr_t) &strioctl) == 0) {
#else
- if (ioctl(sock, SIOCGIFNETMASK, (caddr_t) &ifreq) == 0) {
+ if (ioctl(sock, SIOCGIFNETMASK, (caddr_t) &ifr_tmp) == 0) {
#endif /* _ISC */
- sin = (struct sockaddr_in *) &ifreq.ifr_addr;
+ sin = (struct sockaddr_in *) &ifr_tmp.ifr_addr;
/* store the netmask */
interfaces[num_interfaces].netmask.s_addr = sin->sin_addr.s_addr;
@@ -243,11 +239,7 @@ void load_interfaces()
interfaces[num_interfaces].netmask.s_addr = htonl(IN_CLASSA_NET);
}
- /* avoid localhost and friends */
- if ((interfaces[num_interfaces].addr.s_addr &
- interfaces[num_interfaces].netmask.s_addr) == localhost_mask)
- continue;
-
+ /* only now can we be sure it was a good/interesting interface */
num_interfaces++;
}
diff --git a/gnu/usr.bin/sudo/sudo/logging.c b/gnu/usr.bin/sudo/sudo/logging.c
index 597ad3dc976..9fe7fea27d3 100644
--- a/gnu/usr.bin/sudo/sudo/logging.c
+++ b/gnu/usr.bin/sudo/sudo/logging.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: logging.c,v 1.6 1998/03/31 06:41:03 millert Exp $ */
+/* $OpenBSD: logging.c,v 1.7 1998/09/15 02:42:44 millert Exp $ */
/*
- * CU sudo version 1.5.5 (based on Root Group sudo version 1.1)
+ * CU sudo version 1.5.6 (based on Root Group sudo version 1.1)
*
* This software comes with no waranty whatsoever, use at your own risk.
*
@@ -39,7 +39,7 @@
*/
#ifndef lint
-static char rcsid[] = "Id: logging.c,v 1.94 1998/03/31 05:05:38 millert Exp $";
+static char rcsid[] = "$From: logging.c,v 1.97 1998/09/10 22:51:09 millert Exp $";
#endif /* lint */
#include "config.h"
@@ -89,12 +89,6 @@ static void syslog_wrapper __P((int, char *, char *, char *));
static char *logline;
extern int errorlineno;
-/*
- * length of syslog-like header info used for mail and file logs
- * is len("Mon MM HH:MM:SS : username : ")
- */
-#define LOG_HEADER_LEN 29
-
#ifdef BROKEN_SYSLOG
#define MAXSYSLOGTRIES 16 /* num of retries for broken syslogs */
#define SYSLOG(a,b,c,d) syslog_wrapper(a,b,c,d)
@@ -138,7 +132,7 @@ void log_error(code)
int code;
{
char *p;
- int count;
+ int count, header_length;
time_t now;
#if (LOGGING & SLOG_FILE)
mode_t oldmask;
@@ -150,9 +144,19 @@ void log_error(code)
#endif /* LOGGING & SLOG_SYSLOG */
/*
+ * length of syslog-like header info used for mail and file logs
+ * is len("DDD MM HH:MM:SS : username : ") with an additional
+ * len("HOST=hostname : ") if HOST_IN_LOG is defined.
+ */
+ header_length = 21 + strlen(user_name);
+#ifdef HOST_IN_LOG
+ header_length += 8 + strlen(shost);
+#endif
+
+ /*
* Allocate enough memory for logline so we won't overflow it
*/
- count = LOG_HEADER_LEN + 136 + 2 * MAXPATHLEN + strlen(tty) + strlen(cwd) +
+ count = header_length + 136 + 2 * MAXPATHLEN + strlen(tty) + strlen(cwd) +
strlen(runas_user);
if (cmnd_args)
count += strlen(cmnd_args);
@@ -170,12 +174,16 @@ void log_error(code)
*/
now = time((time_t) 0);
p = ctime(&now) + 4;
- (void) sprintf(logline, "%15.15s : %8.8s : ", p, user_name);
+#ifdef HOST_IN_LOG
+ (void) sprintf(logline, "%15.15s : %s : HOST=%s : ", p, user_name, shost);
+#else
+ (void) sprintf(logline, "%15.15s : %s : ", p, user_name);
+#endif
/*
* we need a pointer to the end of logline for cheap appends.
*/
- p = logline + LOG_HEADER_LEN;
+ p = logline + header_length;
switch (code) {
@@ -318,7 +326,7 @@ void log_error(code)
/*
* Log the full line, breaking into multiple syslog(3) calls if necesary
*/
- p = &logline[LOG_HEADER_LEN]; /* skip past the date and user */
+ p = &logline[header_length]; /* skip past the date, host, and user */
for (count = 0; count < strlen(logline) / MAXSYSLOGLEN + 1; count++) {
if (strlen(p) > MAXSYSLOGLEN) {
/*
@@ -368,6 +376,9 @@ void log_error(code)
char *beg, *oldend, *end;
int maxlen = MAXLOGFILELEN;
+#ifndef WRAP_LOG
+ (void) fprintf(fp, "%s\n", logline);
+#else
/*
* Print out logline with word wrap
*/
@@ -415,6 +426,7 @@ void log_error(code)
beg = NULL; /* exit condition */
}
}
+#endif
(void) fclose(fp);
}
@@ -538,9 +550,15 @@ static void send_mail()
static RETSIGTYPE reapchild(sig)
int sig;
{
- int save_errno = errno;
+ int pid, status, save_errno = errno;
+#ifdef sudo_waitpid
+ do {
+ pid = sudo_waitpid(-1, &status, WNOHANG);
+ } while (pid == -1);
+#else
(void) wait(NULL);
+#endif
#ifndef POSIX_SIGNALS
(void) signal(SIGCHLD, reapchild);
#endif /* POSIX_SIGNALS */
diff --git a/gnu/usr.bin/sudo/sudo/options.h b/gnu/usr.bin/sudo/sudo/options.h
index e7b57a0140c..f6a06dce073 100644
--- a/gnu/usr.bin/sudo/sudo/options.h
+++ b/gnu/usr.bin/sudo/sudo/options.h
@@ -1,7 +1,7 @@
-/* $OpenBSD: options.h,v 1.9 1998/03/31 06:41:04 millert Exp $ */
+/* $OpenBSD: options.h,v 1.10 1998/09/15 02:42:44 millert Exp $ */
/*
- * CU sudo version 1.5.5
+ * CU sudo version 1.5.6
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
*
* Please send bugs, changes, problems to sudo-bugs@courtesan.com
*
- * Id: options.h,v 1.42 1998/03/31 05:15:42 millert Exp $
+ * $From: options.h,v 1.45 1998/09/15 02:25:48 millert Exp $
*/
#ifndef _SUDO_OPTIONS_H
@@ -33,6 +33,7 @@
/* User-configurable Sudo runtime options */
+#define RUNAS_DEFAULT "root" /* default user to run cmd as if no -u flag */
/*#define FQDN /* expect fully qualified hosts in sudoers */
#define LOGGING SLOG_SYSLOG /* log via SLOG_SYSLOG, SLOG_FILE, SLOG_BOTH */
#define LOGFAC LOG_AUTHPRIV /* syslog facility for sudo to use */
diff --git a/gnu/usr.bin/sudo/sudo/parse.c b/gnu/usr.bin/sudo/sudo/parse.c
index e7fbb4b0764..e5b0209ccd9 100644
--- a/gnu/usr.bin/sudo/sudo/parse.c
+++ b/gnu/usr.bin/sudo/sudo/parse.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: parse.c,v 1.7 1998/03/31 06:41:05 millert Exp $ */
+/* $OpenBSD: parse.c,v 1.8 1998/09/15 02:42:44 millert Exp $ */
/*
- * CU sudo version 1.5.5
+ * CU sudo version 1.5.6
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@
*/
#ifndef lint
-static char rcsid[] = "Id: parse.c,v 1.88 1998/03/31 05:05:40 millert Exp $";
+static char rcsid[] = "$From: parse.c,v 1.91 1998/09/07 02:41:33 millert Exp $";
#endif /* lint */
#include "config.h"
@@ -213,13 +213,15 @@ int command_matches(cmnd, user_args, path, sudoers_args)
struct stat pst;
DIR *dirp;
struct dirent *dent;
- char buf[MAXPATHLEN+1];
+ char buf[MAXPATHLEN];
static char *c;
/* don't bother with pseudo commands like "validate" */
if (strchr(cmnd, '/') == NULL)
return(FALSE);
+ plen = strlen(path);
+
/* only need to stat cmnd once since it never changes */
if (cmnd_st.st_dev == 0) {
if (stat(cmnd, &cmnd_st) < 0)
@@ -251,7 +253,6 @@ int command_matches(cmnd, user_args, path, sudoers_args)
else
return(FALSE);
} else {
- plen = strlen(path);
if (path[plen - 1] != '/') {
#ifdef FAST_MATCH
char *p;
@@ -293,6 +294,9 @@ int command_matches(cmnd, user_args, path, sudoers_args)
return(FALSE);
while ((dent = readdir(dirp)) != NULL) {
+ /* ignore paths > MAXPATHLEN (XXX - log) */
+ if (plen + NAMLEN(dent) >= sizeof(buf))
+ continue;
strcpy(buf, path);
strcat(buf, dent->d_name);
#ifdef FAST_MATCH
@@ -406,13 +410,13 @@ int netgr_matches(netgr, host, user)
#ifdef HAVE_GETDOMAINNAME
/* get the domain name (if any) */
if (domain == (char *) -1) {
- if ((domain = (char *) malloc(MAXHOSTNAMELEN + 1)) == NULL) {
+ if ((domain = (char *) malloc(MAXHOSTNAMELEN)) == NULL) {
perror("malloc");
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
exit(1);
}
- if (getdomainname(domain, MAXHOSTNAMELEN + 1) != 0 || *domain == '\0') {
+ if (getdomainname(domain, MAXHOSTNAMELEN) != 0 || *domain == '\0') {
(void) free(domain);
domain = NULL;
}
diff --git a/gnu/usr.bin/sudo/sudo/parse.lex b/gnu/usr.bin/sudo/sudo/parse.lex
index f149a06708f..7e5d64065c2 100644
--- a/gnu/usr.bin/sudo/sudo/parse.lex
+++ b/gnu/usr.bin/sudo/sudo/parse.lex
@@ -1,8 +1,8 @@
%{
-/* $OpenBSD: parse.lex,v 1.5 1998/03/31 06:41:06 millert Exp $ */
+/* $OpenBSD: parse.lex,v 1.6 1998/09/15 02:42:44 millert Exp $ */
/*
- * CU sudo version 1.5.5
+ * CU sudo version 1.5.6
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: parse.lex,v 1.5 1998/03/31 06:41:06 millert Exp $";
+static char rcsid[] = "$From: parse.lex,v 1.78 1998/09/07 03:09:49 millert Exp $";
#endif /* lint */
#include "config.h"
@@ -51,7 +51,7 @@ static char rcsid[] = "$Id: parse.lex,v 1.5 1998/03/31 06:41:06 millert Exp $";
#include <netinet/in.h>
#include "sudo.h"
#include <options.h>
-#include "y.tab.h"
+#include "sudo.tab.h"
#undef yywrap /* guard against a yywrap macro */
@@ -124,7 +124,7 @@ WORD [[:alnum:]_-]+
return(COMMENT);
} /* return comments */
-<GOTCMND>[^:\,= \t\n]+ {
+<GOTCMND>[^:\, \t\n]+ {
LEXTRACE("ARG ");
fill_args(yytext, yyleng, sawspace);
sawspace = FALSE;
diff --git a/gnu/usr.bin/sudo/sudo/parse.yacc b/gnu/usr.bin/sudo/sudo/parse.yacc
index 62a8c1d8fb0..60b38b921c5 100644
--- a/gnu/usr.bin/sudo/sudo/parse.yacc
+++ b/gnu/usr.bin/sudo/sudo/parse.yacc
@@ -1,9 +1,8 @@
%{
-
-/* $OpenBSD: parse.yacc,v 1.9 1998/03/31 06:41:08 millert Exp $ */
+/* $OpenBSD: parse.yacc,v 1.10 1998/09/15 02:42:44 millert Exp $ */
/*
- * CU sudo version 1.5.5
+ * CU sudo version 1.5.6
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,7 +28,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: parse.yacc,v 1.9 1998/03/31 06:41:08 millert Exp $";
+static char rcsid[] = "$From: parse.yacc,v 1.115 1998/09/15 02:25:48 millert Exp $";
#endif /* lint */
#include "config.h"
@@ -310,7 +309,7 @@ opcmnd : cmnd { ; }
;
runasspec : /* empty */ {
- $$ = (strcmp("root", runas_user) == 0);
+ $$ = (strcmp(RUNAS_DEFAULT, runas_user) == 0);
}
| RUNAS runaslist {
$$ = $2;
diff --git a/gnu/usr.bin/sudo/sudo/pathnames.h b/gnu/usr.bin/sudo/sudo/pathnames.h
index e092b3835ef..ebed9935d88 100644
--- a/gnu/usr.bin/sudo/sudo/pathnames.h
+++ b/gnu/usr.bin/sudo/sudo/pathnames.h
@@ -1,7 +1,7 @@
-/* $OpenBSD: pathnames.h,v 1.5 1998/03/31 06:41:09 millert Exp $ */
+/* $OpenBSD: pathnames.h,v 1.6 1998/09/15 02:42:45 millert Exp $ */
/*
- * CU sudo version 1.5.5
+ * CU sudo version 1.5.6
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
*
* Please send bugs, changes, problems to sudo-bugs@courtesan.com
*
- * Id: pathnames.h,v 1.30 1998/03/31 05:05:42 millert Exp $
+ * $From: pathnames.h,v 1.32 1998/09/15 02:25:48 millert Exp $
*/
/*
diff --git a/gnu/usr.bin/sudo/sudo/sudo.8 b/gnu/usr.bin/sudo/sudo/sudo.8
index 33f256e936b..d16bc8b74cf 100644
--- a/gnu/usr.bin/sudo/sudo/sudo.8
+++ b/gnu/usr.bin/sudo/sudo/sudo.8
@@ -1,11 +1,11 @@
.rn '' }`
-''' $OpenBSD: sudo.8,v 1.5 1998/03/31 06:41:10 millert Exp $
+''' $OpenBSD: sudo.8,v 1.6 1998/09/15 02:42:45 millert Exp $
'''
-''' $RCSfile: sudo.8,v $$Revision: 1.5 $$Date: 1998/03/31 06:41:10 $
+''' $RCSfile: sudo.8,v $$Revision: 1.6 $$Date: 1998/09/15 02:42:45 $
'''
''' $Log: sudo.8,v $
-''' Revision 1.5 1998/03/31 06:41:10 millert
-''' sudo 1.5.5
+''' Revision 1.6 1998/09/15 02:42:45 millert
+''' sudo 1.5.6
'''
'''
.de Sh
@@ -98,7 +98,7 @@
.nr % 0
.rr F
.\}
-.TH sudo 8 "1.5.5" "20/Jan/98" "MAINTENANCE COMMANDS"
+.TH sudo 8 "1.5.6" "20/Jan/98" "MAINTENANCE COMMANDS"
.UC
.if n .hy 0
.if n .na
diff --git a/gnu/usr.bin/sudo/sudo/sudo.c b/gnu/usr.bin/sudo/sudo/sudo.c
index 68edb63bf33..7d07c33f658 100644
--- a/gnu/usr.bin/sudo/sudo/sudo.c
+++ b/gnu/usr.bin/sudo/sudo/sudo.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: sudo.c,v 1.9 1998/06/27 20:21:55 millert Exp $ */
+/* $OpenBSD: sudo.c,v 1.10 1998/09/15 02:42:45 millert Exp $ */
/*
- * CU sudo version 1.5.5 (based on Root Group sudo version 1.1)
+ * CU sudo version 1.5.6 (based on Root Group sudo version 1.1)
*
* This software comes with no waranty whatsoever, use at your own risk.
*
@@ -53,7 +53,7 @@
*/
#ifndef lint
-static char rcsid[] = "Id: sudo.c,v 1.190 1998/03/31 05:05:45 millert Exp $";
+static char rcsid[] = "$From: sudo.c,v 1.197 1998/09/13 19:32:48 millert Exp $";
#endif /* lint */
#define MAIN
@@ -143,14 +143,14 @@ char **Argv;
int NewArgc = 0;
char **NewArgv = NULL;
struct passwd *user_pw_ent;
-char *runas_user = "root";
+char *runas_user = RUNAS_DEFAULT;
char *cmnd = NULL;
char *cmnd_args = NULL;
char *tty = "unknown";
char *prompt;
-char host[MAXHOSTNAMELEN + 1];
+char host[MAXHOSTNAMELEN];
char *shost;
-char cwd[MAXPATHLEN + 1];
+char cwd[MAXPATHLEN];
FILE *sudoers_fp = NULL;
struct stat cmnd_st;
static char *runas_homedir = NULL;
@@ -195,7 +195,7 @@ int main(argc, argv)
int sudo_mode = MODE_RUN;
extern char ** environ;
-#if (SHADOW_TYPE == SPW_SECUREWARE)
+#if (SHADOW_TYPE == SPW_SECUREWARE) && defined(HAVE_SET_AUTH_PARAMETERS)
(void) set_auth_parameters(argc, argv);
#endif /* SPW_SECUREWARE */
@@ -275,8 +275,7 @@ int main(argc, argv)
/* add the shell as argv[0] */
if (user_shell && *user_shell) {
- if ((NewArgv[0] = strrchr(user_shell, '/') + 1) == (char *) 1)
- NewArgv[0] = user_shell;
+ NewArgv[0] = user_shell;
} else {
(void) fprintf(stderr, "%s: Unable to determine shell.", Argv[0]);
exit(1);
@@ -419,7 +418,7 @@ static void load_globals(sudo_mode)
if ((user_pw_ent = sudo_getpwuid(getuid())) == NULL) {
/* need to make a fake user_pw_ent */
struct passwd pw_ent;
- char pw_name[MAX_UID_T_LEN+1];
+ char pw_name[MAX_UID_T_LEN + 1];
/* fill in uid and name fields with the uid */
pw_ent.pw_uid = getuid();
@@ -469,10 +468,10 @@ static void load_globals(sudo_mode)
/*
* so we know where we are... (do as user)
*/
- if (!getwd(cwd)) {
+ if (!getcwd(cwd, sizeof(cwd))) {
/* try as root... */
set_perms(PERM_ROOT, sudo_mode);
- if (!getwd(cwd)) {
+ if (!getcwd(cwd, sizeof(cwd))) {
(void) fprintf(stderr, "%s: Can't get working directory!\n",
Argv[0]);
(void) strcpy(cwd, "unknown");
@@ -484,7 +483,7 @@ static void load_globals(sudo_mode)
* load the host global variable from gethostname() and use
* gethostbyname() if we want to be sure it is fully qualified.
*/
- if ((gethostname(host, MAXHOSTNAMELEN))) {
+ if ((gethostname(host, sizeof(host)))) {
strcpy(host, "localhost");
log_error(GLOBAL_NO_HOSTNAME);
inform_user(GLOBAL_NO_HOSTNAME);
@@ -765,7 +764,7 @@ static void add_env(contiguous)
static int load_cmnd(sudo_mode)
int sudo_mode;
{
- if (strlen(NewArgv[0]) > MAXPATHLEN) {
+ if (strlen(NewArgv[0]) >= MAXPATHLEN) {
errno = ENAMETOOLONG;
(void) fprintf(stderr, "%s: %s: Pathname too long\n", Argv[0],
NewArgv[0]);
diff --git a/gnu/usr.bin/sudo/sudo/sudo.h b/gnu/usr.bin/sudo/sudo/sudo.h
index a8650ed37e8..01041b21c9e 100644
--- a/gnu/usr.bin/sudo/sudo/sudo.h
+++ b/gnu/usr.bin/sudo/sudo/sudo.h
@@ -1,7 +1,7 @@
-/* $OpenBSD: sudo.h,v 1.5 1998/03/31 06:41:12 millert Exp $ */
+/* $OpenBSD: sudo.h,v 1.6 1998/09/15 02:42:45 millert Exp $ */
/*
- * CU sudo version 1.5.5 (based on Root Group sudo version 1.1)
+ * CU sudo version 1.5.6 (based on Root Group sudo version 1.1)
*
* This software comes with no waranty whatsoever, use at your own risk.
*
@@ -27,7 +27,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * Id: sudo.h,v 1.122 1998/03/31 05:05:45 millert Exp $
+ * $From: sudo.h,v 1.126 1998/09/07 02:51:05 millert Exp $
*/
#ifndef _SUDO_SUDO_H
@@ -190,8 +190,8 @@ struct generic_alias {
#ifndef HAVE_STRDUP
char *strdup __P((const char *));
#endif
-#ifndef HAVE_GETWD
-char *getwd __P((char *));
+#ifndef HAVE_GETCWD
+char *getcwd __P((char *, size_t size));
#endif
#if !defined(HAVE_PUTENV) && !defined(HAVE_SETENV)
int putenv __P((const char *));
diff --git a/gnu/usr.bin/sudo/sudo/sudo_setenv.c b/gnu/usr.bin/sudo/sudo/sudo_setenv.c
index 5339c707aee..c9b817915a0 100644
--- a/gnu/usr.bin/sudo/sudo/sudo_setenv.c
+++ b/gnu/usr.bin/sudo/sudo/sudo_setenv.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: sudo_setenv.c,v 1.5 1998/03/31 06:41:14 millert Exp $ */
+/* $OpenBSD: sudo_setenv.c,v 1.6 1998/09/15 02:42:45 millert Exp $ */
/*
- * CU sudo version 1.5.5
+ * CU sudo version 1.5.6
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
*/
#ifndef lint
-static char rcsid[] = "Id: sudo_setenv.c,v 1.25 1998/03/31 05:05:46 millert Exp $";
+static char rcsid[] = "$From: sudo_setenv.c,v 1.26 1998/04/06 03:35:47 millert Exp $";
#endif /* lint */
#include "config.h"
diff --git a/gnu/usr.bin/sudo/sudo/sudoers.5 b/gnu/usr.bin/sudo/sudo/sudoers.5
index 34caa3f09d7..935e4e148a7 100644
--- a/gnu/usr.bin/sudo/sudo/sudoers.5
+++ b/gnu/usr.bin/sudo/sudo/sudoers.5
@@ -1,11 +1,11 @@
.rn '' }`
-''' $OpenBSD: sudoers.5,v 1.5 1998/03/31 06:41:15 millert Exp $
+''' $OpenBSD: sudoers.5,v 1.6 1998/09/15 02:42:45 millert Exp $
'''
-''' $RCSfile: sudoers.5,v $$Revision: 1.5 $$Date: 1998/03/31 06:41:15 $
+''' $RCSfile: sudoers.5,v $$Revision: 1.6 $$Date: 1998/09/15 02:42:45 $
'''
''' $Log: sudoers.5,v $
-''' Revision 1.5 1998/03/31 06:41:15 millert
-''' sudo 1.5.5
+''' Revision 1.6 1998/09/15 02:42:45 millert
+''' sudo 1.5.6
'''
'''
.de Sh
@@ -98,7 +98,7 @@
.nr % 0
.rr F
.\}
-.TH sudoers 5 "1.5.5" "6/Feb/98" "FILE FORMATS"
+.TH sudoers 5 "1.5.6" "6/Feb/98" "FILE FORMATS"
.UC
.if n .hy 0
.if n .na
diff --git a/gnu/usr.bin/sudo/sudo/tgetpass.c b/gnu/usr.bin/sudo/sudo/tgetpass.c
index 2703a84fac1..bd6aacd8d09 100644
--- a/gnu/usr.bin/sudo/sudo/tgetpass.c
+++ b/gnu/usr.bin/sudo/sudo/tgetpass.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: tgetpass.c,v 1.9 1998/06/24 16:25:17 millert Exp $ */
+/* $OpenBSD: tgetpass.c,v 1.10 1998/09/15 02:42:45 millert Exp $ */
/*
- * CU sudo version 1.5.5
+ * CU sudo version 1.5.6
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@
*/
#ifndef lint
-static char rcsid[] = "Id: tgetpass.c,v 1.60 1998/03/31 05:05:48 millert Exp $";
+static char rcsid[] = "$From: tgetpass.c,v 1.63 1998/09/09 00:43:49 millert Exp $";
#endif /* lint */
#include "config.h"
@@ -49,6 +49,7 @@ static char rcsid[] = "Id: tgetpass.c,v 1.60 1998/03/31 05:05:48 millert Exp $";
#endif /* HAVE_STRINGS_H */
#include <limits.h>
#include <pwd.h>
+#include <sys/param.h>
#include <sys/types.h>
#ifdef HAVE_SYS_BSDTYPES_H
#include <sys/bsdtypes.h>
diff --git a/gnu/usr.bin/sudo/sudo/version.h b/gnu/usr.bin/sudo/sudo/version.h
index 487783a0f64..127bf5a4ade 100644
--- a/gnu/usr.bin/sudo/sudo/version.h
+++ b/gnu/usr.bin/sudo/sudo/version.h
@@ -1,7 +1,7 @@
-/* $OpenBSD: version.h,v 1.5 1998/03/31 06:41:17 millert Exp $ */
+/* $OpenBSD: version.h,v 1.6 1998/09/15 02:42:45 millert Exp $ */
/*
- * CU sudo version 1.5.5
+ * CU sudo version 1.5.6
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,12 +19,12 @@
*
* Please send bugs, changes, problems to sudo-bugs@courtesan.com
*
- * Id: version.h,v 1.45 1998/01/21 05:49:20 millert Exp $
+ * $From: version.h,v 1.46 1998/04/06 03:36:33 millert Exp $
*/
#ifndef _SUDO_VERSION_H
#define _SUDO_VERSION_H
-static char version[] = "1.5.5";
+static char version[] = "1.5.6";
#endif /* _SUDO_VERSION_H */
diff --git a/gnu/usr.bin/sudo/visudo/Makefile b/gnu/usr.bin/sudo/visudo/Makefile
index c19e408ed38..ff0775a32e1 100644
--- a/gnu/usr.bin/sudo/visudo/Makefile
+++ b/gnu/usr.bin/sudo/visudo/Makefile
@@ -1,10 +1,10 @@
-# $OpenBSD: Makefile,v 1.1 1996/10/14 05:14:57 millert Exp $
+# $OpenBSD: Makefile,v 1.2 1998/09/15 02:42:45 millert Exp $
PROG= visudo
MAN= visudo.8
CFLAGS+=-I${.CURDIR}/../sudo -I.
-SRCS= y.tab.c lex.yy.c visudo.c
-CLEANFILES+=y.tab.c y.tab.h lex.yy.c
+SRCS= sudo.tab.c lex.yy.c visudo.c
+CLEANFILES+=sudo.tab.c sudo.tab.h lex.yy.c
LDADD= -lcompat
DPADD= ${LIBCOMPAT}
@@ -19,5 +19,5 @@ lex.yy.c: ${.CURDIR}/../sudo/parse.lex
rm -f lex.yy.c
$(LEX) ${.CURDIR}/../sudo/parse.lex
-y.tab.c y.tab.h: ${.CURDIR}/../sudo/parse.yacc
- $(YACC) -d ${.CURDIR}/../sudo/parse.yacc
+sudo.tab.c sudo.tab.h: ${.CURDIR}/../sudo/parse.yacc
+ $(YACC) -b sudo -d ${.CURDIR}/../sudo/parse.yacc
diff --git a/gnu/usr.bin/sudo/visudo/visudo.8 b/gnu/usr.bin/sudo/visudo/visudo.8
index 5c5d6195caa..acf550086a7 100644
--- a/gnu/usr.bin/sudo/visudo/visudo.8
+++ b/gnu/usr.bin/sudo/visudo/visudo.8
@@ -1,11 +1,11 @@
.rn '' }`
-''' $OpenBSD: visudo.8,v 1.5 1998/03/31 06:41:19 millert Exp $
+''' $OpenBSD: visudo.8,v 1.6 1998/09/15 02:42:45 millert Exp $
'''
-''' $RCSfile: visudo.8,v $$Revision: 1.5 $$Date: 1998/03/31 06:41:19 $
+''' $RCSfile: visudo.8,v $$Revision: 1.6 $$Date: 1998/09/15 02:42:45 $
'''
''' $Log: visudo.8,v $
-''' Revision 1.5 1998/03/31 06:41:19 millert
-''' sudo 1.5.5
+''' Revision 1.6 1998/09/15 02:42:45 millert
+''' sudo 1.5.6
'''
'''
.de Sh
@@ -98,7 +98,7 @@
.nr % 0
.rr F
.\}
-.TH visudo 8 "1.5.5" "16/Feb/98" "MAINTENANCE COMMANDS"
+.TH visudo 8 "1.5.6" "16/Feb/98" "MAINTENANCE COMMANDS"
.UC
.if n .hy 0
.if n .na
diff --git a/gnu/usr.bin/sudo/visudo/visudo.c b/gnu/usr.bin/sudo/visudo/visudo.c
index ec8c7a95156..30f01188352 100644
--- a/gnu/usr.bin/sudo/visudo/visudo.c
+++ b/gnu/usr.bin/sudo/visudo/visudo.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: visudo.c,v 1.7 1998/03/31 06:41:20 millert Exp $ */
+/* $OpenBSD: visudo.c,v 1.8 1998/09/15 02:42:45 millert Exp $ */
/*
- * CU sudo version 1.5.5
+ * CU sudo version 1.5.6
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: visudo.c,v 1.7 1998/03/31 06:41:20 millert Exp $";
+static char rcsid[] = "$From: visudo.c,v 1.91 1998/09/08 00:42:02 millert Exp $";
#endif /* lint */
#include "config.h"
@@ -107,7 +107,7 @@ int NewArgc = 0;
char *sudoers = _PATH_SUDO_SUDOERS;
char *stmp = _PATH_SUDO_STMP;
int parse_error = FALSE;
-char *runas_user = "root";
+char *runas_user = RUNAS_DEFAULT;
/*
* For the parsing routines
@@ -224,7 +224,7 @@ int main(argc, argv)
*/
if (strlen(Editor) + strlen(stmp) + 30 > sizeof(buf)) {
(void) fprintf(stderr, "%s: Buffer too short (line %d).\n",
- __LINE__, Argv[0]);
+ Argv[0], __LINE__);
Exit(-1);
}
if (parse_error == TRUE)
@@ -276,7 +276,7 @@ int main(argc, argv)
if (yyparse() && parse_error != TRUE) {
(void) fprintf(stderr,
"%s: Failed to parse temporary file (%s), unknown error.\n",
- Argv[0], stmp, sudoers);
+ Argv[0], stmp);
parse_error = TRUE;
}
} else {