CVS commit: src/libexec/httpd

2011-04-24 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Sun Apr 24 07:17:02 UTC 2011

Modified Files:
src/libexec/httpd: bozohttpd.8

Log Message:
Remove the This option... sentence prefix for all option definitions.
Adjust some sentences so that the new text makes sense.  OK mrg@.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/libexec/httpd/bozohttpd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/httpd/bozohttpd.8
diff -u src/libexec/httpd/bozohttpd.8:1.27 src/libexec/httpd/bozohttpd.8:1.28
--- src/libexec/httpd/bozohttpd.8:1.27	Sat Apr  2 07:44:15 2011
+++ src/libexec/httpd/bozohttpd.8	Sun Apr 24 07:17:02 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: bozohttpd.8,v 1.27 2011/04/02 07:44:15 mbalmer Exp $
+.\	$NetBSD: bozohttpd.8,v 1.28 2011/04/24 07:17:02 jmmv Exp $
 .\
 .\	$eterna: bozohttpd.8,v 1.99 2010/09/20 22:26:28 mrg Exp $
 .\
@@ -26,7 +26,7 @@
 .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\ SUCH DAMAGE.
 .\
-.Dd April 2, 2011
+.Dd April 23, 2011
 .Dt HTTPD 8
 .Os
 .Sh NAME
@@ -79,12 +79,12 @@
 The following options are available:
 .Bl -tag -width xxxcgibin
 .It Fl b
-This option enables daemon mode, where
+Enables daemon mode, where
 .Nm
 detaches from the current terminal, running in the background and
 servicing HTTP requests.
 .It Fl C Ar suffix cgihandler
-This option adds a new CGI handler program for a particular file type.
+Adds a new CGI handler program for a particular file type.
 The
 .Ar suffix
 should be any normal file suffix, and the
@@ -96,7 +96,7 @@
 .Fl C
 options may be passed.
 .It Fl c Ar cgibin
-This option enables the CGI/1.1 interface.
+Enables the CGI/1.1 interface.
 The
 .Ar cgibin
 directory is expected to contain the CGI programs to be used.
@@ -114,7 +114,7 @@
 .Em ~user
 translation.
 .It Fl e
-This option causes
+Causes
 .Nm
 to not clear the environment when used with either the
 .Fl t
@@ -122,32 +122,29 @@
 .Fl U
 options.
 .It Fl f
-This option stops the
+Stops the
 .Fl b
 flag from
 .Nm
 detaching from the tty and going into the background.
 .It Fl H
-This option causes directory index mode to hide files and directories
+Causes directory index mode to hide files and directories
 that start with a period, except for
 .Pa .. .
 Also see
 .Fl X .
 .It Fl I Ar port
-This option is only valid with the
-.Fl b
-option.
-It causes
+Causes
 .Ar port
 to use used as the port to bind daemon mode.
 The default is the
 .Dq http
 port.
-.It Fl i Ar address
 This option is only valid with the
 .Fl b
 option.
-It causes
+.It Fl i Ar address
+Causes
 .Ar address
 to use used as the address to bind daemon mode.
 If otherwise unspecified, the address used to bind is derived from the
@@ -157,8 +154,11 @@
 Only the last
 .Fl i
 option is used.
+This option is only valid with the
+.Fl b
+option.
 .It Fl M Ar suffix type encoding encoding11
-This option adds a new entry to the table that converts file suffixes to
+Adds a new entry to the table that converts file suffixes to
 content type and encoding.
 This option takes four additional arguments containing
 the file prefix, its
@@ -174,7 +174,7 @@
 .Fl M
 options may be passed.
 .It Fl n
-This option stops
+Stops
 .Nm
 from doing IP address to name resolution of hosts for setting the
 .Ev REMOTE_HOST
@@ -183,7 +183,7 @@
 .Fl c
 option.
 .It Fl P Ar pidfile
-This option causes
+Causes
 .Nm
 to create a pid file in
 .Ar pidfile
@@ -191,14 +191,14 @@
 .Fl b
 option.
 .It Fl p Ar pubdir
-This option changes the default user directory for
+Changes the default user directory for
 .Em /~user/
 translations from
 .Dq public_html
 to
 .Ar pubdir .
 .It Fl r
-This option forces pages besides the
+Forces pages besides the
 .Dq index.html
 (see the
 .Fl X
@@ -207,14 +207,14 @@
 .Dq index.html
 page will be returned instead.
 .It Fl S Ar server_software
-This option sets the internal server version to
+Sets the internal server version to
 .Ar server_software .
 .It Fl s
-This option forces logging to be set to stderr always.
+Forces logging to be set to stderr always.
 .It Fl t Ar chrootdir
-When this option is used,
+Makes
 .Nm
-will chroot to the specified directory
+chroot to the specified directory
 before answering requests.
 Every other path should be specified relative
 to the new root, if this option is used.
@@ -223,7 +223,7 @@
 .Fl e
 option is also used.
 .It Fl U Ar username
-This option causes
+Causes
 .Nm
 to switch to the user and the groups of
 .Ar username
@@ -236,7 +236,7 @@
 .Fl e
 option is given.
 .It Fl u
-This option enables the transformation of Uniform Resource Locators of
+Enables the transformation of Uniform Resource Locators of
 the form
 .Em /~user/
 into the directory
@@ -245,7 +245,7 @@
 .Fl p
 option above).
 .It Fl V
-This option sets the default virtual host directory to
+Sets the default virtual host directory to
 .Ar slashdir .
 If no directory exists in
 .Ar 

CVS commit: src/libexec/httpd

2011-04-24 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Sun Apr 24 07:19:00 UTC 2011

Modified Files:
src/libexec/httpd: bozohttpd.8

Log Message:
List myself as a contributor.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/libexec/httpd/bozohttpd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/httpd/bozohttpd.8
diff -u src/libexec/httpd/bozohttpd.8:1.28 src/libexec/httpd/bozohttpd.8:1.29
--- src/libexec/httpd/bozohttpd.8:1.28	Sun Apr 24 07:17:02 2011
+++ src/libexec/httpd/bozohttpd.8	Sun Apr 24 07:18:59 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: bozohttpd.8,v 1.28 2011/04/24 07:17:02 jmmv Exp $
+.\	$NetBSD: bozohttpd.8,v 1.29 2011/04/24 07:18:59 jmmv Exp $
 .\
 .\	$eterna: bozohttpd.8,v 1.99 2010/09/20 22:26:28 mrg Exp $
 .\
@@ -26,7 +26,7 @@
 .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\ SUCH DAMAGE.
 .\
-.Dd April 23, 2011
+.Dd April 24, 2011
 .Dt HTTPD 8
 .Os
 .Sh NAME
@@ -594,6 +594,8 @@
 provided chroot and change-to-user support, and other various fixes
 .It
 Coyote Point provided various CGI fixes
+.It
+Julio Merino added pidfile support and provided some man page fixes
 .El
 .Pp
 There are probably others I have forgotten (let me know if you care)



CVS commit: src/crypto/external/bsd/openssh/dist

2011-04-24 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Sun Apr 24 14:01:46 UTC 2011

Modified Files:
src/crypto/external/bsd/openssh/dist: auth-krb5.c gss-serv-krb5.c
sshconnect1.c sshconnect2.c

Log Message:
Stop using functions that are marked as deprecated in Heimdal.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/crypto/external/bsd/openssh/dist/auth-krb5.c \
src/crypto/external/bsd/openssh/dist/sshconnect1.c
cvs rdiff -u -r1.3 -r1.4 src/crypto/external/bsd/openssh/dist/gss-serv-krb5.c
cvs rdiff -u -r1.6 -r1.7 src/crypto/external/bsd/openssh/dist/sshconnect2.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/crypto/external/bsd/openssh/dist/auth-krb5.c
diff -u src/crypto/external/bsd/openssh/dist/auth-krb5.c:1.2 src/crypto/external/bsd/openssh/dist/auth-krb5.c:1.3
--- src/crypto/external/bsd/openssh/dist/auth-krb5.c:1.2	Sun Jun  7 22:38:46 2009
+++ src/crypto/external/bsd/openssh/dist/auth-krb5.c	Sun Apr 24 14:01:46 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: auth-krb5.c,v 1.2 2009/06/07 22:38:46 christos Exp $	*/
+/*	$NetBSD: auth-krb5.c,v 1.3 2011/04/24 14:01:46 elric Exp $	*/
 /* $OpenBSD: auth-krb5.c,v 1.19 2006/08/03 03:34:41 deraadt Exp $ */
 /*
  *Kerberos v5 authentication and ticket-passing routines.
@@ -30,7 +30,7 @@
  */
 
 #include includes.h
-__RCSID($NetBSD: auth-krb5.c,v 1.2 2009/06/07 22:38:46 christos Exp $);
+__RCSID($NetBSD: auth-krb5.c,v 1.3 2011/04/24 14:01:46 elric Exp $);
 #include sys/types.h
 #include pwd.h
 #include stdarg.h
@@ -80,6 +80,7 @@
 	krb5_principal server;
 	krb5_ticket *ticket;
 	int fd, ret;
+	const char *errtxt;
 
 	ret = 0;
 	server = NULL;
@@ -143,10 +144,14 @@
 	}
 
 	if (problem) {
+		errtxt = NULL;
 		if (authctxt-krb5_ctx != NULL)
-			debug(Kerberos v5 authentication failed: %s,
-			krb5_get_err_text(authctxt-krb5_ctx, problem));
-		else
+			errtxt = krb5_get_error_message(authctxt-krb5_ctx,
+			problem);
+		if (errtxt != NULL) {
+			debug(Kerberos v5 authentication failed: %s, errtxt);
+			krb5_free_error_message(authctxt-krb5_ctx, errtxt);
+		} else
 			debug(Kerberos v5 authentication failed: %d,
 			problem);
 	}
@@ -160,13 +165,14 @@
 	krb5_error_code problem;
 	krb5_ccache ccache = NULL;
 	char *pname;
+	const char *errtxt;
 
 	if (authctxt-pw == NULL || authctxt-krb5_user == NULL)
 		return (0);
 
 	temporarily_use_uid(authctxt-pw);
 
-	problem = krb5_cc_gen_new(authctxt-krb5_ctx, krb5_fcc_ops, ccache);
+	problem = krb5_cc_new_unique(authctxt-krb5_ctx, FILE, NULL, ccache);
 	if (problem)
 		goto fail;
 
@@ -201,9 +207,14 @@
 	return (1);
 
  fail:
-	if (problem)
-		debug(Kerberos v5 TGT passing failed: %s,
-		krb5_get_err_text(authctxt-krb5_ctx, problem));
+	if (problem) {
+		errtxt = krb5_get_error_message(authctxt-krb5_ctx, problem);
+		if (errtxt != NULL) {
+			debug(Kerberos v5 TGT passing failed: %s, errtxt);
+			krb5_free_error_message(authctxt-krb5_ctx, errtxt);
+		} else
+			debug(Kerberos v5 TGT passing failed: %d, problem);
+	}
 	if (ccache)
 		krb5_cc_destroy(authctxt-krb5_ctx, ccache);
 
@@ -218,6 +229,7 @@
 {
 	krb5_error_code problem;
 	krb5_ccache ccache = NULL;
+	const char *errtxt;
 
 	temporarily_use_uid(authctxt-pw);
 
@@ -230,7 +242,8 @@
 	if (problem)
 		goto out;
 
-	problem = krb5_cc_gen_new(authctxt-krb5_ctx, krb5_mcc_ops, ccache);
+	problem = krb5_cc_new_unique(authctxt-krb5_ctx, MEMORY, NULL,
+	ccache);
 	if (problem)
 		goto out;
 
@@ -249,7 +262,7 @@
 	if (problem)
 		goto out;
 
-	problem = krb5_cc_gen_new(authctxt-krb5_ctx, krb5_fcc_ops,
+	problem = krb5_cc_new_unique(authctxt-krb5_ctx, FILE, NULL,
 	authctxt-krb5_fwd_ccache);
 	if (problem)
 		goto out;
@@ -271,10 +284,15 @@
 		if (ccache)
 			krb5_cc_destroy(authctxt-krb5_ctx, ccache);
 
+		errtxt = NULL;
 		if (authctxt-krb5_ctx != NULL)
+			errtxt = krb5_get_error_message(authctxt-krb5_ctx,
+			problem);
+		if (errtxt != NULL) {
 			debug(Kerberos password authentication failed: %s,
-			krb5_get_err_text(authctxt-krb5_ctx, problem));
-		else
+			errtxt);
+			krb5_free_error_message(authctxt-krb5_ctx, errtxt);
+		} else
 			debug(Kerberos password authentication failed: %d,
 			problem);
 
Index: src/crypto/external/bsd/openssh/dist/sshconnect1.c
diff -u src/crypto/external/bsd/openssh/dist/sshconnect1.c:1.2 src/crypto/external/bsd/openssh/dist/sshconnect1.c:1.3
--- src/crypto/external/bsd/openssh/dist/sshconnect1.c:1.2	Sun Jun  7 22:38:47 2009
+++ src/crypto/external/bsd/openssh/dist/sshconnect1.c	Sun Apr 24 14:01:46 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sshconnect1.c,v 1.2 2009/06/07 22:38:47 christos Exp $	*/
+/*	$NetBSD: sshconnect1.c,v 1.3 2011/04/24 14:01:46 elric Exp $	*/
 /* $OpenBSD: sshconnect1.c,v 1.70 2006/11/06 21:25:28 markus Exp $ */
 /*
  * Author: Tatu Ylonen y...@cs.hut.fi
@@ -15,7 +15,7 @@
  */
 
 #include includes.h
-__RCSID($NetBSD: sshconnect1.c,v 1.2 2009/06/07 22:38:47 christos 

CVS commit: src/crypto/external/bsd/openssh

2011-04-24 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Sun Apr 24 14:09:39 UTC 2011

Modified Files:
src/crypto/external/bsd/openssh: Makefile.inc
src/crypto/external/bsd/openssh/dist: session.c

Log Message:
Stop using -I/usr/include/gssapi and -I/usr/include/krb5.  We must in this
case find kafs.h as krb5/kafs.h.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/crypto/external/bsd/openssh/Makefile.inc
cvs rdiff -u -r1.5 -r1.6 src/crypto/external/bsd/openssh/dist/session.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/crypto/external/bsd/openssh/Makefile.inc
diff -u src/crypto/external/bsd/openssh/Makefile.inc:1.2 src/crypto/external/bsd/openssh/Makefile.inc:1.3
--- src/crypto/external/bsd/openssh/Makefile.inc:1.2	Sun Nov 21 19:19:21 2010
+++ src/crypto/external/bsd/openssh/Makefile.inc	Sun Apr 24 14:09:39 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.2 2010/11/21 19:19:21 adam Exp $
+#	$NetBSD: Makefile.inc,v 1.3 2011/04/24 14:09:39 elric Exp $
 
 WARNS?=	1	# XXX -Wshadow -Wcast-qual
 
@@ -23,8 +23,8 @@
 .endif	# USE_PAM == no
 
 .if (${USE_KERBEROS} != no)
-CPPFLAGS+=-DGSSAPI -I${DESTDIR}/usr/include/gssapi
-CPPFLAGS+=-DKRB5 -I${DESTDIR}/usr/include/krb5 -DHEIMDAL
+CPPFLAGS+=-DGSSAPI
+CPPFLAGS+=-DKRB5 -DHEIMDAL
 .endif
 
 .if (${USE_LDAP} != no)

Index: src/crypto/external/bsd/openssh/dist/session.c
diff -u src/crypto/external/bsd/openssh/dist/session.c:1.5 src/crypto/external/bsd/openssh/dist/session.c:1.6
--- src/crypto/external/bsd/openssh/dist/session.c:1.5	Sun Nov 21 18:59:04 2010
+++ src/crypto/external/bsd/openssh/dist/session.c	Sun Apr 24 14:09:39 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: session.c,v 1.5 2010/11/21 18:59:04 adam Exp $	*/
+/*	$NetBSD: session.c,v 1.6 2011/04/24 14:09:39 elric Exp $	*/
 /* $OpenBSD: session.c,v 1.256 2010/06/25 07:20:04 djm Exp $ */
 /*
  * Copyright (c) 1995 Tatu Ylonen y...@cs.hut.fi, Espoo, Finland
@@ -35,7 +35,7 @@
  */
 
 #include includes.h
-__RCSID($NetBSD: session.c,v 1.5 2010/11/21 18:59:04 adam Exp $);
+__RCSID($NetBSD: session.c,v 1.6 2011/04/24 14:09:39 elric Exp $);
 #include sys/types.h
 #include sys/wait.h
 #include sys/un.h
@@ -88,7 +88,7 @@
 #include sftp.h
 
 #ifdef KRB5
-#include kafs.h
+#include krb5/kafs.h
 #endif
 
 #define IS_INTERNAL_SFTP(c) \



CVS commit: [netbsd-5] src/lib/libc/gen

2011-04-24 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Apr 24 15:41:10 UTC 2011

Modified Files:
src/lib/libc/gen [netbsd-5]: glob.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #1597):
lib/libc/gen/glob.c: revision 1.28
lib/libc/gen/glob.c: revision 1.29
prevent resource DoS from brace expansion (from Maksymilian Arciemowicz)
remove stray printf.


To generate a diff of this commit:
cvs rdiff -u -r1.23.4.1 -r1.23.4.2 src/lib/libc/gen/glob.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/glob.c
diff -u src/lib/libc/gen/glob.c:1.23.4.1 src/lib/libc/gen/glob.c:1.23.4.2
--- src/lib/libc/gen/glob.c:1.23.4.1	Mon Jul 19 18:14:08 2010
+++ src/lib/libc/gen/glob.c	Sun Apr 24 15:41:10 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: glob.c,v 1.23.4.1 2010/07/19 18:14:08 riz Exp $	*/
+/*	$NetBSD: glob.c,v 1.23.4.2 2011/04/24 15:41:10 riz Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = @(#)glob.c	8.3 (Berkeley) 10/13/93;
 #else
-__RCSID($NetBSD: glob.c,v 1.23.4.1 2010/07/19 18:14:08 riz Exp $);
+__RCSID($NetBSD: glob.c,v 1.23.4.2 2011/04/24 15:41:10 riz Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -87,13 +87,18 @@
 #define NO_GETPW_R
 #endif
 
-#define	GLOB_LIMIT_MALLOC	65536
-#define	GLOB_LIMIT_STAT		128
-#define	GLOB_LIMIT_READDIR	16384
-
-#define	GLOB_INDEX_MALLOC	0
-#define	GLOB_INDEX_STAT		1
-#define	GLOB_INDEX_READDIR	2
+#define	GLOB_LIMIT_STRING	65536	/* number of readdirs */
+#define	GLOB_LIMIT_STAT		128	/* number of stat system calls */
+#define	GLOB_LIMIT_READDIR	16384	/* total buffer size of path strings */
+#define	GLOB_LIMIT_PATH		1024	/* number of path elements */
+#define GLOB_LIMIT_BRACE	128	/* Number of brace calls */
+
+struct glob_limit {
+	size_t l_string;
+	size_t l_stat;	
+	size_t l_readdir;	
+	size_t l_brace;
+};
 
 /*
  * XXX: For NetBSD 1.4.x compatibility. (kill me l8r)
@@ -158,18 +163,18 @@
 static DIR	*g_opendir(Char *, glob_t *);
 static Char	*g_strchr(const Char *, int);
 static int	 g_stat(Char *, __gl_stat_t *, glob_t *);
-static int	 glob0(const Char *, glob_t *, size_t *);
-static int	 glob1(Char *, glob_t *, size_t *);
-static int	 glob2(Char *, Char *, Char *, Char *, glob_t *,
-size_t *);
-static int	 glob3(Char *, Char *, Char *, Char *, Char *, glob_t *,
-size_t *);
-static int	 globextend(const Char *, glob_t *, size_t *);
+static int	 glob0(const Char *, glob_t *, struct glob_limit *);
+static int	 glob1(Char *, glob_t *, struct glob_limit *);
+static int	 glob2(Char *, Char *, Char *, const Char *, glob_t *,
+struct glob_limit *);
+static int	 glob3(Char *, Char *, Char *, const Char *, const Char *, 
+glob_t *, struct glob_limit *);
+static int	 globextend(const Char *, glob_t *, struct glob_limit *);
 static const Char *globtilde(const Char *, Char *, size_t, glob_t *);
-static int	 globexp1(const Char *, glob_t *, size_t *);
+static int	 globexp1(const Char *, glob_t *, struct glob_limit *);
 static int	 globexp2(const Char *, const Char *, glob_t *, int *,
-size_t *);
-static int	 match(Char *, Char *, Char *);
+struct glob_limit *);
+static int	 match(const Char *, const Char *, const Char *);
 #ifdef DEBUG
 static void	 qprintf(const char *, Char *);
 #endif
@@ -181,8 +186,7 @@
 	const u_char *patnext;
 	int c;
 	Char *bufnext, *bufend, patbuf[MAXPATHLEN+1];
-	/* 0 = malloc(), 1 = stat(), 2 = readdir() */
-	size_t limit[] = { 0, 0, 0 };
+	struct glob_limit limit = { 0, 0, 0, 0 };
 
 	_DIAGASSERT(pattern != NULL);
 
@@ -218,9 +222,9 @@
 	*bufnext = EOS;
 
 	if (flags  GLOB_BRACE)
-	return globexp1(patbuf, pglob, limit);
+	return globexp1(patbuf, pglob, limit);
 	else
-	return glob0(patbuf, pglob, limit);
+	return glob0(patbuf, pglob, limit);
 }
 
 /*
@@ -229,7 +233,7 @@
  * characters
  */
 static int
-globexp1(const Char *pattern, glob_t *pglob, size_t *limit)
+globexp1(const Char *pattern, glob_t *pglob, struct glob_limit *limit)
 {
 	const Char* ptr = pattern;
 	int rv;
@@ -237,6 +241,12 @@
 	_DIAGASSERT(pattern != NULL);
 	_DIAGASSERT(pglob != NULL);
 
+	if ((pglob-gl_flags  GLOB_LIMIT) 
+	limit-l_brace++ = GLOB_LIMIT_BRACE) {
+		errno = 0;
+		return GLOB_NOSPACE;
+	}
+
 	/* Protect a single {}, for find(1), like csh */
 	if (pattern[0] == LBRACE  pattern[1] == RBRACE  pattern[2] == EOS)
 		return glob0(pattern, pglob, limit);
@@ -256,7 +266,7 @@
  */
 static int
 globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv,
-size_t *limit)
+struct glob_limit *limit)
 {
 	int i;
 	Char   *lm, *ls;
@@ -461,7 +471,7 @@
  * to find no matches.
  */
 static int
-glob0(const Char *pattern, glob_t *pglob, size_t *limit)
+glob0(const Char *pattern, glob_t *pglob, struct glob_limit *limit)
 {
 	const Char *qpatnext;
 	int c, error;
@@ -567,7 +577,7 @@
 }
 
 static int
-glob1(Char *pattern, glob_t *pglob, 

CVS commit: [netbsd-5-1] src/lib/libc/gen

2011-04-24 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Apr 24 15:41:23 UTC 2011

Modified Files:
src/lib/libc/gen [netbsd-5-1]: glob.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #1597):
lib/libc/gen/glob.c: revision 1.28
lib/libc/gen/glob.c: revision 1.29
prevent resource DoS from brace expansion (from Maksymilian Arciemowicz)
remove stray printf.


To generate a diff of this commit:
cvs rdiff -u -r1.23.4.1 -r1.23.4.1.2.1 src/lib/libc/gen/glob.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/glob.c
diff -u src/lib/libc/gen/glob.c:1.23.4.1 src/lib/libc/gen/glob.c:1.23.4.1.2.1
--- src/lib/libc/gen/glob.c:1.23.4.1	Mon Jul 19 18:14:08 2010
+++ src/lib/libc/gen/glob.c	Sun Apr 24 15:41:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: glob.c,v 1.23.4.1 2010/07/19 18:14:08 riz Exp $	*/
+/*	$NetBSD: glob.c,v 1.23.4.1.2.1 2011/04/24 15:41:23 riz Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = @(#)glob.c	8.3 (Berkeley) 10/13/93;
 #else
-__RCSID($NetBSD: glob.c,v 1.23.4.1 2010/07/19 18:14:08 riz Exp $);
+__RCSID($NetBSD: glob.c,v 1.23.4.1.2.1 2011/04/24 15:41:23 riz Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -87,13 +87,18 @@
 #define NO_GETPW_R
 #endif
 
-#define	GLOB_LIMIT_MALLOC	65536
-#define	GLOB_LIMIT_STAT		128
-#define	GLOB_LIMIT_READDIR	16384
-
-#define	GLOB_INDEX_MALLOC	0
-#define	GLOB_INDEX_STAT		1
-#define	GLOB_INDEX_READDIR	2
+#define	GLOB_LIMIT_STRING	65536	/* number of readdirs */
+#define	GLOB_LIMIT_STAT		128	/* number of stat system calls */
+#define	GLOB_LIMIT_READDIR	16384	/* total buffer size of path strings */
+#define	GLOB_LIMIT_PATH		1024	/* number of path elements */
+#define GLOB_LIMIT_BRACE	128	/* Number of brace calls */
+
+struct glob_limit {
+	size_t l_string;
+	size_t l_stat;	
+	size_t l_readdir;	
+	size_t l_brace;
+};
 
 /*
  * XXX: For NetBSD 1.4.x compatibility. (kill me l8r)
@@ -158,18 +163,18 @@
 static DIR	*g_opendir(Char *, glob_t *);
 static Char	*g_strchr(const Char *, int);
 static int	 g_stat(Char *, __gl_stat_t *, glob_t *);
-static int	 glob0(const Char *, glob_t *, size_t *);
-static int	 glob1(Char *, glob_t *, size_t *);
-static int	 glob2(Char *, Char *, Char *, Char *, glob_t *,
-size_t *);
-static int	 glob3(Char *, Char *, Char *, Char *, Char *, glob_t *,
-size_t *);
-static int	 globextend(const Char *, glob_t *, size_t *);
+static int	 glob0(const Char *, glob_t *, struct glob_limit *);
+static int	 glob1(Char *, glob_t *, struct glob_limit *);
+static int	 glob2(Char *, Char *, Char *, const Char *, glob_t *,
+struct glob_limit *);
+static int	 glob3(Char *, Char *, Char *, const Char *, const Char *, 
+glob_t *, struct glob_limit *);
+static int	 globextend(const Char *, glob_t *, struct glob_limit *);
 static const Char *globtilde(const Char *, Char *, size_t, glob_t *);
-static int	 globexp1(const Char *, glob_t *, size_t *);
+static int	 globexp1(const Char *, glob_t *, struct glob_limit *);
 static int	 globexp2(const Char *, const Char *, glob_t *, int *,
-size_t *);
-static int	 match(Char *, Char *, Char *);
+struct glob_limit *);
+static int	 match(const Char *, const Char *, const Char *);
 #ifdef DEBUG
 static void	 qprintf(const char *, Char *);
 #endif
@@ -181,8 +186,7 @@
 	const u_char *patnext;
 	int c;
 	Char *bufnext, *bufend, patbuf[MAXPATHLEN+1];
-	/* 0 = malloc(), 1 = stat(), 2 = readdir() */
-	size_t limit[] = { 0, 0, 0 };
+	struct glob_limit limit = { 0, 0, 0, 0 };
 
 	_DIAGASSERT(pattern != NULL);
 
@@ -218,9 +222,9 @@
 	*bufnext = EOS;
 
 	if (flags  GLOB_BRACE)
-	return globexp1(patbuf, pglob, limit);
+	return globexp1(patbuf, pglob, limit);
 	else
-	return glob0(patbuf, pglob, limit);
+	return glob0(patbuf, pglob, limit);
 }
 
 /*
@@ -229,7 +233,7 @@
  * characters
  */
 static int
-globexp1(const Char *pattern, glob_t *pglob, size_t *limit)
+globexp1(const Char *pattern, glob_t *pglob, struct glob_limit *limit)
 {
 	const Char* ptr = pattern;
 	int rv;
@@ -237,6 +241,12 @@
 	_DIAGASSERT(pattern != NULL);
 	_DIAGASSERT(pglob != NULL);
 
+	if ((pglob-gl_flags  GLOB_LIMIT) 
+	limit-l_brace++ = GLOB_LIMIT_BRACE) {
+		errno = 0;
+		return GLOB_NOSPACE;
+	}
+
 	/* Protect a single {}, for find(1), like csh */
 	if (pattern[0] == LBRACE  pattern[1] == RBRACE  pattern[2] == EOS)
 		return glob0(pattern, pglob, limit);
@@ -256,7 +266,7 @@
  */
 static int
 globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv,
-size_t *limit)
+struct glob_limit *limit)
 {
 	int i;
 	Char   *lm, *ls;
@@ -461,7 +471,7 @@
  * to find no matches.
  */
 static int
-glob0(const Char *pattern, glob_t *pglob, size_t *limit)
+glob0(const Char *pattern, glob_t *pglob, struct glob_limit *limit)
 {
 	const Char *qpatnext;
 	int c, error;
@@ -567,7 +577,7 @@
 }
 
 static int
-glob1(Char *pattern, 

CVS commit: [netbsd-5-0] src/lib/libc/gen

2011-04-24 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Apr 24 15:41:31 UTC 2011

Modified Files:
src/lib/libc/gen [netbsd-5-0]: glob.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #1597):
lib/libc/gen/glob.c: revision 1.28
lib/libc/gen/glob.c: revision 1.29
prevent resource DoS from brace expansion (from Maksymilian Arciemowicz)
remove stray printf.


To generate a diff of this commit:
cvs rdiff -u -r1.23.10.1 -r1.23.10.2 src/lib/libc/gen/glob.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/glob.c
diff -u src/lib/libc/gen/glob.c:1.23.10.1 src/lib/libc/gen/glob.c:1.23.10.2
--- src/lib/libc/gen/glob.c:1.23.10.1	Mon Jul 19 18:15:17 2010
+++ src/lib/libc/gen/glob.c	Sun Apr 24 15:41:31 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: glob.c,v 1.23.10.1 2010/07/19 18:15:17 riz Exp $	*/
+/*	$NetBSD: glob.c,v 1.23.10.2 2011/04/24 15:41:31 riz Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = @(#)glob.c	8.3 (Berkeley) 10/13/93;
 #else
-__RCSID($NetBSD: glob.c,v 1.23.10.1 2010/07/19 18:15:17 riz Exp $);
+__RCSID($NetBSD: glob.c,v 1.23.10.2 2011/04/24 15:41:31 riz Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -87,13 +87,18 @@
 #define NO_GETPW_R
 #endif
 
-#define	GLOB_LIMIT_MALLOC	65536
-#define	GLOB_LIMIT_STAT		128
-#define	GLOB_LIMIT_READDIR	16384
-
-#define	GLOB_INDEX_MALLOC	0
-#define	GLOB_INDEX_STAT		1
-#define	GLOB_INDEX_READDIR	2
+#define	GLOB_LIMIT_STRING	65536	/* number of readdirs */
+#define	GLOB_LIMIT_STAT		128	/* number of stat system calls */
+#define	GLOB_LIMIT_READDIR	16384	/* total buffer size of path strings */
+#define	GLOB_LIMIT_PATH		1024	/* number of path elements */
+#define GLOB_LIMIT_BRACE	128	/* Number of brace calls */
+
+struct glob_limit {
+	size_t l_string;
+	size_t l_stat;	
+	size_t l_readdir;	
+	size_t l_brace;
+};
 
 /*
  * XXX: For NetBSD 1.4.x compatibility. (kill me l8r)
@@ -158,18 +163,18 @@
 static DIR	*g_opendir(Char *, glob_t *);
 static Char	*g_strchr(const Char *, int);
 static int	 g_stat(Char *, __gl_stat_t *, glob_t *);
-static int	 glob0(const Char *, glob_t *, size_t *);
-static int	 glob1(Char *, glob_t *, size_t *);
-static int	 glob2(Char *, Char *, Char *, Char *, glob_t *,
-size_t *);
-static int	 glob3(Char *, Char *, Char *, Char *, Char *, glob_t *,
-size_t *);
-static int	 globextend(const Char *, glob_t *, size_t *);
+static int	 glob0(const Char *, glob_t *, struct glob_limit *);
+static int	 glob1(Char *, glob_t *, struct glob_limit *);
+static int	 glob2(Char *, Char *, Char *, const Char *, glob_t *,
+struct glob_limit *);
+static int	 glob3(Char *, Char *, Char *, const Char *, const Char *, 
+glob_t *, struct glob_limit *);
+static int	 globextend(const Char *, glob_t *, struct glob_limit *);
 static const Char *globtilde(const Char *, Char *, size_t, glob_t *);
-static int	 globexp1(const Char *, glob_t *, size_t *);
+static int	 globexp1(const Char *, glob_t *, struct glob_limit *);
 static int	 globexp2(const Char *, const Char *, glob_t *, int *,
-size_t *);
-static int	 match(Char *, Char *, Char *);
+struct glob_limit *);
+static int	 match(const Char *, const Char *, const Char *);
 #ifdef DEBUG
 static void	 qprintf(const char *, Char *);
 #endif
@@ -181,8 +186,7 @@
 	const u_char *patnext;
 	int c;
 	Char *bufnext, *bufend, patbuf[MAXPATHLEN+1];
-	/* 0 = malloc(), 1 = stat(), 2 = readdir() */
-	size_t limit[] = { 0, 0, 0 };
+	struct glob_limit limit = { 0, 0, 0, 0 };
 
 	_DIAGASSERT(pattern != NULL);
 
@@ -218,9 +222,9 @@
 	*bufnext = EOS;
 
 	if (flags  GLOB_BRACE)
-	return globexp1(patbuf, pglob, limit);
+	return globexp1(patbuf, pglob, limit);
 	else
-	return glob0(patbuf, pglob, limit);
+	return glob0(patbuf, pglob, limit);
 }
 
 /*
@@ -229,7 +233,7 @@
  * characters
  */
 static int
-globexp1(const Char *pattern, glob_t *pglob, size_t *limit)
+globexp1(const Char *pattern, glob_t *pglob, struct glob_limit *limit)
 {
 	const Char* ptr = pattern;
 	int rv;
@@ -237,6 +241,12 @@
 	_DIAGASSERT(pattern != NULL);
 	_DIAGASSERT(pglob != NULL);
 
+	if ((pglob-gl_flags  GLOB_LIMIT) 
+	limit-l_brace++ = GLOB_LIMIT_BRACE) {
+		errno = 0;
+		return GLOB_NOSPACE;
+	}
+
 	/* Protect a single {}, for find(1), like csh */
 	if (pattern[0] == LBRACE  pattern[1] == RBRACE  pattern[2] == EOS)
 		return glob0(pattern, pglob, limit);
@@ -256,7 +266,7 @@
  */
 static int
 globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv,
-size_t *limit)
+struct glob_limit *limit)
 {
 	int i;
 	Char   *lm, *ls;
@@ -461,7 +471,7 @@
  * to find no matches.
  */
 static int
-glob0(const Char *pattern, glob_t *pglob, size_t *limit)
+glob0(const Char *pattern, glob_t *pglob, struct glob_limit *limit)
 {
 	const Char *qpatnext;
 	int c, error;
@@ -567,7 +577,7 @@
 }
 
 static int
-glob1(Char *pattern, glob_t 

CVS commit: [netbsd-5-0] src/doc

2011-04-24 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Apr 24 15:41:55 UTC 2011

Modified Files:
src/doc [netbsd-5-0]: CHANGES-5.0.3

Log Message:
Ticket 1597


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.38 -r1.1.2.39 src/doc/CHANGES-5.0.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES-5.0.3
diff -u src/doc/CHANGES-5.0.3:1.1.2.38 src/doc/CHANGES-5.0.3:1.1.2.39
--- src/doc/CHANGES-5.0.3:1.1.2.38	Thu Apr  7 17:25:47 2011
+++ src/doc/CHANGES-5.0.3	Sun Apr 24 15:41:55 2011
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.0.3,v 1.1.2.38 2011/04/07 17:25:47 riz Exp $
+# $NetBSD: CHANGES-5.0.3,v 1.1.2.39 2011/04/24 15:41:55 riz Exp $
 
 A complete list of changes from the NetBSD 5.0.2 release to the NetBSD 5.0.3
 release:
@@ -2723,3 +2723,8 @@
 	response values.
 	[spz, ticket #1595]
 
+lib/libc/gen/glob.c1.28-1.29 via patch
+
+	Prevent resource DoS from brace expansion.
+	[spz, ticket #1597]
+



CVS commit: [netbsd-5-1] src/doc

2011-04-24 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Apr 24 15:42:22 UTC 2011

Modified Files:
src/doc [netbsd-5-1]: CHANGES-5.1.1

Log Message:
Ticket 1597


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.23 -r1.1.2.24 src/doc/CHANGES-5.1.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES-5.1.1
diff -u src/doc/CHANGES-5.1.1:1.1.2.23 src/doc/CHANGES-5.1.1:1.1.2.24
--- src/doc/CHANGES-5.1.1:1.1.2.23	Thu Apr  7 17:24:48 2011
+++ src/doc/CHANGES-5.1.1	Sun Apr 24 15:42:22 2011
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.1.1,v 1.1.2.23 2011/04/07 17:24:48 riz Exp $
+# $NetBSD: CHANGES-5.1.1,v 1.1.2.24 2011/04/24 15:42:22 riz Exp $
 
 A complete list of changes from the NetBSD 5.1 release to the NetBSD 5.1.1
 release:
@@ -2396,3 +2396,8 @@
 	response values.
 	[spz, ticket #1595]
 
+lib/libc/gen/glob.c1.28-1.29 via patch
+
+	Prevent resource DoS from brace expansion.
+	[spz, ticket #1597]
+



CVS commit: [netbsd-5] src/doc

2011-04-24 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Apr 24 15:42:45 UTC 2011

Modified Files:
src/doc [netbsd-5]: CHANGES-5.2

Log Message:
Ticket 1597


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.74 -r1.1.2.75 src/doc/CHANGES-5.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES-5.2
diff -u src/doc/CHANGES-5.2:1.1.2.74 src/doc/CHANGES-5.2:1.1.2.75
--- src/doc/CHANGES-5.2:1.1.2.74	Thu Apr  7 17:26:31 2011
+++ src/doc/CHANGES-5.2	Sun Apr 24 15:42:45 2011
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.2,v 1.1.2.74 2011/04/07 17:26:31 riz Exp $
+# $NetBSD: CHANGES-5.2,v 1.1.2.75 2011/04/24 15:42:45 riz Exp $
 
 A complete list of changes from the NetBSD 5.1 release to the NetBSD 5.2
 release:
@@ -5000,3 +5000,8 @@
 	response values.
 	[spz, ticket #1595]
 
+lib/libc/gen/glob.c1.28-1.29 via patch
+
+	Prevent resource DoS from brace expansion.
+	[spz, ticket #1597]
+



CVS commit: [netbsd-5] src/sys/arch/xen/xenbus

2011-04-24 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Apr 24 16:16:51 UTC 2011

Modified Files:
src/sys/arch/xen/xenbus [netbsd-5]: xenbus_probe.c

Log Message:
Pull up following revision(s) (requested by cegger in ticket #1598):
sys/arch/xen/xenbus/xenbus_probe.c: revision 1.30
Continue scanning for other frontends when initialization
of one frontend failed. Bug reported by Konrad Wilk on port-xen@.
Fix this for all error pathes within the loop.


To generate a diff of this commit:
cvs rdiff -u -r1.26.2.1 -r1.26.2.2 src/sys/arch/xen/xenbus/xenbus_probe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/xen/xenbus/xenbus_probe.c
diff -u src/sys/arch/xen/xenbus/xenbus_probe.c:1.26.2.1 src/sys/arch/xen/xenbus/xenbus_probe.c:1.26.2.2
--- src/sys/arch/xen/xenbus/xenbus_probe.c:1.26.2.1	Fri Jan 16 01:17:49 2009
+++ src/sys/arch/xen/xenbus/xenbus_probe.c	Sun Apr 24 16:16:51 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_probe.c,v 1.26.2.1 2009/01/16 01:17:49 snj Exp $ */
+/* $NetBSD: xenbus_probe.c,v 1.26.2.2 2011/04/24 16:16:51 riz Exp $ */
 /**
  * Talks to Xen Store to figure out what devices we have.
  *
@@ -29,7 +29,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: xenbus_probe.c,v 1.26.2.1 2009/01/16 01:17:49 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: xenbus_probe.c,v 1.26.2.2 2011/04/24 16:16:51 riz Exp $);
 
 #if 0
 #define DPRINTK(fmt, args...) \
@@ -284,6 +284,7 @@
 		return err;
 
 	for (i = 0; i  dir_n; i++) {
+		err = 0;
 		/*
 		 * add size of path to size of xenbus_device. xenbus_device
 		 * already has room for one char in xbusd_path.



CVS commit: [netbsd-5] src/sys/arch/xen/xenbus

2011-04-24 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Apr 24 16:20:22 UTC 2011

Modified Files:
src/sys/arch/xen/xenbus [netbsd-5]: xenbus_probe.c

Log Message:
Pull up following revision(s) (requested by cegger in ticket #1599):
sys/arch/xen/xenbus/xenbus_probe.c: revision 1.31
previous fix does not work if there is exactly only one entry where continue
exits the loop.
Apply fix from Konrad Wilke on port-xen@
That makes NetBSD DomU boot on Linux Dom0 with xl.


To generate a diff of this commit:
cvs rdiff -u -r1.26.2.2 -r1.26.2.3 src/sys/arch/xen/xenbus/xenbus_probe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/xen/xenbus/xenbus_probe.c
diff -u src/sys/arch/xen/xenbus/xenbus_probe.c:1.26.2.2 src/sys/arch/xen/xenbus/xenbus_probe.c:1.26.2.3
--- src/sys/arch/xen/xenbus/xenbus_probe.c:1.26.2.2	Sun Apr 24 16:16:51 2011
+++ src/sys/arch/xen/xenbus/xenbus_probe.c	Sun Apr 24 16:20:22 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_probe.c,v 1.26.2.2 2011/04/24 16:16:51 riz Exp $ */
+/* $NetBSD: xenbus_probe.c,v 1.26.2.3 2011/04/24 16:20:22 riz Exp $ */
 /**
  * Talks to Xen Store to figure out what devices we have.
  *
@@ -29,7 +29,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: xenbus_probe.c,v 1.26.2.2 2011/04/24 16:16:51 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: xenbus_probe.c,v 1.26.2.3 2011/04/24 16:20:22 riz Exp $);
 
 #if 0
 #define DPRINTK(fmt, args...) \
@@ -307,6 +307,7 @@
 			printf(xenbus: can't get state 
 			for %s (%d)\n, xbusd-xbusd_path, err);
 			free(xbusd, M_DEVBUF);
+			err = 0;
 			continue;
 		}
 		if (state != XenbusStateInitialising) {



CVS commit: [netbsd-5] src/sys/nfs

2011-04-24 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Apr 24 16:23:49 UTC 2011

Modified Files:
src/sys/nfs [netbsd-5]: nfs_socket.c

Log Message:
Pull up following revision(s) (requested by tls in ticket #1600):
sys/nfs/nfs_socket.c: revision 1.189
As suggested by matt@: change socket buffer reservations for NFS send/receive
to 3 times max RPC size rather than 2 times.  Avoids nasty TCP stalls observed
at Panix.  Will require increase to sbmax via sysctl for those running really
huge NFS rsize/wsize (64K).


To generate a diff of this commit:
cvs rdiff -u -r1.173.4.8 -r1.173.4.9 src/sys/nfs/nfs_socket.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/nfs/nfs_socket.c
diff -u src/sys/nfs/nfs_socket.c:1.173.4.8 src/sys/nfs/nfs_socket.c:1.173.4.9
--- src/sys/nfs/nfs_socket.c:1.173.4.8	Tue Mar 29 19:47:37 2011
+++ src/sys/nfs/nfs_socket.c	Sun Apr 24 16:23:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_socket.c,v 1.173.4.8 2011/03/29 19:47:37 riz Exp $	*/
+/*	$NetBSD: nfs_socket.c,v 1.173.4.9 2011/04/24 16:23:49 riz Exp $	*/
 
 /*
  * Copyright (c) 1989, 1991, 1993, 1995
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: nfs_socket.c,v 1.173.4.8 2011/03/29 19:47:37 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: nfs_socket.c,v 1.173.4.9 2011/04/24 16:23:49 riz Exp $);
 
 #include fs_nfs.h
 #include opt_nfs.h
@@ -321,13 +321,13 @@
 		so-so_snd.sb_timeo = 0;
 	}
 	if (nmp-nm_sotype == SOCK_DGRAM) {
-		sndreserve = (nmp-nm_wsize + NFS_MAXPKTHDR) * 2;
+		sndreserve = (nmp-nm_wsize + NFS_MAXPKTHDR) * 3;
 		rcvreserve = (max(nmp-nm_rsize, nmp-nm_readdirsize) +
 		NFS_MAXPKTHDR) * 2;
 	} else if (nmp-nm_sotype == SOCK_SEQPACKET) {
-		sndreserve = (nmp-nm_wsize + NFS_MAXPKTHDR) * 2;
+		sndreserve = (nmp-nm_wsize + NFS_MAXPKTHDR) * 3;
 		rcvreserve = (max(nmp-nm_rsize, nmp-nm_readdirsize) +
-		NFS_MAXPKTHDR) * 2;
+		NFS_MAXPKTHDR) * 3;
 	} else {
 		sounlock(so);
 		if (nmp-nm_sotype != SOCK_STREAM)
@@ -343,9 +343,9 @@
 			sizeof(val));
 		}
 		sndreserve = (nmp-nm_wsize + NFS_MAXPKTHDR +
-		sizeof (u_int32_t)) * 2;
+		sizeof (u_int32_t)) * 3;
 		rcvreserve = (nmp-nm_rsize + NFS_MAXPKTHDR +
-		sizeof (u_int32_t)) * 2;
+		sizeof (u_int32_t)) * 3;
 		solock(so);
 	}
 	error = soreserve(so, sndreserve, rcvreserve);



CVS commit: [netbsd-5] src/sys/dev/pci

2011-04-24 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Apr 24 16:27:25 UTC 2011

Modified Files:
src/sys/dev/pci [netbsd-5]: if_bge.c

Log Message:
Pull up following revision(s) (requested by buhrow in ticket #1601):
sys/dev/pci/if_bge.c: revision 1.194
Fixes for kern/40018.
Our driver initializes the Broadcom hardware to peform a tcp and udp
checksum on only the payload of the tcp or udp packet, rather than the
entire packet.  The FreeBSD, OpenBSD  and Linux drivers instruct the hardware
to compute
the checksum for the entire packet.  I believe the bug is that some revisions
of the BCM hardware, under certain circumstances, revert to doing the
complete checksum calculation, as the FreeBSD, OpenBSD  and Linux drivers
request, while things are running. As
a result, when we pull the computed checksum from the hardware and pass it
up to the upper layers, we assume the checksum is the more minimal
one, and the upper layers perform the appropriate checks, which, when this
happens, cause the packet to be rejected because the resultant checksum is
decidedly incorrect.
This patch changes the driver to instruct the hardware to perform the
checksum over the entire packet, just as the FreeBSD, OpenBSD  and
Linux drivers do, and to notify the upper layers appropriately.
This patch appears to work on all revisions of the hardware that have been
tested.  (See the list in the bug report.)
this patch is approved by tls.


To generate a diff of this commit:
cvs rdiff -u -r1.152.4.5 -r1.152.4.6 src/sys/dev/pci/if_bge.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.152.4.5 src/sys/dev/pci/if_bge.c:1.152.4.6
--- src/sys/dev/pci/if_bge.c:1.152.4.5	Fri Nov 19 23:58:40 2010
+++ src/sys/dev/pci/if_bge.c	Sun Apr 24 16:27:24 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.152.4.5 2010/11/19 23:58:40 riz Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.152.4.6 2011/04/24 16:27:24 riz Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_bge.c,v 1.152.4.5 2010/11/19 23:58:40 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_bge.c,v 1.152.4.6 2011/04/24 16:27:24 riz Exp $);
 
 #include bpfilter.h
 #include vlan.h
@@ -1870,7 +1870,7 @@
 	 */
 	CSR_WRITE_4(sc, BGE_MODE_CTL, BGE_DMA_SWAP_OPTIONS |
 	BGE_MODECTL_MAC_ATTN_INTR | BGE_MODECTL_HOST_SEND_BDS |
-	BGE_MODECTL_TX_NO_PHDR_CSUM | BGE_MODECTL_RX_NO_PHDR_CSUM);
+	BGE_MODECTL_TX_NO_PHDR_CSUM);
 
 	/*
 	 * BCM5701 B5 have a bug causing data corruption when using
@@ -3451,7 +3451,7 @@
 			cur_rx-bge_tcp_udp_csum;
 			m-m_pkthdr.csum_flags |=
 			(M_CSUM_TCPv4|M_CSUM_UDPv4|
-			 M_CSUM_DATA|M_CSUM_NO_PSEUDOHDR);
+			 M_CSUM_DATA);
 		}
 
 		/*



CVS commit: [netbsd-5] src/doc

2011-04-24 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Apr 24 16:31:01 UTC 2011

Modified Files:
src/doc [netbsd-5]: CHANGES-5.2

Log Message:
Tickets 1598-1601.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.75 -r1.1.2.76 src/doc/CHANGES-5.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES-5.2
diff -u src/doc/CHANGES-5.2:1.1.2.75 src/doc/CHANGES-5.2:1.1.2.76
--- src/doc/CHANGES-5.2:1.1.2.75	Sun Apr 24 15:42:45 2011
+++ src/doc/CHANGES-5.2	Sun Apr 24 16:31:01 2011
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.2,v 1.1.2.75 2011/04/24 15:42:45 riz Exp $
+# $NetBSD: CHANGES-5.2,v 1.1.2.76 2011/04/24 16:31:01 riz Exp $
 
 A complete list of changes from the NetBSD 5.1 release to the NetBSD 5.2
 release:
@@ -5005,3 +5005,28 @@
 	Prevent resource DoS from brace expansion.
 	[spz, ticket #1597]
 
+sys/arch/xen/xenbus/xenbus_probe.c		1.30
+
+	Continue scanning for other frontends when initialization
+	of one frontend failed.
+	[cegger, ticket #1598]
+
+sys/arch/xen/xenbus/xenbus_probe.c		1.31 via patch
+
+	Fix probe so NetBSD DomU can boot on Linux Dom0 with xl.
+	[cegger, ticket #1599]
+
+sys/nfs/nfs_socket.c1.189
+
+	Change socket buffer reservations for NFS send/receive
+	to 3 times max RPC size, to avoid nasty TCP stalls.
+	Will require increase to sbmax via sysctl for those running really
+	huge NFS rsize/wsize (64K).
+	[tls, ticket #1600]
+
+sys/dev/pci/if_bge.c1.194
+
+	Perform hardware checksum over the entire packet, as other OS
+	drivers do.  PR#40018.
+	[buhrow, ticket #1601]
+



CVS commit: src/sys

2011-04-24 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Apr 24 18:46:24 UTC 2011

Modified Files:
src/sys/kern: exec_aout.c exec_ecoff.c kern_ksyms.c kern_pax.c
kern_softint.c subr_autoconf.c subr_blist.c subr_prf.c
subr_userconf.c uipc_mbuf.c uipc_socket2.c uipc_syscalls.c
vfs_bio.c
src/sys/sys: device.h event.h file.h namei.h namei.src

Log Message:
- Replace few malloc(9) uses with kmem(9).
- Rename buf_malloc() to buf_alloc(), fix comments.
- Remove some unnecessary inclusions.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/kern/exec_aout.c \
src/sys/kern/kern_softint.c
cvs rdiff -u -r1.28 -r1.29 src/sys/kern/exec_ecoff.c
cvs rdiff -u -r1.62 -r1.63 src/sys/kern/kern_ksyms.c
cvs rdiff -u -r1.24 -r1.25 src/sys/kern/kern_pax.c
cvs rdiff -u -r1.214 -r1.215 src/sys/kern/subr_autoconf.c
cvs rdiff -u -r1.9 -r1.10 src/sys/kern/subr_blist.c
cvs rdiff -u -r1.139 -r1.140 src/sys/kern/subr_prf.c src/sys/kern/uipc_mbuf.c
cvs rdiff -u -r1.20 -r1.21 src/sys/kern/subr_userconf.c
cvs rdiff -u -r1.107 -r1.108 src/sys/kern/uipc_socket2.c
cvs rdiff -u -r1.142 -r1.143 src/sys/kern/uipc_syscalls.c
cvs rdiff -u -r1.228 -r1.229 src/sys/kern/vfs_bio.c
cvs rdiff -u -r1.138 -r1.139 src/sys/sys/device.h
cvs rdiff -u -r1.21 -r1.22 src/sys/sys/event.h
cvs rdiff -u -r1.73 -r1.74 src/sys/sys/file.h
cvs rdiff -u -r1.76 -r1.77 src/sys/sys/namei.h
cvs rdiff -u -r1.23 -r1.24 src/sys/sys/namei.src

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/exec_aout.c
diff -u src/sys/kern/exec_aout.c:1.34 src/sys/kern/exec_aout.c:1.35
--- src/sys/kern/exec_aout.c:1.34	Wed Nov 19 18:36:06 2008
+++ src/sys/kern/exec_aout.c	Sun Apr 24 18:46:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_aout.c,v 1.34 2008/11/19 18:36:06 ad Exp $	*/
+/*	$NetBSD: exec_aout.c,v 1.35 2011/04/24 18:46:22 rmind Exp $	*/
 
 /*
  * Copyright (c) 1993, 1994 Christopher G. Demetriou
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: exec_aout.c,v 1.34 2008/11/19 18:36:06 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: exec_aout.c,v 1.35 2011/04/24 18:46:22 rmind Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_coredump.h
@@ -40,7 +40,6 @@
 #include sys/param.h
 #include sys/systm.h
 #include sys/proc.h
-#include sys/malloc.h
 #include sys/vnode.h
 #include sys/exec.h
 #include sys/exec_aout.h
Index: src/sys/kern/kern_softint.c
diff -u src/sys/kern/kern_softint.c:1.34 src/sys/kern/kern_softint.c:1.35
--- src/sys/kern/kern_softint.c:1.34	Mon Apr 11 19:13:54 2011
+++ src/sys/kern/kern_softint.c	Sun Apr 24 18:46:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_softint.c,v 1.34 2011/04/11 19:13:54 rmind Exp $	*/
+/*	$NetBSD: kern_softint.c,v 1.35 2011/04/24 18:46:22 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -176,10 +176,9 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_softint.c,v 1.34 2011/04/11 19:13:54 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_softint.c,v 1.35 2011/04/24 18:46:22 rmind Exp $);
 
 #include sys/param.h
-#include sys/malloc.h
 #include sys/proc.h
 #include sys/intr.h
 #include sys/mutex.h

Index: src/sys/kern/exec_ecoff.c
diff -u src/sys/kern/exec_ecoff.c:1.28 src/sys/kern/exec_ecoff.c:1.29
--- src/sys/kern/exec_ecoff.c:1.28	Wed Nov 19 21:29:32 2008
+++ src/sys/kern/exec_ecoff.c	Sun Apr 24 18:46:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_ecoff.c,v 1.28 2008/11/19 21:29:32 cegger Exp $	*/
+/*	$NetBSD: exec_ecoff.c,v 1.29 2011/04/24 18:46:22 rmind Exp $	*/
 
 /*
  * Copyright (c) 1994 Adam Glass
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: exec_ecoff.c,v 1.28 2008/11/19 21:29:32 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: exec_ecoff.c,v 1.29 2011/04/24 18:46:22 rmind Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_coredump.h
@@ -42,7 +42,6 @@
 #include sys/param.h
 #include sys/systm.h
 #include sys/proc.h
-#include sys/malloc.h
 #include sys/vnode.h
 #include sys/exec.h
 #include sys/resourcevar.h

Index: src/sys/kern/kern_ksyms.c
diff -u src/sys/kern/kern_ksyms.c:1.62 src/sys/kern/kern_ksyms.c:1.63
--- src/sys/kern/kern_ksyms.c:1.62	Tue Jan  4 01:40:19 2011
+++ src/sys/kern/kern_ksyms.c	Sun Apr 24 18:46:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_ksyms.c,v 1.62 2011/01/04 01:40:19 matt Exp $	*/
+/*	$NetBSD: kern_ksyms.c,v 1.63 2011/04/24 18:46:22 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_ksyms.c,v 1.62 2011/01/04 01:40:19 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_ksyms.c,v 1.63 2011/04/24 18:46:22 rmind Exp $);
 
 #if defined(_KERNEL)  defined(_KERNEL_OPT)
 #include opt_ddb.h
@@ -280,7 +280,7 @@
 	char *str;
 	int nsyms = symsize / sizeof(Elf_Sym);
 
-	/* sanity check for pre-malloc map table used during startup */
+	/* Sanity check for pre-allocated map table used during startup. */
 	if 

CVS commit: src/lib/libpam/modules/pam_krb5

2011-04-24 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Sun Apr 24 18:48:05 UTC 2011

Modified Files:
src/lib/libpam/modules/pam_krb5: pam_krb5.c

Log Message:
Remove use of functions marked as deprecated in Heimdal.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/lib/libpam/modules/pam_krb5/pam_krb5.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libpam/modules/pam_krb5/pam_krb5.c
diff -u src/lib/libpam/modules/pam_krb5/pam_krb5.c:1.23 src/lib/libpam/modules/pam_krb5/pam_krb5.c:1.24
--- src/lib/libpam/modules/pam_krb5/pam_krb5.c:1.23	Sat Apr  2 10:22:09 2011
+++ src/lib/libpam/modules/pam_krb5/pam_krb5.c	Sun Apr 24 18:48:04 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pam_krb5.c,v 1.23 2011/04/02 10:22:09 mbalmer Exp $	*/
+/*	$NetBSD: pam_krb5.c,v 1.24 2011/04/24 18:48:04 elric Exp $	*/
 
 /*-
  * This pam_krb5 module contains code that is:
@@ -53,7 +53,7 @@
 #ifdef __FreeBSD__
 __FBSDID($FreeBSD: src/lib/libpam/modules/pam_krb5/pam_krb5.c,v 1.22 2005/01/24 16:49:50 rwatson Exp $);
 #else
-__RCSID($NetBSD: pam_krb5.c,v 1.23 2011/04/02 10:22:09 mbalmer Exp $);
+__RCSID($NetBSD: pam_krb5.c,v 1.24 2011/04/24 18:48:04 elric Exp $);
 #endif
 
 #include sys/types.h
@@ -83,6 +83,7 @@
 #define	COMPAT_HEIMDAL
 /* #define	COMPAT_MIT */
 
+static void	log_krb5(krb5_context, const char *, krb5_error_code);
 static int	verify_krb_v5_tgt(krb5_context, krb5_ccache, char *, int);
 static void	cleanup_cache(pam_handle_t *, void *, int);
 static const	char *compat_princ_component(krb5_context, krb5_principal, int);
@@ -111,7 +112,7 @@
 	krb5_creds creds;
 	krb5_principal princ;
 	krb5_ccache ccache;
-	krb5_get_init_creds_opt opts;
+	krb5_get_init_creds_opt *opts = NULL;
 	struct passwd *pwd, pwres;
 	int retval;
 	const void *ccache_data;
@@ -150,10 +151,14 @@
 
 	PAM_LOG(Context initialised);
 
-	krb5_get_init_creds_opt_init(opts);
+	krbret = krb5_get_init_creds_opt_alloc(pam_context, opts);
+	if (krbret != 0) {
+		PAM_VERBOSE_ERROR(Kerberos 5 error);
+		return (PAM_SERVICE_ERR);
+	}
 
 	if (openpam_get_option(pamh, PAM_OPT_FORWARDABLE))
-		krb5_get_init_creds_opt_set_forwardable(opts, 1);
+		krb5_get_init_creds_opt_set_forwardable(opts, 1);
 
 	if ((rtime = openpam_get_option(pamh, PAM_OPT_RENEWABLE)) != NULL) {
 		krb5_deltat renew;
@@ -169,7 +174,7 @@
 		else
 			rtime = 1 month;
 		renew = parse_time(rtime, s);
-		krb5_get_init_creds_opt_set_renew_life(opts, renew);
+		krb5_get_init_creds_opt_set_renew_life(opts, renew);
 	}
 
 
@@ -196,8 +201,7 @@
 	krbret = krb5_parse_name(pam_context, principal, princ);
 	free(principal);
 	if (krbret != 0) {
-		PAM_LOG(Error krb5_parse_name(): %s,
-		krb5_get_err_text(pam_context, krbret));
+		log_krb5(pam_context, Error krb5_parse_name(): %s, krbret);
 		PAM_VERBOSE_ERROR(Kerberos 5 error);
 		retval = PAM_SERVICE_ERR;
 		goto cleanup3;
@@ -208,8 +212,7 @@
 	/* Now convert the principal name into something human readable */
 	krbret = krb5_unparse_name(pam_context, princ, princ_name);
 	if (krbret != 0) {
-		PAM_LOG(Error krb5_unparse_name(): %s,
-		krb5_get_err_text(pam_context, krbret));
+		log_krb5(pam_context, Error krb5_unparse_name(): %s, krbret);
 		PAM_VERBOSE_ERROR(Kerberos 5 error);
 		retval = PAM_SERVICE_ERR;
 		goto cleanup2;
@@ -233,8 +236,8 @@
 		sizeof(luser), luser);
 		if (krbret != 0) {
 			PAM_VERBOSE_ERROR(Kerberos 5 error);
-			PAM_LOG(Error krb5_aname_to_localname(): %s,
-			krb5_get_err_text(pam_context, krbret));
+			log_krb5(pam_context,
+			Error krb5_aname_to_localname(): %s, krbret);
 			retval = PAM_USER_UNKNOWN;
 			goto cleanup2;
 		}
@@ -257,11 +260,11 @@
 	/* Get a TGT */
 	memset(creds, 0, sizeof(krb5_creds));
 	krbret = krb5_get_init_creds_password(pam_context, creds, princ,
-	pass, NULL, pamh, 0, NULL, opts);
+	pass, NULL, pamh, 0, NULL, opts);
 	if (krbret != 0) {
 		PAM_VERBOSE_ERROR(Kerberos 5 error);
-		PAM_LOG(Error krb5_get_init_creds_password(): %s,
-		krb5_get_err_text(pam_context, krbret));
+		log_krb5(pam_context,
+		Error krb5_get_init_creds_password(): %s, krbret);
 		retval = PAM_AUTH_ERR;
 		goto cleanup2;
 	}
@@ -269,27 +272,24 @@
 	PAM_LOG(Got TGT);
 
 	/* Generate a temporary cache */
-	krbret = krb5_cc_gen_new(pam_context, krb5_mcc_ops, ccache);
+	krbret = krb5_cc_new_unique(pam_context, MEMORY, NULL, ccache);
 	if (krbret != 0) {
 		PAM_VERBOSE_ERROR(Kerberos 5 error);
-		PAM_LOG(Error krb5_cc_gen_new(): %s,
-		krb5_get_err_text(pam_context, krbret));
+		log_krb5(pam_context, Error krb5_cc_gen_new(): %s, krbret);
 		retval = PAM_SERVICE_ERR;
 		goto cleanup;
 	}
 	krbret = krb5_cc_initialize(pam_context, ccache, princ);
 	if (krbret != 0) {
 		PAM_VERBOSE_ERROR(Kerberos 5 error);
-		PAM_LOG(Error krb5_cc_initialize(): %s,
-		krb5_get_err_text(pam_context, krbret));
+		log_krb5(pam_context, Error krb5_cc_initialize(): %s, krbret);
 		retval = PAM_SERVICE_ERR;
 		

CVS commit: src/sys/dev/ieee1394

2011-04-24 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Apr 24 18:52:26 UTC 2011

Modified Files:
src/sys/dev/ieee1394: firewirereg.h

Log Message:
Inclusion for malloc decls (missed in previous commit).


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/ieee1394/firewirereg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ieee1394/firewirereg.h
diff -u src/sys/dev/ieee1394/firewirereg.h:1.15 src/sys/dev/ieee1394/firewirereg.h:1.16
--- src/sys/dev/ieee1394/firewirereg.h:1.15	Sun Nov 14 15:47:20 2010
+++ src/sys/dev/ieee1394/firewirereg.h	Sun Apr 24 18:52:26 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewirereg.h,v 1.15 2010/11/14 15:47:20 uebayasi Exp $	*/
+/*	$NetBSD: firewirereg.h,v 1.16 2011/04/24 18:52:26 rmind Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -320,6 +320,8 @@
 #define BIO_READ B_READ
 #define BIO_WRITE B_WRITE
 
+#include sys/mallocvar.h
+
 MALLOC_DECLARE(M_FW);
 MALLOC_DECLARE(M_FWXFER);
 



CVS commit: src/sys/dev/pci

2011-04-24 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Sun Apr 24 18:53:02 UTC 2011

Modified Files:
src/sys/dev/pci: if_msk.c

Log Message:
use static inline for msk_rxvalid(), it is not referenced elsewhere

(avoids C99 vs GNU semantics for external inline functions)


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/pci/if_msk.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.37 src/sys/dev/pci/if_msk.c:1.38
--- src/sys/dev/pci/if_msk.c:1.37	Sat Apr 16 14:03:28 2011
+++ src/sys/dev/pci/if_msk.c	Sun Apr 24 18:53:02 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.37 2011/04/16 14:03:28 jakllsch Exp $ */
+/* $NetBSD: if_msk.c,v 1.38 2011/04/24 18:53:02 plunky Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.42 2007/01/17 02:43:02 krw Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_msk.c,v 1.37 2011/04/16 14:03:28 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_msk.c,v 1.38 2011/04/24 18:53:02 plunky Exp $);
 
 #include rnd.h
 
@@ -105,7 +105,6 @@
 int mskcprint(void *, const char *);
 int msk_intr(void *);
 void msk_intr_yukon(struct sk_if_softc *);
-__inline int msk_rxvalid(struct sk_softc *, u_int32_t, u_int32_t);
 void msk_rxeof(struct sk_if_softc *, u_int16_t, u_int32_t);
 void msk_txeof(struct sk_if_softc *, int);
 int msk_encap(struct sk_if_softc *, struct mbuf *, u_int32_t *);
@@ -1677,7 +1676,7 @@
 	return true;
 }
 
-__inline int
+static __inline int
 msk_rxvalid(struct sk_softc *sc, u_int32_t stat, u_int32_t len)
 {
 	if ((stat  (YU_RXSTAT_CRCERR | YU_RXSTAT_LONGERR |



CVS commit: src/lib/libpam/modules/pam_ksu

2011-04-24 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Sun Apr 24 18:53:55 UTC 2011

Modified Files:
src/lib/libpam/modules/pam_ksu: pam_ksu.c

Log Message:
Stop using functions that are marked as deprecated in Heimdal.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libpam/modules/pam_ksu/pam_ksu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libpam/modules/pam_ksu/pam_ksu.c
diff -u src/lib/libpam/modules/pam_ksu/pam_ksu.c:1.3 src/lib/libpam/modules/pam_ksu/pam_ksu.c:1.4
--- src/lib/libpam/modules/pam_ksu/pam_ksu.c:1.3	Sun Mar  8 19:38:03 2009
+++ src/lib/libpam/modules/pam_ksu/pam_ksu.c	Sun Apr 24 18:53:55 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pam_ksu.c,v 1.3 2009/03/08 19:38:03 christos Exp $	*/
+/*	$NetBSD: pam_ksu.c,v 1.4 2011/04/24 18:53:55 elric Exp $	*/
 
 /*-
  * Copyright (c) 2002 Jacques A. Vidrine nec...@freebsd.org
@@ -29,7 +29,7 @@
 #ifdef __FreeBSD__
 __FBSDID($FreeBSD: src/lib/libpam/modules/pam_ksu/pam_ksu.c,v 1.5 2004/02/10 10:13:21 des Exp $);
 #else
-__RCSID($NetBSD: pam_ksu.c,v 1.3 2009/03/08 19:38:03 christos Exp $);
+__RCSID($NetBSD: pam_ksu.c,v 1.4 2011/04/24 18:53:55 elric Exp $);
 #endif
 
 #include sys/param.h
@@ -51,6 +51,7 @@
 
 #define PASSWORD_PROMPT	%s's password:
 
+static void	log_krb5(krb5_context, const char *, krb5_error_code);
 static long	get_su_principal(krb5_context, const char *, const char *,
 		char **, krb5_principal *);
 static int	auth_krb5(pam_handle_t *, krb5_context, const char *,
@@ -78,8 +79,7 @@
 	PAM_LOG(Got ruser: %s, (const char *)ruser);
 	rv = krb5_init_context(context);
 	if (rv != 0) {
-		PAM_LOG(krb5_init_context failed: %s,
-			krb5_get_err_text(context, rv));
+		log_krb5(context, krb5_init_context failed: %s, rv);
 		return (PAM_SERVICE_ERR);
 	}
 	rv = get_su_principal(context, user, ruser, su_principal_name, su_principal);
@@ -120,14 +120,18 @@
 krb5_principal su_principal)
 {
 	krb5_creds	 creds;
-	krb5_get_init_creds_opt gic_opt;
+	krb5_get_init_creds_opt *gic_opt;
 	krb5_verify_init_creds_opt vic_opt;
 	const char	*pass;
 	char		 prompt[80];
 	long		 rv;
 	int		 pamret;
 
-	krb5_get_init_creds_opt_init(gic_opt);
+	rv = krb5_get_init_creds_opt_alloc(context, gic_opt);
+	if (rv != 0) {
+		log_krb5(context, krb5_get_init_creds_opt_alloc: %s, rv);
+		return (PAM_SERVICE_ERR);
+	}
 	krb5_verify_init_creds_opt_init(vic_opt);
 	if (su_principal_name != NULL)
 		(void)snprintf(prompt, sizeof(prompt), PASSWORD_PROMPT,
@@ -141,10 +145,9 @@
 	if (pamret != PAM_SUCCESS)
 		return (pamret);
 	rv = krb5_get_init_creds_password(context, creds, su_principal,
-	pass, NULL, NULL, 0, NULL, gic_opt);
+	pass, NULL, NULL, 0, NULL, gic_opt);
 	if (rv != 0) {
-		PAM_LOG(krb5_get_init_creds_password: %s,
-			krb5_get_err_text(context, rv));
+		log_krb5(context, krb5_get_init_creds_password: %s, rv);
 		return (PAM_AUTH_ERR);
 	}
 	krb5_verify_init_creds_opt_set_ap_req_nofail(vic_opt, 1);
@@ -152,13 +155,26 @@
 	vic_opt);
 	krb5_free_cred_contents(context, creds);
 	if (rv != 0) {
-		PAM_LOG(krb5_verify_init_creds: %s,
-		   krb5_get_err_text(context, rv));
+		log_krb5(context, krb5_verify_init_creds: %s, rv);
 		return (PAM_AUTH_ERR);
 	}
 	return (PAM_SUCCESS);
 }
 
+static void
+log_krb5(krb5_context ctx, const char *fmt, krb5_error_code err)
+{
+	const char	*errtxt;
+ 
+errtxt = krb5_get_error_message(ctx, err);
+	if (errtxt != NULL) {
+		PAM_LOG(fmt, errtxt);
+		krb5_free_error_message(ctx, errtxt);
+	} else {
+		PAM_LOG(fmt, unknown);
+	}
+}
+
 /* Determine the target principal given the current user and the target user.
  *   context   -- An initialized krb5_context.
  *   target_user   -- The target username.
@@ -183,6 +199,7 @@
 	char		*principal_name, *ccname, *p;
 	long		 rv;
 	uid_t		 euid, ruid;
+	const char	*errtxt;
 
 	*su_principal = NULL;
 	default_principal = NULL;
@@ -227,8 +244,7 @@
 	rv = krb5_unparse_name(context, default_principal, principal_name);
 	krb5_free_principal(context, default_principal);
 	if (rv != 0) {
-		PAM_LOG(krb5_unparse_name: %s,
-		krb5_get_err_text(context, rv));
+		log_krb5(context, krb5_unparse_name: %s, rv);
 		return (rv);
 	}
 	PAM_LOG(Default principal name: %s, principal_name);
@@ -250,8 +266,15 @@
 		return (errno);
 	rv = krb5_parse_name(context, *su_principal_name, default_principal);
 	if (rv != 0) {
-		PAM_LOG(krb5_parse_name `%s': %s, *su_principal_name,
-		krb5_get_err_text(context, rv));
+		errtxt = krb5_get_error_message(context, rv);
+		if (errtxt != NULL) {
+			PAM_LOG(krb5_parse_name `%s': %s, *su_principal_name,
+			errtxt);
+			krb5_free_error_message(context, errtxt);
+		} else {
+			PAM_LOG(krb5_parse_name `%s': %ld, *su_principal_name,
+			rv);
+		}
 		free(*su_principal_name);
 		return (rv);
 	}



CVS commit: src/sys/dev/isa

2011-04-24 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Sun Apr 24 18:54:41 UTC 2011

Modified Files:
src/sys/dev/isa: if_ec.c

Log Message:
use static inline for ec_readmem(), it is not referenced elsewhere

(avoids C99 vs GNU semantics for external inline functions)


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/isa/if_ec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/isa/if_ec.c
diff -u src/sys/dev/isa/if_ec.c:1.33 src/sys/dev/isa/if_ec.c:1.34
--- src/sys/dev/isa/if_ec.c:1.33	Mon Apr 28 20:23:52 2008
+++ src/sys/dev/isa/if_ec.c	Sun Apr 24 18:54:41 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ec.c,v 1.33 2008/04/28 20:23:52 martin Exp $	*/
+/*	$NetBSD: if_ec.c,v 1.34 2011/04/24 18:54:41 plunky Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_ec.c,v 1.33 2008/04/28 20:23:52 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_ec.c,v 1.34 2011/04/24 18:54:41 plunky Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -106,8 +106,6 @@
 int	ec_fake_test_mem(struct dp8390_softc *);
 int	ec_test_mem(struct dp8390_softc *);
 
-inline void ec_readmem(struct ec_softc *, int, u_int8_t *, int);
-
 static const int ec_iobase[] = {
 	0x2e0, 0x2a0, 0x280, 0x250, 0x350, 0x330, 0x310, 0x300,
 };
@@ -549,7 +547,7 @@
  * copy 'len' from NIC to host using shared memory.  The 'len' is rounded
  * up to a word - ok as long as mbufs are word-sized.
  */
-inline void
+static inline void
 ec_readmem(struct ec_softc *esc, int from, uint8_t *to, int len)
 {
 	bus_space_tag_t memt = esc-sc_dp8390.sc_buft;



CVS commit: src/lib/libtelnet

2011-04-24 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Sun Apr 24 19:00:32 UTC 2011

Modified Files:
src/lib/libtelnet: kerberos5.c

Log Message:
Stop using functions that are deprecated in Heimdal.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/libtelnet/kerberos5.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libtelnet/kerberos5.c
diff -u src/lib/libtelnet/kerberos5.c:1.17 src/lib/libtelnet/kerberos5.c:1.18
--- src/lib/libtelnet/kerberos5.c:1.17	Wed Mar 22 16:32:39 2006
+++ src/lib/libtelnet/kerberos5.c	Sun Apr 24 19:00:31 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kerberos5.c,v 1.17 2006/03/22 16:32:39 christos Exp $	*/
+/*	$NetBSD: kerberos5.c,v 1.18 2011/04/24 19:00:31 elric Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -74,6 +74,7 @@
 
 int require_hwpreauth;
 
+const char *get_krb5_err_text(krb5_context, krb5_error_code);
 void kerberos5_forward(Authenticator *);
 
 static unsigned char str_data[1024] = {IAC, SB, TELOPT_AUTHENTICATION, 0,
@@ -125,6 +126,22 @@
 	return (telnet_net_write(str_data, p - str_data));
 }
 
+const char *
+get_krb5_err_text(krb5_context ctx, krb5_error_code ret)
+{
+	static const char	*str = NULL;
+
+	if (str)
+		krb5_free_error_message(ctx, str);
+
+	str = krb5_get_error_message(ctx, ret);
+
+	if (str != NULL)
+		return str;
+
+	return unknown;
+}
+
 int
 kerberos5_init(Authenticator *ap, int server)
 {
@@ -180,7 +197,7 @@
 		if (auth_debug_mode) {
 			printf(
 			Kerberos V5: could not get default ccache: %s\r\n,
-			krb5_get_err_text(telnet_context, ret));
+			get_krb5_err_text(telnet_context, ret));
 		}
 		return (0);
 	}
@@ -196,7 +213,7 @@
 		if (auth_debug_mode) {
 			printf(
 			Kerberos V5: krb5_auth_con_init failed: %s\r\n,
-			krb5_get_err_text(telnet_context, ret));
+			get_krb5_err_text(telnet_context, ret));
 		}
 		return (0);
 	}
@@ -206,7 +223,7 @@
 		if (auth_debug_mode) {
 			printf(Kerberos V5: 
 			krb5_auth_con_setaddrs_from_fd failed: %s\r\n,
-			krb5_get_err_text(telnet_context, ret));
+			get_krb5_err_text(telnet_context, ret));
 		}
 		return (0);
 	}
@@ -222,7 +239,7 @@
 	if (ret) {
 		if (1 || auth_debug_mode) {
 			printf(Kerberos V5: mk_req failed (%s)\r\n,
-			krb5_get_err_text(telnet_context, ret));
+			get_krb5_err_text(telnet_context, ret));
 		}
 		return (0);
 	}
@@ -269,7 +286,7 @@
 			auth_finished(ap, AUTH_REJECT);
 			if (auth_debug_mode)
 printf(Kerberos V5: krb5_auth_con_init failed (%s)\r\n,
-krb5_get_err_text(telnet_context, ret));
+get_krb5_err_text(telnet_context, ret));
 			return;
 		}
 		ret = krb5_auth_con_setaddrs_from_fd(telnet_context,
@@ -280,7 +297,7 @@
 			if (auth_debug_mode)
 printf(Kerberos V5: 
 krb5_auth_con_setaddrs_from_fd failed (%s)\r\n,
-krb5_get_err_text(telnet_context, ret));
+get_krb5_err_text(telnet_context, ret));
 			return;
 		}
 		ret = krb5_sock_to_principal(telnet_context, 0, host,
@@ -291,7 +308,7 @@
 			if (auth_debug_mode)
 printf(Kerberos V5: 
 krb5_sock_to_principal failed (%s)\r\n,
-krb5_get_err_text(telnet_context, ret));
+get_krb5_err_text(telnet_context, ret));
 			return;
 		}
 		ret = krb5_rd_req(telnet_context, auth_context, auth,
@@ -303,7 +320,7 @@
 
 			asprintf(errbuf,
 			Read req failed: %s,
-			krb5_get_err_text(telnet_context, ret));
+			get_krb5_err_text(telnet_context, ret));
 			Data(ap, KRB_REJECT, errbuf, -1);
 			if (auth_debug_mode)
 printf(%s\r\n, errbuf);
@@ -321,7 +338,7 @@
 			if (ret) {
 char *errbuf;
 asprintf(errbuf, Bad checksum: %s,
-krb5_get_err_text(telnet_context, ret));
+get_krb5_err_text(telnet_context, ret));
 Data(ap, KRB_REJECT, errbuf, -1);
 if (auth_debug_mode)
 	printf(%s\r\n, errbuf);
@@ -338,7 +355,7 @@
 			if (auth_debug_mode)
 printf(Kerberos V5: 
 krb5_auth_con_getremotesubkey failed (%s)\r\n,
-krb5_get_err_text(telnet_context, ret));
+get_krb5_err_text(telnet_context, ret));
 			return;
 		}
 		if (key_block == NULL) {
@@ -352,7 +369,7 @@
 			if (auth_debug_mode)
 printf(Kerberos V5: 
    krb5_auth_con_getkey failed (%s)\r\n,
-   krb5_get_err_text(telnet_context, ret));
+   get_krb5_err_text(telnet_context, ret));
 			return;
 		}
 		if (key_block == NULL) {
@@ -373,7 +390,7 @@
 if (auth_debug_mode)
 	printf(Kerberos V5: 
 	krb5_mk_rep failed (%s)\r\n,
-	krb5_get_err_text(telnet_context,
+	get_krb5_err_text(telnet_context,
 	ret));
 krb5_free_keyblock(telnet_context, key_block);
 return;
@@ -440,7 +457,7 @@
 			if (ret) {
 if (auth_debug_mode)
 	printf(Kerberos V5: could not get ccache: %s\r\n,
-	krb5_get_err_text(telnet_context,
+	get_krb5_err_text(telnet_context,
 	ret));
 break;
 			}
@@ -449,7 +466,7 @@
 			if (ret) {

CVS commit: src/lib/libtelnet

2011-04-24 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Sun Apr 24 19:00:56 UTC 2011

Modified Files:
src/lib/libtelnet: Makefile

Log Message:
We no longer need to -I/usr/include/krb5.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/lib/libtelnet/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libtelnet/Makefile
diff -u src/lib/libtelnet/Makefile:1.31 src/lib/libtelnet/Makefile:1.32
--- src/lib/libtelnet/Makefile:1.31	Fri Aug 29 00:02:22 2008
+++ src/lib/libtelnet/Makefile	Sun Apr 24 19:00:56 2011
@@ -1,5 +1,5 @@
 #	from: @(#)Makefile	8.2 (Berkeley) 12/15/93
-#	$NetBSD: Makefile,v 1.31 2008/08/29 00:02:22 gmcgarry Exp $
+#	$NetBSD: Makefile,v 1.32 2011/04/24 19:00:56 elric Exp $
 
 USE_FORT?= yes	# network protocol library
 
@@ -22,7 +22,6 @@
 
 SRCS+=	kerberos5.c
 CPPFLAGS+= -DKRB5
-CPPFLAGS+= -I${DESTDIR}/usr/include/krb5
 .endif
 
 .if ${USE_PAM} != no  ${MKCRYPTO} != no



CVS commit: src/sys

2011-04-24 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Apr 24 20:17:53 UTC 2011

Modified Files:
src/sys/kern: kern_fork.c sys_mqueue.c
src/sys/sys: mqueue.h

Log Message:
- Move some checks into mqueue_get() and avoid some duplication.
- Simplify message queue descriptor unlinking and closure operations.
- Update proc_t::p_mqueue_cnt atomically.  Inherit it on fork().
- Use separate allocation for the name of message queue.


To generate a diff of this commit:
cvs rdiff -u -r1.180 -r1.181 src/sys/kern/kern_fork.c
cvs rdiff -u -r1.31 -r1.32 src/sys/kern/sys_mqueue.c
cvs rdiff -u -r1.12 -r1.13 src/sys/sys/mqueue.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_fork.c
diff -u src/sys/kern/kern_fork.c:1.180 src/sys/kern/kern_fork.c:1.181
--- src/sys/kern/kern_fork.c:1.180	Wed Mar 23 13:57:40 2011
+++ src/sys/kern/kern_fork.c	Sun Apr 24 20:17:53 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_fork.c,v 1.180 2011/03/23 13:57:40 joerg Exp $	*/
+/*	$NetBSD: kern_fork.c,v 1.181 2011/04/24 20:17:53 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2001, 2004, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_fork.c,v 1.180 2011/03/23 13:57:40 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_fork.c,v 1.181 2011/04/24 20:17:53 rmind Exp $);
 
 #include opt_ktrace.h
 
@@ -349,6 +349,9 @@
 	else
 		p2-p_fd = fd_copy();
 
+	/* XXX racy */
+	p2-p_mqueue_cnt = p1-p_mqueue_cnt;
+
 	if (flags  FORK_SHARECWD)
 		cwdshare(p2);
 	else

Index: src/sys/kern/sys_mqueue.c
diff -u src/sys/kern/sys_mqueue.c:1.31 src/sys/kern/sys_mqueue.c:1.32
--- src/sys/kern/sys_mqueue.c:1.31	Tue Jan 18 20:32:53 2011
+++ src/sys/kern/sys_mqueue.c	Sun Apr 24 20:17:53 2011
@@ -1,7 +1,7 @@
-/*	$NetBSD: sys_mqueue.c,v 1.31 2011/01/18 20:32:53 rmind Exp $	*/
+/*	$NetBSD: sys_mqueue.c,v 1.32 2011/04/24 20:17:53 rmind Exp $	*/
 
 /*
- * Copyright (c) 2007-2009 Mindaugas Rasiukevicius rmind at NetBSD org
+ * Copyright (c) 2007-2011 Mindaugas Rasiukevicius rmind at NetBSD org
  * All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
@@ -31,37 +31,30 @@
  * Defined in the Base Definitions volume of IEEE Std 1003.1-2001.
  *
  * Locking
- * 
- * Global list of message queues (mqueue_head) and proc_t::p_mqueue_cnt
- * counter are protected by mqlist_mtx lock.  The very message queue and
- * its members are protected by mqueue::mq_mtx.
- * 
+ *
+ * Global list of message queues (mqueue_head) is protected by mqlist_lock.
+ * Each message queue and its members are protected by mqueue::mq_mtx.
+ * Note that proc_t::p_mqueue_cnt is updated atomically.
+ *
  * Lock order:
- * 	mqlist_mtx -
- * 		mqueue::mq_mtx
+ *
+ *	mqlist_lock -
+ *		mqueue::mq_mtx
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sys_mqueue.c,v 1.31 2011/01/18 20:32:53 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: sys_mqueue.c,v 1.32 2011/04/24 20:17:53 rmind Exp $);
 
 #include sys/param.h
 #include sys/types.h
-#include sys/condvar.h
-#include sys/errno.h
-#include sys/fcntl.h
+
 #include sys/file.h
 #include sys/filedesc.h
 #include sys/kauth.h
-#include sys/kernel.h
-#include sys/kmem.h
 #include sys/lwp.h
 #include sys/mqueue.h
 #include sys/module.h
-#include sys/mutex.h
-#include sys/pool.h
 #include sys/poll.h
-#include sys/proc.h
-#include sys/queue.h
 #include sys/select.h
 #include sys/signal.h
 #include sys/signalvar.h
@@ -70,8 +63,6 @@
 #include sys/syscall.h
 #include sys/syscallvar.h
 #include sys/syscallargs.h
-#include sys/systm.h
-#include sys/unistd.h
 
 #include miscfs/genfs/genfs.h
 
@@ -84,10 +75,10 @@
 static u_int			mq_def_maxmsg = 32;
 static u_int			mq_max_maxmsg = 16 * 32;
 
-static kmutex_t			mqlist_mtx;
-static pool_cache_t		mqmsg_cache;
-static LIST_HEAD(, mqueue)	mqueue_head;
-static struct sysctllog		*mqsysctl_log;
+static pool_cache_t		mqmsg_cache	__read_mostly;
+static kmutex_t			mqlist_lock	__cacheline_aligned;
+static LIST_HEAD(, mqueue)	mqueue_head	__cacheline_aligned;
+static struct sysctllog *	mqsysctl_log;
 
 static int	mqueue_sysinit(void);
 static int	mqueue_sysfini(bool);
@@ -133,7 +124,7 @@
 
 	mqmsg_cache = pool_cache_init(MQ_DEF_MSGSIZE, coherency_unit,
 	0, 0, mqmsgpl, NULL, IPL_NONE, NULL, NULL, NULL);
-	mutex_init(mqlist_mtx, MUTEX_DEFAULT, IPL_NONE);
+	mutex_init(mqlist_lock, MUTEX_DEFAULT, IPL_NONE);
 	LIST_INIT(mqueue_head);
 
 	error = mqueue_sysctl_init();
@@ -160,13 +151,10 @@
 		error = syscall_disestablish(NULL, mqueue_syscalls);
 		if (error)
 			return error;
-		/*
-		 * Check if there are any message queues in use.
-		 * TODO: We shall support forced unload.
-		 */
-		mutex_enter(mqlist_mtx);
+		/* Check if there are any message queues in use. */
+		mutex_enter(mqlist_lock);
 		inuse = !LIST_EMPTY(mqueue_head);
-		mutex_exit(mqlist_mtx);
+		mutex_exit(mqlist_lock);
 		if (inuse) {
 			error = 

CVS commit: src/sys/kern

2011-04-24 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Apr 24 20:30:38 UTC 2011

Modified Files:
src/sys/kern: kern_descrip.c

Log Message:
Drop extern inline for fd_getfile().  Apparently, GCC already ignores it.


To generate a diff of this commit:
cvs rdiff -u -r1.213 -r1.214 src/sys/kern/kern_descrip.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_descrip.c
diff -u src/sys/kern/kern_descrip.c:1.213 src/sys/kern/kern_descrip.c:1.214
--- src/sys/kern/kern_descrip.c:1.213	Sat Apr 23 18:57:27 2011
+++ src/sys/kern/kern_descrip.c	Sun Apr 24 20:30:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_descrip.c,v 1.213 2011/04/23 18:57:27 rmind Exp $	*/
+/*	$NetBSD: kern_descrip.c,v 1.214 2011/04/24 20:30:38 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_descrip.c,v 1.213 2011/04/23 18:57:27 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_descrip.c,v 1.214 2011/04/24 20:30:38 rmind Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -350,7 +350,7 @@
  * Look up the file structure corresponding to a file descriptor
  * and return the file, holding a reference on the descriptor.
  */
-inline file_t *
+file_t *
 fd_getfile(unsigned fd)
 {
 	filedesc_t *fdp;



CVS commit: src/usr.bin/passwd

2011-04-24 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Sun Apr 24 21:16:44 UTC 2011

Modified Files:
src/usr.bin/passwd: krb5_passwd.c

Log Message:
Stop using functions deprecated by Heimdal.  Also, if krb5_init_context()
fails, we can't use Kerberos functions to grab error strings, we
resort to strerror(3) which is what Heimdal's deprecated function
does in this case.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/passwd/krb5_passwd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/passwd/krb5_passwd.c
diff -u src/usr.bin/passwd/krb5_passwd.c:1.18 src/usr.bin/passwd/krb5_passwd.c:1.19
--- src/usr.bin/passwd/krb5_passwd.c:1.18	Sat Apr 18 09:04:34 2009
+++ src/usr.bin/passwd/krb5_passwd.c	Sun Apr 24 21:16:43 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: krb5_passwd.c,v 1.18 2009/04/18 09:04:34 mlelstv Exp $ */
+/* $NetBSD: krb5_passwd.c,v 1.19 2011/04/24 21:16:43 elric Exp $ */
 
 /*
  * Copyright (c) 2000, 2005 The NetBSD Foundation, Inc.
@@ -68,13 +68,14 @@
 {
 	krb5_context context;
 	krb5_error_code ret;
-	krb5_get_init_creds_opt opt;
+	krb5_get_init_creds_opt *opt;
 	krb5_principal principal;
 	krb5_creds cred;
 	int result_code;
 	krb5_data result_code_string, result_string;
 	char pwbuf[BUFSIZ];
 	int ch;
+	const char *errtxt;
 
 	while ((ch = getopt(argc, argv, 5ku:)) != -1) {
 		switch (ch) {
@@ -125,21 +126,34 @@
 	if (ret != 0) {
 		if (ret == ENXIO)
 			errx(1, Kerberos 5 not in use.);
-		warnx(Unable to initialize Kerberos 5: %s,
-		krb5_get_err_text(context, ret));
-		goto bad;
+		errx(1, Unable to initialize Kerberos 5: %s, strerror(ret));
 	}
 
-	krb5_get_init_creds_opt_init(opt);
+	ret = krb5_get_init_creds_opt_alloc(context, opt);
+	if (ret) {
+		errtxt = krb5_get_error_message(context, ret);
+		if (errtxt != NULL) {
+			warnx(failed to allocate opts: %s, errtxt);
+			krb5_free_error_message(context, errtxt);
+		} else {
+			warnx(failed to allocate opts: %d, ret);
+		}
+		goto bad;
+	}
 
-	krb5_get_init_creds_opt_set_tkt_life(opt, 300L);
-	krb5_get_init_creds_opt_set_forwardable(opt, FALSE);
-	krb5_get_init_creds_opt_set_proxiable(opt, FALSE);
+	krb5_get_init_creds_opt_set_tkt_life(opt, 300L);
+	krb5_get_init_creds_opt_set_forwardable(opt, FALSE);
+	krb5_get_init_creds_opt_set_proxiable(opt, FALSE);
 
 	ret = krb5_parse_name(context, username, principal);
 	if (ret) {
-		warnx(failed to parse principal: %s, 
-		krb5_get_err_text(context, ret));
+		errtxt = krb5_get_error_message(context, ret);
+		if (errtxt != NULL) {
+			warnx(failed to parse principal: %s, errtxt);
+			krb5_free_error_message(context, errtxt);
+		} else {
+			warnx(failed to parse principal: %d, ret);
+		}
 		goto bad;
 	}
 
@@ -151,7 +165,7 @@
 	   NULL,
 	   0L,
 	   kadmin/changepw,
-	   opt);
+	   opt);
 
 
 	switch (ret) {
@@ -168,8 +182,13 @@
 		goto bad;
 
 	default:
-		warnx(failed to get credentials: %s, 
-		krb5_get_err_text(context, ret));
+		errtxt = krb5_get_error_message(context, ret);
+		if (errtxt != NULL) {
+			warnx(failed to get credentials: %s, errtxt);
+			krb5_free_error_message(context, errtxt);
+		} else {
+			warnx(failed to get credentials: %d, ret);
+		}
 		goto bad;
  	}
 
@@ -186,8 +205,13 @@
 result_code_string,
 result_string);
 	if (ret) {
-		warnx(unable to set password: %s,
-		krb5_get_err_text(context, ret));
+		errtxt = krb5_get_error_message(context, ret);
+		if (errtxt != NULL) {
+			warnx(unable to set password: %s, errtxt);
+			krb5_free_error_message(context, errtxt);
+		} else {
+			warnx(unable to set password: %d, ret);
+		}
 		goto bad;
 	}
 
@@ -271,11 +295,17 @@
 int result_code;
 krb5_data result_code_string, result_string;
 char pwbuf[BUFSIZ];
+const char *errtxt;
 
 ret = krb5_init_context (context);
 if (ret) {
-	warnx(failed kerberos initialisation: %s, 
-	  krb5_get_err_text(context, ret));
+	errtxt = krb5_get_error_message(context, ret);
+	if (errtxt != NULL) {
+	warnx(failed kerberos initialisation: %s, errtxt);
+	krb5_free_error_message(context, errtxt);
+	} else {
+	warnx(failed kerberos initialisation: %d, ret);
+	}
 	return 1;
 }
 
@@ -288,8 +318,13 @@
 if(username != NULL) {
 ret = krb5_parse_name (context, username, principal);
 if (ret) {
-	warnx(failed to parse principal: %s, 
-		  krb5_get_err_text(context, ret));
+	errtxt = krb5_get_error_message(context, ret);
+	if (errtxt != NULL) {
+		warnx(failed to parse principal: %s, errtxt);
+		krb5_free_error_message(context, errtxt);
+	} else {
+		warnx(failed to parse principal: %d, ret);
+	}
 	return 1;
 	}
 } else
@@ -317,8 +352,13 @@
 	return 1;
 break;
 default:
-	warnx(failed to get credentials: %s, 
-	  krb5_get_err_text(context, ret));
+	errtxt = krb5_get_error_message(context, ret);
+	if (errtxt != NULL) {
+	

CVS commit: src/libexec/telnetd

2011-04-24 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Sun Apr 24 21:18:24 UTC 2011

Modified Files:
src/libexec/telnetd: telnetd.c

Log Message:
#include com_err.h - #include krb5/com_err.h.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/libexec/telnetd/telnetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/telnetd/telnetd.c
diff -u src/libexec/telnetd/telnetd.c:1.51 src/libexec/telnetd/telnetd.c:1.52
--- src/libexec/telnetd/telnetd.c:1.51	Sun Jul 20 01:09:07 2008
+++ src/libexec/telnetd/telnetd.c	Sun Apr 24 21:18:24 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: telnetd.c,v 1.51 2008/07/20 01:09:07 lukem Exp $	*/
+/*	$NetBSD: telnetd.c,v 1.52 2011/04/24 21:18:24 elric Exp $	*/
 
 /*
  * Copyright (C) 1997 and 1998 WIDE Project.
@@ -65,7 +65,7 @@
 #if 0
 static char sccsid[] = @(#)telnetd.c	8.4 (Berkeley) 5/30/95;
 #else
-__RCSID($NetBSD: telnetd.c,v 1.51 2008/07/20 01:09:07 lukem Exp $);
+__RCSID($NetBSD: telnetd.c,v 1.52 2011/04/24 21:18:24 elric Exp $);
 #endif
 #endif /* not lint */
 
@@ -83,7 +83,7 @@
 #define	Authenticator	k5_Authenticator
 #include krb5.h
 #undef	Authenticator
-#include com_err.h
+#include krb5/com_err.h
 #endif
 
 #ifdef AUTHENTICATION



CVS commit: src/sys

2011-04-24 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Apr 24 21:35:30 UTC 2011

Modified Files:
src/sys/fs/nilfs: nilfs_vnops.c
src/sys/fs/tmpfs: tmpfs_vnops.c
src/sys/fs/udf: udf_vnops.c
src/sys/kern: vfs_syscalls.c
src/sys/nfs: nfs_vnops.c
src/sys/ufs/ext2fs: ext2fs_vnops.c
src/sys/ufs/ufs: ufs_vnops.c

Log Message:
sys_link: prevent hard links on directories (cross-mount operations are
already prevented).  File systems are no longer responsible to check this.
Clean up and add asserts (note that dvp == vp cannot happen in vop_link).

OK dholland@


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/fs/nilfs/nilfs_vnops.c
cvs rdiff -u -r1.76 -r1.77 src/sys/fs/tmpfs/tmpfs_vnops.c
cvs rdiff -u -r1.62 -r1.63 src/sys/fs/udf/udf_vnops.c
cvs rdiff -u -r1.422 -r1.423 src/sys/kern/vfs_syscalls.c
cvs rdiff -u -r1.289 -r1.290 src/sys/nfs/nfs_vnops.c
cvs rdiff -u -r1.97 -r1.98 src/sys/ufs/ext2fs/ext2fs_vnops.c
cvs rdiff -u -r1.187 -r1.188 src/sys/ufs/ufs/ufs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/fs/nilfs/nilfs_vnops.c
diff -u src/sys/fs/nilfs/nilfs_vnops.c:1.9 src/sys/fs/nilfs/nilfs_vnops.c:1.10
--- src/sys/fs/nilfs/nilfs_vnops.c:1.9	Tue Nov 30 10:43:03 2010
+++ src/sys/fs/nilfs/nilfs_vnops.c	Sun Apr 24 21:35:29 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: nilfs_vnops.c,v 1.9 2010/11/30 10:43:03 dholland Exp $ */
+/* $NetBSD: nilfs_vnops.c,v 1.10 2011/04/24 21:35:29 rmind Exp $ */
 
 /*
  * Copyright (c) 2008, 2009 Reinoud Zandijk
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__KERNEL_RCSID(0, $NetBSD: nilfs_vnops.c,v 1.9 2010/11/30 10:43:03 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: nilfs_vnops.c,v 1.10 2011/04/24 21:35:29 rmind Exp $);
 #endif /* not lint */
 
 
@@ -1159,15 +1159,9 @@
 	int error;
 
 	DPRINTF(VFSCALL, (nilfs_link called\n));
-	error = 0;
-
-	/* some quick checks */
-	if (vp-v_type == VDIR)
-		return EPERM;		/* can't link a directory */
-	if (dvp-v_mount != vp-v_mount)
-		return EXDEV;		/* can't link across devices */
-	if (dvp == vp)
-		return EPERM;		/* can't be the same */
+	KASSERT(dvp != vp);
+	KASSERT(vp-v_type != VDIR);
+	KASSERT(dvp-v_mount == vp-v_mount);
 
 	/* lock node */
 	error = vn_lock(vp, LK_EXCLUSIVE);

Index: src/sys/fs/tmpfs/tmpfs_vnops.c
diff -u src/sys/fs/tmpfs/tmpfs_vnops.c:1.76 src/sys/fs/tmpfs/tmpfs_vnops.c:1.77
--- src/sys/fs/tmpfs/tmpfs_vnops.c:1.76	Thu Jan 13 13:35:12 2011
+++ src/sys/fs/tmpfs/tmpfs_vnops.c	Sun Apr 24 21:35:29 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: tmpfs_vnops.c,v 1.76 2011/01/13 13:35:12 pooka Exp $	*/
+/*	$NetBSD: tmpfs_vnops.c,v 1.77 2011/04/24 21:35:29 rmind Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tmpfs_vnops.c,v 1.76 2011/01/13 13:35:12 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: tmpfs_vnops.c,v 1.77 2011/04/24 21:35:29 rmind Exp $);
 
 #include sys/param.h
 #include sys/dirent.h
@@ -737,44 +737,34 @@
 	return error;
 }
 
-/* - */
-
+/*
+ * tmpfs:link: create hard link.
+ */
 int
 tmpfs_link(void *v)
 {
-	struct vnode *dvp = ((struct vop_link_args *)v)-a_dvp;
-	struct vnode *vp = ((struct vop_link_args *)v)-a_vp;
-	struct componentname *cnp = ((struct vop_link_args *)v)-a_cnp;
-
-	int error;
+	struct vop_link_args /* {
+		struct vnode *a_dvp;
+		struct vnode *a_vp;
+		struct componentname *a_cnp;
+	} */ *ap = v;
+	struct vnode *dvp = ap-a_dvp;
+	struct vnode *vp = ap-a_vp;
+	struct componentname *cnp = ap-a_cnp;;
+	struct tmpfs_node *dnode, *node;
 	struct tmpfs_dirent *de;
-	struct tmpfs_node *dnode;
-	struct tmpfs_node *node;
+	int error;
 
+	KASSERT(dvp != vp);
 	KASSERT(VOP_ISLOCKED(dvp));
-	KASSERT(dvp != vp); /* XXX When can this be false? */
+	KASSERT(vp-v_type != VDIR);
+	KASSERT(dvp-v_mount == vp-v_mount);
 
 	dnode = VP_TO_TMPFS_DIR(dvp);
 	node = VP_TO_TMPFS_NODE(vp);
 
-	/* Lock vp because we will need to run tmpfs_update over it, which
-	 * needs the vnode to be locked. */
 	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 
-	/* XXX: Why aren't the following two tests done by the caller? */
-
-	/* Hard links of directories are forbidden. */
-	if (vp-v_type == VDIR) {
-		error = EPERM;
-		goto out;
-	}
-
-	/* Cannot create cross-device links. */
-	if (dvp-v_mount != vp-v_mount) {
-		error = EXDEV;
-		goto out;
-	}
-
 	/* Ensure that we do not overflow the maximum number of links imposed
 	 * by the system. */
 	KASSERT(node-tn_links = LINK_MAX);

Index: src/sys/fs/udf/udf_vnops.c
diff -u src/sys/fs/udf/udf_vnops.c:1.62 src/sys/fs/udf/udf_vnops.c:1.63
--- src/sys/fs/udf/udf_vnops.c:1.62	Sun Jan  2 05:09:30 2011
+++ src/sys/fs/udf/udf_vnops.c	Sun Apr 24 21:35:30 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_vnops.c,v 1.62 2011/01/02 05:09:30 dholland Exp $ */
+/* $NetBSD: udf_vnops.c,v 1.63 

CVS commit: src

2011-04-24 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Sun Apr 24 21:42:06 UTC 2011

Modified Files:
src/libexec/ftpd: Makefile
src/libexec/telnetd: Makefile
src/usr.bin/login: Makefile
src/usr.bin/passwd: Makefile
src/usr.bin/su: Makefile
src/usr.bin/telnet: Makefile

Log Message:
We no longer need -I/usr/include/krb5.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/libexec/ftpd/Makefile
cvs rdiff -u -r1.47 -r1.48 src/libexec/telnetd/Makefile
cvs rdiff -u -r1.51 -r1.52 src/usr.bin/login/Makefile
cvs rdiff -u -r1.41 -r1.42 src/usr.bin/passwd/Makefile
cvs rdiff -u -r1.49 -r1.50 src/usr.bin/su/Makefile
cvs rdiff -u -r1.44 -r1.45 src/usr.bin/telnet/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ftpd/Makefile
diff -u src/libexec/ftpd/Makefile:1.60 src/libexec/ftpd/Makefile:1.61
--- src/libexec/ftpd/Makefile:1.60	Sun Mar 15 07:48:36 2009
+++ src/libexec/ftpd/Makefile	Sun Apr 24 21:42:06 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.60 2009/03/15 07:48:36 lukem Exp $
+#	$NetBSD: Makefile,v 1.61 2011/04/24 21:42:06 elric Exp $
 #	@(#)Makefile	8.2 (Berkeley) 4/4/94
 
 .include bsd.own.mk
@@ -43,7 +43,6 @@
 #
 #SRCS+=	k5login.c
 #CPPFLAGS+=-DKERBEROS5
-#CPPFLAGS+=-DKERBEROS5 -I${DESTDIR}/usr/include/krb5
 #DPADD+=	${LIBKRB5} ${LIBASN1}
 #LDADD+= -lkrb5 -lasn1
 #

Index: src/libexec/telnetd/Makefile
diff -u src/libexec/telnetd/Makefile:1.47 src/libexec/telnetd/Makefile:1.48
--- src/libexec/telnetd/Makefile:1.47	Fri Apr 15 18:05:45 2011
+++ src/libexec/telnetd/Makefile	Sun Apr 24 21:42:06 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.47 2011/04/15 18:05:45 elric Exp $
+#	$NetBSD: Makefile,v 1.48 2011/04/24 21:42:06 elric Exp $
 #	from: @(#)Makefile	8.2 (Berkeley) 12/15/93
 
 WARNS?=	2		# XXX: const issues in sys_term.c
@@ -21,7 +21,6 @@
 LIBTELNETDIR!=	cd ${.CURDIR}/../../lib/libtelnet; ${PRINTOBJDIR}
 
 .if (${USE_KERBEROS} != no)
-CPPFLAGS+=-I${DESTDIR}/usr/include/krb5
 CPPFLAGS+=-DKRB5 -DAUTHENTICATION -DENCRYPTION
 LDADD+= -lkrb5 -lasn1 -lcrypto -lcrypt
 DPADD+=	${LIBKRB5} ${LIBASN1} ${LIBCRYPTO} ${LIBCRYPT}

Index: src/usr.bin/login/Makefile
diff -u src/usr.bin/login/Makefile:1.51 src/usr.bin/login/Makefile:1.52
--- src/usr.bin/login/Makefile:1.51	Tue Dec 29 19:26:13 2009
+++ src/usr.bin/login/Makefile	Sun Apr 24 21:42:06 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.51 2009/12/29 19:26:13 christos Exp $
+#	$NetBSD: Makefile,v 1.52 2011/04/24 21:42:06 elric Exp $
 #	@(#)Makefile	8.1 (Berkeley) 7/19/93
 
 WARNS?=	2	# XXX -Wcast-qual issues
@@ -24,7 +24,7 @@
 
 .if (${USE_KERBEROS} != no)
 SRCS+= k5login.c
-CPPFLAGS+=-DKERBEROS5 -I${DESTDIR}/usr/include/krb5
+CPPFLAGS+=-DKERBEROS5
 DPADD+=	${LIBKRB5} ${LIBASN1}
 LDADD+= -lkrb5 -lasn1
 

Index: src/usr.bin/passwd/Makefile
diff -u src/usr.bin/passwd/Makefile:1.41 src/usr.bin/passwd/Makefile:1.42
--- src/usr.bin/passwd/Makefile:1.41	Mon May 28 12:06:29 2007
+++ src/usr.bin/passwd/Makefile	Sun Apr 24 21:42:06 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.41 2007/05/28 12:06:29 tls Exp $
+#	$NetBSD: Makefile,v 1.42 2011/04/24 21:42:06 elric Exp $
 #	from: @(#)Makefile8.3 (Berkeley) 4/2/94
 
 .include bsd.own.mk
@@ -26,7 +26,7 @@
 BINMODE=4555
 
 .if (${USE_KERBEROS} != no)
-CPPFLAGS+= -DKERBEROS5 -I${DESTDIR}/usr/include/krb5
+CPPFLAGS+= -DKERBEROS5
 SRCS+=	krb5_passwd.c
 
 DPADD+=	${LIBKRB5} ${LIBCRYPTO} ${LIBASN1} ${LIBCOM_ERR} ${LIBROKEN} ${LIBCRYPT}

Index: src/usr.bin/su/Makefile
diff -u src/usr.bin/su/Makefile:1.49 src/usr.bin/su/Makefile:1.50
--- src/usr.bin/su/Makefile:1.49	Sun Apr  6 09:54:37 2008
+++ src/usr.bin/su/Makefile	Sun Apr 24 21:42:06 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.49 2008/04/06 09:54:37 lukem Exp $
+#	$NetBSD: Makefile,v 1.50 2011/04/24 21:42:06 elric Exp $
 #	from: @(#)Makefile	8.1 (Berkeley) 7/19/93
 
 .include bsd.own.mk
@@ -45,7 +45,7 @@
 LDADD+= -lkafs
 .endif
 
-CPPFLAGS+=-DKERBEROS5 -I${DESTDIR}/usr/include/krb5
+CPPFLAGS+=-DKERBEROS5
 DPADD+=	${LIBKRB5} ${LIBASN1}
 LDADD+= -lkrb5 -lasn1
 

Index: src/usr.bin/telnet/Makefile
diff -u src/usr.bin/telnet/Makefile:1.44 src/usr.bin/telnet/Makefile:1.45
--- src/usr.bin/telnet/Makefile:1.44	Wed Feb  3 15:34:46 2010
+++ src/usr.bin/telnet/Makefile	Sun Apr 24 21:42:06 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.44 2010/02/03 15:34:46 roy Exp $
+#	$NetBSD: Makefile,v 1.45 2011/04/24 21:42:06 elric Exp $
 #
 # Copyright (c) 1990 The Regents of the University of California.
 # All rights reserved.
@@ -63,7 +63,6 @@
 LIBTELNETDIR!=	cd ${.CURDIR}/../../lib/libtelnet; ${PRINTOBJDIR}
 
 .if (${USE_KERBEROS} != no)
-CPPFLAGS+=-I${DESTDIR}/usr/include/krb5
 CPPFLAGS+=-DKRB5 -DFORWARD -DAUTHENTICATION -DENCRYPTION
 LDADD+= -lkrb5 -lasn1 -lcrypto -lcrypt
 DPADD+=	${LIBKRB5} ${LIBASN1} ${LIBCRYPTO} ${LIBCRYPT}



CVS commit: src/sys/sys

2011-04-24 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Apr 24 21:50:34 UTC 2011

Modified Files:
src/sys/sys: param.h

Log Message:
Bump to 5.99.50 for recent changes.


To generate a diff of this commit:
cvs rdiff -u -r1.386 -r1.387 src/sys/sys/param.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.386 src/sys/sys/param.h:1.387
--- src/sys/sys/param.h:1.386	Mon Apr 11 01:33:46 2011
+++ src/sys/sys/param.h	Sun Apr 24 21:50:34 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.386 2011/04/11 01:33:46 dholland Exp $	*/
+/*	$NetBSD: param.h,v 1.387 2011/04/24 21:50:34 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -63,7 +63,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	599004900	/* NetBSD 5.99.49 */
+#define	__NetBSD_Version__	599005000	/* NetBSD 5.99.50 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) = __NetBSD_Version__)



CVS commit: src/crypto/external/bsd/heimdal/include

2011-04-24 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Sun Apr 24 22:24:14 UTC 2011

Modified Files:
src/crypto/external/bsd/heimdal/include: krb5-types.h

Log Message:
Remove the definition of various X_DEPRECATED as userland has been fixed
to stop using functions defined as deprecated by Heimdal.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/crypto/external/bsd/heimdal/include/krb5-types.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/crypto/external/bsd/heimdal/include/krb5-types.h
diff -u src/crypto/external/bsd/heimdal/include/krb5-types.h:1.4 src/crypto/external/bsd/heimdal/include/krb5-types.h:1.5
--- src/crypto/external/bsd/heimdal/include/krb5-types.h:1.4	Fri Apr 15 14:41:11 2011
+++ src/crypto/external/bsd/heimdal/include/krb5-types.h	Sun Apr 24 22:24:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: krb5-types.h,v 1.4 2011/04/15 14:41:11 elric Exp $	*/
+/*	$NetBSD: krb5-types.h,v 1.5 2011/04/24 22:24:14 elric Exp $	*/
 
 #ifndef __krb5_types_h__
 #define __krb5_types_h__
@@ -14,10 +14,6 @@
 
 typedef int krb5_socket_t;
 
-#define HEIMDAL_DEPRECATED
-#define GSSAPI_DEPRECATED
-#define KRB5_DEPRECATED
-
 #ifndef HEIMDAL_DEPRECATED
 #if defined(__GNUC__)  ((__GNUC__  3) || ((__GNUC__ == 3)  (__GNUC_MINOR__ = 1 )))
 #define HEIMDAL_DEPRECATED __attribute__((deprecated))



CVS commit: src/sys/arch/xen/xen

2011-04-24 Thread Jean-Yves Migeon
Module Name:src
Committed By:   jym
Date:   Mon Apr 25 00:00:50 UTC 2011

Modified Files:
src/sys/arch/xen/xen: if_xennet_xenbus.c

Log Message:
Separate xennet(4) backend initialization code (resume) from the part
that talks with Xenstore to query backend's information. Resuming is now
performed just after xennet(4) attachment instead of waiting for backend
to announce its features in Xenstore and change it state.

This fixes the race observed by Urban Boquist when the domU boots with
root on NFS.

FWIW, the boot code (when root is NFS-backed) can innit() the xennet(4)
interface very early: it tried to access ifnet structures that were not
yet allocated.

Will ask for a pullup. Thanks to Urban for reporting the issue and
investigate it. Confirmed fixed. No regression observed by me for
dynamic attach/detach of xvif(4) and xennet(4) interfaces.

See also http://mail-index.netbsd.org/port-xen/2011/04/18/msg006647.html


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/xen/xen/if_xennet_xenbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/xen/xen/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.48 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.49
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.48	Wed Mar 30 18:33:05 2011
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Mon Apr 25 00:00:50 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.48 2011/03/30 18:33:05 jym Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.49 2011/04/25 00:00:50 jym Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -85,7 +85,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_xennet_xenbus.c,v 1.48 2011/03/30 18:33:05 jym Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_xennet_xenbus.c,v 1.49 2011/04/25 00:00:50 jym Exp $);
 
 #include opt_xen.h
 #include opt_nfs_boot.h
@@ -224,6 +224,7 @@
 static void xennet_tx_complete(struct xennet_xenbus_softc *);
 static void xennet_rx_mbuf_free(struct mbuf *, void *, size_t, void *);
 static int  xennet_handler(void *);
+static int  xennet_talk_to_backend(struct xennet_xenbus_softc *);
 #ifdef XENNET_DEBUG_DUMP
 static void xennet_hex_dump(const unsigned char *, size_t, const char *, int);
 #endif
@@ -372,6 +373,9 @@
 	rnd_attach_source(sc-sc_rnd_source, device_xname(sc-sc_dev),
 	RND_TYPE_NET, 0);
 #endif
+
+	/* resume shared structures and tell backend that we are ready */
+	xennet_xenbus_resume(sc);
 }
 
 static int
@@ -432,13 +436,10 @@
 xennet_xenbus_resume(void *p)
 {
 	struct xennet_xenbus_softc *sc = p;
-	struct xenbus_transaction *xbt;
-	unsigned long rx_copy;
 	int error;
 	netif_tx_sring_t *tx_ring;
 	netif_rx_sring_t *rx_ring;
 	paddr_t ma;
-	const char *errmsg;
 
 	sc-sc_tx_ring_gntref = GRANT_INVALID_REF;
 	sc-sc_rx_ring_gntref = GRANT_INVALID_REF;
@@ -472,6 +473,17 @@
 	event_set_handler(sc-sc_evtchn, xennet_handler, sc,
 	IPL_NET, device_xname(sc-sc_dev));
 
+	return 0;
+}
+
+static int
+xennet_talk_to_backend(struct xennet_xenbus_softc *sc)
+{
+	int error;
+	unsigned long rx_copy;
+	struct xenbus_transaction *xbt;
+	const char *errmsg;
+
 	error = xenbus_read_ul(NULL, sc-sc_xbusd-xbusd_otherend,
 	feature-rx-copy, rx_copy, 10);
 	if (error)
@@ -558,7 +570,7 @@
 		xenbus_switch_state(sc-sc_xbusd, NULL, XenbusStateClosed);
 		break;
 	case XenbusStateInitWait:
-		if (xennet_xenbus_resume(sc) == 0)
+		if (xennet_talk_to_backend(sc) == 0)
 			xenbus_switch_state(sc-sc_xbusd, NULL,
 			XenbusStateConnected);
 		break;



CVS commit: src/sys/arch/xen/xen

2011-04-24 Thread Jean-Yves Migeon
Module Name:src
Committed By:   jym
Date:   Mon Apr 25 00:14:06 UTC 2011

Modified Files:
src/sys/arch/xen/xen: xennetback_xenbus.c

Log Message:
Check that xvif(4) is not already connected before proceeding in the
XenbusStateConnected mode. Under rare occasions, the xenbus watcher
can fire multiple times, overwriting the I/O ring memory mappings with
invalid values. This will lead sooner or later to dom0 panic().

Will ask for pullup. FWIW, xbdback(4) is not affected.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/xen/xen/xennetback_xenbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/xen/xen/xennetback_xenbus.c
diff -u src/sys/arch/xen/xen/xennetback_xenbus.c:1.42 src/sys/arch/xen/xen/xennetback_xenbus.c:1.43
--- src/sys/arch/xen/xen/xennetback_xenbus.c:1.42	Thu Apr 21 13:06:20 2011
+++ src/sys/arch/xen/xen/xennetback_xenbus.c	Mon Apr 25 00:14:06 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: xennetback_xenbus.c,v 1.42 2011/04/21 13:06:20 jym Exp $  */
+/*  $NetBSD: xennetback_xenbus.c,v 1.43 2011/04/25 00:14:06 jym Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -445,6 +445,8 @@
 		break;
 
 	case XenbusStateConnected:
+		if (xneti-xni_status == CONNECTED)
+			break;
 		/* read comunication informations */
 		err = xenbus_read_ul(NULL, xbusd-xbusd_otherend,
 		tx-ring-ref, tx_ring_ref, 10);



CVS commit: src/sys/arch/xen/xen

2011-04-24 Thread Jean-Yves Migeon
Module Name:src
Committed By:   jym
Date:   Mon Apr 25 00:22:37 UTC 2011

Modified Files:
src/sys/arch/xen/xen: xennetback_xenbus.c

Log Message:
use __KERNEL_RCSID()


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/xen/xen/xennetback_xenbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/xen/xen/xennetback_xenbus.c
diff -u src/sys/arch/xen/xen/xennetback_xenbus.c:1.43 src/sys/arch/xen/xen/xennetback_xenbus.c:1.44
--- src/sys/arch/xen/xen/xennetback_xenbus.c:1.43	Mon Apr 25 00:14:06 2011
+++ src/sys/arch/xen/xen/xennetback_xenbus.c	Mon Apr 25 00:22:37 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: xennetback_xenbus.c,v 1.43 2011/04/25 00:14:06 jym Exp $  */
+/*  $NetBSD: xennetback_xenbus.c,v 1.44 2011/04/25 00:22:37 jym Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -25,6 +25,9 @@
  *
  */
 
+#include sys/cdefs.h
+__KERNEL_RCSID(0, $NetBSD: xennetback_xenbus.c,v 1.44 2011/04/25 00:22:37 jym Exp $);
+
 #include opt_xen.h
 
 #include sys/types.h



CVS commit: src/usr.sbin/perfused

2011-04-24 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Mon Apr 25 04:30:59 UTC 2011

Modified Files:
src/usr.sbin/perfused: msg.c perfused.c

Log Message:
- fix warnings
- try to handle ENOBUFS in a nicer way
- use errx() for usage message, not err(), as we do not waht strerror(errno)


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/perfused/msg.c
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/perfused/perfused.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/perfused/msg.c
diff -u src/usr.sbin/perfused/msg.c:1.9 src/usr.sbin/perfused/msg.c:1.10
--- src/usr.sbin/perfused/msg.c:1.9	Mon Oct 11 05:37:58 2010
+++ src/usr.sbin/perfused/msg.c	Mon Apr 25 04:30:59 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: msg.c,v 1.9 2010/10/11 05:37:58 manu Exp $ */
+/*  $NetBSD: msg.c,v 1.10 2011/04/25 04:30:59 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -498,7 +498,7 @@
 	}
 
 #ifdef PERFUSE_DEBUG
-	if (readen != len)
+	if (readen != (ssize_t)len)
 		DERRX(EX_SOFTWARE, %s: short recv %zd/%zd,
 		  __func__, readen, len);
 #endif
@@ -513,7 +513,7 @@
 
 #ifdef PERFUSE_DEBUG
 	if (len  FUSE_BUFSIZE)
-		DERRX(EX_SOFTWARE, %s: foh.len = %d, __func__, len);
+		DERRX(EX_SOFTWARE, %s: foh.len = %zu, __func__, len);
 #endif
 
 	/*
@@ -545,7 +545,7 @@
 	}
 
 #ifdef PERFUSE_DEBUG
-	if (readen != len)
+	if (readen != (ssize_t)len)
 		DERRX(EX_SOFTWARE, %s: short recv %zd/%zd,
 		  __func__, readen, len);
 #endif
@@ -576,10 +576,16 @@
 		/* NOTREACHED */
 		break;
 	case -1:
-		if (errno == EAGAIN)
+		DWARN(%s: send retunred -1, errno = %d, __func__, errno);
+		switch(errno) {
+		case EAGAIN:
+		case ENOBUFS:
 			return 0;
-		DWARN(%s: send retunred -1, __func__);
-		return errno;
+			break;
+		default:
+			return errno;
+			break;
+		}
 		/* NOTREACHED */
 		break;
 	default:
@@ -587,7 +593,7 @@
 	}
 
 #ifdef PERFUSE_DEBUG
-	if (written != len)
+	if (written != (ssize_t)len)
 		DERRX(EX_SOFTWARE, %s: short send %zd/%zd,
 		  __func__, written, len);
 #endif

Index: src/usr.sbin/perfused/perfused.c
diff -u src/usr.sbin/perfused/perfused.c:1.11 src/usr.sbin/perfused/perfused.c:1.12
--- src/usr.sbin/perfused/perfused.c:1.11	Mon Oct 11 05:37:58 2010
+++ src/usr.sbin/perfused/perfused.c	Mon Apr 25 04:30:59 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfused.c,v 1.11 2010/10/11 05:37:58 manu Exp $ */
+/*  $NetBSD: perfused.c,v 1.12 2011/04/25 04:30:59 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -365,7 +365,7 @@
 			foreground = 1;
 			break;
 		default:
-			DERR(EX_USAGE, %s [-fs] [-d level] [-i fd], argv[0]);
+			DERRX(EX_USAGE, %s [-fs] [-d classes] [-i fd], argv[0]);
 			break;
 		}
 	}



CVS commit: src/sys/dev/acpi

2011-04-24 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Mon Apr 25 05:30:21 UTC 2011

Modified Files:
src/sys/dev/acpi: acpi_cpu.c

Log Message:
Add a missing case value in a switch statement.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/acpi/acpi_cpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpi_cpu.c
diff -u src/sys/dev/acpi/acpi_cpu.c:1.39 src/sys/dev/acpi/acpi_cpu.c:1.40
--- src/sys/dev/acpi/acpi_cpu.c:1.39	Thu Mar 24 05:10:06 2011
+++ src/sys/dev/acpi/acpi_cpu.c	Mon Apr 25 05:30:21 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu.c,v 1.39 2011/03/24 05:10:06 jruoho Exp $ */
+/* $NetBSD: acpi_cpu.c,v 1.40 2011/04/25 05:30:21 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010, 2011 Jukka Ruohonen jruoho...@iki.fi
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: acpi_cpu.c,v 1.39 2011/03/24 05:10:06 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: acpi_cpu.c,v 1.40 2011/04/25 05:30:21 jruoho Exp $);
 
 #include sys/param.h
 #include sys/cpu.h
@@ -903,21 +903,22 @@
 acpicpu_debug_print_method(uint8_t val)
 {
 
-	switch (val) {
+	if (val == ACPICPU_C_STATE_FFH)
+		return FFH;
 
-	case ACPICPU_C_STATE_HALT:
+	if (val == ACPICPU_C_STATE_HALT)
 		return HLT;
 
-	case ACPICPU_C_STATE_FFH:
-	case ACPI_ADR_SPACE_FIXED_HARDWARE:
-		return FFH;
+	if (val == ACPICPU_C_STATE_SYSIO)
+		return I/O;
 
-	case ACPICPU_C_STATE_SYSIO:		/* ACPI_ADR_SPACE_SYSTEM_IO */
+	if (val == ACPI_ADR_SPACE_SYSTEM_IO)
 		return I/O;
 
-	default:
-		return ???;
-	}
+	if (val == ACPI_ADR_SPACE_FIXED_HARDWARE)
+		return FFH;
+
+	return ???;
 }
 
 static const char *