Mercurial > dropbear
comparison svr-chansession.c @ 241:c5d3ef11155f
* use own assertions which should get logged properly
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Mon, 05 Sep 2005 15:16:10 +0000 |
parents | 1a52846ec11f |
children | 84925eceeb13 |
comparison
equal
deleted
inserted
replaced
238:e923801a7678 | 241:c5d3ef11155f |
---|---|
146 | 146 |
147 /* send the exitstatus to the client */ | 147 /* send the exitstatus to the client */ |
148 static void send_msg_chansess_exitstatus(struct Channel * channel, | 148 static void send_msg_chansess_exitstatus(struct Channel * channel, |
149 struct ChanSess * chansess) { | 149 struct ChanSess * chansess) { |
150 | 150 |
151 assert(chansess->exit.exitpid != -1); | 151 dropbear_assert(chansess->exit.exitpid != -1); |
152 assert(chansess->exit.exitsignal == -1); | 152 dropbear_assert(chansess->exit.exitsignal == -1); |
153 | 153 |
154 CHECKCLEARTOWRITE(); | 154 CHECKCLEARTOWRITE(); |
155 | 155 |
156 buf_putbyte(ses.writepayload, SSH_MSG_CHANNEL_REQUEST); | 156 buf_putbyte(ses.writepayload, SSH_MSG_CHANNEL_REQUEST); |
157 buf_putint(ses.writepayload, channel->remotechan); | 157 buf_putint(ses.writepayload, channel->remotechan); |
168 struct ChanSess * chansess) { | 168 struct ChanSess * chansess) { |
169 | 169 |
170 int i; | 170 int i; |
171 char* signame = NULL; | 171 char* signame = NULL; |
172 | 172 |
173 assert(chansess->exit.exitpid != -1); | 173 dropbear_assert(chansess->exit.exitpid != -1); |
174 assert(chansess->exit.exitsignal > 0); | 174 dropbear_assert(chansess->exit.exitsignal > 0); |
175 | 175 |
176 CHECKCLEARTOWRITE(); | 176 CHECKCLEARTOWRITE(); |
177 | 177 |
178 /* we check that we can match a signal name, otherwise | 178 /* we check that we can match a signal name, otherwise |
179 * don't send anything */ | 179 * don't send anything */ |
203 /* set up a session channel */ | 203 /* set up a session channel */ |
204 static int newchansess(struct Channel *channel) { | 204 static int newchansess(struct Channel *channel) { |
205 | 205 |
206 struct ChanSess *chansess; | 206 struct ChanSess *chansess; |
207 | 207 |
208 assert(channel->typedata == NULL); | 208 dropbear_assert(channel->typedata == NULL); |
209 | 209 |
210 chansess = (struct ChanSess*)m_malloc(sizeof(struct ChanSess)); | 210 chansess = (struct ChanSess*)m_malloc(sizeof(struct ChanSess)); |
211 chansess->cmd = NULL; | 211 chansess->cmd = NULL; |
212 chansess->pid = 0; | 212 chansess->pid = 0; |
213 | 213 |
277 #endif | 277 #endif |
278 | 278 |
279 /* clear child pid entries */ | 279 /* clear child pid entries */ |
280 for (i = 0; i < svr_ses.childpidsize; i++) { | 280 for (i = 0; i < svr_ses.childpidsize; i++) { |
281 if (svr_ses.childpids[i].chansess == chansess) { | 281 if (svr_ses.childpids[i].chansess == chansess) { |
282 assert(svr_ses.childpids[i].pid > 0); | 282 dropbear_assert(svr_ses.childpids[i].pid > 0); |
283 TRACE(("closing pid %d", svr_ses.childpids[i].pid)) | 283 TRACE(("closing pid %d", svr_ses.childpids[i].pid)) |
284 TRACE(("exitpid = %d", chansess->exit.exitpid)) | 284 TRACE(("exitpid = %d", chansess->exit.exitpid)) |
285 svr_ses.childpids[i].pid = -1; | 285 svr_ses.childpids[i].pid = -1; |
286 svr_ses.childpids[i].chansess = NULL; | 286 svr_ses.childpids[i].chansess = NULL; |
287 } | 287 } |
311 TRACE(("leave chansessionrequest: type too long")) /* XXX send error?*/ | 311 TRACE(("leave chansessionrequest: type too long")) /* XXX send error?*/ |
312 goto out; | 312 goto out; |
313 } | 313 } |
314 | 314 |
315 chansess = (struct ChanSess*)channel->typedata; | 315 chansess = (struct ChanSess*)channel->typedata; |
316 assert(chansess != NULL); | 316 dropbear_assert(chansess != NULL); |
317 TRACE(("type is %s", type)) | 317 TRACE(("type is %s", type)) |
318 | 318 |
319 if (strcmp(type, "window-change") == 0) { | 319 if (strcmp(type, "window-change") == 0) { |
320 ret = sessionwinchange(chansess); | 320 ret = sessionwinchange(chansess); |
321 } else if (strcmp(type, "shell") == 0) { | 321 } else if (strcmp(type, "shell") == 0) { |