mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 10:37:38 -04:00
Agptek Rocker: Restrict root directory to SD only
Actual / of underlying linux OS should not be available to user. I am still not sure if implementation is correct. It doesn't perform any relative path sandboxing for example. Change-Id: Ic577a10f3947f6e950e2c4d03173f9f207395eb7
This commit is contained in:
parent
09fde79ec8
commit
0538ba3d59
4 changed files with 14 additions and 4 deletions
|
@ -51,8 +51,6 @@
|
||||||
#elif defined(DX50) || defined(DX90)
|
#elif defined(DX50) || defined(DX90)
|
||||||
/* Where to put save files like recordings, playlists, screen dumps ...*/
|
/* Where to put save files like recordings, playlists, screen dumps ...*/
|
||||||
#define HOME_DIR "/mnt/sdcard"
|
#define HOME_DIR "/mnt/sdcard"
|
||||||
#elif defined(AGPTEK_ROCKER)
|
|
||||||
#define HOME_DIR "/mnt/sd_0"
|
|
||||||
#else
|
#else
|
||||||
#define HOME_DIR "/"
|
#define HOME_DIR "/"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -37,6 +37,10 @@
|
||||||
#include "logf.h"
|
#include "logf.h"
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(AGPTEK_ROCKER) && !defined(BOOTLOADER)
|
||||||
|
#define PIVOT_ROOT "/mnt/sd_0"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if (CONFIG_PLATFORM & PLATFORM_ANDROID)
|
#if (CONFIG_PLATFORM & PLATFORM_ANDROID)
|
||||||
static const char rbhome[] = "/sdcard";
|
static const char rbhome[] = "/sdcard";
|
||||||
#elif (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO|PLATFORM_PANDORA)) \
|
#elif (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO|PLATFORM_PANDORA)) \
|
||||||
|
@ -205,6 +209,10 @@ const char * handle_special_dirs(const char *dir, unsigned flags,
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_MULTIDRIVE
|
#ifdef HAVE_MULTIDRIVE
|
||||||
dir = handle_special_links(dir, flags, buf, bufsize);
|
dir = handle_special_links(dir, flags, buf, bufsize);
|
||||||
|
#endif
|
||||||
|
#ifdef PIVOT_ROOT
|
||||||
|
snprintf(buf, bufsize, "%s/%s", PIVOT_ROOT, dir);
|
||||||
|
dir = buf;
|
||||||
#endif
|
#endif
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include <string.h> /* size_t */
|
#include <string.h> /* size_t */
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
#include "file.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "load_code.h"
|
#include "load_code.h"
|
||||||
|
|
||||||
|
@ -28,7 +29,11 @@ void *lc_open(const char *filename, unsigned char *buf, size_t buf_size)
|
||||||
{
|
{
|
||||||
(void)buf;
|
(void)buf;
|
||||||
(void)buf_size;
|
(void)buf_size;
|
||||||
void *handle = dlopen(filename, RTLD_NOW);
|
char path[MAX_PATH];
|
||||||
|
|
||||||
|
const char *fpath = handle_special_dirs(filename, 0, path, sizeof(path));
|
||||||
|
|
||||||
|
void *handle = dlopen(fpath, RTLD_NOW);
|
||||||
if (handle == NULL)
|
if (handle == NULL)
|
||||||
{
|
{
|
||||||
DEBUGF("failed to load %s\n", filename);
|
DEBUGF("failed to load %s\n", filename);
|
||||||
|
|
1
tools/configure
vendored
1
tools/configure
vendored
|
@ -4212,7 +4212,6 @@ fi
|
||||||
t_cpu="hosted"
|
t_cpu="hosted"
|
||||||
t_manufacturer="agptek"
|
t_manufacturer="agptek"
|
||||||
t_model="rocker"
|
t_model="rocker"
|
||||||
rbdir='/mnt/sd_0/.rockbox'
|
|
||||||
mipsellinuxcc
|
mipsellinuxcc
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue