1
0
Fork 0

Nasal: Limit SGPath::create_dir access rights to 0755

This commit is contained in:
Thomas Geymayer 2014-06-26 18:09:22 +02:00
parent c65b2eb6b0
commit a66e30aa04

View file

@ -60,6 +60,12 @@ static naRef f_new_path(const nasal::CallContext& ctx)
return validatedPathToNasal(ctx, SGPath(ctx.getArg<std::string>(0)));
}
static int f_path_create_dir(SGPath& p, const nasal::CallContext& ctx)
{
// limit setable access rights for Nasal
return p.create_dir(ctx.getArg<mode_t>(0, 0755) & 0775);
}
/**
* os.path.desktop()
*/
@ -126,10 +132,10 @@ naRef initNasalSGPath(naRef globals, naContext c)
.method("isAbsolute", &SGPath::isAbsolute)
.method("isNull", &SGPath::isNull)
.method("create_dir", &SGPath::create_dir)
.method("create_dir", &f_path_create_dir)
.method("remove", &SGPath::remove)
.method("rename", &SGPath::rename);
nasal::Hash globals_module(globals, c),
path = globals_module.createHash("os")
.createHash("path");