core-agent-linux: misc const fixups
This commit is contained in:
parent
4a4e81f010
commit
475421b2e2
@ -112,14 +112,14 @@ void no_colon_in_cmd()
|
|||||||
exit(1);
|
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 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)
|
if (!realcmd)
|
||||||
no_colon_in_cmd();
|
no_colon_in_cmd();
|
||||||
/* mark end of username and move to command */
|
/* mark end of username and move to command */
|
||||||
*realcmd = 0;
|
user=strndup(cmd,realcmd-cmd);
|
||||||
realcmd++;
|
realcmd++;
|
||||||
/* ignore "nogui:" prefix in linux agent */
|
/* ignore "nogui:" prefix in linux agent */
|
||||||
if (strncmp(realcmd, "nogui:", 6) == 0)
|
if (strncmp(realcmd, "nogui:", 6) == 0)
|
||||||
@ -133,7 +133,7 @@ void do_exec(char *cmd)
|
|||||||
signal(SIGCHLD, SIG_DFL);
|
signal(SIGCHLD, SIG_DFL);
|
||||||
signal(SIGPIPE, SIG_DFL);
|
signal(SIGPIPE, SIG_DFL);
|
||||||
|
|
||||||
execl("/bin/su", "su", "-", cmd, "-c", realcmd, NULL);
|
execl("/bin/su", "su", "-", user, "-c", realcmd, NULL);
|
||||||
perror("execl");
|
perror("execl");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
void perror_wrapper(char * msg)
|
void perror_wrapper(const char * msg)
|
||||||
{
|
{
|
||||||
int prev=errno;
|
int prev=errno;
|
||||||
perror(msg);
|
perror(msg);
|
||||||
@ -48,7 +48,7 @@ void set_block(int fd)
|
|||||||
fcntl(fd, F_SETFL, fl & ~O_NONBLOCK);
|
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 written = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <libqubes-rpc-filecopy.h>
|
#include <libqubes-rpc-filecopy.h>
|
||||||
#define INCOMING_DIR_ROOT "/home/user/QubesIncoming"
|
#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;
|
struct passwd *pwd;
|
||||||
pwd = getpwnam(username);
|
pwd = getpwnam(username);
|
||||||
@ -37,7 +37,7 @@ int main(int argc, char ** argv)
|
|||||||
{
|
{
|
||||||
char *incoming_dir;
|
char *incoming_dir;
|
||||||
int uid;
|
int uid;
|
||||||
char *remote_domain;
|
const char *remote_domain;
|
||||||
|
|
||||||
uid = prepare_creds_return_uid("user");
|
uid = prepare_creds_return_uid("user");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user