Browse code

improve debug messages

git-svn: trunk@2815

Tomasz Kojm authored on 2007/02/20 04:25:16
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Mon Feb 19 18:28:52 CET 2007 (tk)
2
+---------------------------------
3
+  * libclamav/sis.c: improve debug messages
4
+
1 5
 Sun Feb 18 21:26:26 CET 2007 (acab)
2 6
 -----------------------------------
3 7
   * libclamav/pe.c: improved broken detection - closes bb#305
... ...
@@ -102,7 +102,7 @@ static int sis_extract_simple(int fd, char *mfile, uint32_t length, uint32_t off
102 102
 	char *sname = NULL, *dname = NULL, *subdir, *fname, *buff;
103 103
 	int desc, i;
104 104
 	uint8_t get_dname = 1;
105
-	uint32_t namelen, nameoff, filelen, fileoff;
105
+	uint32_t namelen, nameoff, filelen, fileoff, val;
106 106
 	struct stat sb;
107 107
 	uLong osize = 0;
108 108
 	uLongf csize = 0;
... ...
@@ -131,16 +131,21 @@ static int sis_extract_simple(int fd, char *mfile, uint32_t length, uint32_t off
131 131
 	case 0x03:
132 132
 	    cli_dbgmsg("SIS: File type: Run file\n");
133 133
 	    typedir = "run";
134
-	    switch(cli_readint32(mfile + offset + 4)) {
135
-		case 0x0000:
134
+	    val = cli_readint32(mfile + offset + 4);
135
+	    switch(val & 0xff) {
136
+		case 0x00:
136 137
 		    cli_dbgmsg("SIS:    * During installation only\n");
137 138
 		    break;
138
-		case 0x0001:
139
+		case 0x01:
139 140
 		    cli_dbgmsg("SIS:    * During removal only\n");
140 141
 		    break;
141
-		case 0x0002:
142
+		case 0x02:
142 143
 		    cli_dbgmsg("SIS:    * During installation and removal\n");
143 144
 		    break;
145
+		default:
146
+		    cli_warnmsg("SIS: sis_extract_simple: Unknown value in file details (0x%x)\n", cli_readint32(mfile + offset + 4));
147
+	    }
148
+	    switch(val & 0xff00) {
144 149
 		case 0x0100:
145 150
 		    cli_dbgmsg("SIS:    * Ends when installation finished\n");
146 151
 		    break;
... ...
@@ -148,7 +153,7 @@ static int sis_extract_simple(int fd, char *mfile, uint32_t length, uint32_t off
148 148
 		    cli_dbgmsg("SIS:    * Waits until closed before continuing\n");
149 149
 		    break;
150 150
 		default:
151
-		    cli_warnmsg("SIS: sis_extract_simple: Unknown value in file details\n");
151
+		    cli_warnmsg("SIS: sis_extract_simple: Unknown value in file details (0x%x)\n", cli_readint32(mfile + offset + 4));
152 152
 	    }
153 153
 	    break;
154 154
 	case 0x04:
... ...
@@ -470,10 +475,10 @@ int cli_scansis(int desc, cli_ctx *ctx)
470 470
     if(opts & 0x0002)
471 471
 	cli_dbgmsg("SIS:    * File is distributable\n");
472 472
     if(opts & 0x0008) {
473
-	cli_dbgmsg("SIS:    * Packed files are not compressed\n");
473
+	cli_dbgmsg("SIS:    * Archived files are not compressed\n");
474 474
 	compressed = 0;
475 475
     } else {
476
-	cli_dbgmsg("SIS:    * Packed files are compressed\n");
476
+	cli_dbgmsg("SIS:    * Archived files are compressed\n");
477 477
 	compressed = 1;
478 478
     }
479 479
     if(opts & 0x0010)