AW: [proxy-suite] Wrong Answer from FTP-Proxy
Hi Marius,
hi all,
year, got it - was a hard work, but i figuered out the problem after i
was able to compile it on my mashine.
At the end you will find a patchfile. My first problem was to compile
the source 1.7p8 on a Suse 6.4 Kernel 2.2.19
and gcc 2.95.3 20010315 (release).
gcc -g -O2 -c -I. -I.. proc_ftp.c
In file included from /usr/include/linux/sched.h:13,
from /usr/include/linux/mm.h:4,
from /usr/include/linux/slab.h:14,
from /usr/include/linux/malloc.h:4,
from proc_ftp.c:44:
/usr/include/linux/times.h:5: parse error before `clock_t'
... and pages of more errors
a -I/usr/src/linux/include or a line #define _LOOSE_KERNEL_NAMES just
befor #include
-------------------------------SCHNIP------------------------------ --- common/com-socket.c +++ common/com-socket.c Fri Sep 28 15:49:05 2001 @@ -371,8 +371,9 @@ memset(hls->peer, 0, sizeof(hls->peer)); }
hls->kill = 0;
+ hls->readmore = 0;
hls->flag = 0;
hls->ctyp = "???-????";
hls->wbuf = NULL;
@@ -540,13 +541,30 @@
/*
** Transfer at most one line of data
*/
+ hls->readmore = 0; /* D.ROLOFF reset flag */
for (buf = hls->rbuf, cnt = 0; buf != NULL && cnt < len; ) {
if (buf->cur >= buf->len) {
hls->rbuf = buf->next;
misc_free(FL, buf);
- buf = hls->rbuf;
+ /* buf = hls->rbuf; D.ROLOFF old stuff */
+ if(NULL == (buf = hls->rbuf))
+ {
+ /* D.ROLOFF no more data in HighLevel
Socket
+ restore a buffer and exit until more
data
+ avail and end of line (CR/NL) found
*/
+ hls->rbuf = (BUF *) misc_alloc(FL,
sizeof(BUF) + cnt);
+ hls->rbuf->len = cnt;
+ hls->rbuf->cur = 0;
+ memcpy(hls->rbuf->dat, ptr, cnt);
+#if defined(COMPILE_DEBUG)
+ debug(2, "gets preread %d Bytes waiting for end-of-line
'%.128s'%s",
+ cnt, hls->rbuf->dat, (cnt > 128) ? "..." : "");
+#endif
+ hls->readmore = 1;
+ return NULL;
+ }
continue;
}
if (buf->dat[buf->cur] == '\r')
break;
--- common/com-socket.h
+++ common/com-socket.h Fri Sep 28 14:44:21 2001
@@ -83,8 +83,9 @@
struct hls_t *next; /* Next one in the chain */
int sock; /* The corresponding socket */
int kill; /* 1=kill socket after send */
int flag; /* Flag for send() (e.g. OOB) */
+ int readmore; /* 1=read more if rbuf=!NULL */
u_int32_t addr; /* Peer's address (host order) */
u_int16_t port; /* Peer's port (host order) */
char peer[PEER_LEN]; /* Peer's readable address */
char *ctyp; /* Connection type identifier */
--- ftp-proxy/ftp-client.c
+++ ftp-proxy/ftp-client.c Fri Sep 28 15:13:24 2001
@@ -225,12 +225,16 @@
** if all input has been processed.
** (Data buffers are never split.)
*/
need = 1;
+
if (ctx.cli_ctrl && ctx.cli_ctrl->rbuf)
need = 0;
if (ctx.srv_ctrl && ctx.srv_ctrl->rbuf)
need = 0;
+ if(( ctx.srv_ctrl && ctx.srv_ctrl->readmore!=0 ) ||
+ ( ctx.cli_ctrl && ctx.cli_ctrl->readmore!=0 ))
+ need = 1;
if (need != 0) {
if (socket_exec(ctx.timeout, &close_flag) <= 0)
break; /* Timed out or worse */
}
--- ftp-proxy/proc_ftp.c
+++ ftp-proxy/proc_ftp.c Fri Sep 28 12:18:33 2001
@@ -38,8 +38,10 @@
#if !defined(__KERNEL__)
# define __KERNEL__
#endif
+#define _LOOSE_KERNEL_NAMES
+
#include
-------------------------------SCHNAP------------------------------
participants (1)
-
Roloff, Dirk