1 |
|
|
2 |
/* Copyright (C) 1999 Beau Kuiper |
/* Copyright (C) 1999 Beau Kuiper |
3 |
|
|
4 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
19 |
|
|
20 |
extern int signumber; |
extern int signumber; |
21 |
|
|
22 |
int popcmd(FTPSTATE *peer, char **outstr) |
int popcmd(FTPSTATE * peer, |
23 |
|
char **outstr) |
24 |
{ |
{ |
25 |
/* find the EOL marker (remember it is in ansi style!) */ |
/* |
26 |
char *chtmp = strstr(STRTOCHAR(peer->inbuffer), "\r\n"); |
* find the EOL marker (remember it is in ansi style!) |
27 |
|
*/ |
28 |
|
char *chtmp = strstr(STRTOCHAR(peer->inbuffer), "\r\n"); |
29 |
|
|
30 |
*outstr = NULL; |
*outstr = NULL; |
31 |
|
|
32 |
if (chtmp == NULL) |
if (chtmp == NULL) |
33 |
return(FALSE); |
return (FALSE); |
34 |
else |
else |
35 |
{ |
{ |
36 |
if ((chtmp - STRTOCHAR(peer->inbuffer)) != (STRLENGTH(peer->inbuffer) - 2)) |
if ((chtmp - STRTOCHAR(peer->inbuffer)) != |
37 |
|
(STRLENGTH(peer->inbuffer) - 2)) |
38 |
{ |
{ |
39 |
/* they are breaking the RFC, kill them now! */ |
/* |
40 |
return(TRUE); |
* they are breaking the RFC, kill them now! |
41 |
} |
*/ |
42 |
|
return (TRUE); |
43 |
|
} |
44 |
*chtmp = 0; |
*chtmp = 0; |
45 |
*outstr = STRTOCHAR(peer->inbuffer); |
*outstr = STRTOCHAR(peer->inbuffer); |
46 |
return(FALSE); |
return (FALSE); |
47 |
} |
} |
48 |
} |
} |
49 |
|
|
50 |
int readcmd(FTPSTATE *peer) |
int readcmd(FTPSTATE * peer) |
51 |
{ |
{ |
52 |
char inputbuf[BUFFERSIZE]; |
char inputbuf[BUFFERSIZE]; |
53 |
int stringlen, oldlen = STRLENGTH(peer->inbuffer); |
int stringlen, oldlen = STRLENGTH(peer->inbuffer); |
54 |
|
|
55 |
stringlen = read(peer->remotefd, inputbuf, BUFFERSIZE); |
stringlen = read(peer->remotefd, inputbuf, BUFFERSIZE); |
56 |
|
|
57 |
if (stringlen <= 0) |
if (stringlen <= 0) |
58 |
return(TRUE); |
return (TRUE); |
59 |
|
|
60 |
string_cat(&(peer->inbuffer), inputbuf, stringlen); |
string_cat(&(peer->inbuffer), inputbuf, stringlen); |
61 |
string_filterbadchars(&(peer->inbuffer), oldlen); |
string_filterbadchars(&(peer->inbuffer), oldlen); |
62 |
|
|
63 |
return(FALSE); |
return (FALSE); |
64 |
} |
} |