ftpcmd.y (17433) | ftpcmd.y (17435) |
---|---|
1/* 2 * Copyright (c) 1985, 1988, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 57 unchanged lines hidden (view full) --- 66#include <libutil.h> 67 68#include "extern.h" 69 70extern struct sockaddr_in data_dest, his_addr; 71extern int logged_in; 72extern struct passwd *pw; 73extern int guest; | 1/* 2 * Copyright (c) 1985, 1988, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 57 unchanged lines hidden (view full) --- 66#include <libutil.h> 67 68#include "extern.h" 69 70extern struct sockaddr_in data_dest, his_addr; 71extern int logged_in; 72extern struct passwd *pw; 73extern int guest; |
74extern int paranoid; |
|
74extern int logging; 75extern int type; 76extern int form; 77extern int debug; 78extern int timeout; 79extern int maxtimeout; 80extern int pdata; 81extern char hostname[], remotehost[]; --- 65 unchanged lines hidden (view full) --- 147 | PASS SP password CRLF 148 { 149 pass($3); 150 free($3); 151 } 152 | PORT check_login SP host_port CRLF 153 { 154 if ($2) { | 75extern int logging; 76extern int type; 77extern int form; 78extern int debug; 79extern int timeout; 80extern int maxtimeout; 81extern int pdata; 82extern char hostname[], remotehost[]; --- 65 unchanged lines hidden (view full) --- 148 | PASS SP password CRLF 149 { 150 pass($3); 151 free($3); 152 } 153 | PORT check_login SP host_port CRLF 154 { 155 if ($2) { |
155#ifdef PARANOID 156 if ((ntohs(data_dest.sin_port) < 157 IPPORT_RESERVED) || 158 memcmp(&data_dest.sin_addr, 159 &his_addr.sin_addr, 160 sizeof(data_dest.sin_addr))) 161 { | 156 if (paranoid && 157 ((ntohs(data_dest.sin_port) < 158 IPPORT_RESERVED) || 159 memcmp(&data_dest.sin_addr, 160 &his_addr.sin_addr, 161 sizeof(data_dest.sin_addr)))) { |
162 usedefault = 1; 163 reply(500, 164 "Illegal PORT range rejected."); | 162 usedefault = 1; 163 reply(500, 164 "Illegal PORT range rejected."); |
165 } else 166#endif 167 { | 165 } else { |
168 usedefault = 0; 169 if (pdata >= 0) { 170 (void) close(pdata); 171 pdata = -1; 172 } 173 reply(200, "PORT command successful."); 174 } 175 } --- 329 unchanged lines hidden (view full) --- 505 reply(550, "%s: %s", 506 $4, strerror(errno)); 507 else if (!S_ISREG(stbuf.st_mode)) { 508 reply(550, "%s: not a plain file.", $4); 509 } else { 510 struct tm *t; 511 t = gmtime(&stbuf.st_mtime); 512 reply(213, | 166 usedefault = 0; 167 if (pdata >= 0) { 168 (void) close(pdata); 169 pdata = -1; 170 } 171 reply(200, "PORT command successful."); 172 } 173 } --- 329 unchanged lines hidden (view full) --- 503 reply(550, "%s: %s", 504 $4, strerror(errno)); 505 else if (!S_ISREG(stbuf.st_mode)) { 506 reply(550, "%s: not a plain file.", $4); 507 } else { 508 struct tm *t; 509 t = gmtime(&stbuf.st_mtime); 510 reply(213, |
513 "19%02d%02d%02d%02d%02d%02d", 514 t->tm_year, t->tm_mon+1, t->tm_mday, | 511 "%04d%02d%02d%02d%02d%02d", 512 1900 + t->tm_year, 513 t->tm_mon+1, t->tm_mday, |
515 t->tm_hour, t->tm_min, t->tm_sec); 516 } 517 } 518 if ($4 != NULL) 519 free($4); 520 } 521 | QUIT CRLF 522 { --- 44 unchanged lines hidden (view full) --- 567 ; 568 569host_port 570 : NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA 571 NUMBER COMMA NUMBER 572 { 573 char *a, *p; 574 | 514 t->tm_hour, t->tm_min, t->tm_sec); 515 } 516 } 517 if ($4 != NULL) 518 free($4); 519 } 520 | QUIT CRLF 521 { --- 44 unchanged lines hidden (view full) --- 566 ; 567 568host_port 569 : NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA 570 NUMBER COMMA NUMBER 571 { 572 char *a, *p; 573 |
575 a = (char *)&data_dest.sin_addr; 576 a[0] = $1; a[1] = $3; a[2] = $5; a[3] = $7; | 574 data_dest.sin_len = sizeof(struct sockaddr_in); 575 data_dest.sin_family = AF_INET; |
577 p = (char *)&data_dest.sin_port; 578 p[0] = $9; p[1] = $11; | 576 p = (char *)&data_dest.sin_port; 577 p[0] = $9; p[1] = $11; |
579 data_dest.sin_family = AF_INET; | 578 a = (char *)&data_dest.sin_addr; 579 a[0] = $1; a[1] = $3; a[2] = $5; a[3] = $7; |
580 } 581 ; 582 583form_code 584 : N 585 { 586 $$ = FORM_N; 587 } --- 699 unchanged lines hidden --- | 580 } 581 ; 582 583form_code 584 : N 585 { 586 $$ = FORM_N; 587 } --- 699 unchanged lines hidden --- |