comparison svr-x11fwd.c @ 13:db2c8e6fb284

Fixed stupid agentfwd error (using the listening FD, not the accepted on. gah)
author Matt Johnston <matt@ucc.asn.au>
date Thu, 03 Jun 2004 18:08:34 +0000
parents 7a37cff27258
children 20563735e8b5
comparison
equal deleted inserted replaced
12:7a37cff27258 13:db2c8e6fb284
104 104
105 int fd; 105 int fd;
106 struct sockaddr_in addr; 106 struct sockaddr_in addr;
107 int len; 107 int len;
108 int ret; 108 int ret;
109 struct ChanSess * chansess = (struct ChanSess *)(listener->typedata);
109 110
110 len = sizeof(addr); 111 len = sizeof(addr);
111 112
112 fd = accept(listener->sock, (struct sockaddr*)&addr, &len); 113 fd = accept(listener->sock, (struct sockaddr*)&addr, &len);
113 if (fd < 0) { 114 if (fd < 0) {
114 return; 115 return;
115 } 116 }
116 117
117 /* if single-connection we close it up */ 118 /* if single-connection we close it up */
118 if (((struct ChanSess *)(listener->typedata))->x11singleconn) { 119 if (chansess->x11singleconn) {
119 x11cleanup(listener); 120 x11cleanup(chansess);
120 } 121 }
121 122
122 ret = send_msg_channel_open_x11(fd, &addr); 123 ret = send_msg_channel_open_x11(fd, &addr);
123 if (ret == DROPBEAR_FAILURE) { 124 if (ret == DROPBEAR_FAILURE) {
124 close(fd); 125 close(fd);
164 } else { 165 } else {
165 fprintf(stderr, "Failed to run %s\n", XAUTH_COMMAND); 166 fprintf(stderr, "Failed to run %s\n", XAUTH_COMMAND);
166 } 167 }
167 } 168 }
168 169
169 void x11cleanup(struct Listener *listener) { 170 void x11cleanup(struct ChanSess *chansess) {
170
171 struct ChanSess *chansess = (struct ChanSess*)listener->typedata;
172 171
173 m_free(chansess->x11authprot); 172 m_free(chansess->x11authprot);
174 m_free(chansess->x11authcookie); 173 m_free(chansess->x11authcookie);
175 remove_listener(listener); 174 remove_listener(chansess->x11listener);
176 chansess->x11listener = NULL; 175 chansess->x11listener = NULL;
177 } 176 }
178 177
179 static const struct ChanType chan_x11 = { 178 static const struct ChanType chan_x11 = {
180 0, /* sepfds */ 179 0, /* sepfds */