Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Feb 2003 16:58:52 +1100
From:      Tim Robbins <tjr@FreeBSD.org>
To:        Patrick Stinson <ajole-1@gci.net>
Cc:        freebsd-current <freebsd-current@FreeBSD.org>
Subject:   Re: appending files on smbfs
Message-ID:  <20030203165852.A58080@dilbert.robbins.dropbear.id.au>
In-Reply-To: <DGEJJGCKEJIEOAABJNHMCEBICHAA.ajole-1@gci.net>; from ajole-1@gci.net on Thu, Jan 30, 2003 at 07:37:04PM -0000
References:  <DGEJJGCKEJIEOAABJNHMCEBICHAA.ajole-1@gci.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jan 30, 2003 at 07:37:04PM -0000, Patrick Stinson wrote:

> has anyone every had problems with appending existing files on volumes
> mounted by smbfs or shlight?
> 
> $ echo "sdsad" >> hey
> $ echo "sdsad" >> hey
> cannot create hey: Permission denied

Please try this patch and let me know whether it solves the problem.


Index: src/sys/fs/smbfs/smbfs_vnops.c
===================================================================
RCS file: /x/freebsd/src/sys/fs/smbfs/smbfs_vnops.c,v
retrieving revision 1.28
diff -u -r1.28 smbfs_vnops.c
--- src/sys/fs/smbfs/smbfs_vnops.c	29 Jan 2003 13:41:52 -0000	1.28
+++ src/sys/fs/smbfs/smbfs_vnops.c	3 Feb 2003 05:51:45 -0000
@@ -139,10 +139,9 @@
 	} */ *ap;
 {
 	struct vnode *vp = ap->a_vp;
-	struct ucred *cred = ap->a_cred;
-	u_int mode = ap->a_mode;
+	mode_t mode = ap->a_mode;
+	mode_t smbmode;
 	struct smbmount *smp = VTOSMBFS(vp);
-	int error = 0;
 
 	SMBVDEBUG("\n");
 	if ((mode & VWRITE) && (vp->v_mount->mnt_flag & MNT_RDONLY)) {
@@ -153,15 +152,10 @@
 			break;
 		}
 	}
-	if (cred->cr_uid == 0)
-		return 0;
-	if (cred->cr_uid != smp->sm_args.uid) {
-		mode >>= 3;
-		if (!groupmember(smp->sm_args.gid, cred))
-			mode >>= 3;
-	}
-	error = (((vp->v_type == VREG) ? smp->sm_args.file_mode : smp->sm_args.dir_mode) & mode) == mode ? 0 : EACCES;
-	return error;
+	smbmode = vp->v_type == VREG ? smp->sm_args.file_mode :
+	    smp->sm_args.dir_mode;
+	return (vaccess(vp->v_type, smbmode, smp->sm_args.uid,
+	    smp->sm_args.gid, ap->a_mode, ap->a_cred, NULL));
 }
 
 /* ARGSUSED */



Tim

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030203165852.A58080>