Keresztfalvi Gabor <[EMAIL PROTECTED]> writes:

> That's true... Indeed, I thought about 2 additional bytes outside the
> payload, but it would touch the secsh-draft deeply...

It would have to be a new "compression algorithm", with a distinct
name during algorithm negotiation. I think it is a bad idea to limit
the length to 2^16; I'd like to keep the possibility to negotiate
really lage packet sizes, even if they are not currently supported. I
think it would be better to add a 4 byte length prefix to the data
before deflating it.

> The patch seems to solve this problem. 17MB comes through well.

Good!

> P.s.: In do_free_zstream is this really good to do?:
>   int (*free)(z_stream *z) = z->opaque;
>   int res = free(z);
> As free() already exists. Probably it's harmless, but it's hurting my
> eyes. ;)

It's no problem to use local variables that overide globals. On the
other hand, it's not particularly pretty. And ANSI-C doesn't
guaranteee that casting between function pointers and void * works. So
I should clean that up some day.

> P.ss.: Ending a deflating (and not inflating!) zlib_instance in the
> server causes to return -3 (Z_DATA_ERROR) by deflateEnd.
> According to zlib.h:
>      deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
>    stream state was inconsistent, Z_DATA_ERROR if the stream was freed  
>    prematurely (some input or output was discarded). In the error case,
>    msg may be set but then points to a static string (which must not be
>    deallocated).
> Any ideas? It seems harmless, but who knows...

Hmm. This happens when the connection is closed, and the z_stream is
deallocated? It might be possible to use Z_FULL_FLUSH when writing the
SSH_MSG_DISCONNECT message, but I'm not sure it is worth the effort.
Does ssh2 do that?

> (BTW it's saying only "In the error case, msg _may_ be set"!)

If it is not set, I would hope it's at least NULL and not some random
garbage. 

> P.sss.: What about (verbose) writing some stats in do_free_zstream?
> Eg. total_in, total_out and whether it was deflating or inflating?

I have considered adding some kind of statistics object to the
connection. I'm not sure do_free_zstream (which is only called by the
gc) is the right place to print user friendly messages.

/Niels

Reply via email to