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); }