Commit 39228ed9 authored by Petr Vandrovec's avatar Petr Vandrovec

Allow access to all 256 volumes from Netware server.

parent e70cad34
......@@ -307,6 +307,7 @@ __ncp_lookup_validate(struct dentry * dentry, int flags)
if (!res)
res = ncp_obtain_info(server, dir, __name, &(finfo.i));
}
finfo.volume = finfo.i.volNumber;
DDPRINTK("ncp_lookup_validate: looked for %s/%s, res=%d\n",
dentry->d_parent->d_name.name, __name, res);
/*
......@@ -670,6 +671,7 @@ ncp_read_volume_list(struct file *filp, void *dirent, filldir_t filldir,
info.volume_name);
continue;
}
entry.volume = entry.i.volNumber;
if (!ncp_fill_cache(filp, dirent, filldir, ctl, &entry))
return;
}
......@@ -704,6 +706,7 @@ ncp_do_readdir(struct file *filp, void *dirent, filldir_t filldir,
DPRINTK("ncp_do_readdir: search failed, err=%d\n", err);
return;
}
entry.volume = entry.i.volNumber;
if (!ncp_fill_cache(filp, dirent, filldir, ctl, &entry))
return;
}
......@@ -788,6 +791,7 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry)
*/
finfo.opened = 0;
finfo.ino = iunique(dir->i_sb, 2);
finfo.volume = finfo.i.volNumber;
error = -EACCES;
inode = ncp_iget(dir->i_sb, &finfo);
......
......@@ -51,12 +51,10 @@ int ncp_make_open(struct inode *inode, int right)
struct ncp_entry_info finfo;
int result;
finfo.i.dirEntNum = NCP_FINFO(inode)->dirEntNum;
finfo.i.volNumber = NCP_FINFO(inode)->volNumber;
/* tries max. rights */
finfo.access = O_RDWR;
result = ncp_open_create_file_or_subdir(NCP_SERVER(inode),
NULL, NULL, OC_MODE_OPEN,
inode, NULL, OC_MODE_OPEN,
0, AR_READ | AR_WRITE, &finfo);
if (!result)
goto update;
......@@ -65,13 +63,13 @@ int ncp_make_open(struct inode *inode, int right)
case O_RDONLY:
finfo.access = O_RDONLY;
result = ncp_open_create_file_or_subdir(NCP_SERVER(inode),
NULL, NULL, OC_MODE_OPEN,
inode, NULL, OC_MODE_OPEN,
0, AR_READ, &finfo);
break;
case O_WRONLY:
finfo.access = O_WRONLY;
result = ncp_open_create_file_or_subdir(NCP_SERVER(inode),
NULL, NULL, OC_MODE_OPEN,
inode, NULL, OC_MODE_OPEN,
0, AR_WRITE, &finfo);
break;
}
......
......@@ -103,13 +103,9 @@ void ncp_update_inode(struct inode *inode, struct ncp_entry_info *nwinfo)
{
NCP_FINFO(inode)->DosDirNum = nwinfo->i.DosDirNum;
NCP_FINFO(inode)->dirEntNum = nwinfo->i.dirEntNum;
NCP_FINFO(inode)->volNumber = nwinfo->i.volNumber;
NCP_FINFO(inode)->volNumber = nwinfo->volume;
#ifdef CONFIG_NCPFS_STRONG
NCP_FINFO(inode)->nwattr = nwinfo->i.attributes;
#else
NCP_FINFO(inode)->nwattr = nwinfo->i.attributes;
#endif
NCP_FINFO(inode)->access = nwinfo->access;
memcpy(NCP_FINFO(inode)->file_handle, nwinfo->file_handle,
sizeof(nwinfo->file_handle));
......@@ -478,7 +474,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
#ifdef CONFIG_NCPFS_SMALLDOS
finfo.i.NSCreator = NW_NS_DOS;
#endif
finfo.i.volNumber = NCP_NUMBER_OF_VOLUMES + 1; /* illegal volnum */
finfo.volume = NCP_NUMBER_OF_VOLUMES;
/* set dates of mountpoint to Jan 1, 1986; 00:00 */
finfo.i.creationTime = finfo.i.modifyTime
= cpu_to_le16(0x0000);
......@@ -491,7 +487,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
finfo.opened = 0;
finfo.ino = 2; /* tradition */
server->name_space[finfo.i.volNumber] = NW_NS_DOS;
server->name_space[finfo.volume] = NW_NS_DOS;
error = -ENOMEM;
root_inode = ncp_iget(sb, &finfo);
......
......@@ -201,7 +201,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
case NCP_IOC_SETROOT:
{
struct ncp_setroot_ioctl sr;
struct nw_info_struct i;
unsigned int vnum, de, dosde;
struct dentry* dentry;
if (!capable(CAP_SYS_ADMIN))
......@@ -214,25 +214,31 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
sizeof(sr))) return -EFAULT;
if (sr.volNumber < 0) {
server->m.mounted_vol[0] = 0;
i.volNumber = NCP_NUMBER_OF_VOLUMES + 1;
i.dirEntNum = 0;
i.DosDirNum = 0;
vnum = NCP_NUMBER_OF_VOLUMES;
de = 0;
dosde = 0;
} else if (sr.volNumber >= NCP_NUMBER_OF_VOLUMES) {
return -EINVAL;
} else
if (ncp_mount_subdir(server, &i, sr.volNumber,
} else {
struct nw_info_struct ni;
if (ncp_mount_subdir(server, &ni, sr.volNumber,
sr.namespace, sr.dirEntNum))
return -ENOENT;
vnum = ni.volNumber;
de = ni.dirEntNum;
dosde = ni.DosDirNum;
}
dentry = inode->i_sb->s_root;
server->root_setuped = 1;
if (dentry) {
struct inode* inode = dentry->d_inode;
if (inode) {
NCP_FINFO(inode)->volNumber = i.volNumber;
NCP_FINFO(inode)->dirEntNum = i.dirEntNum;
NCP_FINFO(inode)->DosDirNum = i.DosDirNum;
NCP_FINFO(inode)->volNumber = vnum;
NCP_FINFO(inode)->dirEntNum = de;
NCP_FINFO(inode)->DosDirNum = dosde;
} else
DPRINTK("ncpfs: s_root->d_inode==NULL\n");
} else
......
......@@ -640,15 +640,12 @@ int ncp_open_create_file_or_subdir(struct ncp_server *server,
struct ncp_entry_info *target)
{
__u16 search_attribs = ntohs(0x0600);
__u8 volnum = target->i.volNumber;
__u32 dirent = target->i.dirEntNum;
__u8 volnum;
__u32 dirent;
int result;
if (dir)
{
volnum = NCP_FINFO(dir)->volNumber;
dirent = NCP_FINFO(dir)->dirEntNum;
}
volnum = NCP_FINFO(dir)->volNumber;
dirent = NCP_FINFO(dir)->dirEntNum;
if ((create_attributes & aDIR) != 0) {
search_attribs |= ntohs(0x0080);
......@@ -672,6 +669,7 @@ int ncp_open_create_file_or_subdir(struct ncp_server *server,
/* in target there's a new finfo to fill */
ncp_extract_file_info(ncp_reply_data(server, 6), &(target->i));
target->volume = target->i.volNumber;
ConvertToNWfromDWORD(ncp_reply_dword(server, 0), target->file_handle);
out:
......
......@@ -44,7 +44,7 @@ struct ncp_reply_header {
};
#define NCP_VOLNAME_LEN (16)
#define NCP_NUMBER_OF_VOLUMES (64)
#define NCP_NUMBER_OF_VOLUMES (256)
struct ncp_volume_info {
__u32 total_blocks;
__u32 free_blocks;
......
......@@ -182,6 +182,7 @@ struct ncp_entry_info {
ino_t ino;
int opened;
int access;
unsigned int volume;
__u8 file_handle[6];
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment