*/
const char *stream_to_ascii(char *buf, int stream, int fi)
{
- if (fi < 0) {
- sprintf(buf, "%d", stream);
- return buf;
- }
- switch (stream) {
- case STREAM_UNIX_ATTRIBUTES:
- return "UATTR";
- case STREAM_FILE_DATA:
- return "DATA";
- case STREAM_WIN32_DATA:
- return "WIN32-DATA";
- case STREAM_WIN32_GZIP_DATA:
- return "WIN32-GZIP";
- case STREAM_MD5_DIGEST:
- return "MD5";
- case STREAM_SHA1_DIGEST:
- return "SHA1";
- case STREAM_GZIP_DATA:
- return "GZIP";
- case STREAM_UNIX_ATTRIBUTES_EX:
- return "UNIX-ATTR-EX";
- case STREAM_RESTORE_OBJECT:
- return "RESTORE-OBJECT";
- case STREAM_SPARSE_DATA:
- return "SPARSE-DATA";
- case STREAM_SPARSE_GZIP_DATA:
- return "SPARSE-GZIP";
- case STREAM_PROGRAM_NAMES:
- return "PROG-NAMES";
- case STREAM_PROGRAM_DATA:
- return "PROG-DATA";
- case STREAM_PLUGIN_NAME:
- return "PLUGIN-NAME";
- case STREAM_MACOS_FORK_DATA:
- return "MACOS-RSRC";
- case STREAM_HFSPLUS_ATTRIBUTES:
- return "HFSPLUS-ATTR";
- case STREAM_SHA256_DIGEST:
- return "SHA256";
- case STREAM_SHA512_DIGEST:
- return "SHA512";
- case STREAM_SIGNED_DIGEST:
- return "SIGNED-DIGEST";
- case STREAM_ENCRYPTED_SESSION_DATA:
- return "ENCRYPTED-SESSION-DATA";
- case STREAM_ENCRYPTED_FILE_DATA:
- return "ENCRYPTED-FILE";
- case STREAM_ENCRYPTED_FILE_GZIP_DATA:
- return "ENCRYPTED-GZIP";
- case STREAM_ENCRYPTED_WIN32_DATA:
- return "ENCRYPTED-WIN32-DATA";
- case STREAM_ENCRYPTED_WIN32_GZIP_DATA:
- return "ENCRYPTED-WIN32-GZIP";
- case STREAM_ENCRYPTED_MACOS_FORK_DATA:
- return "ENCRYPTED-MACOS-RSRC";
- case -STREAM_UNIX_ATTRIBUTES:
- return "contUATTR";
- case -STREAM_FILE_DATA:
- return "contDATA";
- case -STREAM_WIN32_DATA:
- return "contWIN32-DATA";
- case -STREAM_WIN32_GZIP_DATA:
- return "contWIN32-GZIP";
- case -STREAM_MD5_DIGEST:
- return "contMD5";
- case -STREAM_SHA1_DIGEST:
- return "contSHA1";
- case -STREAM_GZIP_DATA:
- return "contGZIP";
- case -STREAM_UNIX_ATTRIBUTES_EX:
- return "contUNIX-ATTR-EX";
- case -STREAM_RESTORE_OBJECT:
- return "contRESTORE-OBJECT";
- case -STREAM_SPARSE_DATA:
- return "contSPARSE-DATA";
- case -STREAM_SPARSE_GZIP_DATA:
- return "contSPARSE-GZIP";
- case -STREAM_PROGRAM_NAMES:
- return "contPROG-NAMES";
- case -STREAM_PROGRAM_DATA:
- return "contPROG-DATA";
- case -STREAM_MACOS_FORK_DATA:
- return "contMACOS-RSRC";
- case -STREAM_HFSPLUS_ATTRIBUTES:
- return "contHFSPLUS-ATTR";
- case -STREAM_SHA256_DIGEST:
- return "contSHA256";
- case -STREAM_SHA512_DIGEST:
- return "contSHA512";
- case -STREAM_SIGNED_DIGEST:
- return "contSIGNED-DIGEST";
- case -STREAM_ENCRYPTED_SESSION_DATA:
- return "contENCRYPTED-SESSION-DATA";
- case -STREAM_ENCRYPTED_FILE_DATA:
- return "contENCRYPTED-FILE";
- case -STREAM_ENCRYPTED_FILE_GZIP_DATA:
- return "contENCRYPTED-GZIP";
- case -STREAM_ENCRYPTED_WIN32_DATA:
- return "contENCRYPTED-WIN32-DATA";
- case -STREAM_ENCRYPTED_WIN32_GZIP_DATA:
- return "contENCRYPTED-WIN32-GZIP";
- case -STREAM_ENCRYPTED_MACOS_FORK_DATA:
- return "contENCRYPTED-MACOS-RSRC";
- case -STREAM_PLUGIN_NAME:
- return "contPLUGIN-NAME";
-
- default:
- sprintf(buf, "%d", stream);
- return buf;
- }
+
+ if (fi < 0) {
+ sprintf(buf, "%d", stream);
+ return buf;
+ }
+ if (stream < 0) {
+ stream = -stream;
+ stream &= STREAMMASK_TYPE;
+ /* Stream was negative => all are continuation items */
+ switch (stream) {
+ case STREAM_UNIX_ATTRIBUTES:
+ return "contUATTR";
+ case STREAM_FILE_DATA:
+ return "contDATA";
+ case STREAM_WIN32_DATA:
+ return "contWIN32-DATA";
+ case STREAM_WIN32_GZIP_DATA:
+ return "contWIN32-GZIP";
+ case STREAM_MD5_DIGEST:
+ return "contMD5";
+ case STREAM_SHA1_DIGEST:
+ return "contSHA1";
+ case STREAM_GZIP_DATA:
+ return "contGZIP";
+ case STREAM_UNIX_ATTRIBUTES_EX:
+ return "contUNIX-ATTR-EX";
+ case STREAM_RESTORE_OBJECT:
+ return "contRESTORE-OBJECT";
+ case STREAM_SPARSE_DATA:
+ return "contSPARSE-DATA";
+ case STREAM_SPARSE_GZIP_DATA:
+ return "contSPARSE-GZIP";
+ case STREAM_PROGRAM_NAMES:
+ return "contPROG-NAMES";
+ case STREAM_PROGRAM_DATA:
+ return "contPROG-DATA";
+ case STREAM_MACOS_FORK_DATA:
+ return "contMACOS-RSRC";
+ case STREAM_HFSPLUS_ATTRIBUTES:
+ return "contHFSPLUS-ATTR";
+ case STREAM_SHA256_DIGEST:
+ return "contSHA256";
+ case STREAM_SHA512_DIGEST:
+ return "contSHA512";
+ case STREAM_SIGNED_DIGEST:
+ return "contSIGNED-DIGEST";
+ case STREAM_ENCRYPTED_SESSION_DATA:
+ return "contENCRYPTED-SESSION-DATA";
+ case STREAM_ENCRYPTED_FILE_DATA:
+ return "contENCRYPTED-FILE";
+ case STREAM_ENCRYPTED_FILE_GZIP_DATA:
+ return "contENCRYPTED-GZIP";
+ case STREAM_ENCRYPTED_WIN32_DATA:
+ return "contENCRYPTED-WIN32-DATA";
+ case STREAM_ENCRYPTED_WIN32_GZIP_DATA:
+ return "contENCRYPTED-WIN32-GZIP";
+ case STREAM_ENCRYPTED_MACOS_FORK_DATA:
+ return "contENCRYPTED-MACOS-RSRC";
+ case STREAM_PLUGIN_NAME:
+ return "contPLUGIN-NAME";
+
+ default:
+ sprintf(buf, "%d", -stream);
+ return buf;
+ }
+ }
+
+ switch (stream & STREAMMASK_TYPE) {
+ case STREAM_UNIX_ATTRIBUTES:
+ return "UATTR";
+ case STREAM_FILE_DATA:
+ return "DATA";
+ case STREAM_WIN32_DATA:
+ return "WIN32-DATA";
+ case STREAM_WIN32_GZIP_DATA:
+ return "WIN32-GZIP";
+ case STREAM_MD5_DIGEST:
+ return "MD5";
+ case STREAM_SHA1_DIGEST:
+ return "SHA1";
+ case STREAM_GZIP_DATA:
+ return "GZIP";
+ case STREAM_UNIX_ATTRIBUTES_EX:
+ return "UNIX-ATTR-EX";
+ case STREAM_RESTORE_OBJECT:
+ return "RESTORE-OBJECT";
+ case STREAM_SPARSE_DATA:
+ return "SPARSE-DATA";
+ case STREAM_SPARSE_GZIP_DATA:
+ return "SPARSE-GZIP";
+ case STREAM_PROGRAM_NAMES:
+ return "PROG-NAMES";
+ case STREAM_PROGRAM_DATA:
+ return "PROG-DATA";
+ case STREAM_PLUGIN_NAME:
+ return "PLUGIN-NAME";
+ case STREAM_MACOS_FORK_DATA:
+ return "MACOS-RSRC";
+ case STREAM_HFSPLUS_ATTRIBUTES:
+ return "HFSPLUS-ATTR";
+ case STREAM_SHA256_DIGEST:
+ return "SHA256";
+ case STREAM_SHA512_DIGEST:
+ return "SHA512";
+ case STREAM_SIGNED_DIGEST:
+ return "SIGNED-DIGEST";
+ case STREAM_ENCRYPTED_SESSION_DATA:
+ return "ENCRYPTED-SESSION-DATA";
+ case STREAM_ENCRYPTED_FILE_DATA:
+ return "ENCRYPTED-FILE";
+ case STREAM_ENCRYPTED_FILE_GZIP_DATA:
+ return "ENCRYPTED-GZIP";
+ case STREAM_ENCRYPTED_WIN32_DATA:
+ return "ENCRYPTED-WIN32-DATA";
+ case STREAM_ENCRYPTED_WIN32_GZIP_DATA:
+ return "ENCRYPTED-WIN32-GZIP";
+ case STREAM_ENCRYPTED_MACOS_FORK_DATA:
+ return "ENCRYPTED-MACOS-RSRC";
+
+ default:
+ sprintf(buf, "%d", stream);
+ return buf;
+ }
}
/*
return false; /* This is from some other Session */
}
rec->Stream = -Stream; /* set correct Stream */
+ rec->maskedStream = rec->Stream & STREAMMASK_TYPE;
} else { /* Regular record */
rec->Stream = Stream;
+ rec->maskedStream = rec->Stream & STREAMMASK_TYPE;
rec->data_len = 0; /* transfer to beginning of data */
}
rec->VolSessionId = VolSessionId;