ndr_compression: use inflateReset() and inflateSetDictionary() instead of inflateReset2()
authorStefan Metzmacher <metze@samba.org>
Fri, 5 Sep 2008 18:18:07 +0000 (20:18 +0200)
committerStefan Metzmacher <metze@samba.org>
Sat, 6 Sep 2008 14:15:39 +0000 (16:15 +0200)
Now we can use an unmodified system zlib-1.2.3

metze

source/librpc/ndr/ndr_compression.c

index 37f95bb1b6067a579d4d169b583bee9bdba69460..0b33d40c24293ec826aee017153d41c61c04549b 100644 (file)
@@ -104,13 +104,6 @@ static enum ndr_err_code ndr_pull_compression_mszip_chunk(struct ndr_pull *ndrpu
                                              zError(z_ret), z_ret);
 
                }
-       } else {
-               z_ret = inflateReset2(z, Z_RESET_KEEP_WINDOW);
-               if (z_ret != Z_OK) {
-                       return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
-                                             "Bad inflateReset2 error %s(%d) (PULL)",
-                                             zError(z_ret), z_ret);
-               }
        }
 
        /* call inflate untill we get Z_STREAM_END or an error */
@@ -142,6 +135,20 @@ static enum ndr_err_code ndr_pull_compression_mszip_chunk(struct ndr_pull *ndrpu
                *last = true;
        }
 
+       z_ret = inflateReset(z);
+       if (z_ret != Z_OK) {
+               return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+                                     "Bad inflateReset error %s(%d) (PULL)",
+                                     zError(z_ret), z_ret);
+       }
+
+       z_ret = inflateSetDictionary(z, plain_chunk.data, plain_chunk.length);
+       if (z_ret != Z_OK) {
+               return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+                                     "Bad inflateSetDictionary error %s(%d) (PULL)",
+                                     zError(z_ret), z_ret);
+       }
+
        return NDR_ERR_SUCCESS;
 }