|
Lines 351-422
Link Here
|
| 351 |
if ($2) |
351 |
if ($2) |
| 352 |
long_passive("EPSV", PF_UNSPEC); |
352 |
long_passive("EPSV", PF_UNSPEC); |
| 353 |
} |
353 |
} |
| 354 |
| TYPE SP type_code CRLF |
354 |
| TYPE check_login SP type_code CRLF |
| 355 |
{ |
355 |
{ |
| 356 |
switch (cmd_type) { |
356 |
if ($2) { |
|
|
357 |
switch (cmd_type) { |
| 358 |
|
| 359 |
case TYPE_A: |
| 360 |
if (cmd_form == FORM_N) { |
| 361 |
reply(200, "Type set to A."); |
| 362 |
type = cmd_type; |
| 363 |
form = cmd_form; |
| 364 |
} else |
| 365 |
reply(504, "Form must be N."); |
| 366 |
break; |
| 367 |
|
| 368 |
case TYPE_E: |
| 369 |
reply(504, "Type E not implemented."); |
| 370 |
break; |
| 357 |
|
371 |
|
| 358 |
case TYPE_A: |
372 |
case TYPE_I: |
| 359 |
if (cmd_form == FORM_N) { |
373 |
reply(200, "Type set to I."); |
| 360 |
reply(200, "Type set to A."); |
|
|
| 361 |
type = cmd_type; |
374 |
type = cmd_type; |
| 362 |
form = cmd_form; |
375 |
break; |
| 363 |
} else |
|
|
| 364 |
reply(504, "Form must be N."); |
| 365 |
break; |
| 366 |
|
| 367 |
case TYPE_E: |
| 368 |
reply(504, "Type E not implemented."); |
| 369 |
break; |
| 370 |
|
| 371 |
case TYPE_I: |
| 372 |
reply(200, "Type set to I."); |
| 373 |
type = cmd_type; |
| 374 |
break; |
| 375 |
|
376 |
|
| 376 |
case TYPE_L: |
377 |
case TYPE_L: |
| 377 |
#if NBBY == 8 |
378 |
#if NBBY == 8 |
| 378 |
if (cmd_bytesz == 8) { |
379 |
if (cmd_bytesz == 8) { |
| 379 |
reply(200, |
380 |
reply(200, |
| 380 |
"Type set to L (byte size 8)."); |
381 |
"Type set to L (byte size 8)."); |
| 381 |
type = cmd_type; |
382 |
type = cmd_type; |
| 382 |
} else |
383 |
} else |
| 383 |
reply(504, "Byte size must be 8."); |
384 |
reply(504, "Byte size must be 8."); |
| 384 |
#else /* NBBY == 8 */ |
385 |
#else /* NBBY == 8 */ |
| 385 |
UNIMPLEMENTED for NBBY != 8 |
386 |
UNIMPLEMENTED for NBBY != 8 |
| 386 |
#endif /* NBBY == 8 */ |
387 |
#endif /* NBBY == 8 */ |
|
|
388 |
} |
| 387 |
} |
389 |
} |
| 388 |
} |
390 |
} |
| 389 |
| STRU SP struct_code CRLF |
391 |
| STRU check_login SP struct_code CRLF |
| 390 |
{ |
392 |
{ |
| 391 |
switch ($3) { |
393 |
if ($2) { |
|
|
394 |
switch ($4) { |
| 392 |
|
395 |
|
| 393 |
case STRU_F: |
396 |
case STRU_F: |
| 394 |
reply(200, "STRU F ok."); |
397 |
reply(200, "STRU F ok."); |
| 395 |
break; |
398 |
break; |
| 396 |
|
399 |
|
| 397 |
default: |
400 |
default: |
| 398 |
reply(504, "Unimplemented STRU type."); |
401 |
reply(504, "Unimplemented STRU type."); |
|
|
402 |
} |
| 399 |
} |
403 |
} |
| 400 |
} |
404 |
} |
| 401 |
| MODE SP mode_code CRLF |
405 |
| MODE check_login SP mode_code CRLF |
| 402 |
{ |
406 |
{ |
| 403 |
switch ($3) { |
407 |
if ($2) { |
| 404 |
|
408 |
switch ($4) { |
| 405 |
case MODE_S: |
|
|
| 406 |
reply(200, "MODE S ok."); |
| 407 |
break; |
| 408 |
|
409 |
|
| 409 |
default: |
410 |
case MODE_S: |
| 410 |
reply(502, "Unimplemented MODE type."); |
411 |
reply(200, "MODE S ok."); |
|
|
412 |
break; |
| 413 |
|
| 414 |
default: |
| 415 |
reply(502, "Unimplemented MODE type."); |
| 416 |
} |
| 411 |
} |
417 |
} |
| 412 |
} |
418 |
} |
| 413 |
| ALLO SP NUMBER CRLF |
419 |
| ALLO check_login SP NUMBER CRLF |
| 414 |
{ |
420 |
{ |
| 415 |
reply(202, "ALLO command ignored."); |
421 |
if ($2) { |
|
|
422 |
reply(202, "ALLO command ignored."); |
| 423 |
} |
| 416 |
} |
424 |
} |
| 417 |
| ALLO SP NUMBER SP R SP NUMBER CRLF |
425 |
| ALLO check_login SP NUMBER SP R SP NUMBER CRLF |
| 418 |
{ |
426 |
{ |
| 419 |
reply(202, "ALLO command ignored."); |
427 |
if ($2) { |
|
|
428 |
reply(202, "ALLO command ignored."); |
| 429 |
} |
| 420 |
} |
430 |
} |
| 421 |
| RETR check_login SP pathname CRLF |
431 |
| RETR check_login SP pathname CRLF |
| 422 |
{ |
432 |
{ |
|
Lines 470-478
Link Here
|
| 470 |
if ($4 != NULL) |
480 |
if ($4 != NULL) |
| 471 |
free($4); |
481 |
free($4); |
| 472 |
} |
482 |
} |
| 473 |
| STAT CRLF |
483 |
| STAT check_login CRLF |
| 474 |
{ |
484 |
{ |
| 475 |
statcmd(); |
485 |
if ($2) { |
|
|
486 |
statcmd(); |
| 487 |
} |
| 476 |
} |
488 |
} |
| 477 |
| DELE check_login SP pathname CRLF |
489 |
| DELE check_login SP pathname CRLF |
| 478 |
{ |
490 |
{ |
|
Lines 494-502
Link Here
|
| 494 |
} |
506 |
} |
| 495 |
free($4); |
507 |
free($4); |
| 496 |
} |
508 |
} |
| 497 |
| ABOR CRLF |
509 |
| ABOR check_login CRLF |
| 498 |
{ |
510 |
{ |
| 499 |
reply(225, "ABOR command successful."); |
511 |
if ($2) |
|
|
512 |
reply(225, "ABOR command successful."); |
| 500 |
} |
513 |
} |
| 501 |
| CWD check_login CRLF |
514 |
| CWD check_login CRLF |
| 502 |
{ |
515 |
{ |
|
Lines 604-627
Link Here
|
| 604 |
if ($8 != NULL) |
617 |
if ($8 != NULL) |
| 605 |
free($8); |
618 |
free($8); |
| 606 |
} |
619 |
} |
| 607 |
| SITE SP IDLE CRLF |
620 |
| SITE SP check_login IDLE CRLF |
| 608 |
{ |
621 |
{ |
| 609 |
reply(200, |
622 |
if ($3) |
| 610 |
"Current IDLE time limit is %d seconds; max %d", |
|
|
| 611 |
timeout, maxtimeout); |
| 612 |
} |
| 613 |
| SITE SP IDLE SP NUMBER CRLF |
| 614 |
{ |
| 615 |
if ($5 < 30 || $5 > maxtimeout) { |
| 616 |
reply(501, |
| 617 |
"Maximum IDLE time must be between 30 and %d seconds", |
| 618 |
maxtimeout); |
| 619 |
} else { |
| 620 |
timeout = $5; |
| 621 |
(void) alarm((unsigned) timeout); |
| 622 |
reply(200, |
623 |
reply(200, |
| 623 |
"Maximum IDLE time set to %d seconds", |
624 |
"Current IDLE time limit is %d seconds; max %d", |
| 624 |
timeout); |
625 |
timeout, maxtimeout); |
|
|
626 |
} |
| 627 |
| SITE SP check_login IDLE SP NUMBER CRLF |
| 628 |
{ |
| 629 |
if ($3) { |
| 630 |
if ($6 < 30 || $6 > maxtimeout) { |
| 631 |
reply(501, |
| 632 |
"Maximum IDLE time must be between " |
| 633 |
"30 and %d seconds", |
| 634 |
maxtimeout); |
| 635 |
} else { |
| 636 |
timeout = $6; |
| 637 |
(void) alarm((unsigned) timeout); |
| 638 |
reply(200, |
| 639 |
"Maximum IDLE time set to %d seconds", |
| 640 |
timeout); |
| 641 |
} |
| 625 |
} |
642 |
} |
| 626 |
} |
643 |
} |
| 627 |
| STOU check_login SP pathname CRLF |
644 |
| STOU check_login SP pathname CRLF |
|
Lines 631-638
Link Here
|
| 631 |
if ($4 != NULL) |
648 |
if ($4 != NULL) |
| 632 |
free($4); |
649 |
free($4); |
| 633 |
} |
650 |
} |
| 634 |
| SYST CRLF |
651 |
| SYST check_login CRLF |
| 635 |
{ |
652 |
{ |
|
|
653 |
if ($2) |
| 636 |
#ifdef unix |
654 |
#ifdef unix |
| 637 |
#ifdef BSD |
655 |
#ifdef BSD |
| 638 |
reply(215, "UNIX Type: L%d Version: BSD-%d", |
656 |
reply(215, "UNIX Type: L%d Version: BSD-%d", |
|
Lines 714-725
Link Here
|
| 714 |
} |
732 |
} |
| 715 |
} |
733 |
} |
| 716 |
} |
734 |
} |
| 717 |
| REST SP byte_size CRLF |
735 |
| REST check_login SP byte_size CRLF |
| 718 |
{ |
736 |
{ |
| 719 |
fromname = (char *) 0; |
737 |
if ($2) { |
| 720 |
restart_point = $3; /* XXX $3 is only "int" */ |
738 |
fromname = (char *) 0; |
| 721 |
reply(350, "Restarting at %qd. %s", restart_point, |
739 |
restart_point = $4; /* XXX $4 is only "int" */ |
| 722 |
"Send STORE or RETRIEVE to initiate transfer."); |
740 |
reply(350, "Restarting at %qd. %s", |
|
|
741 |
restart_point, |
| 742 |
"Send STORE or RETRIEVE to initiate transfer."); |
| 743 |
} |
| 723 |
} |
744 |
} |
| 724 |
; |
745 |
; |