Changeset 251
- Timestamp:
- Oct 1, 2009, 9:42:28 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/configure.ac
r248 r251 12 12 dnl start 13 13 dnl 14 AM_INIT_AUTOMAKE(samhain, 2.5.9 b)14 AM_INIT_AUTOMAKE(samhain, 2.5.9c) 15 15 AC_DEFINE([SAMHAIN], 1, [Application is samhain]) 16 16 AC_CANONICAL_HOST -
trunk/docs/Changelog
r250 r251 1 2.5.9c: 2 * move stale file record error message closer to problem zone 3 * sh_port2proc.c: fix flawed logic for interpreting /proc/net/udp,tcp 4 1 5 2.5.9b: 2 6 * remove stale file record when creating handle, and raise diagnostic -
trunk/src/sh_port2proc.c
r250 r251 46 46 #if defined(SH_USE_PORTCHECK) && (defined (SH_WITH_CLIENT) || defined (SH_STANDALONE)) 47 47 48 /* #define DEBUG_P2P 1 */ 49 48 50 /**************************************************************************** 49 51 * … … 329 331 *pid = 0; 330 332 333 #ifdef DEBUG_P2P 334 { 335 char errmsg[256]; 336 sl_snprintf(errmsg, sizeof(errmsg), 337 "query, file=%s, proto=%d, port=%d, iface=%s\n", 338 file, proto, sport, inet_ntoa(*saddr)); 339 fprintf(stderr, "%s", errmsg); 340 } 341 #endif 342 331 343 if (fd) 332 344 { 333 int n, iface, port, inode;345 unsigned int n, iface, port, inode, istatus; 334 346 char line[512]; 335 347 … … 337 349 { 338 350 339 if (4 == sscanf(line, 340 "%d: %X:%X %*X:%*X %*X %*X:%*X %*X:%*X %*X %*d %*d %d %*s", 341 &n, &iface, &port, &inode)) 351 #ifdef DEBUG_P2P 352 { 353 fprintf(stderr, "%s", line); 354 } 355 #endif 356 357 if (5 == sscanf(line, 358 "%u: %X:%X %*X:%*X %X %*X:%*X %*X:%*X %*X %*d %*d %u %*s", 359 &n, &iface, &port, &istatus, &inode)) 342 360 { 343 361 struct in_addr haddr; 362 344 363 haddr.s_addr = (unsigned long)iface; 345 364 346 if ((proto == IPPROTO_UDP || haddr.s_addr == saddr->s_addr) && port == sport) 365 #ifdef DEBUG_P2P 366 { 367 char a[32]; 368 char b[32]; 369 370 sl_strlcpy(a, inet_ntoa(haddr), sizeof(a)); 371 sl_strlcpy(b, inet_ntoa(*saddr), sizeof(b)); 372 373 fprintf(stderr, " -> inode %u, iface/port %s,%u, status %u, searching %s,%u, %u\n", 374 inode, a, port, istatus, b, sport, 375 proto == IPPROTO_TCP ? 0x0a : 0x07); 376 } 377 #endif 378 379 if (proto == IPPROTO_TCP && istatus != 0x0a) 380 continue; 381 if (proto == IPPROTO_UDP && istatus == 0x01) 382 continue; 383 384 #ifdef DEBUG_P2P 385 { 386 fprintf(stderr, "check iface %u..\n", iface); 387 } 388 #endif 389 390 if ((proto == IPPROTO_UDP || iface == 0 || haddr.s_addr == saddr->s_addr) && port == (unsigned int)sport) 347 391 { 348 392 struct sock_store * new = socklist; 349 393 394 #ifdef DEBUG_P2P 395 { 396 fprintf(stderr, "found it\n"); 397 } 398 #endif 399 350 400 while (new) 351 401 { 352 if ((unsigned int)inode == new->sock) 402 #ifdef DEBUG_P2P 403 { 404 fprintf(stderr, "searching inode %u: %lu\n", 405 inode, new->sock); 406 } 407 #endif 408 if (inode == new->sock) 353 409 { 410 #ifdef DEBUG_P2P 411 { 412 fprintf(stderr, "found it: path=(%s), user=(%s)\n", 413 new->path == NULL ? "NULL" : new->path, 414 new->user == NULL ? "NULL" : new->user); 415 } 416 #endif 354 417 fclose(fd); 355 418 *pid = (unsigned long) new->pid; -
trunk/src/sh_unix.c
r248 r251 3477 3477 err_open = errno; 3478 3478 3479 { 3480 char * stale = sl_check_stale(); 3481 3482 if (stale) 3483 { 3484 sh_error_handle(SH_ERR_ERR, FIL__, __LINE__, err_open, MSG_E_SUBGEN, 3485 stale, _("sh_unix_getinfo_open")); 3486 } 3487 } 3488 3479 3489 alert_timeout = 120; /* this is per 8K block now ! */ 3480 3490 … … 3505 3515 { 3506 3516 fstat_return = retry_fstat (FIL__, __LINE__, fd, &fbuf); 3517 3507 3518 if (fstat_return) 3508 fstat_errno = errno; 3519 { 3520 char * stale; 3521 3522 fstat_errno = errno; 3523 3524 stale = sl_check_stale(); 3525 3526 if (stale) 3527 { 3528 sh_error_handle(SH_ERR_ERR, FIL__, __LINE__, fstat_errno, 3529 MSG_E_SUBGEN, 3530 stale, _("sh_unix_getinfo_fstat")); 3531 } 3532 } 3509 3533 } 3510 3534 else
Note:
See TracChangeset
for help on using the changeset viewer.