Create a bidirectional mapping of the DOS 'read only' attribute
to the 'w' flag. PR: kern/77958 Submitted by: ghozzy gmail com MFC after: 1 month
This commit is contained in:
parent
834340ae9a
commit
fb8e9ead37
@ -40,6 +40,7 @@
|
||||
#include <sys/mount.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/vnode.h>
|
||||
@ -421,6 +422,8 @@ smbfs_attr_cachelookup(struct vnode *vp, struct vattr *va)
|
||||
va->va_type = vp->v_type; /* vnode type (for create) */
|
||||
if (vp->v_type == VREG) {
|
||||
va->va_mode = smp->sm_file_mode; /* files access mode and type */
|
||||
if (np->n_dosattr & SMB_FA_RDONLY)
|
||||
va->va_mode &= ~(S_IWUSR|S_IWGRP|S_IWOTH);
|
||||
} else if (vp->v_type == VDIR) {
|
||||
va->va_mode = smp->sm_dir_mode; /* files access mode and type */
|
||||
} else
|
||||
|
@ -512,9 +512,10 @@ smbfs_smb_setpattr(struct smbnode *np, u_int16_t attr, struct timespec *mtime,
|
||||
mb_put_uint8(mbp, 0);
|
||||
smb_rq_bend(rqp);
|
||||
error = smb_rq_simple(rqp);
|
||||
SMBERROR("%d\n", error);
|
||||
if (error)
|
||||
if (error) {
|
||||
SMBERROR("smb_rq_simple(rqp) => error %d\n", error);
|
||||
break;
|
||||
}
|
||||
} while(0);
|
||||
smb_rq_done(rqp);
|
||||
return error;
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/limits.h>
|
||||
#include <sys/lockf.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_extern.h>
|
||||
@ -301,6 +302,7 @@ smbfs_setattr(ap)
|
||||
struct smb_vc *vcp = SSTOVC(ssp);
|
||||
u_quad_t tsize = 0;
|
||||
int isreadonly, doclose, error = 0;
|
||||
int old_n_dosattr;
|
||||
|
||||
SMBVDEBUG("\n");
|
||||
if (vap->va_flags != VNOVAL)
|
||||
@ -346,6 +348,18 @@ smbfs_setattr(ap)
|
||||
return error;
|
||||
}
|
||||
}
|
||||
if (vap->va_mode != (mode_t)VNOVAL) {
|
||||
old_n_dosattr = np->n_dosattr;
|
||||
if (vap->va_mode & S_IWUSR)
|
||||
np->n_dosattr &= ~SMB_FA_RDONLY;
|
||||
else
|
||||
np->n_dosattr |= SMB_FA_RDONLY;
|
||||
if (np->n_dosattr != old_n_dosattr) {
|
||||
error = smbfs_smb_setpattr(np, np->n_dosattr, NULL, &scred);
|
||||
if (error)
|
||||
return error;
|
||||
}
|
||||
}
|
||||
mtime = atime = NULL;
|
||||
if (vap->va_mtime.tv_sec != VNOVAL)
|
||||
mtime = &vap->va_mtime;
|
||||
|
Loading…
x
Reference in New Issue
Block a user