Skip to content

Commit

Permalink
Add helper messages for lax permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
ralight committed Sep 18, 2023
1 parent 7ae22c3 commit 97c2565
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions lib/misc_mosq.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,9 @@ FILE *mosquitto__fopen(const char *path, const char *mode, bool restrict_read)
#else
fprintf(stderr,
#endif
"Warning: File %s has world readable permissions. Future versions will refuse to load this file.",
path);
"Warning: File %s has world readable permissions. Future versions will refuse to load this file.\n"
"To fix this, use `chmod 0700 %s`.",
path, path);
#if 0
return NULL;
#endif
Expand All @@ -175,8 +176,9 @@ FILE *mosquitto__fopen(const char *path, const char *mode, bool restrict_read)
#else
fprintf(stderr,
#endif
"Warning: File %s owner is not %s. Future versions will refuse to load this file.",
path, result->pw_name);
"Warning: File %s owner is not %s. Future versions will refuse to load this file."
"To fix this, use `chown %s %s`.",
path, result->pw_name, result->pw_name, path);
}
#if 0
// Future version
Expand Down
10 changes: 6 additions & 4 deletions plugins/dynamic-security/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,9 @@ FILE *mosquitto__fopen(const char *path, const char *mode, bool restrict_read)
#else
fprintf(stderr,
#endif
"Warning: File %s has world readable permissions. Future versions will refuse to load this file.",
path);
"Warning: File %s has world readable permissions. Future versions will refuse to load this file."
"To fix this, use `chmod 0700 %s`.",
path, path);
#if 0
return NULL;
#endif
Expand All @@ -183,8 +184,9 @@ FILE *mosquitto__fopen(const char *path, const char *mode, bool restrict_read)
#else
fprintf(stderr,
#endif
"Warning: File %s owner is not %s. Future versions will refuse to load this file.",
path, result->pw_name);
"Warning: File %s owner is not %s. Future versions will refuse to load this file."
"To fix this, use `chown %s %s`.",
path, result->pw_name, result->pw_name, path);
}
#if 0
// Future version
Expand Down

0 comments on commit 97c2565

Please sign in to comment.