Skip to content
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

Merged
merged 7 commits into from Aug 28, 2023

Conversation

glzhao89
Copy link
Contributor

permission of the directory

@@ -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)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

两个问题:

  1. taosMulModeMkDir 这个函数是个底层通用函数,不能因为日志的用法就改变这个函数的含义;
  2. 对日志来说,需要能读、写、创建文件,TD_FILE_ACCESS_WRITE_OK是否足够?有没有实际测试一下?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 单独添加函数用于写日志
  2. 经过测试,非同一个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)) {
Copy link
Contributor

@dapan1121 dapan1121 Aug 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

254行的分支也需要修改

Copy link
Contributor Author

@glzhao89 glzhao89 Aug 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已进行修改

@dapan1121 dapan1121 merged commit b00aa1a into main Aug 28, 2023
1 check passed
@gccgdb1234 gccgdb1234 deleted the fix/TD-25719 branch December 11, 2023 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants