New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: fix non-root users cannot create log files even if they have write #22458
Conversation
permission of the directory
source/os/src/osDir.c
Outdated
@@ -206,7 +206,11 @@ int32_t taosMulModeMkDir(const char *dirname, int mode) { | |||
#endif | |||
|
|||
if (taosDirExist(temp)) { | |||
return chmod(temp, mode); | |||
if (taosCheckAccessFile(temp, TD_FILE_ACCESS_WRITE_OK)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
两个问题:
- taosMulModeMkDir 这个函数是个底层通用函数,不能因为日志的用法就改变这个函数的含义;
- 对日志来说,需要能读、写、创建文件,TD_FILE_ACCESS_WRITE_OK是否足够?有没有实际测试一下?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 单独添加函数用于写日志
- 经过测试,非同一个group的用户创建的目录,当前用户还是需要具有W/R/E 三个权限保证日志功能正常执行,已添加对三个权限的检测。
@@ -206,6 +206,9 @@ int32_t taosMulModeMkDir(const char *dirname, int mode) { | |||
#endif | |||
|
|||
if (taosDirExist(temp)) { | |||
if (checkAccess && taosCheckAccessFile(temp, TD_FILE_ACCESS_EXIST_OK | TD_FILE_ACCESS_READ_OK | TD_FILE_ACCESS_WRITE_OK)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
254行的分支也需要修改
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已进行修改
permission of the directory