Module Name:    src
Committed By:   pooka
Date:           Thu Jan  7 21:23:10 UTC 2010

Modified Files:
        src/usr.sbin/puffs/mount_psshfs: psshfs.c

Log Message:
Don't allow mangling of uid or gid -1, since they have a special
meaning in the sftp protocol.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/usr.sbin/puffs/mount_psshfs/psshfs.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/puffs/mount_psshfs/psshfs.c
diff -u src/usr.sbin/puffs/mount_psshfs/psshfs.c:1.56 src/usr.sbin/puffs/mount_psshfs/psshfs.c:1.57
--- src/usr.sbin/puffs/mount_psshfs/psshfs.c:1.56	Thu Jan  7 21:05:50 2010
+++ src/usr.sbin/puffs/mount_psshfs/psshfs.c	Thu Jan  7 21:23:10 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: psshfs.c,v 1.56 2010/01/07 21:05:50 pooka Exp $	*/
+/*	$NetBSD: psshfs.c,v 1.57 2010/01/07 21:23:10 pooka Exp $	*/
 
 /*
  * Copyright (c) 2006-2009  Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: psshfs.c,v 1.56 2010/01/07 21:05:50 pooka Exp $");
+__RCSID("$NetBSD: psshfs.c,v 1.57 2010/01/07 21:23:10 pooka Exp $");
 #endif /* !lint */
 
 #include <sys/types.h>
@@ -157,6 +157,9 @@
 		case 'g':
 			pctx.domanglegid = 1;
 			pctx.manglegid = atoi(optarg);
+			if (pctx.manglegid == (gid_t)-1)
+				errx(1, "%s: -1 not allowed for -g",
+				    getprogname());
 			pctx.mygid = getegid();
 			break;
 		case 'O':
@@ -186,6 +189,9 @@
 		case 'u':
 			pctx.domangleuid = 1;
 			pctx.mangleuid = atoi(optarg);
+			if (pctx.mangleuid == (uid_t)-1)
+				errx(1, "%s: -1 not allowed for -u",
+				    getprogname());
 			pctx.myuid = geteuid();
 			break;
 		default:

Reply via email to