some security fixes for fluxbox-remote, and a minor change for the gvim fix
This commit is contained in:
parent
823ce0d017
commit
ae3c304239
9 changed files with 43 additions and 31 deletions
|
@ -3,9 +3,10 @@ Changes for 1.0.0:
|
||||||
*07/07/03:
|
*07/07/03:
|
||||||
* Avoid some problems with tabbed windows and resize increments (Mark)
|
* Avoid some problems with tabbed windows and resize increments (Mark)
|
||||||
Window.cc WinClient.cc/hh
|
Window.cc WinClient.cc/hh
|
||||||
* Added utility fluxbox-remote, which takes one argument and has fluxbox
|
* Added utility fluxbox-remote, which allows script access to most fluxbox
|
||||||
execute it just like in the keys file (Mark)
|
commands; support must be turned on in the init file with
|
||||||
- e.g. fluxbox-remote "CustomMenu ~/.fluxbox/custommenu"
|
session.screen<N>.allowRemoteActions; the syntax is, e.g.,
|
||||||
|
fluxbox-remote "CustomMenu ~/.fluxbox/custommenu" (Mark)
|
||||||
Screen.cc util/fluxbox-remote.cc util/Makefile.am
|
Screen.cc util/fluxbox-remote.cc util/Makefile.am
|
||||||
* Update systemtray and KDE dockapps in slit when background changes (Mark)
|
* Update systemtray and KDE dockapps in slit when background changes (Mark)
|
||||||
Screen.cc/hh Systemtray.cc Slit.cc FbTk/FbPixmap.cc/hh
|
Screen.cc/hh Systemtray.cc Slit.cc FbTk/FbPixmap.cc/hh
|
||||||
|
|
|
@ -62,7 +62,7 @@ CommandParser &CommandParser::instance() {
|
||||||
return *s_singleton;
|
return *s_singleton;
|
||||||
}
|
}
|
||||||
|
|
||||||
FbTk::Command *CommandParser::parseLine(const std::string &line) {
|
FbTk::Command *CommandParser::parseLine(const std::string &line, bool trusted) {
|
||||||
|
|
||||||
// parse arguments and command
|
// parse arguments and command
|
||||||
string command = line;
|
string command = line;
|
||||||
|
@ -83,13 +83,14 @@ FbTk::Command *CommandParser::parseLine(const std::string &line) {
|
||||||
// we didn't find any matching command in default commands,
|
// we didn't find any matching command in default commands,
|
||||||
// so we search in the command creators modules for a
|
// so we search in the command creators modules for a
|
||||||
// matching command string
|
// matching command string
|
||||||
return toCommand(command, arguments);
|
return toCommand(command, arguments, trusted);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FbTk::Command *CommandParser::toCommand(const std::string &command_str, const std::string &arguments) {
|
FbTk::Command *CommandParser::toCommand(const std::string &command_str,
|
||||||
|
const std::string &arguments, bool trusted) {
|
||||||
if (m_commandfactorys[command_str] != 0)
|
if (m_commandfactorys[command_str] != 0)
|
||||||
return m_commandfactorys[command_str]->stringToCommand(command_str, arguments);
|
return m_commandfactorys[command_str]->stringToCommand(command_str, arguments, trusted);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,8 @@ public:
|
||||||
CommandFactory();
|
CommandFactory();
|
||||||
virtual ~CommandFactory();
|
virtual ~CommandFactory();
|
||||||
virtual FbTk::Command *stringToCommand(const std::string &command,
|
virtual FbTk::Command *stringToCommand(const std::string &command,
|
||||||
const std::string &arguments) = 0;
|
const std::string &arguments,
|
||||||
|
bool trusted) = 0;
|
||||||
protected:
|
protected:
|
||||||
void addCommand(const std::string &value);
|
void addCommand(const std::string &value);
|
||||||
};
|
};
|
||||||
|
@ -52,7 +53,7 @@ public:
|
||||||
typedef std::map<std::string, CommandFactory *> CommandFactoryMap;
|
typedef std::map<std::string, CommandFactory *> CommandFactoryMap;
|
||||||
|
|
||||||
/// @return parses and returns a command matching the line
|
/// @return parses and returns a command matching the line
|
||||||
FbTk::Command *parseLine(const std::string &line);
|
FbTk::Command *parseLine(const std::string &line, bool trusted = true);
|
||||||
|
|
||||||
CommandParser();
|
CommandParser();
|
||||||
|
|
||||||
|
@ -70,7 +71,7 @@ private:
|
||||||
|
|
||||||
/// search for a command in our command factory map
|
/// search for a command in our command factory map
|
||||||
FbTk::Command *toCommand(const std::string &command,
|
FbTk::Command *toCommand(const std::string &command,
|
||||||
const std::string &arguments);
|
const std::string &arguments, bool trusted);
|
||||||
|
|
||||||
CommandFactoryMap m_commandfactorys; ///< a string to factory map
|
CommandFactoryMap m_commandfactorys; ///< a string to factory map
|
||||||
|
|
||||||
|
|
|
@ -173,12 +173,12 @@ FbCommandFactory::FbCommandFactory() {
|
||||||
}
|
}
|
||||||
|
|
||||||
FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
|
FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
|
||||||
const std::string &arguments) {
|
const std::string &arguments, bool trusted) {
|
||||||
using namespace FbCommands;
|
using namespace FbCommands;
|
||||||
//
|
//
|
||||||
// WM commands
|
// WM commands
|
||||||
//
|
//
|
||||||
if (command == "restart")
|
if (command == "restart" && trusted)
|
||||||
return new RestartFluxboxCmd(arguments);
|
return new RestartFluxboxCmd(arguments);
|
||||||
else if (command == "reconfigure" || command == "reconfig")
|
else if (command == "reconfigure" || command == "reconfig")
|
||||||
return new ReconfigureFluxboxCmd();
|
return new ReconfigureFluxboxCmd();
|
||||||
|
@ -190,11 +190,12 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
|
||||||
return new KeyModeCmd(arguments);
|
return new KeyModeCmd(arguments);
|
||||||
else if (command == "saverc")
|
else if (command == "saverc")
|
||||||
return new SaveResources();
|
return new SaveResources();
|
||||||
else if (command == "execcommand" || command == "execute" || command == "exec")
|
else if (command == "execcommand" || command == "execute" || command == "exec") {
|
||||||
|
if (!trusted) return 0;
|
||||||
return new ExecuteCmd(arguments); // execute command on key screen
|
return new ExecuteCmd(arguments); // execute command on key screen
|
||||||
else if (command == "exit" || command == "quit")
|
} else if (command == "exit" || command == "quit")
|
||||||
return new ExitFluxboxCmd();
|
return new ExitFluxboxCmd();
|
||||||
else if (command == "setenv" || command == "export") {
|
else if ((command == "setenv" || command == "export") && trusted) {
|
||||||
|
|
||||||
string name = arguments;
|
string name = arguments;
|
||||||
FbTk::StringUtil::removeFirstWhitespace(name);
|
FbTk::StringUtil::removeFirstWhitespace(name);
|
||||||
|
@ -216,9 +217,9 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
|
||||||
}
|
}
|
||||||
else if (command == "commanddialog") // run specified fluxbox command
|
else if (command == "commanddialog") // run specified fluxbox command
|
||||||
return new CommandDialogCmd();
|
return new CommandDialogCmd();
|
||||||
else if (command == "bindkey")
|
else if (command == "bindkey" && trusted)
|
||||||
return new BindKeyCmd(arguments);
|
return new BindKeyCmd(arguments);
|
||||||
else if (command == "setresourcevalue") {
|
else if (command == "setresourcevalue" && trusted) {
|
||||||
// we need to parse arguments as:
|
// we need to parse arguments as:
|
||||||
// <remove whitespace here><resname><one whitespace><value>
|
// <remove whitespace here><resname><one whitespace><value>
|
||||||
string name = arguments;
|
string name = arguments;
|
||||||
|
@ -517,7 +518,7 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
|
||||||
}
|
}
|
||||||
c= FbTk::StringUtil::toLower(cmd);
|
c= FbTk::StringUtil::toLower(cmd);
|
||||||
|
|
||||||
FbTk::Command* fbcmd= stringToCommand(c,a);
|
FbTk::Command* fbcmd= stringToCommand(c,a,trusted);
|
||||||
if (fbcmd) {
|
if (fbcmd) {
|
||||||
FbTk::RefCount<FbTk::Command> rfbcmd(fbcmd);
|
FbTk::RefCount<FbTk::Command> rfbcmd(fbcmd);
|
||||||
macro->add(rfbcmd);
|
macro->add(rfbcmd);
|
||||||
|
@ -554,7 +555,7 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
|
||||||
}
|
}
|
||||||
c= FbTk::StringUtil::toLower(cmd);
|
c= FbTk::StringUtil::toLower(cmd);
|
||||||
|
|
||||||
FbTk::Command* fbcmd= stringToCommand(c,a);
|
FbTk::Command* fbcmd= stringToCommand(c,a,trusted);
|
||||||
if (fbcmd) {
|
if (fbcmd) {
|
||||||
FbTk::RefCount<FbTk::Command> rfbcmd(fbcmd);
|
FbTk::RefCount<FbTk::Command> rfbcmd(fbcmd);
|
||||||
macro->add(rfbcmd);
|
macro->add(rfbcmd);
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
class FbCommandFactory: public CommandFactory {
|
class FbCommandFactory: public CommandFactory {
|
||||||
public:
|
public:
|
||||||
FbTk::Command *stringToCommand(const std::string &command,
|
FbTk::Command *stringToCommand(const std::string &command,
|
||||||
const std::string &arguments);
|
const std::string &arguments, bool trusted);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FbCommandFactory();
|
FbCommandFactory();
|
||||||
|
|
|
@ -326,6 +326,7 @@ BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager &rm,
|
||||||
altscrname+".overlay.CapStyle"),
|
altscrname+".overlay.CapStyle"),
|
||||||
scroll_action(rm, "", scrname+".windowScrollAction", altscrname+".WindowScrollAction"),
|
scroll_action(rm, "", scrname+".windowScrollAction", altscrname+".WindowScrollAction"),
|
||||||
scroll_reverse(rm, false, scrname+".windowScrollReverse", altscrname+".WindowScrollReverse"),
|
scroll_reverse(rm, false, scrname+".windowScrollReverse", altscrname+".WindowScrollReverse"),
|
||||||
|
allow_remote_actions(rm, false, scrname+".allowRemoteActions", altscrname+".AllowRemoteActions"),
|
||||||
max_over_tabs(rm, false, scrname+".tabs.maxOver", altscrname+".Tabs.MaxOver"),
|
max_over_tabs(rm, false, scrname+".tabs.maxOver", altscrname+".Tabs.MaxOver"),
|
||||||
default_internal_tabs(rm, true /* TODO: autoconf option? */ , scrname+".tabs.intitlebar", altscrname+".Tabs.InTitlebar") {
|
default_internal_tabs(rm, true /* TODO: autoconf option? */ , scrname+".tabs.intitlebar", altscrname+".Tabs.InTitlebar") {
|
||||||
|
|
||||||
|
@ -785,8 +786,8 @@ void BScreen::update(FbTk::Subject *subj) {
|
||||||
|
|
||||||
void BScreen::propertyNotify(Atom atom) {
|
void BScreen::propertyNotify(Atom atom) {
|
||||||
static Atom fbcmd_atom = XInternAtom(FbTk::App::instance()->display(),
|
static Atom fbcmd_atom = XInternAtom(FbTk::App::instance()->display(),
|
||||||
"_FLUXBOX_COMMAND", False);
|
"_FLUXBOX_ACTION", False);
|
||||||
if (atom == fbcmd_atom) {
|
if (allowRemoteActions() && atom == fbcmd_atom) {
|
||||||
Atom xa_ret_type;
|
Atom xa_ret_type;
|
||||||
int ret_format;
|
int ret_format;
|
||||||
unsigned long ret_nitems, ret_bytes_after;
|
unsigned long ret_nitems, ret_bytes_after;
|
||||||
|
@ -803,7 +804,7 @@ void BScreen::propertyNotify(Atom atom) {
|
||||||
&ret_bytes_after, (unsigned char **)&str);
|
&ret_bytes_after, (unsigned char **)&str);
|
||||||
}
|
}
|
||||||
|
|
||||||
FbTk::RefCount<FbTk::Command> cmd(CommandParser::instance().parseLine(str));
|
FbTk::RefCount<FbTk::Command> cmd(CommandParser::instance().parseLine(str, false));
|
||||||
if (cmd.get())
|
if (cmd.get())
|
||||||
cmd->execute();
|
cmd->execute();
|
||||||
XFree(str);
|
XFree(str);
|
||||||
|
|
|
@ -149,6 +149,7 @@ public:
|
||||||
|
|
||||||
inline const std::string &getScrollAction() const { return *resource.scroll_action; }
|
inline const std::string &getScrollAction() const { return *resource.scroll_action; }
|
||||||
inline const bool getScrollReverse() const { return *resource.scroll_reverse; }
|
inline const bool getScrollReverse() const { return *resource.scroll_reverse; }
|
||||||
|
inline const bool allowRemoteActions() const { return *resource.allow_remote_actions; }
|
||||||
inline const bool getDefaultInternalTabs() const { return *resource.default_internal_tabs; }
|
inline const bool getDefaultInternalTabs() const { return *resource.default_internal_tabs; }
|
||||||
inline const bool getMaxOverTabs() const { return *resource.max_over_tabs; }
|
inline const bool getMaxOverTabs() const { return *resource.max_over_tabs; }
|
||||||
|
|
||||||
|
@ -582,6 +583,7 @@ private:
|
||||||
FbTk::Resource<FbTk::GContext::CapStyle> gc_cap_style;
|
FbTk::Resource<FbTk::GContext::CapStyle> gc_cap_style;
|
||||||
FbTk::Resource<std::string> scroll_action;
|
FbTk::Resource<std::string> scroll_action;
|
||||||
FbTk::Resource<bool> scroll_reverse;
|
FbTk::Resource<bool> scroll_reverse;
|
||||||
|
FbTk::Resource<bool> allow_remote_actions;
|
||||||
FbTk::Resource<bool> max_over_tabs;
|
FbTk::Resource<bool> max_over_tabs;
|
||||||
FbTk::Resource<bool> default_internal_tabs;
|
FbTk::Resource<bool> default_internal_tabs;
|
||||||
|
|
||||||
|
|
|
@ -2564,13 +2564,18 @@ void FluxboxWindow::configureRequestEvent(XConfigureRequestEvent &cr) {
|
||||||
int cx = frame().x(), cy = frame().y(), ignore = 0;
|
int cx = frame().x(), cy = frame().y(), ignore = 0;
|
||||||
unsigned int cw = frame().width(), ch = frame().height();
|
unsigned int cw = frame().width(), ch = frame().height();
|
||||||
|
|
||||||
// if this is not m_client and m_client has resize_inc, make sure the new
|
// make sure the new width/height would be ok with all clients, or else they
|
||||||
// size would be ok with m_client
|
// could try to resize the window back and forth
|
||||||
if (client != m_client && cr.value_mask & CWWidth &&
|
if (client != m_client &&
|
||||||
cr.value_mask & CWHeight &&
|
cr.value_mask & CWWidth && cr.value_mask & CWHeight) {
|
||||||
!m_client->checkSizeHints(cr.width, cr.height)) {
|
ClientList::iterator it = clientList().begin();
|
||||||
sendConfigureNotify();
|
ClientList::iterator it_end = clientList().end();
|
||||||
return;
|
for (; it != it_end; ++it) {
|
||||||
|
if (!m_client->checkSizeHints(cr.width, cr.height)) {
|
||||||
|
sendConfigureNotify();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cr.value_mask & CWBorderWidth)
|
if (cr.value_mask & CWBorderWidth)
|
||||||
|
|
|
@ -40,7 +40,7 @@ int main(int argc, char **argv) {
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Atom fbcmd_atom = XInternAtom(disp, "_FLUXBOX_COMMAND", False);
|
Atom fbcmd_atom = XInternAtom(disp, "_FLUXBOX_ACTION", False);
|
||||||
Window root = DefaultRootWindow(disp);
|
Window root = DefaultRootWindow(disp);
|
||||||
|
|
||||||
char *str = argv[1];
|
char *str = argv[1];
|
||||||
|
|
Loading…
Reference in a new issue