Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2301_76519099
rt-thread
提交
7d090718
R
rt-thread
项目概览
2301_76519099
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
3
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7d090718
编写于
6月 26, 2019
作者:
还_没_想_好
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[components][dfs][nfs] 修复Linux NFS服务器认证问题
上级
0fab1cc6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
189 addition
and
2 deletion
+189
-2
components/dfs/filesystems/nfs/SConscript
components/dfs/filesystems/nfs/SConscript
+2
-0
components/dfs/filesystems/nfs/dfs_nfs.c
components/dfs/filesystems/nfs/dfs_nfs.c
+11
-2
components/dfs/filesystems/nfs/mount_xdr.c
components/dfs/filesystems/nfs/mount_xdr.c
+2
-0
components/dfs/filesystems/nfs/nfs_auth.c
components/dfs/filesystems/nfs/nfs_auth.c
+172
-0
components/dfs/filesystems/nfs/nfs_xdr.c
components/dfs/filesystems/nfs/nfs_xdr.c
+2
-0
未找到文件。
components/dfs/filesystems/nfs/SConscript
浏览文件 @
7d090718
...
...
@@ -6,6 +6,8 @@ cwd = GetCurrentDir()
src
=
Glob
(
'*.c'
)
+
Glob
(
'rpc/*.c'
)
CPPPATH
=
[
cwd
]
SrcRemove
(
src
,
[
'rpc/auth_none.c'
])
group
=
DefineGroup
(
'Filesystem'
,
src
,
depend
=
[
'RT_USING_DFS'
,
'RT_USING_DFS_NFS'
],
CPPPATH
=
CPPPATH
)
Return
(
'group'
)
components/dfs/filesystems/nfs/dfs_nfs.c
浏览文件 @
7d090718
...
...
@@ -225,7 +225,7 @@ static nfs_fh3 *get_dir_handle(nfs_filesystem *nfs, const char *name)
copy_handle
(
handle
,
&
nfs
->
current_handle
);
}
while
((
file
=
strtok_r
(
NULL
,
"/"
,
&
path
))
!=
NULL
&&
path
[
0
]
!=
0
)
while
((
file
=
strtok_r
(
NULL
,
"/"
,
&
path
))
!=
NULL
&&
path
&&
path
[
0
]
!=
0
)
{
LOOKUP3args
args
;
LOOKUP3res
res
;
...
...
@@ -747,7 +747,7 @@ int nfs_open(struct dfs_fd *file)
RT_ASSERT
(
file
->
data
!=
NULL
);
struct
dfs_filesystem
*
dfs_nfs
=
((
struct
dfs_filesystem
*
)(
file
->
data
));
nfs
=
(
struct
nfs_filesystem
*
)(
dfs_nfs
->
data
);
RT_ASSERT
(
nfs
!=
NULL
);
if
(
file
->
flags
&
O_DIRECTORY
)
{
...
...
@@ -1106,6 +1106,15 @@ int nfs_getdents(struct dfs_fd *file, struct dirent *dirp, uint32_t count)
if
(
name
==
NULL
)
break
;
if
(
rt_strcmp
(
name
,
"."
)
==
0
)
{
continue
;
}
else
if
(
rt_strcmp
(
name
,
".."
)
==
0
)
{
continue
;
}
d
->
d_type
=
DT_REG
;
d
->
d_namlen
=
rt_strlen
(
name
);
...
...
components/dfs/filesystems/nfs/mount_xdr.c
浏览文件 @
7d090718
...
...
@@ -101,6 +101,8 @@ xdr_mountres3(register XDR *xdrs, mountres3 *objp)
if
(
!
xdr_mountres3_ok
(
xdrs
,
&
objp
->
mountres3_u
.
mountinfo
))
return
(
FALSE
);
break
;
default
:
return
(
FALSE
);
}
return
(
TRUE
);
}
...
...
components/dfs/filesystems/nfs/nfs_auth.c
0 → 100644
浏览文件 @
7d090718
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
*/
#include <rpc/types.h>
#include <rpc/xdr.h>
#include <rpc/auth.h>
#define MAX_MARSHEL_SIZE 64
struct
nfs_credentia
{
rt_uint32_t
stamp
;
char
*
name
;
rt_uint32_t
uid
;
rt_uint32_t
gid
;
rt_uint32_t
*
auxi
;
rt_uint32_t
auxi_count
;
};
static
void
authnone_verf
(
AUTH
*
);
static
bool_t
authnone_validate
(
AUTH
*
,
struct
opaque_auth
*
);
static
bool_t
authnone_refresh
(
AUTH
*
);
static
void
authnone_destroy
(
AUTH
*
);
static
bool_t
authnone_marshal
(
AUTH
*
client
,
XDR
*
xdrs
);
static
struct
nfs_credentia
_credentia
=
{
.
stamp
=
0
,
.
name
=
"rt-thread"
,
.
uid
=
0
,
.
gid
=
0
,
.
auxi
=
NULL
,
.
auxi_count
=
0
,
};
struct
opaque_auth
_null_auth
;
static
struct
auth_ops
ops
=
{
authnone_verf
,
authnone_marshal
,
authnone_validate
,
authnone_refresh
,
authnone_destroy
};
static
struct
authnone_private
{
AUTH
no_client
;
char
marshalled_client
[
MAX_MARSHEL_SIZE
];
unsigned
int
mcnt
;
}
*
authnone_private
;
AUTH
*
authnone_create
(
void
)
{
register
struct
authnone_private
*
ap
=
authnone_private
;
XDR
xdr_stream
;
register
XDR
*
xdrs
;
extern
bool_t
xdr_opaque_auth
(
XDR
*
xdrs
,
struct
opaque_auth
*
ap
);
struct
opaque_auth
auth
;
rt_uint32_t
*
auth_buf
,
*
auth_base
;
int
buf_len
=
0
,
str_len
=
0
;
if
(
_credentia
.
name
)
{
str_len
=
strlen
(
_credentia
.
name
);
}
if
(
str_len
==
0
)
{
_credentia
.
name
=
"unknown"
;
str_len
=
strlen
(
_credentia
.
name
);
}
buf_len
=
((
str_len
)
+
(
sizeof
(
rt_uint32_t
))
-
1
)
&
~
((
sizeof
(
rt_uint32_t
))
-
1
);
buf_len
+=
sizeof
(
struct
nfs_credentia
);
if
(
_credentia
.
auxi
&&
_credentia
.
auxi_count
)
{
buf_len
+=
sizeof
(
rt_uint32_t
)
*
_credentia
.
auxi_count
;
}
auth_buf
=
auth_base
=
rt_malloc
(
buf_len
);
if
(
auth_buf
==
NULL
)
{
return
NULL
;
}
memset
(
auth_buf
,
0
,
buf_len
);
*
auth_buf
++
=
htonl
(
rt_tick_get
());
*
auth_buf
++
=
htonl
(
str_len
);
memcpy
(
auth_buf
,
_credentia
.
name
,
str_len
);
auth_buf
+=
(
str_len
+
sizeof
(
rt_uint32_t
)
-
1
)
>>
2
;
*
auth_buf
++
=
htonl
(
_credentia
.
uid
);
*
auth_buf
++
=
htonl
(
_credentia
.
gid
);
if
(
_credentia
.
auxi
&&
_credentia
.
auxi_count
)
{
rt_uint32_t
tmp_cnt
=
0
;
*
auth_buf
++
=
htonl
(
_credentia
.
auxi_count
);
while
(
tmp_cnt
<
_credentia
.
auxi_count
)
{
*
auth_buf
++
=
htonl
(
_credentia
.
auxi
[
tmp_cnt
]);
}
}
else
{
*
auth_buf
++
=
htonl
(
0
);
}
if
(
ap
==
0
)
{
ap
=
(
struct
authnone_private
*
)
rt_malloc
(
sizeof
(
*
ap
));
if
(
ap
==
0
)
{
rt_free
(
auth_base
);
return
NULL
;
}
memset
(
ap
,
0
,
sizeof
(
*
ap
));
authnone_private
=
ap
;
}
if
(
!
ap
->
mcnt
)
{
memset
(
&
auth
,
0
,
sizeof
(
auth
));
auth
.
oa_flavor
=
1
;
auth
.
oa_base
=
(
char
*
)
auth_base
;
auth
.
oa_length
=
(
auth_buf
-
auth_base
)
*
sizeof
(
rt_uint32_t
);
ap
->
no_client
.
ah_cred
=
auth
;
ap
->
no_client
.
ah_verf
=
_null_auth
;
ap
->
no_client
.
ah_ops
=
&
ops
;
xdrs
=
&
xdr_stream
;
xdrmem_create
(
xdrs
,
ap
->
marshalled_client
,
(
unsigned
int
)
MAX_MARSHEL_SIZE
,
XDR_ENCODE
);
(
void
)
xdr_opaque_auth
(
xdrs
,
&
ap
->
no_client
.
ah_cred
);
(
void
)
xdr_opaque_auth
(
xdrs
,
&
ap
->
no_client
.
ah_verf
);
ap
->
mcnt
=
XDR_GETPOS
(
xdrs
);
XDR_DESTROY
(
xdrs
);
}
rt_free
(
auth_base
);
return
(
&
ap
->
no_client
);
}
/*ARGSUSED*/
static
bool_t
authnone_marshal
(
AUTH
*
client
,
XDR
*
xdrs
)
{
register
struct
authnone_private
*
ap
=
authnone_private
;
if
(
ap
==
0
)
return
(
0
);
return
((
*
xdrs
->
x_ops
->
x_putbytes
)(
xdrs
,
ap
->
marshalled_client
,
ap
->
mcnt
));
}
static
void
authnone_verf
(
AUTH
*
x
)
{
}
static
bool_t
authnone_validate
(
AUTH
*
x
,
struct
opaque_auth
*
x1
)
{
return
(
TRUE
);
}
static
bool_t
authnone_refresh
(
AUTH
*
x
)
{
return
(
FALSE
);
}
static
void
authnone_destroy
(
AUTH
*
x
)
{
}
components/dfs/filesystems/nfs/nfs_xdr.c
浏览文件 @
7d090718
...
...
@@ -496,6 +496,8 @@ xdr_GETATTR3res(register XDR *xdrs, GETATTR3res *objp)
if
(
!
xdr_GETATTR3resok
(
xdrs
,
&
objp
->
GETATTR3res_u
.
resok
))
return
(
FALSE
);
break
;
default
:
return
(
FALSE
);
}
return
(
TRUE
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录