From 475421b2e29bd00d9149bbe2ffb77fc481b79ce7 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Sat, 28 Dec 2013 06:49:30 -0500 Subject: [PATCH] core-agent-linux: misc const fixups --- qrexec/qrexec-agent.c | 8 ++++---- qubes-rpc/ioall.c | 4 ++-- qubes-rpc/qfile-unpacker.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/qrexec/qrexec-agent.c b/qrexec/qrexec-agent.c index 1e833d9..be63963 100644 --- a/qrexec/qrexec-agent.c +++ b/qrexec/qrexec-agent.c @@ -112,14 +112,14 @@ void no_colon_in_cmd() exit(1); } -void do_exec(char *cmd) +void do_exec(const char *cmd) { char buf[strlen(QUBES_RPC_MULTIPLEXER_PATH) + strlen(cmd) - strlen(QUBES_RPC_MAGIC_CMD) + 1]; - char *realcmd = index(cmd, ':'); + char *realcmd = index(cmd, ':'), *user; if (!realcmd) no_colon_in_cmd(); /* mark end of username and move to command */ - *realcmd = 0; + user=strndup(cmd,realcmd-cmd); realcmd++; /* ignore "nogui:" prefix in linux agent */ if (strncmp(realcmd, "nogui:", 6) == 0) @@ -133,7 +133,7 @@ void do_exec(char *cmd) signal(SIGCHLD, SIG_DFL); signal(SIGPIPE, SIG_DFL); - execl("/bin/su", "su", "-", cmd, "-c", realcmd, NULL); + execl("/bin/su", "su", "-", user, "-c", realcmd, NULL); perror("execl"); exit(1); } diff --git a/qubes-rpc/ioall.c b/qubes-rpc/ioall.c index ce61700..ef04e0b 100644 --- a/qubes-rpc/ioall.c +++ b/qubes-rpc/ioall.c @@ -25,7 +25,7 @@ #include #include -void perror_wrapper(char * msg) +void perror_wrapper(const char * msg) { int prev=errno; perror(msg); @@ -48,7 +48,7 @@ void set_block(int fd) fcntl(fd, F_SETFL, fl & ~O_NONBLOCK); } -int write_all(int fd, void *buf, int size) +int write_all(int fd, const void *buf, int size) { int written = 0; int ret; diff --git a/qubes-rpc/qfile-unpacker.c b/qubes-rpc/qfile-unpacker.c index 1286d27..cd406c8 100644 --- a/qubes-rpc/qfile-unpacker.c +++ b/qubes-rpc/qfile-unpacker.c @@ -12,7 +12,7 @@ #include #include #define INCOMING_DIR_ROOT "/home/user/QubesIncoming" -int prepare_creds_return_uid(char *username) +int prepare_creds_return_uid(const char *username) { struct passwd *pwd; pwd = getpwnam(username); @@ -37,7 +37,7 @@ int main(int argc, char ** argv) { char *incoming_dir; int uid; - char *remote_domain; + const char *remote_domain; uid = prepare_creds_return_uid("user");