- Timestamp:
- Apr 30, 2010, 11:55:18 PM (15 years ago)
- Location:
- trunk/src
- Files:
-
- 2 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/dnmalloc.c
r237 r279 309 309 char * i3 = "): "; 310 310 char * i5 = "\n"; 311 int res = 0; 311 312 312 313 iov[0].iov_base = i1; iov[0].iov_len = strlen(i1); … … 314 315 iov[2].iov_base = i3; iov[2].iov_len = strlen(i3); 315 316 iov[3].iov_base = (char*) error; iov[3].iov_len = strlen(error); 316 iov[4].iov_base = i5; iov[4].iov_len = strlen(i5); 317 writev(STDERR_FILENO, iov, 5); 317 iov[4].iov_base = i5; iov[4].iov_len = strlen(i5); 318 do { 319 res = writev(STDERR_FILENO, iov, 5); 320 } while (res < 0 && errno == EINTR); 318 321 #else 319 322 fputs("assertion failed (", stderr); -
trunk/src/kern_head.c
r96 r279 7 7 #include "config.h" 8 8 9 #if def HOST_IS_I86LINUX9 #if defined(HOST_IS_I86LINUX) || defined(HOST_IS_64LINUX) 10 10 #define SH_IDT_TABLE 11 11 #endif … … 73 73 static unsigned char system_call_code[SYS_CODE_SIZE]; 74 74 75 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) 76 75 77 static int kmem_read (int fd, unsigned long addr, unsigned char * buf, int len) 76 78 { … … 105 107 106 108 if (verbose) 107 fprintf(stderr, 108 "kmem_mmap: read() from /dev/kmem failed, now trying mmap()\n"); 109 fprintf(stderr, "kmem_mmap: read() failed, now trying mmap()\n"); 109 110 110 111 sz = getpagesize(); /* unistd.h */ … … 141 142 142 143 fd = open ("/dev/kmem", O_RDONLY); 144 143 145 if (fd < 0) 144 146 { 145 perror("read_kcode: open /dev/kmem"); 146 return -1; 147 } 147 if (0 != access("/proc/kmem", R_OK)) 148 { 149 perror("read_kcode: access /proc/kmem"); 150 151 fprintf(stderr, "\n"); 152 153 fprintf(stderr, "NOTE: kern_head: apparently you have no /dev/kmem, and the samhain_kmem module is not loaded\n"); 154 fprintf(stderr, " If you get this message, then proceed as follows:\n"); 155 fprintf(stderr, " $ make samhain_kmem.ko\n"); 156 fprintf(stderr, " $ sudo insmod samhain_kmem.ko; sudo ./kern_head > sh_ks.h; sudo rmmod samhain_kmem\n"); 157 fprintf(stderr, " $ make\n\n"); 158 exit (EXIT_FAILURE); 159 } 160 fd = open ("/proc/kmem", O_RDONLY); 161 } 162 163 if (fd < 0) 164 { 165 perror("read_kcode: open /dev/kmem and /proc/kmem"); 166 return -1; 167 } 168 148 169 if (kmem_mmap(fd, addr, buf, len) < 0) 149 170 { … … 151 172 return -1; 152 173 } 174 153 175 close (fd); 176 154 177 return 0; 155 178 } … … 203 226 { 204 227 FILE * fp; 205 char buf[512], addr[ 16], * p;228 char buf[512], addr[32], * p; 206 229 unsigned long retval = 0; 230 #if defined(__x86_64__) || defined(__amd64__) 231 int off = 8; 232 #else 233 int off = 0; 234 #endif 207 235 208 236 fp = fopen (systemmap, "r"); … … 216 244 while (fgets(buf, 512, fp) != NULL) 217 245 { 218 if (buf[9 ] != flag)246 if (buf[9+off] != flag) 219 247 continue; 220 248 … … 223 251 *p = '\0'; 224 252 225 if (0 != strcmp(&buf[11 ], symbol))253 if (0 != strcmp(&buf[11+off], symbol)) 226 254 continue; 227 255 228 256 addr[0] = '0'; addr[1] = 'x'; addr[2] = '\0'; 229 strncat(&addr[2], buf, 8 );257 strncat(&addr[2], buf, 8+off); 230 258 231 259 retval = strtoul(addr, NULL, 0); … … 247 275 { 248 276 FILE * fp; 249 char buf[512], addr[ 16], name[128];277 char buf[512], addr[32], name[128]; 250 278 int i, j, count = 0, maxcall = 0; 279 #if defined(__x86_64__) || defined(__amd64__) 280 int off = 8; 281 #else 282 int off = 0; 283 #endif 251 284 252 285 fp = fopen (SYSTEMMAP, "r"); … … 266 299 { 267 300 268 if ( ( (buf[9 ] == 'D') || (buf[9] == 'd') ||269 (buf[9 ] == 'R') || (buf[9] == 'r')) &&270 0 == strncmp("sys_call_table", &buf[11 ], 14))301 if ( ( (buf[9+off] == 'D') || (buf[9+off] == 'd') || 302 (buf[9+off] == 'R') || (buf[9+off] == 'r')) && 303 0 == strncmp("sys_call_table", &buf[11+off], 14)) 271 304 { 272 305 printf("/* found sys_call_table */\n"); … … 274 307 */ 275 308 addr[0] = '0'; addr[1] = 'x'; addr[2] = '\0'; 276 strncat(&addr[2], buf, 8); 277 addr[10] = '\0'; 309 strncat(&addr[2], buf, 8+off); 310 addr[10+off] = '\0'; 311 278 312 sh_sys_call.addr_sys_call_table = strtoul(addr, NULL, 0); 279 313 if (sh_sys_call.addr_sys_call_table == ULONG_MAX) … … 288 322 } 289 323 290 if (buf[9 ] != 'T')324 if (buf[9+off] != 'T') 291 325 continue; 292 326 293 if (0 == strncmp("system_call", &buf[11 ], 11))327 if (0 == strncmp("system_call", &buf[11+off], 11)) 294 328 { 295 329 printf("/* found system_call */\n"); … … 297 331 */ 298 332 addr[0] = '0'; addr[1] = 'x'; addr[2] = '\0'; 299 strncat(&addr[2], buf, 8 );300 addr[10 ] = '\0';333 strncat(&addr[2], buf, 8+off); 334 addr[10+off] = '\0'; 301 335 addr_system_call = strtoul(addr, NULL, 0); 302 336 if (addr_system_call == ULONG_MAX) … … 308 342 309 343 310 if ( (buf[11]!='s' || buf[12]!='y' || buf[13]!='s' || buf[14]!='_') && 311 (buf[11]!='o' || buf[12]!='l' || buf[13]!='d' || buf[14]!='_')) 344 if ( (buf[11+off]!='s' || buf[12+off]!='y' || 345 buf[13+off]!='s' || buf[14+off]!='_') && 346 (buf[11+off]!='o' || buf[12+off]!='l' || 347 buf[13+off]!='d' || buf[14+off]!='_')) 312 348 continue; 313 349 314 350 for (i = 0; i < num; ++i) 315 351 { 316 for (j = 0; j < 12 8; ++j)352 for (j = 0; j < 127; ++j) 317 353 { 318 if (buf[11+ j] == '\n' || buf[11+j] == '\0')354 if (buf[11+off+j] == '\n' || buf[11+off+j] == '\0') 319 355 { 320 356 name[j] = '\0'; 321 357 break; 322 358 } 323 name[j] = buf[11+ j];359 name[j] = buf[11+off+j]; 324 360 } 325 361 … … 331 367 */ 332 368 addr[0] = '0'; addr[1] = 'x'; addr[2] = '\0'; 333 strncat(&addr[2], buf, 8 );334 addr[10 ] = '\0';369 strncat(&addr[2], buf, 8+off); 370 addr[10+off] = '\0'; 335 371 sh_smap[i].addr = strtoul(addr, NULL, 0); 336 372 if (sh_smap[i].addr == ULONG_MAX) … … 347 383 } 348 384 fclose(fp); 385 349 386 if ((count > 0) && (maxcall > 0)) 350 387 return maxcall+1; … … 357 394 { 358 395 int i, count, maxcall, qq; 359 int which = 4;360 int two_six_seventeen_plus = 0;361 396 smap_entry sh_smap[SH_MAXCALLS]; 362 397 struct utsname utbuf; … … 368 403 369 404 unsigned long addr_ni_syscall = 0; 405 406 int major, minor, micro, is64 = 0; 370 407 371 408 if (argc > 1) … … 396 433 } 397 434 398 if (strncmp(p, "2.2", 3) == 0) 399 which = 2; 400 else if (strncmp(p, "2.4", 3) == 0) 401 which = 4; 402 else if (strncmp(p, "2.6", 3) == 0) 403 { 404 which = 6; 405 if (17 >= atoi (&p[4])) 406 { 407 two_six_seventeen_plus = 1; 408 } 409 } 410 else 435 if (3 != sscanf(p, "%d.%d.%d", &major, &minor, µ)) 436 { 437 perror("kern_head: sscanf"); 438 exit (EXIT_FAILURE); 439 } 440 441 if (minor != 4 && minor != 6) 411 442 { 412 443 fprintf(stderr, "kern_head: kernel %s not supported\n", p); … … 418 449 utbuf.machine[3] != '6') 419 450 { 420 fprintf(stderr, "kern_head: machine %s not supported\n", utbuf.machine); 421 exit (EXIT_FAILURE); 451 if (0 != strcmp(utbuf.machine, "x86_64")) 452 { 453 fprintf(stderr, "kern_head: machine %s not supported\n", utbuf.machine); 454 exit (EXIT_FAILURE); 455 } 456 else 457 { 458 is64 = 1; 459 } 422 460 } 423 461 … … 428 466 fprintf(stderr, "NOTE: kern_head: must run as 'root' (need to read from /dev/kmem)\n"); 429 467 fprintf(stderr, " If you get this message, then proceed as follows:\n"); 430 fprintf(stderr, " $ su\n"); 431 fprintf(stderr, " $ ./kern_head > sh_ks.h\n"); 432 fprintf(stderr, " $ exit\n"); 468 fprintf(stderr, " $ sudo ./kern_head > sh_ks.h\n"); 433 469 fprintf(stderr, " $ make\n\n"); 434 470 exit (EXIT_FAILURE); … … 438 474 printf("#define SH_KERN_CALLS_H\n\n"); 439 475 440 printf("\n/* Kernel %s, machine %s -- use table %s*/\n\n",476 printf("\n/* Kernel %s, machine %s, %d bit -- use table callz_2p4 */\n\n", 441 477 p, utbuf.machine, 442 ( which == 2) ? "callz_2p2" : "callz_2p4");443 478 (is64 == 0) ? 32 : 64, 479 (is64 == 0) ? "syscalls_32" : "syscalls_64"); 444 480 445 481 /* initiate the system call table 446 482 */ 447 for (i = 0; i < SH_MAXCALLS; ++i)448 { 449 if (which == 2)450 { 451 if ( callz_2p2[i] == NULL)483 if (is64 == 0) 484 { 485 for (i = 0; i < SH_MAXCALLS; ++i) 486 { 487 if (syscalls_32[i] == NULL) 452 488 break; 453 strcpy(sh_smap[i].name, callz_2p2[i]); 454 } 455 else 456 { 457 if (callz_2p4[i] == NULL) 489 strcpy(sh_smap[i].name, syscalls_32[i]); 490 sh_smap[i].addr = 0UL; 491 } 492 if (minor == 6) /* fix syscall map for 2.6 */ 493 { 494 strcpy(sh_smap[0].name, "sys_restart_syscall"); 495 strcpy(sh_smap[180].name, "sys_pread64"); 496 strcpy(sh_smap[181].name, "sys_pwrite64"); 497 } 498 } 499 else /* x86_64 */ 500 { 501 for (i = 0; i < SH_MAXCALLS; ++i) 502 { 503 if (syscalls_64[i] == NULL) 458 504 break; 459 strcpy(sh_smap[i].name, callz_2p4[i]); 460 } 461 sh_smap[i].addr = 0UL; 462 } 463 464 if (which == 6) /* fix syscall map for 2.6 */ 465 { 466 strcpy(sh_smap[0].name, "sys_restart_syscall"); 467 strcpy(sh_smap[180].name, "sys_pread64"); 468 strcpy(sh_smap[181].name, "sys_pwrite64"); 469 } 505 strcpy(sh_smap[i].name, syscalls_64[i]); 506 sh_smap[i].addr = 0UL; 507 } 508 } 509 470 510 count = i; 471 511 472 /* get the actual number of the highest syscall sand use no more.512 /* get the actual number of the highest syscall and use no more. 473 513 * get sys_call_table and system_call 474 514 */ … … 480 520 exit (EXIT_FAILURE); 481 521 } 522 482 523 if (addr_system_call == 0L) 483 524 { … … 502 543 } 503 544 } 504 if (which < 6) 545 546 if (minor < 6) 505 547 { 506 548 maxcall = (maxcall > 256) ? 256 : maxcall; … … 622 664 } 623 665 624 if (two_six_seventeen_plus == 1) { 625 printf("#define TWO_SIX_SEVENTEEN_PLUS 1\n\n"); 626 } 666 if (KERNEL_VERSION(major,minor,micro) >= KERNEL_VERSION(2,6,17)) 667 { 668 printf("#define TWO_SIX_SEVENTEEN_PLUS 1\n\n"); 669 } 627 670 628 671 printf("#endif\n"); -
trunk/src/sh_cat.c
r265 r279 121 121 { MSG_UT_LG3C, SH_ERR_INFO, EVENT, N_("msg=\"Logout\" tty=\"%s\" time=\"%s\" status=\"%d\"")}, 122 122 { MSG_UT_ROT, SH_ERR_WARN, RUN, N_("msg=\"Logfile size decreased\" path=\"%s\"")}, 123 124 { MSG_UT_BAD, SH_ERR_SEVERE, EVENT, N_("msg=\"Login at disallowed time\" userid=\"%s\" host=\"%s\" time=\"%s\"")}, 125 { MSG_UT_FIRST, SH_ERR_SEVERE, EVENT, N_("msg=\"First login from this host\" userid=\"%s\" host=\"%s\" time=\"%s\"")}, 126 { MSG_UT_OUTLIER, SH_ERR_SEVERE, EVENT, N_("msg=\"Login time outlier\" userid=\"%s\" host=\"%s\" time=\"%s\"")}, 123 127 124 128 #endif … … 454 458 { MSG_UT_ROT, SH_ERR_WARN, RUN, N_("msg=<Logfile size decreased>, path=<%s>")}, 455 459 460 { MSG_UT_BAD, SH_ERR_SEVERE, EVENT, N_("msg=<Login at disallowed time> userid=<%s> host=<%s> time=<%s>")}, 461 { MSG_UT_FIRST, SH_ERR_SEVERE, EVENT, N_("msg=<First login from this host> userid=<%s> host=<%s> time=<%s>")}, 462 { MSG_UT_OUTLIER, SH_ERR_SEVERE, EVENT, N_("msg=<Login time outlier> userid=<%s> host=<%s> time=<%s>")}, 456 463 #endif 457 464 -
trunk/src/sh_err_log.c
r248 r279 377 377 key[0] = '\0'; 378 378 379 while (s l_strlen(key) < KEY_LEN )379 while (strlen(key) < KEY_LEN ) 380 380 { 381 381 if (key[0] != '\n' && key[0] != '\0') -
trunk/src/sh_err_syslog.c
r170 r279 131 131 } 132 132 133 133 static int sh_stamp_priority = LOG_ERR; 134 135 /* set priority for heartbeat messages 136 */ 137 int sh_log_set_stamp_priority (const char * c) 138 { 139 int retval = 0; 140 141 if (0 == strcmp(c, _("LOG_DEBUG"))) { sh_stamp_priority = LOG_DEBUG; } 142 else if (0 == strcmp(c, _("LOG_INFO"))) { sh_stamp_priority = LOG_INFO; } 143 else if (0 == strcmp(c, _("LOG_NOTICE"))) { sh_stamp_priority = LOG_NOTICE;} 144 else if (0 == strcmp(c, _("LOG_WARNING"))) { sh_stamp_priority = LOG_WARNING;} 145 else if (0 == strcmp(c, _("LOG_ERR"))) { sh_stamp_priority = LOG_ERR; } 146 else if (0 == strcmp(c, _("LOG_CRIT"))) { sh_stamp_priority = LOG_CRIT; } 147 else if (0 == strcmp(c, _("LOG_ALERT"))) { sh_stamp_priority = LOG_ALERT; } 148 #ifdef LOG_EMERG 149 else if (0 == strcmp(c, _("LOG_EMERG"))) { sh_stamp_priority = LOG_EMERG; } 150 #endif 151 else { retval = -1; } 152 153 return retval; 154 } 134 155 135 156 /* syslog error message … … 154 175 else if (severity == SH_ERR_NOTICE) priority = LOG_NOTICE; 155 176 else if (severity == SH_ERR_WARN) priority = LOG_WARNING; 156 else if (severity == SH_ERR_STAMP) priority = LOG_ERR;177 else if (severity == SH_ERR_STAMP) priority = sh_stamp_priority; 157 178 else if (severity == SH_ERR_ERR) priority = LOG_ERR; 158 179 else if (severity == SH_ERR_SEVERE) priority = LOG_CRIT; -
trunk/src/sh_hash.c
r252 r279 1805 1805 sl_write (pushdata_fd, _(" Date "), 6); 1806 1806 (void) sh_unix_time(0, timestring, sizeof(timestring)); 1807 sl_write (pushdata_fd, timestring, s l_strlen(timestring));1807 sl_write (pushdata_fd, timestring, strlen(timestring)); 1808 1808 sl_write (pushdata_fd, "\n", 1); 1809 1809 } else { -
trunk/src/sh_kern.c
r277 r279 137 137 */ 138 138 #ifdef SH_SYS_CALL_TABLE 139 static unsigned intkaddr = SH_SYS_CALL_TABLE;139 static unsigned long kaddr = SH_SYS_CALL_TABLE; 140 140 #else 141 static unsigned intkaddr = 0;141 static unsigned long kaddr = 0; 142 142 #endif 143 143 … … 268 268 #ifdef HOST_IS_LINUX 269 269 270 #ifndef KERNEL_VERSION 271 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) 272 #endif 273 270 274 /* 271 275 * Interrupt Descriptor Table … … 281 285 static char * sh_strseg(unsigned short segment) 282 286 { 287 static int flip = 0; 288 static char one[32]; 289 static char two[32]; 290 283 291 switch (segment) { 284 292 #ifdef __KERNEL_CS … … 299 307 #endif 300 308 default: 301 return _("unknown"); 309 if (flip == 0) 310 { 311 snprintf(one, sizeof(one), "%hX", segment); 312 flip = 1; 313 return one; 314 } 315 else 316 { 317 snprintf(two, sizeof(two), "%hX", segment); 318 flip = 0; 319 return two; 320 } 302 321 } 303 322 } … … 550 569 unsigned int kmem_code_table[SH_KERN_SIZ][2]; 551 570 552 unsigned char buf[6];553 unsigned short idt_size;554 unsigned long idt_addr;555 556 571 unsigned char new_system_call_code[SH_KERN_SCC]; 557 572 … … 620 635 * and read the content into the global array sh_idt_table[] 621 636 */ 622 __asm__ volatile ("sidt %0": "=m" (buf)); 623 idt_size = *((unsigned short *) &buf[0]); 624 idt_addr = *((unsigned long *) &buf[2]); 625 idt_size = (idt_size + 1)/8; 637 struct { 638 char pad[6]; 639 unsigned short size; 640 unsigned long addr; 641 } idt; 642 643 __asm__ volatile ("sidt %0": "=m" (idt.size)); 644 645 idt.size = (idt.size + 1)/8; 626 646 627 if (idt _size > SH_MAXIDT)628 idt _size = SH_MAXIDT;647 if (idt.size > SH_MAXIDT) 648 idt.size = SH_MAXIDT; 629 649 630 650 memset(sh_idt_table, '\0', SH_MAXIDT*8); 631 if (sh_kern_read_data (kd, idt _addr,632 (unsigned char *) sh_idt_table, idt _size*8))651 if (sh_kern_read_data (kd, idt.addr, 652 (unsigned char *) sh_idt_table, idt.size*8)) 633 653 status = -5; 634 654 } … … 660 680 } 661 681 /* 2.6.21 (((2) << 16) + ((6) << 8) + (21)) */ 662 #if SH_KERNEL_NUMBER < 132629682 #if SH_KERNEL_NUMBER < KERNEL_VERSION(2,6,21) 663 683 if(status == 0) 664 684 { … … 669 689 } 670 690 #else 671 memset(&proc_root_inode, '\0', sizeof(proc_root_inode));691 memset(&proc_root_inode, '\0', sizeof(proc_root_inode)); 672 692 #endif 673 693 … … 1062 1082 static void check_proc_root (struct sh_kernel_info * kinfo) 1063 1083 { 1064 struct proc_dir_entry proc_root_dir; 1084 struct proc_dir_entry proc_root_dir; 1085 struct inode_operations * proc_root_inode_op = NULL; 1065 1086 1066 1087 /* 2.6.21 (((2) << 16) + ((6) << 8) + (21)) */ 1067 #if SH_KERNEL_NUMBER < 1326291088 #if SH_KERNEL_NUMBER < KERNEL_VERSION(2,6,21) 1068 1089 struct inode_operations proc_root_inode; 1069 1090 … … 1080 1101 1081 1102 memcpy (&proc_root_dir, &(kinfo->proc_root_dir), sizeof(struct proc_dir_entry)); 1082 if ( (((unsigned int) * &proc_root_dir.proc_iops) != proc_root_iops) 1083 && (proc_root_dir.size != proc_root_iops) 1084 && (((unsigned int) * &proc_root_dir.proc_fops) != proc_root_iops) 1085 ) 1103 1104 if (((unsigned long) * &proc_root_dir.proc_iops) == proc_root_iops) 1105 { 1106 proc_root_inode_op = (struct inode_operations *) &(proc_root_dir.proc_iops); 1107 } 1108 else if (proc_root_dir.size == proc_root_iops) 1109 { 1110 proc_root_inode_op = (struct inode_operations *) &(proc_root_dir.size); 1111 } 1112 else if ((unsigned long) * &proc_root_dir.proc_fops == proc_root_iops) 1113 { 1114 proc_root_inode_op = (struct inode_operations *) &(proc_root_dir.proc_fops); 1115 } 1116 1117 if (!proc_root_inode_op) 1086 1118 { 1087 1119 sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_KERN_PROC, … … 1365 1397 if (kd < 0) 1366 1398 { 1399 kd = aud_open(FIL__, __LINE__, SL_YESPRIV, _("/proc/kmem"), O_RDONLY, 0); 1400 } 1401 1402 if (kd < 0) 1403 { 1367 1404 status = errno; 1368 1405 sh_error_handle ((-1), FIL__, __LINE__, status, MSG_E_SUBGEN, -
trunk/src/sh_port2proc.c
r252 r279 322 322 /* returns the command and fills the 'user' array 323 323 */ 324 static char * port2proc_query(char * file, int proto, struct in_addr * saddr, int sport, 324 static char * port2proc_query(char * file, int proto, 325 struct in_addr * saddr, int sport, 325 326 unsigned long * pid, char * user, size_t userlen) 326 327 { -
trunk/src/sh_readconf.c
r272 r279 255 255 sh.host.release, sh.host.machine); 256 256 257 if (sl_strncmp (p, myident, s l_strlen(myident)) == 0257 if (sl_strncmp (p, myident, strlen(myident)) == 0 258 258 #ifdef HAVE_REGEX_H 259 259 || sh_util_regcmp (p, myident) == 0 … … 1202 1202 sh_log_set_facility }, 1203 1203 1204 { N_("syslogmapstampto"), SH_SECTION_LOG, SH_SECTION_MISC, 1205 sh_log_set_stamp_priority }, 1206 1204 1207 { N_("mactype"), SH_SECTION_MISC, SH_SECTION_NONE, 1205 1208 sh_util_sigtype }, -
trunk/src/sh_unix.c
r265 r279 670 670 sig_force_check = 1; 671 671 #endif 672 #ifdef SIGTTIN 673 if (mysignal == SIGTTIN) 674 sig_fresh_trail = 1; 675 #endif 672 676 #ifdef SIGABRT 673 677 if (mysignal == SIGABRT) … … 837 841 retry_sigaction(FIL__, __LINE__, SIGTSTP, &ignact, &oldact); 838 842 #endif 839 #ifdef SIGTTIN 840 retry_sigaction(FIL__, __LINE__, SIGTTIN, &ignact, &oldact); 841 #endif 843 842 844 #if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE) 843 845 #ifdef SIGTTOU … … 847 849 retry_sigaction(FIL__, __LINE__, SIGTTOU, &ignact, &oldact); 848 850 #endif 851 #ifdef SIGTTIN 852 if (goDaemon == 1) 853 retry_sigaction(FIL__, __LINE__, SIGTTIN, &act2, &oldact); 854 else 855 retry_sigaction(FIL__, __LINE__, SIGTTIN, &ignact, &oldact); 856 #endif 849 857 #else 850 858 #ifdef SIGTTOU 851 859 retry_sigaction(FIL__, __LINE__, SIGTTOU, &ignact, &oldact); 860 #endif 861 #ifdef SIGTTIN 862 retry_sigaction(FIL__, __LINE__, SIGTTIN, &ignact, &oldact); 852 863 #endif 853 864 #endif … … 3128 3139 SL_RETURN(0, _("sh_unix_getinfo_attr")); 3129 3140 } 3130 #else3131 static3132 int sh_unix_getinfo_attr (char * name,3133 unsigned long * flags,3134 char * c_attr,3135 int fd, struct stat * buf)3136 {3137 return 0;3138 }3139 3141 3140 3142 /* defined(__linux__) || defined(HAVE_STAT_FLAGS) */ … … 3905 3907 theFile->attributes = 0; 3906 3908 3909 #if (defined(__linux__) && (defined(HAVE_LINUX_EXT2_FS_H) || defined(HAVE_EXT2FS_EXT2_FS_H))) || defined(HAVE_STAT_FLAGS) 3907 3910 if (theFile->c_mode[0] != 'c' && theFile->c_mode[0] != 'b' && 3908 3911 theFile->c_mode[0] != 'l' ) … … 3910 3913 &theFile->attributes, theFile->c_attributes, 3911 3914 fd, &buf); 3915 #endif 3912 3916 #endif 3913 3917 -
trunk/src/sh_utmp.c
r262 r279 225 225 }, 226 226 { 227 N_("logincheckfirst"), 228 sh_login_set_checklevel 229 }, 230 { 231 N_("logincheckoutlier"), 232 sh_login_set_siglevel 233 }, 234 { 235 N_("logincheckdate"), 236 sh_login_set_def_allow 237 }, 238 { 239 N_("logincheckuserdate"), 240 sh_login_set_user_allow 241 }, 242 { 227 243 NULL, 228 244 NULL … … 237 253 ShUtmpActive = S_TRUE; 238 254 ShUtmpInterval = 300; 255 256 sh_login_reset(); 239 257 return; 240 258 } … … 498 516 int sh_utmp_init (struct mod_type * arg) 499 517 { 518 #if !defined(HAVE_PTHREAD) 519 (void) arg; 520 #endif 500 521 if (ShUtmpActive == BAD) 501 522 return SH_MOD_FAILED; … … 548 569 init_done = 0; 549 570 571 #if defined(HAVE_PTHREAD) 550 572 sh_inotify_remove(&inotify_watch); 573 #endif 551 574 552 575 SL_RETURN( (0), _("sh_utmp_end")); … … 557 580 { 558 581 set_defaults(); 582 #if defined(HAVE_PTHREAD) 559 583 sh_inotify_remove(&inotify_watch); 584 #endif 560 585 return 0; 561 586 } … … 1206 1231 } 1207 1232 1233 extern void sh_ltrack_check(struct SH_UTMP_S * ut); 1208 1234 1209 1235 static void sh_utmp_login_morechecks(struct SH_UTMP_S * ut) 1210 1236 { 1211 if (ut) 1212 return; 1237 sh_ltrack_check(ut); 1213 1238 return; 1214 1239 } … … 1216 1241 static void sh_utmp_logout_morechecks(struct log_user * user) 1217 1242 { 1218 if (user) 1219 return; 1243 (void) user; 1220 1244 return; 1221 1245 } -
trunk/src/slib.c
r272 r279 16 16 #endif 17 17 18 #include <sys/types.h> 19 #include <sys/stat.h> 18 20 #include <unistd.h> 19 #include <sys/stat.h>20 #include <sys/types.h>21 21 #include <fcntl.h> 22 22 #include <signal.h> … … 259 259 else 260 260 sl_strlcpy(tmp, fmt, 256); 261 retval = s l_strlen(tmp);261 retval = strlen(tmp); 262 262 if (retval > 0 && tmp[retval-1] == '\n') 263 263 tmp[retval-1] = '\0'; … … 274 274 sprintf (val, _("[%2d] "), trace_level); 275 275 sl_strlcat (msg, val, 256); 276 sl_vsnprintf (&msg[s l_strlen(msg)], 255, tmp, ap);276 sl_vsnprintf (&msg[strlen(msg)], 255, tmp, ap); 277 277 sl_snprintf (tmp, 255, _(" \t - File %c%s%c at line %d"), 278 278 0x22, file, 0x22, line);
Note:
See TracChangeset
for help on using the changeset viewer.