Skip to content
Snippets Groups Projects
Commit 598056d1 authored by Francois Perrad's avatar Francois Perrad
Browse files

Pointer parameter could be declared as pointing to const (callback)

parent 89e64c63
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -84,7 +84,7 @@ struct Channel {
int flushing;
 
/* Used by client chansession to handle ~ escaping, NULL ignored otherwise */
void (*read_mangler)(struct Channel*, unsigned char* bytes, int *len);
void (*read_mangler)(const struct Channel*, const unsigned char* bytes, int *len);
 
const struct ChanType* type;
 
Loading
Loading
@@ -98,7 +98,7 @@ struct ChanType {
int (*inithandler)(struct Channel*);
int (*check_close)(struct Channel*);
void (*reqhandler)(struct Channel*);
void (*closehandler)(struct Channel*);
void (*closehandler)(const struct Channel*);
};
 
/* Callback for connect_remote */
Loading
Loading
Loading
Loading
@@ -35,12 +35,12 @@
#include "chansession.h"
#include "agentfwd.h"
 
static void cli_closechansess(struct Channel *channel);
static void cli_closechansess(const struct Channel *channel);
static int cli_initchansess(struct Channel *channel);
static void cli_chansessreq(struct Channel *channel);
static void send_chansess_pty_req(const struct Channel *channel);
static void send_chansess_shell_req(const struct Channel *channel);
static void cli_escape_handler(struct Channel *channel, unsigned char* buf, int *len);
static void cli_escape_handler(const struct Channel *channel, const unsigned char* buf, int *len);
static int cli_init_netcat(struct Channel *channel);
 
static void cli_tty_setup(void);
Loading
Loading
@@ -83,7 +83,7 @@ out:
 
/* If the main session goes, we close it up */
static void cli_closechansess(struct Channel *UNUSED(channel)) {
static void cli_closechansess(const struct Channel *UNUSED(channel)) {
cli_tty_cleanup(); /* Restore tty modes etc */
 
/* This channel hasn't gone yet, so we have > 1 */
Loading
Loading
@@ -452,7 +452,7 @@ do_escape(unsigned char c) {
}
 
static
void cli_escape_handler(struct Channel* UNUSED(channel), unsigned char* buf, int *len) {
void cli_escape_handler(const struct Channel* UNUSED(channel), const unsigned char* buf, int *len) {
char c;
int skip_char = 0;
 
Loading
Loading
Loading
Loading
@@ -142,7 +142,7 @@ static void cli_dropbear_log(int priority,
fflush(stderr);
}
 
static void exec_proxy_cmd(void *user_data_cmd) {
static void exec_proxy_cmd(const void *user_data_cmd) {
const char *cmd = user_data_cmd;
char *usershell;
 
Loading
Loading
Loading
Loading
@@ -241,7 +241,7 @@ int connect_unix(const char* path) {
* it will be run after the child has fork()ed, and is passed exec_data.
* If ret_errfd == NULL then stderr will not be captured.
* ret_pid can be passed as NULL to discard the pid. */
int spawn_command(void(*exec_fn)(void *user_data), void *exec_data,
int spawn_command(void(*exec_fn)(const void *user_data), const void *exec_data,
int *ret_writefd, int *ret_readfd, int *ret_errfd, pid_t *ret_pid) {
int infds[2];
int outfds[2];
Loading
Loading
Loading
Loading
@@ -56,7 +56,7 @@ extern int debug_trace;
 
char * stripcontrol(const char * text);
 
int spawn_command(void(*exec_fn)(void *user_data), void *exec_data,
int spawn_command(void(*exec_fn)(const void *user_data), const void *exec_data,
int *writefd, int *readfd, int *errfd, pid_t *pid);
void run_shell_command(const char* cmd, unsigned int maxfd, char* usershell);
#ifdef ENABLE_CONNECT_UNIX
Loading
Loading
Loading
Loading
@@ -78,8 +78,8 @@ void handle_listeners(const fd_set * readfds) {
* cleanup(void* typedata) happens when cleaning up */
struct Listener* new_listener(const int socks[], unsigned int nsocks,
int type, void* typedata,
void (*acceptor)(struct Listener* listener, int sock),
void (*cleanup)(struct Listener*)) {
void (*acceptor)(const struct Listener* listener, int sock),
void (*cleanup)(const struct Listener*)) {
 
unsigned int i, j;
struct Listener *newlisten = NULL;
Loading
Loading
@@ -132,8 +132,8 @@ struct Listener* new_listener(const int socks[], unsigned int nsocks,
 
/* Return the first listener which matches the type-specific comparison
* function. Particularly needed for global requests, like tcp */
struct Listener * get_listener(int type, void* typedata,
int (*match)(void*, void*)) {
struct Listener * get_listener(int type, const void* typedata,
int (*match)(const void*, const void*)) {
 
unsigned int i;
struct Listener* listener;
Loading
Loading
Loading
Loading
@@ -35,8 +35,8 @@ struct Listener {
 
int index; /* index in the array of listeners */
 
void (*acceptor)(struct Listener*, int sock);
void (*cleanup)(struct Listener*);
void (*acceptor)(const struct Listener*, int sock);
void (*cleanup)(const struct Listener*);
 
int type; /* CHANNEL_ID_X11, CHANNEL_ID_AGENT,
CHANNEL_ID_TCPDIRECT (for clients),
Loading
Loading
@@ -52,11 +52,11 @@ void set_listener_fds(fd_set * readfds);
 
struct Listener* new_listener(const int socks[], unsigned int nsocks,
int type, void* typedata,
void (*acceptor)(struct Listener* listener, int sock),
void (*cleanup)(struct Listener*));
void (*acceptor)(const struct Listener* listener, int sock),
void (*cleanup)(const struct Listener*));
 
struct Listener * get_listener(int type, void* typedata,
int (*match)(void*, void*));
struct Listener * get_listener(int type, const void* typedata,
int (*match)(const void*, const void*));
 
void remove_listener(struct Listener* listener);
 
Loading
Loading
Loading
Loading
@@ -45,7 +45,7 @@
 
static int send_msg_channel_open_agent(int fd);
static int bindagent(int fd, struct ChanSess * chansess);
static void agentaccept(struct Listener * listener, int sock);
static void agentaccept(const struct Listener * listener, int sock);
 
/* Handles client requests to start agent forwarding, sets up listening socket.
* Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */
Loading
Loading
@@ -100,7 +100,7 @@ fail:
/* accepts a connection on the forwarded socket and opens a new channel for it
* back to the client */
/* returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */
static void agentaccept(struct Listener *UNUSED(listener), int sock) {
static void agentaccept(const struct Listener *UNUSED(listener), int sock) {
 
int fd;
 
Loading
Loading
Loading
Loading
@@ -47,10 +47,10 @@ static int sessionsignal(const struct ChanSess *chansess);
static int noptycommand(struct Channel *channel, struct ChanSess *chansess);
static int ptycommand(struct Channel *channel, struct ChanSess *chansess);
static int sessionwinchange(const struct ChanSess *chansess);
static void execchild(void *user_data_chansess);
static void execchild(const void *user_data_chansess);
static void addchildpid(struct ChanSess *chansess, pid_t pid);
static void sesssigchild_handler(int val);
static void closechansess(struct Channel *channel);
static void closechansess(const struct Channel *channel);
static int newchansess(struct Channel *channel);
static void chansessionrequest(struct Channel *channel);
static int sesscheckclose(const struct Channel *channel);
Loading
Loading
@@ -281,7 +281,7 @@ chansess_login_alloc(const struct ChanSess *chansess) {
}
 
/* clean a session channel */
static void closechansess(struct Channel *channel) {
static void closechansess(const struct Channel *channel) {
 
struct ChanSess *chansess;
unsigned int i;
Loading
Loading
@@ -898,7 +898,7 @@ static void addchildpid(struct ChanSess *chansess, pid_t pid) {
 
/* Clean up, drop to user privileges, set up the environment and execute
* the command/shell. This function does not return. */
static void execchild(void *user_data) {
static void execchild(const void *user_data) {
struct ChanSess *chansess = user_data;
char *usershell = NULL;
 
Loading
Loading
Loading
Loading
@@ -107,7 +107,7 @@ out:
TRACE(("leave recv_msg_global_request"))
}
 
static int matchtcp(void* typedata1, void* typedata2) {
static int matchtcp(const void* typedata1, const void* typedata2) {
 
const struct TCPListener *info1 = (struct TCPListener*)typedata1;
const struct TCPListener *info2 = (struct TCPListener*)typedata2;
Loading
Loading
Loading
Loading
@@ -38,7 +38,7 @@
#define X11BASEPORT 6000
#define X11BINDBASE 6010
 
static void x11accept(struct Listener* listener, int sock);
static void x11accept(const struct Listener* listener, int sock);
static int bindport(int fd);
static int send_msg_channel_open_x11(int fd, const struct sockaddr_in* addr);
 
Loading
Loading
@@ -126,7 +126,7 @@ fail:
 
/* accepts a new X11 socket */
/* returns DROPBEAR_FAILURE or DROPBEAR_SUCCESS */
static void x11accept(struct Listener* listener, int sock) {
static void x11accept(const struct Listener* listener, int sock) {
 
int fd;
struct sockaddr_in addr;
Loading
Loading
Loading
Loading
@@ -35,7 +35,7 @@
 
#if DROPBEAR_TCP_ACCEPT
 
static void cleanup_tcp(struct Listener *listener) {
static void cleanup_tcp(const struct Listener *listener) {
 
struct TCPListener *tcpinfo = (struct TCPListener*)(listener->typedata);
 
Loading
Loading
@@ -52,7 +52,7 @@ int tcp_prio_inithandler(struct Channel* channel)
return 0;
}
 
static void tcp_acceptor(struct Listener *listener, int sock) {
static void tcp_acceptor(const struct Listener *listener, int sock) {
 
int fd;
struct sockaddr_storage sa;
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment