Compare commits
No commits in common. "fd62de647459c8296fa406563dd29ce42ed833c3" and "cc72a1655de0d9ca7169d3d92ef0d5f998bbf476" have entirely different histories.
fd62de6474
...
cc72a1655d
@ -149,28 +149,10 @@ static Result<void> load_service(const os::Path& path)
|
|||||||
|
|
||||||
if (parts[0].view() == "Command")
|
if (parts[0].view() == "Command")
|
||||||
{
|
{
|
||||||
if (!service.command.is_empty())
|
|
||||||
{
|
|
||||||
fprintf(g_init_log, "[init] 'Command' cannot be specified after 'Script' has already been set! (%s)\n",
|
|
||||||
line.chars());
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
service.command = move(parts[1]);
|
service.command = move(parts[1]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parts[0].view() == "Script")
|
|
||||||
{
|
|
||||||
if (!service.command.is_empty())
|
|
||||||
{
|
|
||||||
fprintf(g_init_log, "[init] 'Script' cannot be specified after 'Command' has already been set! (%s)\n",
|
|
||||||
line.chars());
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
service.command = TRY(String::format("/bin/sh -- %s"_sv, parts[1].chars()));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (parts[0].view() == "Restart")
|
if (parts[0].view() == "Restart")
|
||||||
{
|
{
|
||||||
if (parts[1].view() == "true" || parts[1].view().to_uint().value_or(0) == 1)
|
if (parts[1].view() == "true" || parts[1].view().to_uint().value_or(0) == 1)
|
||||||
@ -228,7 +210,7 @@ static Result<void> load_service(const os::Path& path)
|
|||||||
|
|
||||||
if (service.command.is_empty())
|
if (service.command.is_empty())
|
||||||
{
|
{
|
||||||
fprintf(g_init_log, "[init] service file is missing 'Command' or 'Script' entry, aborting!\n");
|
fprintf(g_init_log, "[init] service file is missing 'Command' entry, aborting!\n");
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
Name=tmpfs
|
|
||||||
Script=/sbin/mount-tmpfs
|
|
||||||
Wait=true
|
|
@ -1,3 +0,0 @@
|
|||||||
mkdir -p /tmp
|
|
||||||
mount -t tmpfs /tmp
|
|
||||||
chmod 1777 /tmp
|
|
@ -168,11 +168,6 @@ namespace VFS
|
|||||||
return inode->mode() & S_ISGID;
|
return inode->mode() & S_ISGID;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_sticky(SharedPtr<Inode> inode)
|
|
||||||
{
|
|
||||||
return inode->mode() & S_ISVTX;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool is_seekable(SharedPtr<Inode> inode)
|
bool is_seekable(SharedPtr<Inode> inode)
|
||||||
{
|
{
|
||||||
return inode->type() != InodeType::FIFO && inode->type() != InodeType::CharacterDevice;
|
return inode->type() != InodeType::FIFO && inode->type() != InodeType::CharacterDevice;
|
||||||
|
@ -290,7 +290,6 @@ namespace VFS
|
|||||||
bool can_write(SharedPtr<Inode> inode, Credentials auth);
|
bool can_write(SharedPtr<Inode> inode, Credentials auth);
|
||||||
bool is_setuid(SharedPtr<Inode> inode);
|
bool is_setuid(SharedPtr<Inode> inode);
|
||||||
bool is_setgid(SharedPtr<Inode> inode);
|
bool is_setgid(SharedPtr<Inode> inode);
|
||||||
bool is_sticky(SharedPtr<Inode> inode);
|
|
||||||
|
|
||||||
bool is_seekable(SharedPtr<Inode> inode);
|
bool is_seekable(SharedPtr<Inode> inode);
|
||||||
|
|
||||||
|
@ -25,12 +25,11 @@ Result<u64> sys_unlinkat(Registers*, SyscallArgs args)
|
|||||||
auto inode = TRY(current->resolve_atfile(dirfd, dirname, false, false));
|
auto inode = TRY(current->resolve_atfile(dirfd, dirname, false, false));
|
||||||
if (!VFS::can_write(inode, current->auth)) return err(EACCES);
|
if (!VFS::can_write(inode, current->auth)) return err(EACCES);
|
||||||
|
|
||||||
auto child = TRY(inode->find(basename.chars()));
|
if (flags > 0)
|
||||||
if (flags == AT_REMOVEDIR && child->type() != VFS::InodeType::Directory) return err(ENOTDIR);
|
{
|
||||||
|
auto child = TRY(inode->find(basename.chars()));
|
||||||
if (current->auth.euid != 0 && VFS::is_sticky(inode) && current->auth.euid != inode->uid() &&
|
if (child->type() != VFS::InodeType::Directory) return err(ENOTDIR);
|
||||||
current->auth.euid != child->uid())
|
}
|
||||||
return err(EACCES);
|
|
||||||
|
|
||||||
TRY(inode->remove_entry(basename.chars()));
|
TRY(inode->remove_entry(basename.chars()));
|
||||||
|
|
||||||
|
@ -50,6 +50,5 @@ static void quicksort_impl(void* base, usize start, usize end, usize size, compa
|
|||||||
|
|
||||||
void c_quicksort(void* base, usize nmemb, usize size, compar_t compar)
|
void c_quicksort(void* base, usize nmemb, usize size, compar_t compar)
|
||||||
{
|
{
|
||||||
if (nmemb == 0) return;
|
|
||||||
quicksort_impl(base, 0, nmemb - 1, size, compar);
|
quicksort_impl(base, 0, nmemb - 1, size, compar);
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,8 @@ namespace os
|
|||||||
out[6] = (mode & S_ISGID) ? ((mode & S_IXGRP) ? 's' : 'S') : ((mode & S_IXGRP) ? 'x' : '-');
|
out[6] = (mode & S_ISGID) ? ((mode & S_IXGRP) ? 's' : 'S') : ((mode & S_IXGRP) ? 'x' : '-');
|
||||||
out[7] = (mode & S_IROTH) ? 'r' : '-';
|
out[7] = (mode & S_IROTH) ? 'r' : '-';
|
||||||
out[8] = (mode & S_IWOTH) ? 'w' : '-';
|
out[8] = (mode & S_IWOTH) ? 'w' : '-';
|
||||||
out[9] = (mode & S_ISVTX) ? ((mode & S_IXOTH) ? 't' : 'T') : ((mode & S_IXOTH) ? 'x' : '-');
|
// FIXME: Support the sticky bit.
|
||||||
|
out[9] = (mode & S_IXOTH) ? 'x' : '-';
|
||||||
out[10] = '\0';
|
out[10] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user