diff options
author | Damien Miller <djm@mindrot.org> | 2000-04-01 03:09:21 +0200 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2000-04-01 03:09:21 +0200 |
commit | b38eff8e4ff901df9cf1113a9f14d64c3565a401 (patch) | |
tree | 9a856898f15f7760ed95c5d47789a6f954b4ad2f /compress.c | |
parent | - OpenBSD CVS update (diff) | |
download | openssh-b38eff8e4ff901df9cf1113a9f14d64c3565a401.tar.xz openssh-b38eff8e4ff901df9cf1113a9f14d64c3565a401.zip |
- Big OpenBSD CVS update (mainly beginnings of SSH2 infrastructure)
- [auth.c session.c sshd.c auth.h]
split sshd.c -> auth.c session.c sshd.c plus cleanup and goto-removal
- [bufaux.c bufaux.h]
support ssh2 bignums
- [channels.c channels.h clientloop.c sshd.c nchan.c nchan.h packet.c]
[readconf.c ssh.c ssh.h serverloop.c]
replace big switch() with function tables (prepare for ssh2)
- [ssh2.h]
ssh2 message type codes
- [sshd.8]
reorder Xr to avoid cutting
- [serverloop.c]
close(fdin) if fdin != fdout, shutdown otherwise, ok theo@
- [channels.c]
missing close
allow bigger packets
- [cipher.c cipher.h]
support ssh2 ciphers
- [compress.c]
cleanup, less code
- [dispatch.c dispatch.h]
function tables for different message types
- [log-server.c]
do not log() if debuggin to stderr
rename a cpp symbol, to avoid param.h collision
- [mpaux.c]
KNF
- [nchan.c]
sync w/ channels.c
Diffstat (limited to 'compress.c')
-rw-r--r-- | compress.c | 40 |
1 files changed, 9 insertions, 31 deletions
diff --git a/compress.c b/compress.c index cf15c6670..ee5cdccb5 100644 --- a/compress.c +++ b/compress.c @@ -14,7 +14,7 @@ */ #include "includes.h" -RCSID("$Id: compress.c,v 1.4 2000/03/17 12:40:16 damien Exp $"); +RCSID("$Id: compress.c,v 1.5 2000/04/01 01:09:24 damien Exp $"); #include "ssh.h" #include "buffer.h" @@ -90,23 +90,13 @@ buffer_compress(Buffer * input_buffer, Buffer * output_buffer) case Z_OK: /* Append compressed data to output_buffer. */ buffer_append(output_buffer, buf, - sizeof(buf) - outgoing_stream.avail_out); + sizeof(buf) - outgoing_stream.avail_out); break; - case Z_STREAM_END: - fatal("buffer_compress: deflate returned Z_STREAM_END"); - /* NOTREACHED */ - case Z_STREAM_ERROR: - fatal("buffer_compress: deflate returned Z_STREAM_ERROR"); - /* NOTREACHED */ - case Z_BUF_ERROR: - fatal("buffer_compress: deflate returned Z_BUF_ERROR"); - /* NOTREACHED */ default: fatal("buffer_compress: deflate returned %d", status); /* NOTREACHED */ } - } - while (outgoing_stream.avail_out == 0); + } while (outgoing_stream.avail_out == 0); } /* @@ -127,27 +117,17 @@ buffer_uncompress(Buffer * input_buffer, Buffer * output_buffer) incoming_stream.next_in = (unsigned char *) buffer_ptr(input_buffer); incoming_stream.avail_in = buffer_len(input_buffer); - incoming_stream.next_out = (unsigned char *) buf; - incoming_stream.avail_out = sizeof(buf); - for (;;) { + /* Set up fixed-size output buffer. */ + incoming_stream.next_out = (unsigned char *) buf; + incoming_stream.avail_out = sizeof(buf); + status = inflate(&incoming_stream, Z_PARTIAL_FLUSH); switch (status) { case Z_OK: buffer_append(output_buffer, buf, - sizeof(buf) - incoming_stream.avail_out); - incoming_stream.next_out = (unsigned char *) buf; - incoming_stream.avail_out = sizeof(buf); + sizeof(buf) - incoming_stream.avail_out); break; - case Z_STREAM_END: - fatal("buffer_uncompress: inflate returned Z_STREAM_END"); - /* NOTREACHED */ - case Z_DATA_ERROR: - fatal("buffer_uncompress: inflate returned Z_DATA_ERROR"); - /* NOTREACHED */ - case Z_STREAM_ERROR: - fatal("buffer_uncompress: inflate returned Z_STREAM_ERROR"); - /* NOTREACHED */ case Z_BUF_ERROR: /* * Comments in zlib.h say that we should keep calling @@ -155,11 +135,9 @@ buffer_uncompress(Buffer * input_buffer, Buffer * output_buffer) * be the error that we get. */ return; - case Z_MEM_ERROR: - fatal("buffer_uncompress: inflate returned Z_MEM_ERROR"); - /* NOTREACHED */ default: fatal("buffer_uncompress: inflate returned %d", status); + /* NOTREACHED */ } } } |