CVS commit: src/usr.sbin/puffs/mount_psshfs
Module Name:src Committed By: christos Date: Fri Oct 7 21:09:57 UTC 2016 Modified Files: src/usr.sbin/puffs/mount_psshfs: node.c Log Message: PR/514612: Mateusz Paszwa: When no more data, bail out (reading from empty files) instead of stuck looping. To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 src/usr.sbin/puffs/mount_psshfs/node.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/node.c diff -u src/usr.sbin/puffs/mount_psshfs/node.c:1.64 src/usr.sbin/puffs/mount_psshfs/node.c:1.65 --- src/usr.sbin/puffs/mount_psshfs/node.c:1.64 Fri Jan 20 17:07:58 2012 +++ src/usr.sbin/puffs/mount_psshfs/node.c Fri Oct 7 17:09:57 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: node.c,v 1.64 2012/01/20 22:07:58 jakllsch Exp $ */ +/* $NetBSD: node.c,v 1.65 2016/10/07 21:09:57 christos Exp $ */ /* * Copyright (c) 2006-2009 Antti Kantee. All Rights Reserved. @@ -27,7 +27,7 @@ #include #ifndef lint -__RCSID("$NetBSD: node.c,v 1.64 2012/01/20 22:07:58 jakllsch Exp $"); +__RCSID("$NetBSD: node.c,v 1.65 2016/10/07 21:09:57 christos Exp $"); #endif /* !lint */ #include @@ -563,7 +563,7 @@ again: TAILQ_REMOVE(>pw, pwp, pw_entries); } - if (rv == 0 && *resid > 0) { + if (rv == 0 && *resid > 0 && readlen > 0) { reqid = NEXTREQ(pctx); psbuf_recycleout(pb); goto again;
CVS commit: src/usr.sbin/puffs/mount_psshfs
Module Name:src Committed By: szptvlfn Date: Wed Jun 25 23:22:18 UTC 2014 Modified Files: src/usr.sbin/puffs/mount_psshfs: mount_psshfs.8 Log Message: s/stavfs/statvfs/ To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8 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/mount_psshfs.8 diff -u src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.26 src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.27 --- src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.26 Tue Dec 25 20:31:03 2012 +++ src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8 Wed Jun 25 23:22:18 2014 @@ -1,4 +1,4 @@ -.\ $NetBSD: mount_psshfs.8,v 1.26 2012/12/25 20:31:03 reed Exp $ +.\ $NetBSD: mount_psshfs.8,v 1.27 2014/06/25 23:22:18 szptvlfn Exp $ .\ .\ Copyright (c) 2007-2009 Antti Kantee. All rights reserved. .\ @@ -198,7 +198,7 @@ Do not expect the file system to behave .Pp Depending on if the server supports the .Xr sftp 1 -stavfs protocol extension, +statvfs protocol extension, free disk space may be displayed for the mount by .Xr df 1 . This information reflects the status at the server's mountpoint
CVS commit: src/usr.sbin/puffs/mount_psshfs
Module Name:src Committed By: reed Date: Tue Dec 25 20:31:04 UTC 2012 Modified Files: src/usr.sbin/puffs/mount_psshfs: mount_psshfs.8 Log Message: fix spelling typo To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8 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/mount_psshfs.8 diff -u src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.25 src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.26 --- src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.25 Thu Sep 15 11:52:09 2011 +++ src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8 Tue Dec 25 20:31:03 2012 @@ -1,4 +1,4 @@ -.\ $NetBSD: mount_psshfs.8,v 1.25 2011/09/15 11:52:09 wiz Exp $ +.\ $NetBSD: mount_psshfs.8,v 1.26 2012/12/25 20:31:03 reed Exp $ .\ .\ Copyright (c) 2007-2009 Antti Kantee. All rights reserved. .\ @@ -202,4 +202,4 @@ stavfs protocol extension, free disk space may be displayed for the mount by .Xr df 1 . This information reflects the status at the server's mountpoint -and may differ for subdiretories under the mount root. +and may differ for subdirectories under the mount root.
CVS commit: src/usr.sbin/puffs/mount_psshfs
Module Name:src Committed By: christos Date: Sun Nov 4 22:46:08 UTC 2012 Modified Files: src/usr.sbin/puffs/mount_psshfs: psbuf.c psshfs.c subr.c Log Message: include the headers you use To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/puffs/mount_psshfs/psbuf.c cvs rdiff -u -r1.65 -r1.66 src/usr.sbin/puffs/mount_psshfs/psshfs.c cvs rdiff -u -r1.50 -r1.51 src/usr.sbin/puffs/mount_psshfs/subr.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/psbuf.c diff -u src/usr.sbin/puffs/mount_psshfs/psbuf.c:1.18 src/usr.sbin/puffs/mount_psshfs/psbuf.c:1.19 --- src/usr.sbin/puffs/mount_psshfs/psbuf.c:1.18 Fri Jan 8 05:53:31 2010 +++ src/usr.sbin/puffs/mount_psshfs/psbuf.c Sun Nov 4 17:46:08 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: psbuf.c,v 1.18 2010/01/08 10:53:31 pooka Exp $*/ +/* $NetBSD: psbuf.c,v 1.19 2012/11/04 22:46:08 christos Exp $*/ /* * Copyright (c) 2006-2009 Antti Kantee. All Rights Reserved. @@ -27,7 +27,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: psbuf.c,v 1.18 2010/01/08 10:53:31 pooka Exp $); +__RCSID($NetBSD: psbuf.c,v 1.19 2012/11/04 22:46:08 christos Exp $); #endif /* !lint */ /* @@ -39,6 +39,7 @@ __RCSID($NetBSD: psbuf.c,v 1.18 2010/01 #include sys/types.h #include sys/time.h #include sys/vnode.h +#include sys/socket.h #include err.h #include errno.h Index: src/usr.sbin/puffs/mount_psshfs/psshfs.c diff -u src/usr.sbin/puffs/mount_psshfs/psshfs.c:1.65 src/usr.sbin/puffs/mount_psshfs/psshfs.c:1.66 --- src/usr.sbin/puffs/mount_psshfs/psshfs.c:1.65 Wed Aug 31 09:32:39 2011 +++ src/usr.sbin/puffs/mount_psshfs/psshfs.c Sun Nov 4 17:46:08 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: psshfs.c,v 1.65 2011/08/31 13:32:39 joerg Exp $ */ +/* $NetBSD: psshfs.c,v 1.66 2012/11/04 22:46:08 christos Exp $ */ /* * Copyright (c) 2006-2009 Antti Kantee. All Rights Reserved. @@ -41,12 +41,14 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: psshfs.c,v 1.65 2011/08/31 13:32:39 joerg Exp $); +__RCSID($NetBSD: psshfs.c,v 1.66 2012/11/04 22:46:08 christos Exp $); #endif /* !lint */ #include sys/types.h #include sys/wait.h +#include sys/socket.h +#include stdio.h #include assert.h #include err.h #include errno.h Index: src/usr.sbin/puffs/mount_psshfs/subr.c diff -u src/usr.sbin/puffs/mount_psshfs/subr.c:1.50 src/usr.sbin/puffs/mount_psshfs/subr.c:1.51 --- src/usr.sbin/puffs/mount_psshfs/subr.c:1.50 Wed Mar 31 22:34:09 2010 +++ src/usr.sbin/puffs/mount_psshfs/subr.c Sun Nov 4 17:46:08 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: subr.c,v 1.50 2010/04/01 02:34:09 pooka Exp $*/ +/* $NetBSD: subr.c,v 1.51 2012/11/04 22:46:08 christos Exp $*/ /* * Copyright (c) 2006 Antti Kantee. All Rights Reserved. @@ -27,9 +27,10 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: subr.c,v 1.50 2010/04/01 02:34:09 pooka Exp $); +__RCSID($NetBSD: subr.c,v 1.51 2012/11/04 22:46:08 christos Exp $); #endif /* !lint */ +#include stdio.h #include assert.h #include err.h #include errno.h
CVS commit: src/usr.sbin/puffs/mount_psshfs
Module Name:src Committed By: jakllsch Date: Fri Jan 20 22:07:58 UTC 2012 Modified Files: src/usr.sbin/puffs/mount_psshfs: node.c Log Message: Ensure psshfs_node_read() completely reads all data before return. Fixes file corruption in psshfs exposed with kernel MAXPHYS at 128KiB. To generate a diff of this commit: cvs rdiff -u -r1.63 -r1.64 src/usr.sbin/puffs/mount_psshfs/node.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/node.c diff -u src/usr.sbin/puffs/mount_psshfs/node.c:1.63 src/usr.sbin/puffs/mount_psshfs/node.c:1.64 --- src/usr.sbin/puffs/mount_psshfs/node.c:1.63 Fri Aug 12 04:14:00 2011 +++ src/usr.sbin/puffs/mount_psshfs/node.c Fri Jan 20 22:07:58 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: node.c,v 1.63 2011/08/12 04:14:00 riastradh Exp $ */ +/* $NetBSD: node.c,v 1.64 2012/01/20 22:07:58 jakllsch Exp $ */ /* * Copyright (c) 2006-2009 Antti Kantee. All Rights Reserved. @@ -27,7 +27,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: node.c,v 1.63 2011/08/12 04:14:00 riastradh Exp $); +__RCSID($NetBSD: node.c,v 1.64 2012/01/20 22:07:58 jakllsch Exp $); #endif /* !lint */ #include assert.h @@ -525,6 +525,7 @@ psshfs_node_read(struct puffs_usermount goto farout; } +again: readlen = *resid; psbuf_req_data(pb, SSH_FXP_READ, reqid, psn-fhand_r, psn-fhand_r_len); psbuf_put_8(pb, offset); @@ -546,8 +547,11 @@ psshfs_node_read(struct puffs_usermount GETRESPONSE(pb, pctx-sshfd_data); rv = psbuf_do_data(pb, buf, readlen); - if (rv == 0) + if (rv == 0) { *resid -= readlen; + buf += readlen; + offset += readlen; + } out: if (max_reads --psn-readcount = max_reads) { @@ -559,6 +563,12 @@ psshfs_node_read(struct puffs_usermount TAILQ_REMOVE(psn-pw, pwp, pw_entries); } + if (rv == 0 *resid 0) { + reqid = NEXTREQ(pctx); + psbuf_recycleout(pb); + goto again; + } + farout: /* check if we need a lazyclose */ if (psn-stat PSN_HANDLECLOSE psn-fhand_r) {
CVS commit: src/usr.sbin/puffs/mount_psshfs
Module Name:src Committed By: wiz Date: Thu Sep 15 11:52:09 UTC 2011 Modified Files: src/usr.sbin/puffs/mount_psshfs: mount_psshfs.8 Log Message: Wording, from Snader_LB. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8 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/mount_psshfs.8 diff -u src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.24 src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.25 --- src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.24 Wed Feb 3 17:16:29 2010 +++ src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8 Thu Sep 15 11:52:09 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: mount_psshfs.8,v 1.24 2010/02/03 17:16:29 pooka Exp $ +.\ $NetBSD: mount_psshfs.8,v 1.25 2011/09/15 11:52:09 wiz Exp $ .\ .\ Copyright (c) 2007-2009 Antti Kantee. All rights reserved. .\ @@ -129,7 +129,7 @@ This option is used to adjust the timeout period to .Ar timeout seconds. -A value 0 means the cache is never valid and \-1 means it is +A value of 0 means the cache is never valid; \-1 means it is valid indefinitely. It is possible to force a re-read regardless of timeout status by sending .Dv SIGHUP
CVS commit: src/usr.sbin/puffs/mount_psshfs
Module Name:src Committed By: jakllsch Date: Thu Aug 25 19:49:05 UTC 2011 Modified Files: src/usr.sbin/puffs/mount_psshfs: psshfs.c Log Message: Bring mount_psshfs user/host/path argument processing in line with sftp(1). To generate a diff of this commit: cvs rdiff -u -r1.63 -r1.64 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.63 src/usr.sbin/puffs/mount_psshfs/psshfs.c:1.64 --- src/usr.sbin/puffs/mount_psshfs/psshfs.c:1.63 Thu May 19 15:07:16 2011 +++ src/usr.sbin/puffs/mount_psshfs/psshfs.c Thu Aug 25 19:49:05 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: psshfs.c,v 1.63 2011/05/19 15:07:16 riastradh Exp $ */ +/* $NetBSD: psshfs.c,v 1.64 2011/08/25 19:49:05 jakllsch 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.63 2011/05/19 15:07:16 riastradh Exp $); +__RCSID($NetBSD: psshfs.c,v 1.64 2011/08/25 19:49:05 jakllsch Exp $); #endif /* !lint */ #include sys/types.h @@ -64,6 +64,8 @@ static int pssh_connect(struct puffs_usermount *, int); static void psshfs_loopfn(struct puffs_usermount *); static void usage(void); +static char * cleanhostname(char *); +static char * colon(char *); static void add_ssharg(char ***, int *, const char *); static void psshfs_notify(struct puffs_usermount *, int, int); @@ -72,6 +74,37 @@ unsigned int max_reads; static int sighup; +static char * +cleanhostname(char *host) +{ + if (*host == '[' host[strlen(host) - 1] == ']') { + host[strlen(host) - 1] = '\0'; + return (host + 1); + } else + return host; +} + +static char * +colon(char *cp) +{ + int flag = 0; + + if (*cp == '[') + flag = 1; + + for (; *cp; ++cp) { + if (*cp == '@' *(cp+1) == '[') + flag = 1; + if (*cp == ']' *(cp+1) == ':' flag) + return (cp+1); + if (*cp == ':' !flag) + return (cp); + if (*cp == '/') + return NULL; + } + return NULL; +} + static void add_ssharg(char ***sshargs, int *nargs, const char *arg) { @@ -113,8 +146,9 @@ struct vattr *rva; mntoptparse_t mp; char **sshargs; - char *userhost; - char *hostpath; + char *user; + char *host; + char *path; int mntflags, pflags, ch; int detach; int exportfs, refreshival, numconnections; @@ -243,15 +277,33 @@ pctx.refreshival = refreshival; pctx.numconnections = numconnections; - userhost = argv[0]; - hostpath = strchr(userhost, ':'); - if (hostpath) { - *hostpath++ = '\0'; - pctx.mountpath = hostpath; - } else + user = strdup(argv[0]); + if ((host = strrchr(user, '@')) == NULL) { + host = user; + } else { + *host++ = '\0'; /* break at the '@' */ + if (user[0] == '\0') { + fprintf(stderr, Missing username\n); + usage(); + } + add_ssharg(sshargs, nargs, -l); + add_ssharg(sshargs, nargs, user); + } + + if ((path = colon(host)) != NULL) { + *path++ = '\0'; /* break at the ':' */ + pctx.mountpath = path; + } else { pctx.mountpath = .; + } + + host = cleanhostname(host); + if (host[0] == '\0') { + fprintf(stderr, Missing hostname\n); + usage(); + } - add_ssharg(sshargs, nargs, argv[0]); + add_ssharg(sshargs, nargs, host); add_ssharg(sshargs, nargs, sftp); pctx.sshargs = sshargs;
CVS commit: src/usr.sbin/puffs/mount_psshfs
Module Name:src Committed By: riastradh Date: Thu May 19 15:07:16 UTC 2011 Modified Files: src/usr.sbin/puffs/mount_psshfs: psshfs.c Log Message: Initialize psshfs root node's readdir waiters queue. Every other node's readder waiters queue is initialized in makenode, but the root node is created specially. ok pooka To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 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.62 src/usr.sbin/puffs/mount_psshfs/psshfs.c:1.63 --- src/usr.sbin/puffs/mount_psshfs/psshfs.c:1.62 Fri Oct 29 16:13:51 2010 +++ src/usr.sbin/puffs/mount_psshfs/psshfs.c Thu May 19 15:07:16 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: psshfs.c,v 1.62 2010/10/29 16:13:51 pooka Exp $ */ +/* $NetBSD: psshfs.c,v 1.63 2011/05/19 15:07:16 riastradh 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.62 2010/10/29 16:13:51 pooka Exp $); +__RCSID($NetBSD: psshfs.c,v 1.63 2011/05/19 15:07:16 riastradh Exp $); #endif /* !lint */ #include sys/types.h @@ -257,6 +257,7 @@ pctx.nextino = 2; memset(root, 0, sizeof(struct psshfs_node)); + TAILQ_INIT(root-pw); pn_root = puffs_pn_new(pu, root); if (pn_root == NULL) return errno;
CVS commit: src/usr.sbin/puffs/mount_psshfs
Module Name:src Committed By: pooka Date: Fri Oct 29 16:13:51 UTC 2010 Modified Files: src/usr.sbin/puffs/mount_psshfs: fs.c node.c psshfs.c Log Message: Make error message more userfriendly in cases where server does not support sftp. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/puffs/mount_psshfs/fs.c cvs rdiff -u -r1.61 -r1.62 src/usr.sbin/puffs/mount_psshfs/node.c \ 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/fs.c diff -u src/usr.sbin/puffs/mount_psshfs/fs.c:1.22 src/usr.sbin/puffs/mount_psshfs/fs.c:1.23 --- src/usr.sbin/puffs/mount_psshfs/fs.c:1.22 Thu Apr 1 02:34:09 2010 +++ src/usr.sbin/puffs/mount_psshfs/fs.c Fri Oct 29 16:13:51 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: fs.c,v 1.22 2010/04/01 02:34:09 pooka Exp $ */ +/* $NetBSD: fs.c,v 1.23 2010/10/29 16:13:51 pooka Exp $ */ /* * Copyright (c) 2006-2009 Antti Kantee. All Rights Reserved. @@ -27,7 +27,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: fs.c,v 1.22 2010/04/01 02:34:09 pooka Exp $); +__RCSID($NetBSD: fs.c,v 1.23 2010/10/29 16:13:51 pooka Exp $); #endif /* !lint */ #include err.h @@ -47,8 +47,6 @@ *(a4) = 0; \ rv = fname(a1, a2, a3, a4); \ if (rv || a4 == 0) { \ - fprintf(stderr, psshfs_handshake failed %d (%s) %d\n, \ - rv, strerror(rv), *a4);\ return rv ? rv : EPROTO;\ }\ } while (/*CONSTCOND*/0) @@ -82,7 +80,7 @@ NULL, 0 }}; - + int psshfs_handshake(struct puffs_usermount *pu, int fd) { Index: src/usr.sbin/puffs/mount_psshfs/node.c diff -u src/usr.sbin/puffs/mount_psshfs/node.c:1.61 src/usr.sbin/puffs/mount_psshfs/node.c:1.62 --- src/usr.sbin/puffs/mount_psshfs/node.c:1.61 Thu Apr 1 02:34:09 2010 +++ src/usr.sbin/puffs/mount_psshfs/node.c Fri Oct 29 16:13:51 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: node.c,v 1.61 2010/04/01 02:34:09 pooka Exp $ */ +/* $NetBSD: node.c,v 1.62 2010/10/29 16:13:51 pooka Exp $ */ /* * Copyright (c) 2006-2009 Antti Kantee. All Rights Reserved. @@ -27,7 +27,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: node.c,v 1.61 2010/04/01 02:34:09 pooka Exp $); +__RCSID($NetBSD: node.c,v 1.62 2010/10/29 16:13:51 pooka Exp $); #endif /* !lint */ #include assert.h @@ -362,8 +362,9 @@ *ncookies = 0; rv = sftp_readdir(pu, pctx, pn); - if (rv) + if (rv) { goto out; + } /* find next dirent */ for (i = *readoff;;i++) { Index: src/usr.sbin/puffs/mount_psshfs/psshfs.c diff -u src/usr.sbin/puffs/mount_psshfs/psshfs.c:1.61 src/usr.sbin/puffs/mount_psshfs/psshfs.c:1.62 --- src/usr.sbin/puffs/mount_psshfs/psshfs.c:1.61 Wed Feb 17 15:54:10 2010 +++ src/usr.sbin/puffs/mount_psshfs/psshfs.c Fri Oct 29 16:13:51 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: psshfs.c,v 1.61 2010/02/17 15:54:10 pooka Exp $ */ +/* $NetBSD: psshfs.c,v 1.62 2010/10/29 16:13:51 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.61 2010/02/17 15:54:10 pooka Exp $); +__RCSID($NetBSD: psshfs.c,v 1.62 2010/10/29 16:13:51 pooka Exp $); #endif /* !lint */ #include sys/types.h @@ -415,7 +415,7 @@ } if (psshfs_handshake(pu, *sshfd) != 0) - errx(1, psshfs_handshake %d, which); + errx(1, handshake failed, server does not support sftp?); x = 1; if (ioctl(*sshfd, FIONBIO, x) == -1) err(1, nonblocking descriptor %d, which);
CVS commit: src/usr.sbin/puffs/mount_psshfs
Module Name:src Committed By: pooka Date: Thu Apr 1 02:34:09 UTC 2010 Modified Files: src/usr.sbin/puffs/mount_psshfs: fs.c node.c psshfs.h subr.c Log Message: In case we create a file, reclaim the vnode, and lookup the file without the directory timeout expiring, we get vattr_null as the attributes for that file. Ensure that we always report sane attributes by getting them from the server if this is the case. (also, sprinkle some const) Fixes problem reported by dyoung. But wait! The bug's medallion begins to glow! The bug looks much better! I crumble to dust. There's probably another similar bug related to lazy open. It will trigger if we reclaim a node before the response to the open arrives. Even the comments (typoless) know about this bug ... But verifying it exists and fixing it will have to wait for another day. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/puffs/mount_psshfs/fs.c cvs rdiff -u -r1.60 -r1.61 src/usr.sbin/puffs/mount_psshfs/node.c cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/puffs/mount_psshfs/psshfs.h cvs rdiff -u -r1.49 -r1.50 src/usr.sbin/puffs/mount_psshfs/subr.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/fs.c diff -u src/usr.sbin/puffs/mount_psshfs/fs.c:1.21 src/usr.sbin/puffs/mount_psshfs/fs.c:1.22 --- src/usr.sbin/puffs/mount_psshfs/fs.c:1.21 Wed Feb 3 17:02:52 2010 +++ src/usr.sbin/puffs/mount_psshfs/fs.c Thu Apr 1 02:34:09 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: fs.c,v 1.21 2010/02/03 17:02:52 pooka Exp $ */ +/* $NetBSD: fs.c,v 1.22 2010/04/01 02:34:09 pooka Exp $ */ /* * Copyright (c) 2006-2009 Antti Kantee. All Rights Reserved. @@ -27,7 +27,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: fs.c,v 1.21 2010/02/03 17:02:52 pooka Exp $); +__RCSID($NetBSD: fs.c,v 1.22 2010/04/01 02:34:09 pooka Exp $); #endif /* !lint */ #include err.h @@ -269,7 +269,7 @@ return EINVAL; /* update node attributes */ - rv = getnodeattr(pu, pn); + rv = getnodeattr(pu, pn, NULL); if (rv) return EINVAL; Index: src/usr.sbin/puffs/mount_psshfs/node.c diff -u src/usr.sbin/puffs/mount_psshfs/node.c:1.60 src/usr.sbin/puffs/mount_psshfs/node.c:1.61 --- src/usr.sbin/puffs/mount_psshfs/node.c:1.60 Thu Jan 7 21:05:50 2010 +++ src/usr.sbin/puffs/mount_psshfs/node.c Thu Apr 1 02:34:09 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: node.c,v 1.60 2010/01/07 21:05:50 pooka Exp $ */ +/* $NetBSD: node.c,v 1.61 2010/04/01 02:34:09 pooka Exp $ */ /* * Copyright (c) 2006-2009 Antti Kantee. All Rights Reserved. @@ -27,7 +27,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: node.c,v 1.60 2010/01/07 21:05:50 pooka Exp $); +__RCSID($NetBSD: node.c,v 1.61 2010/04/01 02:34:09 pooka Exp $); #endif /* !lint */ #include assert.h @@ -90,7 +90,17 @@ if (pd-entry) pn = pd-entry; else - pn = makenode(pu, pn_dir, pd, pd-va); + pd-entry = pn = makenode(pu, pn_dir, pd, pd-va); + + /* + * sure sure we have fresh attributes. most likely we will + * have them cached. we might not if we go through: + * create - reclaim - lookup (this). + */ + rv = getnodeattr(pu, pn, PCNPATH(pcn)); + if (rv) + return rv; + psn = pn-pn_data; } @@ -110,7 +120,7 @@ struct puffs_node *pn = opc; int rv; - rv = getnodeattr(pu, pn); + rv = getnodeattr(pu, pn, NULL); if (rv) return rv; Index: src/usr.sbin/puffs/mount_psshfs/psshfs.h diff -u src/usr.sbin/puffs/mount_psshfs/psshfs.h:1.39 src/usr.sbin/puffs/mount_psshfs/psshfs.h:1.40 --- src/usr.sbin/puffs/mount_psshfs/psshfs.h:1.39 Thu Jan 7 21:05:50 2010 +++ src/usr.sbin/puffs/mount_psshfs/psshfs.h Thu Apr 1 02:34:09 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: psshfs.h,v 1.39 2010/01/07 21:05:50 pooka Exp $ */ +/* $NetBSD: psshfs.h,v 1.40 2010/04/01 02:34:09 pooka Exp $ */ /* * Copyright (c) 2006-2009 Antti Kantee. All Rights Reserved. @@ -230,14 +230,14 @@ struct psshfs_dir *lookup(struct psshfs_dir *, size_t, const char *); struct puffs_node *makenode(struct puffs_usermount *, struct puffs_node *, - struct psshfs_dir *, const struct vattr *); + const struct psshfs_dir *, const struct vattr *); struct puffs_node *allocnode(struct puffs_usermount *, struct puffs_node *, const char *, const struct vattr *); struct psshfs_dir *direnter(struct puffs_node *, const char *); void nukenode(struct puffs_node *, const char *, int); void doreclaim(struct puffs_node *); int getpathattr(struct puffs_usermount *, const char *, struct vattr *); -int getnodeattr(struct puffs_usermount *, struct puffs_node *); +int getnodeattr(struct puffs_usermount *, struct puffs_node *, const char *); void closehandles(struct puffs_usermount *, struct psshfs_node *, int); void lazyopen_rresp(struct puffs_usermount *, struct puffs_framebuf *, Index: src/usr.sbin/puffs/mount_psshfs/subr.c diff -u
CVS commit: src/usr.sbin/puffs/mount_psshfs
Module Name:src Committed By: pooka Date: Wed Feb 17 15:47:36 UTC 2010 Modified Files: src/usr.sbin/puffs/mount_psshfs: subr.c Log Message: Save . attributes in readdir. This fixes the root link count after readdir is called for the root dir the first time (yes, there's still a window of wrong link count after the fs is mounted. it's currently quite difficult to call sftp_readdir() from outside the main loop). Should fix find /mnt problem for a mountpoint with more than the guessed amount of subdirectories, as reported by dyoung. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/usr.sbin/puffs/mount_psshfs/subr.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/subr.c diff -u src/usr.sbin/puffs/mount_psshfs/subr.c:1.48 src/usr.sbin/puffs/mount_psshfs/subr.c:1.49 --- src/usr.sbin/puffs/mount_psshfs/subr.c:1.48 Thu Jan 7 21:05:50 2010 +++ src/usr.sbin/puffs/mount_psshfs/subr.c Wed Feb 17 15:47:36 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: subr.c,v 1.48 2010/01/07 21:05:50 pooka Exp $*/ +/* $NetBSD: subr.c,v 1.49 2010/02/17 15:47:36 pooka Exp $*/ /* * Copyright (c) 2006 Antti Kantee. All Rights Reserved. @@ -27,7 +27,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: subr.c,v 1.48 2010/01/07 21:05:50 pooka Exp $); +__RCSID($NetBSD: subr.c,v 1.49 2010/02/17 15:47:36 pooka Exp $); #endif /* !lint */ #include assert.h @@ -344,6 +344,14 @@ } free(longname); longname = NULL; + + /* + * In case of DOT, copy the attributes (mostly + * because we want the link count for the root dir). + */ + if (strcmp(psn-dir[idx].entryname, .) == 0) { +setpnva(pu, pn, psn-dir[idx].va); + } /* * Check if we already have a psshfs_dir for the
CVS commit: src/usr.sbin/puffs/mount_psshfs
Module Name:src Committed By: pooka Date: Wed Feb 17 15:50:54 UTC 2010 Modified Files: src/usr.sbin/puffs/mount_psshfs: psshfs.c Log Message: Bump the initial rootdir link count guess to a ludicrous value. To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 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.59 src/usr.sbin/puffs/mount_psshfs/psshfs.c:1.60 --- src/usr.sbin/puffs/mount_psshfs/psshfs.c:1.59 Tue Jan 12 18:43:37 2010 +++ src/usr.sbin/puffs/mount_psshfs/psshfs.c Wed Feb 17 15:50:54 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: psshfs.c,v 1.59 2010/01/12 18:43:37 pooka Exp $ */ +/* $NetBSD: psshfs.c,v 1.60 2010/02/17 15:50:54 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.59 2010/01/12 18:43:37 pooka Exp $); +__RCSID($NetBSD: psshfs.c,v 1.60 2010/02/17 15:50:54 pooka Exp $); #endif /* !lint */ #include sys/types.h @@ -287,7 +287,15 @@ rva = pn_root-pn_va; rva-va_fileid = pctx.nextino++; - rva-va_nlink = 101; /* XXX */ + + /* + * For root link count, just guess something ridiculously high. + * Guessing too high has no known adverse effects, but fsu() + * doesn't like too low values. This guess will be replaced + * with the real value when readdir is first called for + * the root directory. + */ + rva-va_nlink = 8811; if (detach) if (puffs_daemon(pu, 1, 1) == -1)
CVS commit: src/usr.sbin/puffs/mount_psshfs
Module Name:src Committed By: pooka Date: Wed Feb 17 15:54:10 UTC 2010 Modified Files: src/usr.sbin/puffs/mount_psshfs: psshfs.c Log Message: umgah. meant fts, not fsu To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 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.60 src/usr.sbin/puffs/mount_psshfs/psshfs.c:1.61 --- src/usr.sbin/puffs/mount_psshfs/psshfs.c:1.60 Wed Feb 17 15:50:54 2010 +++ src/usr.sbin/puffs/mount_psshfs/psshfs.c Wed Feb 17 15:54:10 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: psshfs.c,v 1.60 2010/02/17 15:50:54 pooka Exp $ */ +/* $NetBSD: psshfs.c,v 1.61 2010/02/17 15:54: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.60 2010/02/17 15:50:54 pooka Exp $); +__RCSID($NetBSD: psshfs.c,v 1.61 2010/02/17 15:54:10 pooka Exp $); #endif /* !lint */ #include sys/types.h @@ -290,7 +290,7 @@ /* * For root link count, just guess something ridiculously high. - * Guessing too high has no known adverse effects, but fsu() + * Guessing too high has no known adverse effects, but fts(3) * doesn't like too low values. This guess will be replaced * with the real value when readdir is first called for * the root directory.
CVS commit: src/usr.sbin/puffs/mount_psshfs
Module Name:src Committed By: pooka Date: Wed Feb 3 17:02:52 UTC 2010 Modified Files: src/usr.sbin/puffs/mount_psshfs: fs.c Log Message: statvfs: Since bresvd is not available from the server, calculate: bresvd = bfree - bavail. Then df calculates: bavail = bfree - bresvd; And we now get a much more accurate report from df on how much one can write to the fs. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/puffs/mount_psshfs/fs.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/fs.c diff -u src/usr.sbin/puffs/mount_psshfs/fs.c:1.20 src/usr.sbin/puffs/mount_psshfs/fs.c:1.21 --- src/usr.sbin/puffs/mount_psshfs/fs.c:1.20 Wed May 20 14:08:21 2009 +++ src/usr.sbin/puffs/mount_psshfs/fs.c Wed Feb 3 17:02:52 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: fs.c,v 1.20 2009/05/20 14:08:21 pooka Exp $ */ +/* $NetBSD: fs.c,v 1.21 2010/02/03 17:02:52 pooka Exp $ */ /* * Copyright (c) 2006-2009 Antti Kantee. All Rights Reserved. @@ -27,7 +27,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: fs.c,v 1.20 2009/05/20 14:08:21 pooka Exp $); +__RCSID($NetBSD: fs.c,v 1.21 2010/02/03 17:02:52 pooka Exp $); #endif /* !lint */ #include err.h @@ -211,6 +211,9 @@ psbuf_get_8(pb, tmpval); sbp-f_namemax = tmpval; + sbp-f_bresvd = sbp-f_bfree - sbp-f_bavail; + sbp-f_fresvd = sbp-f_ffree - sbp-f_favail; + out: PSSHFSRETURN(rv); }
CVS commit: src/usr.sbin/puffs/mount_psshfs
Module Name:src Committed By: pooka Date: Wed Feb 3 17:16:29 UTC 2010 Modified Files: src/usr.sbin/puffs/mount_psshfs: mount_psshfs.8 Log Message: Give credit: psshfs was inspired by FUSE sshfs. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8 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/mount_psshfs.8 diff -u src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.23 src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.24 --- src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.23 Thu Jan 7 23:35:45 2010 +++ src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8 Wed Feb 3 17:16:29 2010 @@ -1,4 +1,4 @@ -.\ $NetBSD: mount_psshfs.8,v 1.23 2010/01/07 23:35:45 wiz Exp $ +.\ $NetBSD: mount_psshfs.8,v 1.24 2010/02/03 17:16:29 pooka Exp $ .\ .\ Copyright (c) 2007-2009 Antti Kantee. All rights reserved. .\ @@ -191,6 +191,7 @@ .Nm utility first appeared in .Nx 5.0 . +It was inspired by FUSE sshfs. .Sh CAVEATS Permissions are not handled. Do not expect the file system to behave except for a single user.
CVS commit: src/usr.sbin/puffs/mount_psshfs
Module Name:src Committed By: pooka Date: Thu Jan 7 21:05:50 UTC 2010 Modified Files: src/usr.sbin/puffs/mount_psshfs: mount_psshfs.8 node.c psbuf.c psshfs.c psshfs.h subr.c Log Message: Add -u and -g, which allow to remap one (local,remote) uidgid, i.e. umapfs without the fuss. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8 cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/puffs/mount_psshfs/node.c cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/puffs/mount_psshfs/psbuf.c cvs rdiff -u -r1.55 -r1.56 src/usr.sbin/puffs/mount_psshfs/psshfs.c cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/puffs/mount_psshfs/psshfs.h cvs rdiff -u -r1.47 -r1.48 src/usr.sbin/puffs/mount_psshfs/subr.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/mount_psshfs.8 diff -u src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.21 src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.22 --- src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.21 Wed May 20 14:08:21 2009 +++ src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8 Thu Jan 7 21:05:50 2010 @@ -1,4 +1,4 @@ -.\ $NetBSD: mount_psshfs.8,v 1.21 2009/05/20 14:08:21 pooka Exp $ +.\ $NetBSD: mount_psshfs.8,v 1.22 2010/01/07 21:05:50 pooka Exp $ .\ .\ Copyright (c) 2007-2009 Antti Kantee. All rights reserved. .\ @@ -23,7 +23,7 @@ .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\ SUCH DAMAGE. .\ -.Dd May 20, 2009 +.Dd Jan 7, 2010 .Dt MOUNT_PSSHFS 8 .Os .Sh NAME @@ -88,6 +88,12 @@ .Pa configfile instead of .Pa ~/.ssh/config . +.It Fl g Ar manglegid +Converts remote +.Ar manglegid +to the effective gid of the file server and vice versa. +See +.Fl u . .It Fl o Ar [no]option This flag can be used to give standard mount options and options to puffs. @@ -135,6 +141,23 @@ kernel and will lose all cached information in doing so. How frequently this happens depends on system activity and the total number of available vnodes in the system (kern.maxvnodes). +.It Fl u Ar mangleuid +Converts remote +.Ar mangleuid +to the effective uid of the file server and vice versa. +This is a simple special case of the functionality of +.Xr mount_umap 8 . +For example: you mount remote m...@darkmoon as the local user me. +If the uid of me on the local system is 101 and on +darkmoon it is 202, you would use +.Fl u +.Ar 202 +to see files owned by 202 on darkmoon as owned by 101 when browsing the +mount point. +Apart from the cosmetic effect, this makes things like +chown me file work. +See +.Fl g . .El .Sh EXAMPLES The following example illustrates how to mount the directory Index: src/usr.sbin/puffs/mount_psshfs/node.c diff -u src/usr.sbin/puffs/mount_psshfs/node.c:1.59 src/usr.sbin/puffs/mount_psshfs/node.c:1.60 --- src/usr.sbin/puffs/mount_psshfs/node.c:1.59 Thu Nov 5 13:28:18 2009 +++ src/usr.sbin/puffs/mount_psshfs/node.c Thu Jan 7 21:05:50 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: node.c,v 1.59 2009/11/05 13:28:18 pooka Exp $ */ +/* $NetBSD: node.c,v 1.60 2010/01/07 21:05:50 pooka Exp $ */ /* * Copyright (c) 2006-2009 Antti Kantee. All Rights Reserved. @@ -27,7 +27,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: node.c,v 1.59 2009/11/05 13:28:18 pooka Exp $); +__RCSID($NetBSD: node.c,v 1.60 2010/01/07 21:05:50 pooka Exp $); #endif /* !lint */ #include assert.h @@ -147,7 +147,7 @@ kludgeva.va_atime.tv_sec = va-va_mtime.tv_sec; } - psbuf_put_vattr(pb, kludgeva); + psbuf_put_vattr(pb, kludgeva, pctx); GETRESPONSE(pb, pctx-sshfd); rv = psbuf_expect_status(pb); @@ -172,7 +172,7 @@ /* Create node on server first */ psbuf_req_str(pb, SSH_FXP_OPEN, reqid, PCNPATH(pcn)); psbuf_put_4(pb, SSH_FXF_WRITE | SSH_FXF_CREAT | SSH_FXF_TRUNC); - psbuf_put_vattr(pb, va); + psbuf_put_vattr(pb, va, pctx); GETRESPONSE(pb, pctx-sshfd); rv = psbuf_expect_handle(pb, fhand, fhandlen); if (rv) @@ -246,7 +246,7 @@ reqid = NEXTREQ(pctx); psbuf_req_str(pb, SSH_FXP_OPEN, reqid, PNPATH(pn)); psbuf_put_4(pb, SSH_FXF_READ); - psbuf_put_vattr(pb, va); + psbuf_put_vattr(pb, va, pctx); if (puffs_framev_enqueue_cb(pu, pctx-sshfd_data, pb, lazyopen_rresp, psn, 0) == -1) { @@ -264,7 +264,7 @@ reqid = NEXTREQ(pctx); psbuf_req_str(pb2, SSH_FXP_OPEN, reqid, PNPATH(pn)); psbuf_put_4(pb2, SSH_FXF_WRITE); - psbuf_put_vattr(pb2, va); + psbuf_put_vattr(pb2, va, pctx); if (puffs_framev_enqueue_cb(pu, pctx-sshfd_data, pb2, lazyopen_wresp, psn, 0) == -1) { @@ -715,7 +715,7 @@ struct puffs_node *pn_new; psbuf_req_str(pb, SSH_FXP_MKDIR, reqid, PCNPATH(pcn)); - psbuf_put_vattr(pb, va); + psbuf_put_vattr(pb, va, pctx); GETRESPONSE(pb, pctx-sshfd); rv = psbuf_expect_status(pb); Index: src/usr.sbin/puffs/mount_psshfs/psbuf.c diff -u src/usr.sbin/puffs/mount_psshfs/psbuf.c:1.15 src/usr.sbin/puffs/mount_psshfs/psbuf.c:1.16 ---
CVS commit: src/usr.sbin/puffs/mount_psshfs
Module Name:src Committed By: pooka Date: Thu Jan 7 21:19:45 UTC 2010 Modified Files: src/usr.sbin/puffs/mount_psshfs: psbuf.c Log Message: Fix chgrp (and don't rely on VNOVAL being -1, however unlikely that is to be broken). To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/puffs/mount_psshfs/psbuf.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/psbuf.c diff -u src/usr.sbin/puffs/mount_psshfs/psbuf.c:1.16 src/usr.sbin/puffs/mount_psshfs/psbuf.c:1.17 --- src/usr.sbin/puffs/mount_psshfs/psbuf.c:1.16 Thu Jan 7 21:05:50 2010 +++ src/usr.sbin/puffs/mount_psshfs/psbuf.c Thu Jan 7 21:19:45 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: psbuf.c,v 1.16 2010/01/07 21:05:50 pooka Exp $*/ +/* $NetBSD: psbuf.c,v 1.17 2010/01/07 21:19:45 pooka Exp $*/ /* * Copyright (c) 2006-2009 Antti Kantee. All Rights Reserved. @@ -27,7 +27,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: psbuf.c,v 1.16 2010/01/07 21:05:50 pooka Exp $); +__RCSID($NetBSD: psbuf.c,v 1.17 2010/01/07 21:19:45 pooka Exp $); #endif /* !lint */ /* @@ -260,12 +260,23 @@ const struct psshfs_ctx *pctx) { uint32_t flags; + int32_t theuid = -1, thegid = -1; flags = 0; if (va-va_size != (uint64_t)PUFFS_VNOVAL) flags |= SSH_FILEXFER_ATTR_SIZE; - if (va-va_uid != (uid_t)PUFFS_VNOVAL) + if (va-va_uid != (uid_t)PUFFS_VNOVAL) { + theuid = va-va_uid; + if (pctx-domangleuid theuid == pctx-myuid) + theuid = pctx-mangleuid; flags |= SSH_FILEXFER_ATTR_UIDGID; + } + if (va-va_gid != (gid_t)PUFFS_VNOVAL) { + thegid = va-va_gid; + if (pctx-domanglegid thegid == pctx-mygid) + thegid = pctx-manglegid; + flags |= SSH_FILEXFER_ATTR_UIDGID; + } if (va-va_mode != (mode_t)PUFFS_VNOVAL) flags |= SSH_FILEXFER_ATTR_PERMISSIONS; @@ -276,16 +287,6 @@ if (flags SSH_FILEXFER_ATTR_SIZE) psbuf_put_8(pb, va-va_size); if (flags SSH_FILEXFER_ATTR_UIDGID) { - uid_t theuid; - gid_t thegid; - - theuid = va-va_uid; - if (pctx-domangleuid theuid == pctx-myuid) - theuid = pctx-mangleuid; - thegid = va-va_gid; - if (pctx-domanglegid thegid == pctx-mygid) - thegid = pctx-manglegid; - psbuf_put_4(pb, theuid); psbuf_put_4(pb, thegid); }
CVS commit: src/usr.sbin/puffs/mount_psshfs
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:
CVS commit: src/usr.sbin/puffs/mount_psshfs
Module Name:src Committed By: pooka Date: Thu Jan 7 21:26:49 UTC 2010 Modified Files: src/usr.sbin/puffs/mount_psshfs: psshfs.c Log Message: errx() already contains progname ... To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 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.57 src/usr.sbin/puffs/mount_psshfs/psshfs.c:1.58 --- src/usr.sbin/puffs/mount_psshfs/psshfs.c:1.57 Thu Jan 7 21:23:10 2010 +++ src/usr.sbin/puffs/mount_psshfs/psshfs.c Thu Jan 7 21:26:49 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: psshfs.c,v 1.57 2010/01/07 21:23:10 pooka Exp $ */ +/* $NetBSD: psshfs.c,v 1.58 2010/01/07 21:26:49 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.57 2010/01/07 21:23:10 pooka Exp $); +__RCSID($NetBSD: psshfs.c,v 1.58 2010/01/07 21:26:49 pooka Exp $); #endif /* !lint */ #include sys/types.h @@ -158,8 +158,7 @@ pctx.domanglegid = 1; pctx.manglegid = atoi(optarg); if (pctx.manglegid == (gid_t)-1) -errx(1, %s: -1 not allowed for -g, -getprogname()); +errx(1, -1 not allowed for -g); pctx.mygid = getegid(); break; case 'O': @@ -190,8 +189,7 @@ pctx.domangleuid = 1; pctx.mangleuid = atoi(optarg); if (pctx.mangleuid == (uid_t)-1) -errx(1, %s: -1 not allowed for -u, -getprogname()); +errx(1, -1 not allowed for -u); pctx.myuid = geteuid(); break; default:
CVS commit: src/usr.sbin/puffs/mount_psshfs
Module Name:src Committed By: wiz Date: Thu Jan 7 23:35:45 UTC 2010 Modified Files: src/usr.sbin/puffs/mount_psshfs: mount_psshfs.8 Log Message: Don't be terse. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8 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/mount_psshfs.8 diff -u src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.22 src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.23 --- src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.22 Thu Jan 7 21:05:50 2010 +++ src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8 Thu Jan 7 23:35:45 2010 @@ -1,4 +1,4 @@ -.\ $NetBSD: mount_psshfs.8,v 1.22 2010/01/07 21:05:50 pooka Exp $ +.\ $NetBSD: mount_psshfs.8,v 1.23 2010/01/07 23:35:45 wiz Exp $ .\ .\ Copyright (c) 2007-2009 Antti Kantee. All rights reserved. .\ @@ -23,7 +23,7 @@ .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\ SUCH DAMAGE. .\ -.Dd Jan 7, 2010 +.Dd January 7, 2010 .Dt MOUNT_PSSHFS 8 .Os .Sh NAME
CVS commit: src/usr.sbin/puffs/mount_psshfs
Module Name:src Committed By: pooka Date: Wed May 20 14:08:21 UTC 2009 Modified Files: src/usr.sbin/puffs/mount_psshfs: fs.c mount_psshfs.8 node.c psbuf.c psshfs.c psshfs.h Log Message: Copyright year management. no functional change (unless sarah disagrees) To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/puffs/mount_psshfs/fs.c cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8 cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/puffs/mount_psshfs/node.c cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/puffs/mount_psshfs/psbuf.c cvs rdiff -u -r1.51 -r1.52 src/usr.sbin/puffs/mount_psshfs/psshfs.c cvs rdiff -u -r1.36 -r1.37 src/usr.sbin/puffs/mount_psshfs/psshfs.h 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/fs.c diff -u src/usr.sbin/puffs/mount_psshfs/fs.c:1.19 src/usr.sbin/puffs/mount_psshfs/fs.c:1.20 --- src/usr.sbin/puffs/mount_psshfs/fs.c:1.19 Wed May 20 13:56:36 2009 +++ src/usr.sbin/puffs/mount_psshfs/fs.c Wed May 20 14:08:21 2009 @@ -1,7 +1,7 @@ -/* $NetBSD: fs.c,v 1.19 2009/05/20 13:56:36 pooka Exp $ */ +/* $NetBSD: fs.c,v 1.20 2009/05/20 14:08:21 pooka Exp $ */ /* - * Copyright (c) 2006 Antti Kantee. All Rights Reserved. + * Copyright (c) 2006-2009 Antti Kantee. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,7 +27,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: fs.c,v 1.19 2009/05/20 13:56:36 pooka Exp $); +__RCSID($NetBSD: fs.c,v 1.20 2009/05/20 14:08:21 pooka Exp $); #endif /* !lint */ #include err.h Index: src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8 diff -u src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.20 src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.21 --- src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.20 Wed May 20 13:56:36 2009 +++ src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8 Wed May 20 14:08:21 2009 @@ -1,6 +1,6 @@ -.\ $NetBSD: mount_psshfs.8,v 1.20 2009/05/20 13:56:36 pooka Exp $ +.\ $NetBSD: mount_psshfs.8,v 1.21 2009/05/20 14:08:21 pooka Exp $ .\ -.\ Copyright (c) 2007 Antti Kantee. All rights reserved. +.\ Copyright (c) 2007-2009 Antti Kantee. All rights reserved. .\ .\ Redistribution and use in source and binary forms, with or without .\ modification, are permitted provided that the following conditions Index: src/usr.sbin/puffs/mount_psshfs/node.c diff -u src/usr.sbin/puffs/mount_psshfs/node.c:1.57 src/usr.sbin/puffs/mount_psshfs/node.c:1.58 --- src/usr.sbin/puffs/mount_psshfs/node.c:1.57 Wed May 20 13:56:36 2009 +++ src/usr.sbin/puffs/mount_psshfs/node.c Wed May 20 14:08:21 2009 @@ -1,7 +1,7 @@ -/* $NetBSD: node.c,v 1.57 2009/05/20 13:56:36 pooka Exp $ */ +/* $NetBSD: node.c,v 1.58 2009/05/20 14:08:21 pooka Exp $ */ /* - * Copyright (c) 2006 Antti Kantee. All Rights Reserved. + * Copyright (c) 2006-2009 Antti Kantee. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,7 +27,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: node.c,v 1.57 2009/05/20 13:56:36 pooka Exp $); +__RCSID($NetBSD: node.c,v 1.58 2009/05/20 14:08:21 pooka Exp $); #endif /* !lint */ #include assert.h Index: src/usr.sbin/puffs/mount_psshfs/psbuf.c diff -u src/usr.sbin/puffs/mount_psshfs/psbuf.c:1.13 src/usr.sbin/puffs/mount_psshfs/psbuf.c:1.14 --- src/usr.sbin/puffs/mount_psshfs/psbuf.c:1.13 Sat Sep 6 12:29:57 2008 +++ src/usr.sbin/puffs/mount_psshfs/psbuf.c Wed May 20 14:08:21 2009 @@ -1,7 +1,7 @@ -/* $NetBSD: psbuf.c,v 1.13 2008/09/06 12:29:57 pooka Exp $*/ +/* $NetBSD: psbuf.c,v 1.14 2009/05/20 14:08:21 pooka Exp $*/ /* - * Copyright (c) 2006, 2007 Antti Kantee. All Rights Reserved. + * Copyright (c) 2006-2009 Antti Kantee. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,7 +27,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: psbuf.c,v 1.13 2008/09/06 12:29:57 pooka Exp $); +__RCSID($NetBSD: psbuf.c,v 1.14 2009/05/20 14:08:21 pooka Exp $); #endif /* !lint */ /* Index: src/usr.sbin/puffs/mount_psshfs/psshfs.c diff -u src/usr.sbin/puffs/mount_psshfs/psshfs.c:1.51 src/usr.sbin/puffs/mount_psshfs/psshfs.c:1.52 --- src/usr.sbin/puffs/mount_psshfs/psshfs.c:1.51 Wed May 20 13:56:36 2009 +++ src/usr.sbin/puffs/mount_psshfs/psshfs.c Wed May 20 14:08:21 2009 @@ -1,7 +1,7 @@ -/* $NetBSD: psshfs.c,v 1.51 2009/05/20 13:56:36 pooka Exp $ */ +/* $NetBSD: psshfs.c,v 1.52 2009/05/20 14:08:21 pooka Exp $ */ /* - * Copyright (c) 2006 Antti Kantee. All Rights Reserved. + * Copyright (c) 2006-2009 Antti Kantee. All Rights Reserved. * *
CVS commit: src/usr.sbin/puffs/mount_psshfs
Module Name:src Committed By: pooka Date: Wed May 20 15:04:37 UTC 2009 Modified Files: src/usr.sbin/puffs/mount_psshfs: psshfs.c Log Message: wait() for dead ssh processes (but don't block, so we might have one teeny zmobie in the system). To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 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.53 src/usr.sbin/puffs/mount_psshfs/psshfs.c:1.54 --- src/usr.sbin/puffs/mount_psshfs/psshfs.c:1.53 Wed May 20 14:39:42 2009 +++ src/usr.sbin/puffs/mount_psshfs/psshfs.c Wed May 20 15:04:36 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: psshfs.c,v 1.53 2009/05/20 14:39:42 pooka Exp $ */ +/* $NetBSD: psshfs.c,v 1.54 2009/05/20 15:04:36 pooka Exp $ */ /* * Copyright (c) 2006-2009 Antti Kantee. All Rights Reserved. @@ -41,10 +41,11 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: psshfs.c,v 1.53 2009/05/20 14:39:42 pooka Exp $); +__RCSID($NetBSD: psshfs.c,v 1.54 2009/05/20 15:04:36 pooka Exp $); #endif /* !lint */ #include sys/types.h +#include sys/wait.h #include assert.h #include err.h @@ -294,7 +295,7 @@ psshfs_notify(struct puffs_usermount *pu, int fd, int what) { struct psshfs_ctx *pctx = puffs_getspecific(pu); - int x, nretry, which, newfd; + int nretry, which, newfd, dummy; if (fd == pctx-sshfd) { which = PSSHFD_META; @@ -312,6 +313,10 @@ } close(fd); + /* deal with zmobies, beware of half-eaten brain */ + while (waitpid(-1, dummy, WNOHANG) 0) + continue; + for (nretry = 0;;nretry++) { if ((newfd = pssh_connect(pu, which)) == -1) goto retry2;
CVS commit: src/usr.sbin/puffs/mount_psshfs
Module Name:src Committed By: pooka Date: Sun Mar 29 16:06:54 UTC 2009 Modified Files: src/usr.sbin/puffs/mount_psshfs: node.c Log Message: Save errno before descending to cleanup gehennom. To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/usr.sbin/puffs/mount_psshfs/node.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/node.c diff -u src/usr.sbin/puffs/mount_psshfs/node.c:1.55 src/usr.sbin/puffs/mount_psshfs/node.c:1.56 --- src/usr.sbin/puffs/mount_psshfs/node.c:1.55 Thu Jan 1 13:41:45 2009 +++ src/usr.sbin/puffs/mount_psshfs/node.c Sun Mar 29 16:06:53 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: node.c,v 1.55 2009/01/01 13:41:45 pooka Exp $ */ +/* $NetBSD: node.c,v 1.56 2009/03/29 16:06:53 pooka Exp $ */ /* * Copyright (c) 2006 Antti Kantee. All Rights Reserved. @@ -27,7 +27,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: node.c,v 1.55 2009/01/01 13:41:45 pooka Exp $); +__RCSID($NetBSD: node.c,v 1.56 2009/03/29 16:06:53 pooka Exp $); #endif /* !lint */ #include assert.h @@ -250,8 +250,8 @@ if (puffs_framev_enqueue_cb(pu, pctx-sshfd, pb, lazyopen_rresp, psn, 0) == -1) { - puffs_framebuf_destroy(pb); rv = errno; + puffs_framebuf_destroy(pb); goto out; } @@ -268,8 +268,8 @@ if (puffs_framev_enqueue_cb(pu, pctx-sshfd, pb2, lazyopen_wresp, psn, 0) == -1) { - puffs_framebuf_destroy(pb2); rv = errno; + puffs_framebuf_destroy(pb2); goto out; }