summaryrefslogtreecommitdiffstats
path: root/fs/ncpfs/ioctl.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-02-04 07:40:19 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-02-04 07:40:19 +0000
commit33263fc5f9ac8e8cb2b22d06af3ce5ac1dd815e4 (patch)
tree2d1b86a40bef0958a68cf1a2eafbeb0667a70543 /fs/ncpfs/ioctl.c
parent216f5f51aa02f8b113aa620ebc14a9631a217a00 (diff)
Merge with Linux 2.3.32.
Diffstat (limited to 'fs/ncpfs/ioctl.c')
-rw-r--r--fs/ncpfs/ioctl.c80
1 files changed, 39 insertions, 41 deletions
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c
index 05def9d6c..36063db81 100644
--- a/fs/ncpfs/ioctl.c
+++ b/fs/ncpfs/ioctl.c
@@ -3,7 +3,7 @@
*
* Copyright (C) 1995, 1996 by Volker Lendecke
* Modified 1997 Peter Waltenberg, Bill Hawes, David Woodhouse for 2.1 dcache
- * Modified 1998 Wolfram Pienkoss for NLS
+ * Modified 1998, 1999 Wolfram Pienkoss for NLS
*
*/
@@ -364,8 +364,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
#ifdef CONFIG_NCPFS_NDS_DOMAINS
case NCP_IOC_GETOBJECTNAME:
- if ( (permission(inode, MAY_READ) != 0)
- && (current->uid != server->m.mounted_uid)) {
+ if (current->uid != server->m.mounted_uid) {
return -EACCES;
}
{
@@ -396,8 +395,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
return 0;
}
case NCP_IOC_SETOBJECTNAME:
- if ( (permission(inode, MAY_WRITE) != 0)
- && (current->uid != server->m.mounted_uid)) {
+ if (current->uid != server->m.mounted_uid) {
return -EACCES;
}
{
@@ -441,8 +439,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
return 0;
}
case NCP_IOC_GETPRIVATEDATA:
- if ( (permission(inode, MAY_READ) != 0)
- && (current->uid != server->m.mounted_uid)) {
+ if (current->uid != server->m.mounted_uid) {
return -EACCES;
}
{
@@ -471,8 +468,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
return 0;
}
case NCP_IOC_SETPRIVATEDATA:
- if ( (permission(inode, MAY_WRITE) != 0)
- && (current->uid != server->m.mounted_uid)) {
+ if (current->uid != server->m.mounted_uid) {
return -EACCES;
}
{
@@ -531,7 +527,8 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
codepage = NULL;
user.codepage[NCP_IOCSNAME_LEN] = 0;
- if (!user.codepage[0])
+ if (!user.codepage[0] ||
+ !strcmp(user.codepage, "default"))
codepage = load_nls_default();
else {
codepage = load_nls(user.codepage);
@@ -542,13 +539,21 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
iocharset = NULL;
user.iocharset[NCP_IOCSNAME_LEN] = 0;
- if (user.iocharset[0] == 0)
+ if (!user.iocharset[0] ||
+ !strcmp(user.iocharset, "default")) {
iocharset = load_nls_default();
- else {
- iocharset = load_nls(user.iocharset);
- if (!iocharset) {
- unload_nls(codepage);
- return -EBADRQC;
+ NCP_CLR_FLAG(server, NCP_FLAG_UTF8);
+ } else {
+ if (!strcmp(user.iocharset, "utf8")) {
+ iocharset = load_nls_default();
+ NCP_SET_FLAG(server, NCP_FLAG_UTF8);
+ } else {
+ iocharset = load_nls(user.iocharset);
+ if (!iocharset) {
+ unload_nls(codepage);
+ return -EBADRQC;
+ }
+ NCP_CLR_FLAG(server, NCP_FLAG_UTF8);
}
}
@@ -568,35 +573,28 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
case NCP_IOC_GETCHARSETS: /* not tested */
{
struct ncp_nls_ioctl user;
+ int len;
memset(&user, 0, sizeof(user));
- if (server->nls_vol)
- if (server->nls_vol->charset) {
- strncpy(user.codepage,
- server->nls_vol->charset,
- NCP_IOCSNAME_LEN);
- user.codepage[NCP_IOCSNAME_LEN] = 0;
- if (!strcmp(user.codepage, "default"))
- /* unfortunately, we cannot set
- 'default' charset... maybe
- we should change load_nls()?
- It is easy, do not initialize
- 'tables' in fs/nls/nls_base.c
- with NULL, but with
- 'default_table'... */
- memset(user.codepage, 0,
- sizeof(user.codepage));
- }
+ if (server->nls_vol && server->nls_vol->charset) {
+ len = strlen(server->nls_vol->charset);
+ if (len > NCP_IOCSNAME_LEN)
+ len = NCP_IOCSNAME_LEN;
+ strncpy(user.codepage,
+ server->nls_vol->charset, len);
+ user.codepage[len] = 0;
+ }
- if (server->nls_io)
- if (server->nls_io->charset) {
+ if (NCP_IS_FLAG(server, NCP_FLAG_UTF8))
+ strcpy(user.iocharset, "utf8");
+ else
+ if (server->nls_io && server->nls_io->charset) {
+ len = strlen(server->nls_io->charset);
+ if (len > NCP_IOCSNAME_LEN)
+ len = NCP_IOCSNAME_LEN;
strncpy(user.iocharset,
- server->nls_io->charset,
- NCP_IOCSNAME_LEN);
- user.iocharset[NCP_IOCSNAME_LEN] = 0;
- if (!strcmp(user.iocharset, "default"))
- memset(user.iocharset, 0,
- sizeof(user.iocharset));
+ server->nls_io->charset, len);
+ user.iocharset[len] = 0;
}
if (copy_to_user((struct ncp_nls_ioctl*)arg, &user,