Browse code

* libclamav/chmunpack.c: make sure we don't get filename collisions * clamd/server-th.c: don't queue requests when we are exiting

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@764 77e5149b-7576-45b1-b177-96237e5ba77b

Trog authored on 2004/08/18 23:25:58
Showing 3 changed files
... ...
@@ -1,3 +1,9 @@
1
+Wed Aug 18 15:24:00 BST 2004 (trog)
2
+-----------------------------------
3
+  * libclamav/chmunpack.c: make sure we don't get filename collisions
4
+
5
+  * clamd/server-th.c: don't queue requests when we are exiting
6
+
1 7
 Wed Aug 18 13:01:06 CEST 2004 (tk)
2 8
 ----------------------------------
3 9
   * libclamav/filetypes.c: add new e-mail detection rule
... ...
@@ -447,7 +447,7 @@ int acceptloop_th(int socketd, struct cl_node *root, const struct cfgstruct *cop
447 447
 		sighup = 0;
448 448
 	}
449 449
 
450
-	if (new_sd >= 0) {
450
+	if (!progexit && new_sd >= 0) {
451 451
 		client_conn = (client_conn_t *) mmalloc(sizeof(struct client_conn_tag));
452 452
 		client_conn->sd = new_sd;
453 453
 		client_conn->options = options;
... ...
@@ -464,6 +464,9 @@ int acceptloop_th(int socketd, struct cl_node *root, const struct cfgstruct *cop
464 464
 
465 465
 	pthread_mutex_lock(&exit_mutex);
466 466
 	if(progexit) {
467
+	    if (new_sd >= 0) {
468
+		close(new_sd);
469
+	    }
467 470
 	    pthread_mutex_unlock(&exit_mutex);
468 471
 	    break;
469 472
 	}
... ...
@@ -846,7 +846,7 @@ static int chm_decompress_stream(int fd, const char *dirname, itsf_header_t *its
846 846
 	lzx_content_t *lzx_content=NULL;
847 847
 	lzx_reset_table_t *lzx_reset_table=NULL;
848 848
 	lzx_control_t *lzx_control=NULL;
849
-	int window_bits, length, ofd, retval=FALSE;
849
+	int window_bits, count, length, ofd, retval=FALSE;
850 850
 	uint64_t com_offset;
851 851
 	struct mspack_file_p mf_in, mf_out;
852 852
 	struct lzxd_stream * stream;
... ...
@@ -962,6 +962,7 @@ static int chm_decompress_stream(int fd, const char *dirname, itsf_header_t *its
962 962
 	/* Delete the file */
963 963
 	unlink(filename);
964 964
 	
965
+	count=0;
965 966
 	while(entry) {
966 967
 		if (entry->section != 1) {
967 968
 			entry = entry->next;
... ...
@@ -973,7 +974,7 @@ static int chm_decompress_stream(int fd, const char *dirname, itsf_header_t *its
973 973
 			continue;
974 974
 		}
975 975
 		
976
-		snprintf(filename, 1024, "%s/%llu.chm", dirname, entry->offset);
976
+		snprintf(filename, 1024, "%s/%d-%llu.chm", dirname, count, entry->offset);
977 977
 		ofd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, S_IRWXU);
978 978
 		if (ofd < 0) {
979 979
 			entry = entry->next;
... ...
@@ -985,6 +986,7 @@ static int chm_decompress_stream(int fd, const char *dirname, itsf_header_t *its
985 985
 		
986 986
 		close(ofd);		
987 987
 		entry = entry->next;
988
+		count++;
988 989
 	}
989 990
 	close(mf_out.desc);
990 991
 	retval = TRUE;