mirror of
https://github.com/EvernodeXRPL/sashimono.git
synced 2026-04-29 15:38:00 +00:00
Contract directory permission fix. (#42)
This commit is contained in:
committed by
GitHub
parent
8ba64058f8
commit
4ed4e45ef1
@@ -41,8 +41,7 @@ namespace comm
|
||||
|
||||
const std::string command = "chown :sashiadmin " + conf::ctx.socket_path;
|
||||
|
||||
char mode[] = "0660"; // rw-rw----
|
||||
const mode_t permission_mode = strtol(mode, 0, 8); // Char to octal conversion.
|
||||
const mode_t permission_mode = 0660; // rw-rw----
|
||||
|
||||
if (bind(ctx.connection_socket, (const struct sockaddr *)&sock_name, sizeof(struct sockaddr_un)) == -1 ||
|
||||
chmod(conf::ctx.socket_path.c_str(), permission_mode) == -1 ||
|
||||
|
||||
@@ -604,9 +604,9 @@ namespace hp
|
||||
len = 12 + (username.length() * 2) + contract_dir.length();
|
||||
char own_command[len];
|
||||
sprintf(own_command, CHOWN_DIR, username.data(), username.data(), contract_dir.data());
|
||||
if (system(own_command) != 0)
|
||||
if (system(own_command) != 0 || chmod(contract_dir.data(), util::DIR_PERMS) == -1)
|
||||
{
|
||||
LOG_ERROR << "Changing contract ownership failed " << contract_dir;
|
||||
LOG_ERROR << "Changing contract ownership and permissions failed " << contract_dir;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
namespace util
|
||||
{
|
||||
constexpr mode_t DIR_PERMS = 0755;
|
||||
constexpr const char *RUN_SH = "chmod +x %s && sudo bash %s %s"; // Enable execute permission before running in case bash script does not have the permission.
|
||||
|
||||
const std::string to_hex(const std::string_view bin)
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
namespace util
|
||||
{
|
||||
constexpr const mode_t DIR_PERMS = 0755;
|
||||
struct user_info
|
||||
{
|
||||
std::string username;
|
||||
|
||||
Reference in New Issue
Block a user