From 851b6a097165af4d51c0db01b5e05256e5006896 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:00:48 +0200 Subject: Adding upstream version 2.6.1. Signed-off-by: Daniel Baumann --- test/interactive-helper/aptdropprivs.cc | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 test/interactive-helper/aptdropprivs.cc (limited to 'test/interactive-helper/aptdropprivs.cc') diff --git a/test/interactive-helper/aptdropprivs.cc b/test/interactive-helper/aptdropprivs.cc new file mode 100644 index 0000000..1cc04f3 --- /dev/null +++ b/test/interactive-helper/aptdropprivs.cc @@ -0,0 +1,27 @@ +#include + +#include +#include +#include +#include + +#include + +int main(int const argc, const char * argv[]) +{ + CommandLine::Args Args[] = { + {'c',"config-file",0,CommandLine::ConfigFile}, + {'o',"option",0,CommandLine::ArbItem}, + {0, "user", "APT::Sandbox::User", CommandLine::HasArg}, + {0,0,0,0} + }; + + CommandLine CmdL(Args, _config); + if(CmdL.Parse(argc,argv) == false || DropPrivileges() == false) + { + _error->DumpErrors(std::cerr, GlobalError::DEBUG); + return 42; + } + + return execv(CmdL.FileList[0], const_cast(CmdL.FileList)); +} -- cgit v1.2.3