comparison svr-chansession.c @ 1123:d7b752525b91

buf_getstring and buf_putstring now use non-unsigned char*
author Matt Johnston <matt@ucc.asn.au>
date Thu, 04 Jun 2015 23:08:50 +0800
parents 367d3800555b
children b1fabf797bd3
comparison
equal deleted inserted replaced
1121:bb3a03feb31f 1123:d7b752525b91
181 181
182 CHECKCLEARTOWRITE(); 182 CHECKCLEARTOWRITE();
183 183
184 buf_putbyte(ses.writepayload, SSH_MSG_CHANNEL_REQUEST); 184 buf_putbyte(ses.writepayload, SSH_MSG_CHANNEL_REQUEST);
185 buf_putint(ses.writepayload, channel->remotechan); 185 buf_putint(ses.writepayload, channel->remotechan);
186 buf_putstring(ses.writepayload, (const unsigned char *) "exit-status", 11); 186 buf_putstring(ses.writepayload, "exit-status", 11);
187 buf_putbyte(ses.writepayload, 0); /* boolean FALSE */ 187 buf_putbyte(ses.writepayload, 0); /* boolean FALSE */
188 buf_putint(ses.writepayload, chansess->exit.exitstatus); 188 buf_putint(ses.writepayload, chansess->exit.exitstatus);
189 189
190 encrypt_packet(); 190 encrypt_packet();
191 191
217 return; 217 return;
218 } 218 }
219 219
220 buf_putbyte(ses.writepayload, SSH_MSG_CHANNEL_REQUEST); 220 buf_putbyte(ses.writepayload, SSH_MSG_CHANNEL_REQUEST);
221 buf_putint(ses.writepayload, channel->remotechan); 221 buf_putint(ses.writepayload, channel->remotechan);
222 buf_putstring(ses.writepayload, (const unsigned char *) "exit-signal", 11); 222 buf_putstring(ses.writepayload, "exit-signal", 11);
223 buf_putbyte(ses.writepayload, 0); /* boolean FALSE */ 223 buf_putbyte(ses.writepayload, 0); /* boolean FALSE */
224 buf_putstring(ses.writepayload, (const unsigned char *) signame, strlen(signame)); 224 buf_putstring(ses.writepayload, signame, strlen(signame));
225 buf_putbyte(ses.writepayload, chansess->exit.exitcore); 225 buf_putbyte(ses.writepayload, chansess->exit.exitcore);
226 buf_putstring(ses.writepayload, (const unsigned char *) "", 0); /* error msg */ 226 buf_putstring(ses.writepayload, "", 0); /* error msg */
227 buf_putstring(ses.writepayload, (const unsigned char *) "", 0); /* lang */ 227 buf_putstring(ses.writepayload, "", 0); /* lang */
228 228
229 encrypt_packet(); 229 encrypt_packet();
230 } 230 }
231 231
232 /* set up a session channel */ 232 /* set up a session channel */
349 int ret = 1; 349 int ret = 1;
350 struct ChanSess *chansess; 350 struct ChanSess *chansess;
351 351
352 TRACE(("enter chansessionrequest")) 352 TRACE(("enter chansessionrequest"))
353 353
354 type = (char *) buf_getstring(ses.payload, &typelen); 354 type = buf_getstring(ses.payload, &typelen);
355 wantreply = buf_getbool(ses.payload); 355 wantreply = buf_getbool(ses.payload);
356 356
357 if (typelen > MAX_NAME_LEN) { 357 if (typelen > MAX_NAME_LEN) {
358 TRACE(("leave chansessionrequest: type too long")) /* XXX send error?*/ 358 TRACE(("leave chansessionrequest: type too long")) /* XXX send error?*/
359 goto out; 359 goto out;
412 if (chansess->pid == 0) { 412 if (chansess->pid == 0) {
413 /* haven't got a process pid yet */ 413 /* haven't got a process pid yet */
414 return DROPBEAR_FAILURE; 414 return DROPBEAR_FAILURE;
415 } 415 }
416 416
417 signame = (char *) buf_getstring(ses.payload, NULL); 417 signame = buf_getstring(ses.payload, NULL);
418 418
419 i = 0; 419 i = 0;
420 while (signames[i].name != 0) { 420 while (signames[i].name != 0) {
421 if (strcmp(signames[i].name, signame) == 0) { 421 if (strcmp(signames[i].name, signame) == 0) {
422 sig = signames[i].signal; 422 sig = signames[i].signal;
565 if (!svr_pubkey_allows_pty()) { 565 if (!svr_pubkey_allows_pty()) {
566 TRACE(("leave sessionpty : pty forbidden by public key option")) 566 TRACE(("leave sessionpty : pty forbidden by public key option"))
567 return DROPBEAR_FAILURE; 567 return DROPBEAR_FAILURE;
568 } 568 }
569 569
570 chansess->term = (char *) buf_getstring(ses.payload, &termlen); 570 chansess->term = buf_getstring(ses.payload, &termlen);
571 if (termlen > MAX_TERM_LEN) { 571 if (termlen > MAX_TERM_LEN) {
572 /* TODO send disconnect ? */ 572 /* TODO send disconnect ? */
573 TRACE(("leave sessionpty: term len too long")) 573 TRACE(("leave sessionpty: term len too long"))
574 return DROPBEAR_FAILURE; 574 return DROPBEAR_FAILURE;
575 } 575 }
647 } 647 }
648 648
649 if (iscmd) { 649 if (iscmd) {
650 /* "exec" */ 650 /* "exec" */
651 if (chansess->cmd == NULL) { 651 if (chansess->cmd == NULL) {
652 chansess->cmd = (char *) buf_getstring(ses.payload, &cmdlen); 652 chansess->cmd = buf_getstring(ses.payload, &cmdlen);
653 653
654 if (cmdlen > MAX_CMD_LEN) { 654 if (cmdlen > MAX_CMD_LEN) {
655 m_free(chansess->cmd); 655 m_free(chansess->cmd);
656 /* TODO - send error - too long ? */ 656 /* TODO - send error - too long ? */
657 return DROPBEAR_FAILURE; 657 return DROPBEAR_FAILURE;