RE: appending files on smbfs

2003-02-11 Thread Patrick Stinson
hello, tim. the patch you sent me did fix the problem stated, but now I've
noticed some interesting characteristics of the files that are created by a
unix machine on a share mounted by mount_smbfs, which itself resides on a
windows 200 machine.

I haven't looked into the details, but I'm using kdevelop to create a blank
c++ project with no lsm/GNU files, on that share. the problems come up in
configure with conftest and its corresponsing files. the configure script
fails with permission problems in deleteing the file. that unix machine
thinks conftest is a file, and the windows machine thinks it's a directory.
the windows machine can delete the directory, the unix machine can't delete
the file. hmm. There are also several similar errors with conftest.cc, etc.
Also, the configure script complains about not being able to find
Makefile.in, which is actually there. This could have something to do with
the conftest thing.
Copying files works fine from both directions, and I haven't seen any other
problems but this one. it probably has something to do with the way the
files are created, don't know. The symptoms are slightly worse with windows
98 machines.

The box is still a relatively clean 5.0-release, with only the patch below
applied to the smbfs source.

hope that helps, thanks!

-P

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Tim Robbins
Sent: Monday, February 03, 2003 5:59 AM
To: Patrick Stinson
Cc: freebsd-current
Subject: Re: appending files on smbfs


On Thu, Jan 30, 2003 at 07:37:04PM -, 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 -  1.28
+++ src/sys/fs/smbfs/smbfs_vnops.c  3 Feb 2003 05:51:45 -
@@ -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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: appending files on smbfs

2003-02-02 Thread Tim Robbins
On Thu, Jan 30, 2003 at 07:37:04PM -, 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 -  1.28
+++ src/sys/fs/smbfs/smbfs_vnops.c  3 Feb 2003 05:51:45 -
@@ -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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: appending files on smbfs

2003-02-01 Thread Alex

Dear/Beste Patrick,

Thursday, January 30, 2003, 8:37:04 PM, you 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

You should look at permission on the windows machine if the system has
NTFS.

-- 
Best regards/Met vriendelijke groet,
Alex


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



RE: Re[2]: appending files on smbfs

2003-01-30 Thread Patrick Stinson
The files on the ntfs machine are owned and shared only by the user that
owns them. The same username is being used from the unix side via smbfs.
I've changed the privelages to everyone with full rights, and only that
username with full rights, and no go.

interesting. I don't see any point where there could be a security hang up.
Also, do you have any idea what, at an OS-security level, the difference is
between creating and appending files?

-Original Message-
From: Alex [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 10:43 PM
To: Patrick Stinson
Cc: Alex
Subject: Re[2]: appending files on smbfs



Dear/Beste Patrick,

Thursday, January 30, 2003, 11:16:09 PM, you 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

> You should look at permission on the windows machine if the system has
> NTFS.

*** From Patrick

> oh wait, thought you were swedish.

No, i'm Dutch.

> I meant that I looked at that. You have to log in to the filesystem
> with a name that works before it will let yo on. notice how I can
> create the file, but canat append to it.

NTFS hasn't got the same security system as UFS. Just because you can
logon to a filesystem doesn't mean you have any rights. Just because
you can write a file doesn't mean you can append. On NTFS one can
allow per person or per group to list, view, read, create or modify
(append) a file. And that for multiple users and multiple groups.

--
Best regards/Met vriendelijke groet,
Alex

P.S. Please don't top-post. It makes it hard to read, especially for
others.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



appending files on smbfs

2003-01-30 Thread Patrick Stinson
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


hmmm

thanks


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message