Changeset 247
- Timestamp:
- Sep 17, 2009, 10:22:48 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/configure.ac
r242 r247 12 12 dnl start 13 13 dnl 14 AM_INIT_AUTOMAKE(samhain, 2.5. 8a)14 AM_INIT_AUTOMAKE(samhain, 2.5.9a) 15 15 AC_DEFINE([SAMHAIN], 1, [Application is samhain]) 16 16 AC_CANONICAL_HOST -
trunk/docs/Changelog
r246 r247 1 2.5.9: 1 2.5.9a: 2 * fixed a race condition in closing of file handles 3 4 2.5.9 (11-09-2009): 2 5 * added code to generate directory for pid file, since it 3 6 would get cleaned if /var/run is a tmpfs mount (problem … … 5 8 * fixed a bug that prevented reporting of user/executable path 6 9 for open UDP ports (issue reported by N. Rath) 7 8 2.5.8a: 10 * added more debugging code 11 12 2.5.8a (18-08-2009): 9 13 * fixed a bug in sh_files.c that would prevent samhain from 10 14 running on MacOS X (reported by David) 11 15 12 2.5.8 :16 2.5.8 (06-08-2009): 13 17 * fixed a bug in the MX resolver routine which causes it to fail 14 18 sometimes (issue reported by N. Rath). -
trunk/src/sh_extern.c
r235 r247 391 391 _exit(EXIT_FAILURE); 392 392 } 393 393 394 pfd = get_the_fd(fd); 395 396 do { 397 val_return = dup (pfd); 398 } while (val_return < 0 && errno == EINTR); 399 pfd = val_return; 400 if (pfd < 0) 401 { 402 PDBGC_S("fexecve: dup (2) failed"); 403 _exit(EXIT_FAILURE); 404 } 405 sl_close(fd); 406 fd = -1; 394 407 } 395 408 #endif … … 426 439 sl_close(fd); 427 440 else if (pfd != -1) 428 close( fd);441 close(pfd); 429 442 } 430 443 #endif -
trunk/src/sh_gpg.c
r227 r247 263 263 264 264 #if defined(HAVE_GPG_CHECKSUM) 265 SL_TICKET checkfd ;265 SL_TICKET checkfd = -1; 266 266 int myrand; 267 267 int i; … … 560 560 */ 561 561 sl_close(checkfd); 562 checkfd = -1; 562 563 #endif 563 564 -
trunk/src/sh_hash.c
r227 r247 820 820 } 821 821 822 sh_fin_fd = fdopen( get_the_fd(fd), "rb");822 sh_fin_fd = fdopen(dup(get_the_fd(fd)), "rb"); 823 823 if (!sh_fin_fd) 824 824 { … … 1128 1128 #if defined(WITH_GPG) || defined(WITH_PGP) 1129 1129 extern int get_the_fd (SL_TICKET ticket); 1130 FILE * fin_cp ;1130 FILE * fin_cp = NULL; 1131 1131 1132 1132 char * buf = NULL; … … 1243 1243 fdTmp = open_tmp(); 1244 1244 1245 fin_cp = fdopen( get_the_fd(fd), "rb");1245 fin_cp = fdopen(dup(get_the_fd(fd)), "rb"); 1246 1246 buf = SH_ALLOC(FGETS_BUF); 1247 1247 -
trunk/src/sh_unix.c
r246 r247 1279 1279 fdlimit = 65536; 1280 1280 1281 if (!inchild) 1282 sl_dropall (fdx, except); 1283 else 1284 sl_dropall_dirty (fdx, except); 1285 1281 1286 /* Close everything from fd (inclusive) up to fdlimit (exclusive). 1282 1287 */ … … 1290 1295 close(fd++); 1291 1296 } 1292 1293 if (!inchild)1294 sl_dropall (fdx, except);1295 else1296 sl_dropall_dirty (fdx, except);1297 1297 1298 1298 SL_RET0(_("sh_unix_closeall")); -
trunk/src/slib.c
r243 r247 1674 1674 if ( (ofiles[fd]->path = (char *) malloc(len) ) == NULL) 1675 1675 { 1676 free (ofiles[fd]);1676 free (ofiles[fd]); 1677 1677 ofiles[fd] = NULL; 1678 1678 SL_IRETURN(SL_EMEM, _("sl_make_ticket")); … … 1687 1687 (void) free (ofiles[fd]->path); 1688 1688 (void) free (ofiles[fd]); 1689 ofiles[fd] = NULL; 1689 1690 SL_IRETURN(ticket, _("sl_make_ticket")); 1690 1691 } … … 1935 1936 if ( (ofiles[fd]->path = (char *) malloc(len) ) == NULL) 1936 1937 { 1937 free (ofiles[fd]);1938 free (ofiles[fd]); 1938 1939 ofiles[fd] = NULL; 1939 1940 close(fd); … … 1949 1950 (void) free (ofiles[fd]->path); 1950 1951 (void) free (ofiles[fd]); 1952 ofiles[fd] = NULL; 1951 1953 close(fd); 1952 1954 SL_IRETURN(ticket, _("sl_open_file")); … … 2209 2211 SL_IRETURN(fd, _("sl_close")); 2210 2212 2213 if (ofiles[fd] != NULL) 2214 { 2211 2215 #if defined(HAVE_POSIX_FADVISE) && defined(HAVE_MINCORE) && defined(POSIX_FADV_DONTNEED) 2212 2213 if (ofiles[fd]->flush == SL_TRUE) 2214 { 2215 posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED); 2216 } 2217 2218 #endif 2216 if (ofiles[fd]->flush == SL_TRUE) 2217 { 2218 posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED); 2219 } 2220 #endif 2221 if (ofiles[fd]->content) 2222 sh_string_destroy(&(ofiles[fd]->content)); 2223 (void) free (ofiles[fd]->path); 2224 (void) free (ofiles[fd]); 2225 ofiles[fd] = NULL; 2226 } 2219 2227 2220 2228 /* This may fail, but what to do then ? 2221 2229 */ 2222 if (0 != close(fd) && ofiles[fd] != NULL)2230 if (0 != close(fd)) 2223 2231 { 2224 2232 TPT((0, FIL__, __LINE__, 2225 _("msg=<Error closing file.>, path=<%s>, fd=<%d>, err=<%s>\n"), 2226 ofiles[fd]->path, fd, strerror(errno))); 2227 } 2228 2229 if (ofiles[fd] != NULL) 2230 { 2231 if (ofiles[fd]->content) 2232 sh_string_destroy(&(ofiles[fd]->content)); 2233 (void) free(ofiles[fd]->path); 2234 (void) free(ofiles[fd]); 2235 ofiles[fd] = NULL; 2233 _("msg=<Error closing file.>, fd=<%d>, err=<%s>\n"), 2234 fd, strerror(errno))); 2236 2235 } 2237 2236 … … 2248 2247 sh_string_destroy(&(ofiles[fd]->content)); 2249 2248 if (ofiles[fd]->path != NULL) 2250 (void) free (ofiles[fd]->path);2251 (void) free (ofiles[fd]);2249 (void) free (ofiles[fd]->path); 2250 (void) free (ofiles[fd]); 2252 2251 ofiles[fd] = NULL; 2253 2252 }
Note:
See TracChangeset
for help on using the changeset viewer.