Fix -Wextra warnings
This commit is contained in:
parent
168b182a7d
commit
aa0fda1984
@ -14,10 +14,6 @@
|
|||||||
#define DEFAULT_MAX_UPDATES_BYTES (2LL<<30)
|
#define DEFAULT_MAX_UPDATES_BYTES (2LL<<30)
|
||||||
#define DEFAULT_MAX_UPDATES_FILES 2048
|
#define DEFAULT_MAX_UPDATES_FILES 2048
|
||||||
|
|
||||||
void notify_progress(int p1, int p2)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int prepare_creds_return_uid(const char *username)
|
int prepare_creds_return_uid(const char *username)
|
||||||
{
|
{
|
||||||
struct passwd *pwd;
|
struct passwd *pwd;
|
||||||
|
@ -61,19 +61,26 @@ const char *default_user = "user";
|
|||||||
const char default_user_keyword[] = "DEFAULT:";
|
const char default_user_keyword[] = "DEFAULT:";
|
||||||
#define default_user_keyword_len_without_colon (sizeof(default_user_keyword)-2)
|
#define default_user_keyword_len_without_colon (sizeof(default_user_keyword)-2)
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
|
||||||
|
#else
|
||||||
|
# define UNUSED(x) UNUSED_ ## x
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
we need to track the number of children, so that excessive QREXEC_EXECUTE_*
|
we need to track the number of children, so that excessive QREXEC_EXECUTE_*
|
||||||
commands do not fork-bomb dom0
|
commands do not fork-bomb dom0
|
||||||
*/
|
*/
|
||||||
volatile int children_count;
|
volatile int children_count;
|
||||||
|
|
||||||
void sigusr1_handler(int x)
|
void sigusr1_handler(int UNUSED(x))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "connected\n");
|
fprintf(stderr, "connected\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sigchld_parent_handler(int x)
|
void sigchld_parent_handler(int UNUSED(x))
|
||||||
{
|
{
|
||||||
children_count--;
|
children_count--;
|
||||||
/* starting value is 0 so we see dead real qrexec-daemon as -1 */
|
/* starting value is 0 so we see dead real qrexec-daemon as -1 */
|
||||||
@ -314,7 +321,7 @@ void handle_message_from_client(int fd)
|
|||||||
// We have already passed cmdline from client.
|
// We have already passed cmdline from client.
|
||||||
// Now the client passes us raw data from its stdin.
|
// Now the client passes us raw data from its stdin.
|
||||||
len = buffer_space_vchan_ext();
|
len = buffer_space_vchan_ext();
|
||||||
if (len <= sizeof s_hdr)
|
if (len <= (int)sizeof s_hdr)
|
||||||
return;
|
return;
|
||||||
/* Read at most the amount of data that we have room for in vchan */
|
/* Read at most the amount of data that we have room for in vchan */
|
||||||
ret = read(fd, buf, len - sizeof(s_hdr));
|
ret = read(fd, buf, len - sizeof(s_hdr));
|
||||||
@ -412,7 +419,7 @@ flag in appropriate moment.
|
|||||||
|
|
||||||
int child_exited;
|
int child_exited;
|
||||||
|
|
||||||
void sigchld_handler(int x)
|
void sigchld_handler(int UNUSED(x))
|
||||||
{
|
{
|
||||||
child_exited = 1;
|
child_exited = 1;
|
||||||
signal(SIGCHLD, sigchld_handler);
|
signal(SIGCHLD, sigchld_handler);
|
||||||
@ -512,7 +519,7 @@ void handle_execute_predefined_command(void)
|
|||||||
|
|
||||||
void check_client_id_in_range(unsigned int untrusted_client_id)
|
void check_client_id_in_range(unsigned int untrusted_client_id)
|
||||||
{
|
{
|
||||||
if (untrusted_client_id >= MAX_CLIENTS || untrusted_client_id < 0) {
|
if (untrusted_client_id >= MAX_CLIENTS) {
|
||||||
fprintf(stderr, "from agent: client_id=%d\n",
|
fprintf(stderr, "from agent: client_id=%d\n",
|
||||||
untrusted_client_id);
|
untrusted_client_id);
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -529,8 +536,7 @@ void sanitize_message_from_agent(struct server_header *untrusted_header)
|
|||||||
case MSG_AGENT_TO_SERVER_STDERR:
|
case MSG_AGENT_TO_SERVER_STDERR:
|
||||||
case MSG_AGENT_TO_SERVER_EXIT_CODE:
|
case MSG_AGENT_TO_SERVER_EXIT_CODE:
|
||||||
check_client_id_in_range(untrusted_header->client_id);
|
check_client_id_in_range(untrusted_header->client_id);
|
||||||
if (untrusted_header->len > MAX_DATA_CHUNK
|
if (untrusted_header->len > MAX_DATA_CHUNK) {
|
||||||
|| untrusted_header->len < 0) {
|
|
||||||
fprintf(stderr, "agent feeded %d of data bytes?\n",
|
fprintf(stderr, "agent feeded %d of data bytes?\n",
|
||||||
untrusted_header->len);
|
untrusted_header->len);
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -663,7 +669,7 @@ int main(int argc, char **argv)
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
max = fill_fdsets_for_select(&read_fdset, &write_fdset);
|
max = fill_fdsets_for_select(&read_fdset, &write_fdset);
|
||||||
if (buffer_space_vchan_ext() <=
|
if (buffer_space_vchan_ext() <=
|
||||||
sizeof(struct server_header))
|
(int)sizeof(struct server_header))
|
||||||
FD_ZERO(&read_fdset); // vchan full - don't read from clients
|
FD_ZERO(&read_fdset); // vchan full - don't read from clients
|
||||||
|
|
||||||
sigprocmask(SIG_BLOCK, &chld_set, NULL);
|
sigprocmask(SIG_BLOCK, &chld_set, NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user