comparison svr-x11fwd.c @ 1461:fb90a5ba84e0

Merge pull request #49 from fperrad/20170812_lint Some linting, const parameters
author Matt Johnston <matt@ucc.asn.au>
date Thu, 25 Jan 2018 21:55:25 +0800
parents 58a74cb829b8
children 79eef94ccea9
comparison
equal deleted inserted replaced
1454:ef310db5ccec 1461:fb90a5ba84e0
36 #include "auth.h" 36 #include "auth.h"
37 37
38 #define X11BASEPORT 6000 38 #define X11BASEPORT 6000
39 #define X11BINDBASE 6010 39 #define X11BINDBASE 6010
40 40
41 static void x11accept(struct Listener* listener, int sock); 41 static void x11accept(const struct Listener* listener, int sock);
42 static int bindport(int fd); 42 static int bindport(int fd);
43 static int send_msg_channel_open_x11(int fd, struct sockaddr_in* addr); 43 static int send_msg_channel_open_x11(int fd, const struct sockaddr_in* addr);
44 44
45 /* Check untrusted xauth strings for metacharacters */ 45 /* Check untrusted xauth strings for metacharacters */
46 /* Returns DROPBEAR_SUCCESS/DROPBEAR_FAILURE */ 46 /* Returns DROPBEAR_SUCCESS/DROPBEAR_FAILURE */
47 static int 47 static int
48 xauth_valid_string(const char *s) 48 xauth_valid_string(const char *s)
124 return DROPBEAR_FAILURE; 124 return DROPBEAR_FAILURE;
125 } 125 }
126 126
127 /* accepts a new X11 socket */ 127 /* accepts a new X11 socket */
128 /* returns DROPBEAR_FAILURE or DROPBEAR_SUCCESS */ 128 /* returns DROPBEAR_FAILURE or DROPBEAR_SUCCESS */
129 static void x11accept(struct Listener* listener, int sock) { 129 static void x11accept(const struct Listener* listener, int sock) {
130 130
131 int fd; 131 int fd;
132 struct sockaddr_in addr; 132 struct sockaddr_in addr;
133 socklen_t len; 133 socklen_t len;
134 int ret; 134 int ret;
152 } 152 }
153 } 153 }
154 154
155 /* This is called after switching to the user, and sets up the xauth 155 /* This is called after switching to the user, and sets up the xauth
156 * and environment variables. */ 156 * and environment variables. */
157 void x11setauth(struct ChanSess *chansess) { 157 void x11setauth(const struct ChanSess *chansess) {
158 158
159 char display[20]; /* space for "localhost:12345.123" */ 159 char display[20]; /* space for "localhost:12345.123" */
160 FILE * authprog = NULL; 160 FILE * authprog = NULL;
161 int val; 161 int val;
162 162
218 NULL, /* reqhandler */ 218 NULL, /* reqhandler */
219 NULL /* closehandler */ 219 NULL /* closehandler */
220 }; 220 };
221 221
222 222
223 static int send_msg_channel_open_x11(int fd, struct sockaddr_in* addr) { 223 static int send_msg_channel_open_x11(int fd, const struct sockaddr_in* addr) {
224 224
225 char* ipstring = NULL; 225 char* ipstring = NULL;
226 226
227 if (send_msg_channel_open_init(fd, &chan_x11) == DROPBEAR_SUCCESS) { 227 if (send_msg_channel_open_init(fd, &chan_x11) == DROPBEAR_SUCCESS) {
228 ipstring = inet_ntoa(addr->sin_addr); 228 ipstring = inet_ntoa(addr->sin_addr);