- Timestamp:
- Dec 5, 2011, 10:30:33 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/configure.ac
r378 r383 12 12 dnl start 13 13 dnl 14 AM_INIT_AUTOMAKE(samhain, 3.0. 0a)14 AM_INIT_AUTOMAKE(samhain, 3.0.1) 15 15 AC_DEFINE([SAMHAIN], 1, [Application is samhain]) 16 16 AC_CANONICAL_HOST -
trunk/include/sh_mem.h
r149 r383 35 35 #define SH_FREE(a) sh_mem_free((a), FIL__, __LINE__) 36 36 #define SH_ALLOC(a) sh_mem_malloc((a), FIL__, __LINE__) 37 #define SH_OALLOC(a,b,c) sh_mem_malloc((a), (b), (c)) 37 38 38 39 #else … … 51 52 #define SH_FREE(a) sh_mem_free(a) 52 53 #define SH_ALLOC(a) sh_mem_malloc(a) 54 #define SH_OALLOC(a,b,c) ((void) (b), \ 55 (void) (c), \ 56 sh_mem_malloc(a)) \ 53 57 54 58 #endif -
trunk/include/sh_pthread.h
r378 r383 31 31 do { \ 32 32 int oldtype; \ 33 int executeStack = 0;\33 volatile int executeStack = 0; \ 34 34 pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype); \ 35 35 pthread_cleanup_push(sh_pthread_mutex_unlock, (void*)&(M));\ -
trunk/src/depend-gen.c
r1 r383 197 197 p = strrchr(name, '/'); 198 198 if (p) 199 ++p; 200 len = strlen(p); 199 { 200 ++p; 201 len = strlen(p); 202 } 201 203 202 204 /* skip other dependencies … … 206 208 if (NULL == fgets(line, 1023, fout)) 207 209 break; 208 if ( 0 == strncmp(line, p, len))210 if (p && 0 == strncmp(line, p, len)) 209 211 break; 210 212 fprintf(ftmp, "%s", line); -
trunk/src/dnmalloc.c
r362 r383 2854 2854 assert(temp != NULL); 2855 2855 #endif 2856 prevtemp->hash_next = temp->hash_next;2856 if (temp) prevtemp->hash_next = temp->hash_next; 2857 2857 } 2858 2858 } … … 3558 3558 3559 3559 else { 3560 front_misalign = 0;3561 end_misalign = 0;3560 /* front_misalign = 0; *//*superfluous */ 3561 /* end_misalign = 0; *//*superfluous */ 3562 3562 correction = 0; 3563 3563 aligned_brk = brk; … … 4284 4284 retval = sYSMALLOc(nb, av); 4285 4285 if (retval) { 4286 victim = mem2chunk(retval); 4286 #if PARANOIA > 2 4287 victim = mem2chunk(retval); /* is used in guard_set macro */ 4288 #endif 4287 4289 guard_set(av->guard_stored, victim, bytes, nb); 4288 4290 } … … 5516 5518 } rdat; 5517 5519 #if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) 5518 s ize_t sz = 0;5520 ssize_t sz = 0; 5519 5521 int fd; 5520 5522 #endif … … 5540 5542 fd = open("/dev/urandom", O_RDONLY); 5541 5543 if (fd != -1) { 5542 sz = (size_t)read(fd, rdat.rnd, sizeof (rdat.rnd)); 5543 close(fd); 5544 sz = (size_t)read(fd, rdat.rnd, sizeof (rdat.rnd)); 5545 /* 5546 * gcc complains if we ignore the return value of read(), and 5547 * the llvm/clang analyzer complains if we don't use it... 5548 */ 5549 if (sz > (-256)) /* always true */ 5550 close(fd); 5544 5551 } 5552 /* 5545 5553 if (sz > sizeof (rdat.rnd)) 5546 5554 sz = 0; 5555 */ 5547 5556 #endif 5548 5557 -
trunk/src/rijndael-alg-fst.c
r291 r383 28 28 */ 29 29 int j, r, t, rconpointer = 0; 30 word8 tk[MAXKC][4] ;30 word8 tk[MAXKC][4] = { { 0 } }; /* init for llvm/clang analyzer */ 31 31 int KC = ROUNDS - 6; 32 32 word32 tmp; -
trunk/src/sh_error.c
r352 r383 648 648 } 649 649 650 if (!str_s) 651 { 652 SL_RETURN ((-1), _("sh_error_set_level")); 653 } 650 654 /* skip to end of string 651 655 */ -
trunk/src/sh_extern.c
r321 r383 435 435 /* failed 436 436 */ 437 _exit( EXIT_FAILURE);437 _exit((errnum == 0) ? (EXIT_SUCCESS) : (EXIT_FAILURE)); 438 438 } 439 439 PDBGC_S("fexecve: not working"); … … 471 471 /* failed 472 472 */ 473 _exit( EXIT_FAILURE);473 _exit((errnum == 0) ? (EXIT_SUCCESS) : (EXIT_FAILURE)); 474 474 } 475 475 /* -
trunk/src/sh_files.c
r381 r383 107 107 po = SH_ALLOC(len+1); *po = '\0'; p = po; pend = &po[len]; 108 108 109 i = 0;q = s;109 q = s; 110 110 111 111 do … … 925 925 #endif 926 926 927 int sh_files_push_file_int (int class, const char * str_s, size_t len, unsigned long check_mask) 927 int sh_files_push_file_int (int class, const char * str_s, size_t len, 928 unsigned long check_mask) 928 929 { 929 930 dirstack_t * new_item_ptr; 930 931 char * fileName; 931 932 int ret; 932 int count = 0;933 volatile int count = 0; 933 934 934 935 SL_ENTER(_("sh_files_push_file_int")); … … 1022 1023 glob_t pglob; 1023 1024 1024 int count = 0;1025 volatile int count = 0; 1025 1026 volatile unsigned long check_mask = (flag == 0) ? sh_files_maskof(class) : check_mask_in; 1026 1027 … … 1877 1878 1878 1879 static void * sh_dummy_dirlist; 1880 static void * sh_dummy_tmpcat; 1879 1881 1880 1882 /* -- Check a single directory and its content. Does not … … 1904 1906 int class = 0; 1905 1907 volatile int rdepth_next; 1906 intclass_next;1908 volatile int class_next; 1907 1909 volatile int file_class_next; 1908 unsigned long check_mask_next;1910 volatile unsigned long check_mask_next; 1909 1911 volatile unsigned long file_check_mask_next; 1910 1912 … … 1921 1923 1922 1924 SL_ENTER(_("sh_files_checkdir")); 1923 1924 sh_dummy_dirlist = (void *) &dirlist;1925 1925 1926 1926 if (sig_urgent > 0) { … … 2064 2064 sl_strlcpy (theDir->DirPath, iname, PATH_MAX); 2065 2065 2066 2067 sh_dummy_dirlist = (void *) &dirlist; 2068 sh_dummy_tmpcat = (void *) &tmpcat; 2066 2069 2067 2070 /* ---- read ---- … … 2347 2350 { 2348 2351 SH_FREE(theDir); 2352 sh_dummy_dirlist = NULL; 2349 2353 SL_RETURN((0), _("sh_files_checkdir")); 2350 2354 } … … 2397 2401 SH_FREE(tmpname); 2398 2402 SH_FREE(theDir); 2403 2404 sh_dummy_dirlist = NULL; 2399 2405 2400 2406 SL_RETURN((0), _("sh_files_checkdir")); … … 2686 2692 int * rdepth) 2687 2693 { 2688 int retval = 0;2694 volatile int retval = 0; 2689 2695 #if defined(HAVE_GLOB_H) && defined(HAVE_FNMATCH_H) 2690 2696 sh_globstack_t * testPattern; … … 2757 2763 unsigned long *check_mask, int *reported) 2758 2764 { 2759 int retval = 0;2765 volatile int retval = 0; 2760 2766 #if defined(HAVE_GLOB_H) && defined(HAVE_FNMATCH_H) 2761 2767 sh_globstack_t * testPattern; -
trunk/src/sh_forward.c
r379 r383 455 455 _("sh_forward_send_intern: blockEncrypt")); 456 456 memcpy(q, outBlock, B_SIZ); 457 q += B_SIZ;457 /* q += B_SIZ; *//* never read */ 458 458 } 459 459 … … 584 584 } 585 585 /*@-usedef +ignoresigns@*/ 586 else if (msgbuf == NULL) 587 { 588 sh_error_handle((-1), FIL__, __LINE__, 0, MSG_E_SUBGEN, 589 _("msgbuf is NULL"), _("sh_forward_receive_intern")); 590 SL_RETURN((-1), _("sh_forward_receive_intern")); 591 } 586 592 else if (head[0] != protocol && 587 593 (head[0] & SH_PROTO_SRP) == (char)0 /* not set */) … … 1666 1672 { 1667 1673 flag_err = (-1); 1668 sh_error_handle((-1), FIL__, __LINE__, 0, MSG_TCP_EFIL);1674 sh_error_handle((-1), FIL__, __LINE__, flag_err, MSG_TCP_EFIL); 1669 1675 } 1670 1676 else … … 1673 1679 */ 1674 1680 transfercount = 0; 1675 flag_err = 0;1681 /* flag_err = 0; *//* never read */ 1676 1682 1677 1683 do { … … 1734 1740 if (0 == check_request_nerr(head_u, _("EEOT")) && 1735 1741 0 < flag_err && 1736 0 == hash_check (foo_M1, answer, (int)s trlen(answer)))1742 0 == hash_check (foo_M1, answer, (int)sl_strlen(answer))) 1737 1743 { 1738 1744 flag_err = … … 1745 1751 (void) sl_sync(sfd); 1746 1752 if (flag_err_info == SL_TRUE) 1747 sh_error_handle((-1), FIL__, __LINE__, 0, MSG_TCP_FOK);1753 sh_error_handle((-1), FIL__, __LINE__, flag_err, MSG_TCP_FOK); 1748 1754 } 1749 1755 else … … 2389 2395 &(conn->client_entry->keyInstE)); 2390 2396 } 2397 else if (msg == NULL) 2398 { 2399 sh_error_handle((-1), FIL__, __LINE__, -1, MSG_E_SUBGEN, 2400 _("msg is NULL"), 2401 _("sh_forward_prep_send_int: cipherInit")); 2402 } 2391 2403 else if ((S_TRUE == docrypt) && ((protocol & SH_PROTO_ENC) != 0) && 2392 2404 ((length2 + 1) > length2)) … … 2431 2443 _("sh_forward_prep_send_int: blockEncrypt")); 2432 2444 memcpy(q, outBlock, B_SIZ); 2433 q += B_SIZ;2445 /* q += B_SIZ; *//* never read */ 2434 2446 } 2435 2447 … … 2533 2545 if (val <= 0) 2534 2546 SL_RETURN( (-1), _("sh_forward_set_time_limit")); 2535 2536 val = (val < 0 ? 0 : val);2537 2547 2538 2548 time_client_limit = (time_t) val; … … 5142 5152 conns[sock].fd = sh_tcp_sock[sock]; 5143 5153 conns[sock].state = CONN_READING; 5144 high_fd = (sh_tcp_sock[sock] > high_fd) ? sh_tcp_sock[sock] : high_fd;5154 /* high_fd = (sh_tcp_sock[sock] > high_fd) ? sh_tcp_sock[sock] : high_fd; */ 5145 5155 ++sock; 5146 5156 } … … 5149 5159 conns[sock].fd = pf_unix_fd; 5150 5160 conns[sock].state = CONN_READING; 5151 high_fd = (pf_unix_fd > high_fd) ? pf_unix_fd : high_fd;5161 /* high_fd = (pf_unix_fd > high_fd) ? pf_unix_fd : high_fd; */ 5152 5162 5153 5163 sock_unix = sock; … … 5175 5185 conns[sock].fd = syslog_sock[s2]; 5176 5186 conns[sock].state = CONN_READING; 5177 high_fd = (high_fd > conns[sock].fd) ? high_fd : conns[sock].fd;5187 /* high_fd = (high_fd > conns[sock].fd) ? high_fd : conns[sock].fd; */ 5178 5188 ++sock; 5179 5189 } -
trunk/src/sh_gpg.c
r347 r383 173 173 174 174 k = 0; 175 for (i = 0; i < 127; ++i) 176 { 177 if (test_ptr2[i] == '\0') 178 break; 179 if (test_ptr2[i] != ' ') 180 { 181 wstrip2[k] = test_ptr2[i]; 182 ++k; 175 if (test_ptr2) 176 { 177 for (i = 0; i < 127; ++i) 178 { 179 if (test_ptr2[i] == '\0') 180 break; 181 if (test_ptr2[i] != ' ') 182 { 183 wstrip2[k] = test_ptr2[i]; 184 ++k; 185 } 183 186 } 184 187 } … … 552 555 pfd = val_return; 553 556 sl_close(checkfd); 554 checkfd = -1;557 /* checkfd = -1; *//* never read */ 555 558 556 559 sl_snprintf(pname, sizeof(pname), _("/proc/self/fd/%d"), pfd); … … 815 818 { 816 819 sl_strlcpy (sign_id, &line[25], SH_MINIBUF+1); 817 sign_id[sl_strlen(sign_id)-1] = '\0'; /* remove trailing '"' */ 820 if (sign_id) 821 sign_id[sl_strlen(sign_id)-1] = '\0'; /* remove trailing '"' */ 818 822 have_id = GOOD; 819 823 } … … 839 843 ptr = strchr ( line, '"'); 840 844 ++ptr; 841 sl_strlcpy (sign_id, ptr, SH_MINIBUF+1); 842 sign_id[sl_strlen(sign_id)-1] = '\0'; /* remove trailing dot */ 843 sign_id[sl_strlen(sign_id)-2] = '\0'; /* remove trailing '"' */ 845 if (ptr) 846 { 847 sl_strlcpy (sign_id, ptr, SH_MINIBUF+1); 848 sign_id[sl_strlen(sign_id)-1] = '\0'; /* remove trailing dot */ 849 sign_id[sl_strlen(sign_id)-2] = '\0'; /* remove trailing '"' */ 850 } 851 else 852 { 853 sl_strlcpy (sign_id, _("(null)"), SH_MINIBUF+1); 854 } 844 855 have_id = GOOD; 845 856 } -
trunk/src/sh_hash.c
r371 r383 600 600 prev->next = p->next; 601 601 602 p =delete_db_entry(p);602 delete_db_entry(p); 603 603 604 604 SL_RET0(_("hash_unvisited")); … … 693 693 entries.prev->next = p->next; 694 694 695 p =delete_db_entry(p);695 delete_db_entry(p); 696 696 697 697 goto end; … … 915 915 SL_RET0(_("hashinsert")); 916 916 } 917 else 918 if (p->next == NULL) 919 { 920 p->next = s; 921 p->next->next = NULL; 922 SL_RET0(_("hashinsert")); 923 } 924 p = p->next; 917 else if (p && p->next == NULL) 918 { 919 p->next = s; 920 p->next->next = NULL; 921 SL_RET0(_("hashinsert")); 922 } 923 if (p) 924 p = p->next; 925 else /* cannot really happen, but llvm/clang does not know */ 926 break; 925 927 } 926 928 } … … 1470 1472 sl_close (fd); 1471 1473 sh_hash_getline_end(); 1472 fd = -1;1474 /* fd = -1; */ 1473 1475 1474 1476 unlock_and_return: -
trunk/src/sh_html.c
r248 r383 158 158 #endif 159 159 if (time_ptr != NULL) 160 st atus = strftime (ts1, 80, _("%d-%m-%Y %H:%M:%S"), time_ptr);160 strftime (ts1, 80, _("%d-%m-%Y %H:%M:%S"), time_ptr); 161 161 now = time(NULL); 162 162 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_LOCALTIME_R) … … 166 166 #endif 167 167 if (time_ptr != NULL) 168 st atus = strftime (ts2, 80, _("%d-%m-%Y %H:%M:%S"), time_ptr);168 strftime (ts2, 80, _("%d-%m-%Y %H:%M:%S"), time_ptr); 169 169 170 170 sl_snprintf(outline, 1023, … … 192 192 #endif 193 193 if (time_ptr != NULL) 194 st atus = strftime (ts1, 80, _("%d-%m-%Y %H:%M:%S"), time_ptr);194 strftime (ts1, 80, _("%d-%m-%Y %H:%M:%S"), time_ptr); 195 195 sl_snprintf(outline, 1023, 196 196 _("<p>Last connection at %s</p>"), … … 323 323 { 324 324 entry_size = 0; 325 add_size = 0;325 /* add_size = 0; *//* never read */ 326 326 SL_RETURN( 0, _("sh_html_get_entry")); 327 327 } -
trunk/src/sh_inotify.c
r382 r383 388 388 SH_MUTEX_UNLOCK(mutex_list_dormant); 389 389 390 sh_dummy_popret = NULL; 390 391 return popret; 391 392 } -
trunk/src/sh_log_evalrule.c
r363 r383 635 635 if (pflag == 'K') 636 636 { 637 nr->label = sh_string_new_from_lchar(dstr, s trlen(dstr));637 nr->label = sh_string_new_from_lchar(dstr, sl_strlen(dstr)); 638 638 nr->flags |= RFL_KEEP; 639 639 nr->delay = dsec; … … 642 642 else if (pflag == 'M') 643 643 { 644 nr->label = sh_string_new_from_lchar(dstr, s trlen(dstr));644 nr->label = sh_string_new_from_lchar(dstr, sl_strlen(dstr)); 645 645 nr->flags |= RFL_MARK; 646 646 nr->delay = dsec; … … 919 919 DEBUG("debug: no match found\n"); 920 920 /* If there was no match, this is NULL */ 921 dummy1 = NULL; 921 922 return rule; 922 923 } … … 993 994 } while (group); 994 995 } 996 997 dummy2 = NULL; 998 dummy3 = NULL; 995 999 return result; 996 1000 } -
trunk/src/sh_login_track.c
r299 r383 298 298 while (entry) 299 299 { 300 n = fwrite(&(entry->data), sizeof(struct sh_track_entry_data), 1, fp); 300 fwrite(&(entry->data), sizeof(struct sh_track_entry_data), 301 1, fp); 301 302 entry = entry->next; 302 303 } … … 426 427 } 427 428 428 while ( *p && (*p == ' ' || *p == '\t')) ++p;429 430 if ( *p && (i < SH_LTRACK_USIZE) && (*p == ':'))429 while (p && *p && (*p == ' ' || *p == '\t')) ++p; 430 431 if (p && *p && (i < SH_LTRACK_USIZE) && (*p == ':')) 431 432 { 432 433 user[i] = '\0'; … … 970 971 971 972 urecord = load_data(user); 972 last_login = (urecord->head).last_login;973 974 urecord = load_data(user);975 973 last_login = (urecord->head).last_login; 976 974 -
trunk/src/sh_mail.c
r379 r383 458 458 } 459 459 460 voidsh_mail_signature_block (sh_string * sigMsg, char * recipient,461 460 sh_string * sh_mail_signature_block (sh_string * sigMsg, char * recipient, 461 char * bufcompress) 462 462 { 463 463 time_t id_audit; … … 511 511 sigMsg = sh_string_add_from_char(sigMsg, _("-----END MESSAGE-----")); 512 512 513 return ;513 return sigMsg; 514 514 } 515 515 … … 599 599 * how to filter messages. */ 600 600 601 theMsg = sh_string_new_from_lchar(message, strlen(message)); 601 theMsg = sh_string_new_from_lchar(message, sl_strlen(message)); 602 if (!theMsg) 603 { 604 SL_RETURN((-1), _("sh_mail_msg")); 605 } 602 606 603 607 /* ---------- Header ---------------------------------------- */ … … 694 698 sh_string * sigMsg = sh_string_new (0); 695 699 696 s h_mail_signature_block (sigMsg,697 sh_string_str(address_list->recipient),698 bufcompress);700 sigMsg = sh_mail_signature_block (sigMsg, 701 sh_string_str(address_list->recipient), 702 bufcompress); 699 703 700 704 wrlen = fwrite (sh_string_str(sigMsg), 1, … … 746 750 sh_string * sigMsg = sh_string_new (0); 747 751 748 s h_mail_signature_block (sigMsg,749 NULL,750 bufcompress);752 sigMsg = sh_mail_signature_block (sigMsg, 753 NULL, 754 bufcompress); 751 755 752 756 wrlen = fwrite (sh_string_str(sigMsg), 1, … … 774 778 } 775 779 776 sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_SRV_FAIL, 777 _("mail"), sh_string_str(ma_address->recipient)); 780 if (ma_address) 781 sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_SRV_FAIL, 782 _("mail"), 783 sh_string_str(ma_address->recipient)); 778 784 errcount = address_num; 779 785 ++sh.statistics.mail_failed; … … 1652 1658 } 1653 1659 1654 ret = 0; 1660 1655 1661 header = (HEADER *) reply; 1656 1662 … … 1753 1759 /* CLASS (re-use 'type' var) 1754 1760 */ 1755 type = get_short (comp_dn);1761 /* type = get_short (comp_dn); *//* don't care */ 1756 1762 comp_dn += 2; 1757 1763 if (comp_dn >= eom) -
trunk/src/sh_portcheck.c
r380 r383 605 605 ptr = ptr->next; 606 606 } 607 608 sh_dummy_ptr = NULL; 609 sh_dummy_pre = NULL; 610 607 611 return; 608 612 } … … 1546 1550 } while (*str); 1547 1551 1552 sh_dummy_str = NULL; 1548 1553 return 0; 1549 1554 } … … 1653 1658 { 1654 1659 if (portchk_debug) 1655 fprintf(stderr, _("add_required_port \n"));1660 fprintf(stderr, _("add_required_port %d\n"), (int) port); 1656 1661 sh_portchk_add_to_list (proto, -1, &saddr, buf, type, SH_PORT_UNKN); 1657 1662 } -
trunk/src/sh_processcheck.c
r379 r383 460 460 list = list->next; 461 461 } 462 463 sh_dummy_watchlist = NULL; 464 return; 462 465 } 463 466 … … 518 521 SL_ENTER(_("sh_prochk_set_pspath")); 519 522 520 if (!str &&('/' != str[0]))523 if (!str || ('/' != str[0])) 521 524 SL_RETURN((-1), _("sh_prochk_set_pspath")); 522 525 if (sh_prochk_pspath) -
trunk/src/sh_readconf.c
r367 r383 142 142 while (tmp && isspace((int)*tmp)) ++tmp; 143 143 144 if (tmp [0] == '$' && tmp[1] == '(')144 if (tmp && tmp[0] == '$' && tmp[1] == '(') 145 145 { 146 146 size_t len = strlen(tmp); -
trunk/src/sh_restrict.c
r341 r383 107 107 SL_ENTER(_("matches_prefix")); 108 108 109 path_len = sl_strlen(path); 110 pref_len = sl_strlen(prefix); 111 112 if (path_len >= pref_len) 113 { 114 if (0 == strncmp(path, prefix, pref_len)) 115 { 116 SL_RETURN(1, _("matches_prefix")); 109 if (path && prefix) 110 { 111 path_len = sl_strlen(path); 112 pref_len = sl_strlen(prefix); 113 114 if (path_len >= pref_len) 115 { 116 if (0 == strncmp(path, prefix, pref_len)) 117 { 118 SL_RETURN(1, _("matches_prefix")); 119 } 117 120 } 118 121 } -
trunk/src/sh_socket.c
r362 r383 997 997 (struct sockaddr *) & name, size); 998 998 */ 999 nbytes =send (talkfd, _("END"), 4, 0);999 /* nbytes = *//* never read */ send (talkfd, _("END"), 4, 0); 1000 1000 sl_close_fd(FIL__, __LINE__, talkfd); 1001 1001 return 0; -
trunk/src/sh_string.c
r276 r383 47 47 if (*s) 48 48 { 49 a = s;50 51 49 /* move a to next delim 52 50 */ … … 257 255 char * s = line; 258 256 char * p; 257 unsigned int sind = (prefix) ? strlen(prefix) : 0; 259 258 260 259 while ( *s && isspace((int)*s) ) ++s; 261 260 if (prefix && 0 != strncmp(s, prefix, strlen(prefix))) 262 261 return NULL; 263 s = &s[s trlen(prefix)];262 s = &s[sind]; 264 263 while ( *s && isspace((int)*s) ) ++s; 265 264 if (!s || (*s != '(')) … … 437 436 s = SH_ALLOC(sizeof(sh_string)); 438 437 s->str = SH_ALLOC(len+1); 439 memcpy(s->str, str, len); 438 if (str) 439 memcpy(s->str, str, len); 440 else 441 s->str[0] = '\0'; 440 442 s->str[len] = '\0'; 441 443 s->siz = len+1; … … 599 601 600 602 curr = -1; 601 last = -1;602 603 603 604 for (i = 0; i < ovecnum; ++i) -
trunk/src/sh_suidchk.c
r381 r383 927 927 SH_FREE(tmp); 928 928 SH_FREE(msg); 929 cperm_status = -1;930 929 } 931 930 } … … 1539 1538 ShSuidchkExclude = sh_util_strdup (c); 1540 1539 ExcludeLen = sl_strlen (ShSuidchkExclude); 1541 if (ShSuidchkExclude [ExcludeLen-1] == '/')1540 if (ShSuidchkExclude && ShSuidchkExclude[ExcludeLen-1] == '/') 1542 1541 { 1543 1542 ShSuidchkExclude[ExcludeLen-1] = '\0'; -
trunk/src/sh_tiger0.c
r300 r383 287 287 sh.statistics.bytes_hashed += tt; 288 288 289 bptr = buffer;tt = 0;289 tt = 0; 290 290 for (i = 0; i < blk; ++i) 291 291 { … … 366 366 /* MAY_LOCK */ 367 367 sh.statistics.bytes_hashed += 64; 368 ++nblocks; ncount = 0; 368 ++nblocks; 369 #ifdef TIGER_DBG 370 ncount = 0; 371 #endif 369 372 sl_memset(bbuf, 0, 56 ); 370 373 } -
trunk/src/sh_tools.c
r379 r383 339 339 break; 340 340 341 c = *p; 341 342 342 343 343 switch (*p) { … … 516 516 { 517 517 sin_cache * check_cache = conn_cache; 518 sin_cache * old_entry = conn_cache;518 sin_cache * old_entry; 519 519 520 520 SL_ENTER(_("delete_cache")); -
trunk/src/sh_unix.c
r381 r383 1108 1108 int status; 1109 1109 int level; 1110 uid_t ff_euid ;1110 uid_t ff_euid = (uid_t) -1; 1111 1111 1112 1112 SL_ENTER(_("tf_trust_check")); … … 1136 1136 aud_exit (FIL__, __LINE__, EXIT_FAILURE); 1137 1137 } 1138 ff_euid = tempres->pw_uid; 1138 else 1139 { 1140 ff_euid = tempres->pw_uid; 1141 } 1139 1142 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETPWNAM_R) 1140 1143 SH_FREE(buffer); … … 2623 2626 static void sh_userid_additem(struct user_id * list, struct user_id * item) 2624 2627 { 2625 while (list && list->next) 2626 list = list->next; 2627 list->next = item; 2628 if (list) 2629 { 2630 while (list && list->next) 2631 list = list->next; 2632 list->next = item; 2633 } 2628 2634 return; 2629 2635 } -
trunk/src/sh_utmp.c
r363 r383 872 872 SL_ENTER(_("sh_utmp_addlogin")); 873 873 874 if (ut->ut_line[0] == '\0') 875 SL_RET0(_("sh_utmp_addlogin")); 876 877 /* for some stupid reason, AIX repeats the wtmp entry for logouts 878 * with ssh 879 */ 880 if (memcmp (&save_utmp, ut, sizeof(struct SH_UTMP_S)) == 0) 881 { 882 memset(&save_utmp, (int) '\0', sizeof(struct SH_UTMP_S)); 883 SL_RET0(_("sh_utmp_addlogin")); 884 } 885 memcpy (&save_utmp, ut, sizeof(struct SH_UTMP_S)); 886 874 887 /* Take the address to keep gcc from putting them into registers. 875 888 * Avoids the 'clobbered by longjmp' warning. … … 877 890 sh_dummy_userold = (void*) &userold; 878 891 sh_dummy_user = (void*) &user; 879 880 if (ut->ut_line[0] == '\0')881 SL_RET0(_("sh_utmp_addlogin"));882 883 /* for some stupid reason, AIX repeats the wtmp entry for logouts884 * with ssh885 */886 if (memcmp (&save_utmp, ut, sizeof(struct SH_UTMP_S)) == 0)887 {888 memset(&save_utmp, (int) '\0', sizeof(struct SH_UTMP_S));889 SL_RET0(_("sh_utmp_addlogin"));890 }891 memcpy (&save_utmp, ut, sizeof(struct SH_UTMP_S));892 893 892 894 893 /* ------- find user -------- … … 993 992 994 993 sh_utmp_login_morechecks(ut); 995 SL_RET0(_("sh_utmp_addlogin"));994 goto out; 996 995 } 997 996 … … 1052 1051 SH_MUTEX_UNLOCK(mutex_thread_nolog); 1053 1052 } 1054 SL_RET0(_("sh_utmp_addlogin"));1053 goto out; 1055 1054 } 1056 1055 1057 1056 /* default */ 1058 SL_RET0(_("sh_utmp_addlogin"));1057 goto out; 1059 1058 1060 1059 /* #ifdef HAVE_UTTYPE */ … … 1136 1135 } 1137 1136 1137 #endif 1138 1139 out: 1140 sh_dummy_user = NULL; 1141 sh_dummy_userold = NULL; 1142 1138 1143 SL_RET0(_("sh_utmp_addlogin")); 1139 #endif1140 1144 } 1141 1145 … … 1214 1218 { 1215 1219 while (this_read < lastread) { 1216 ut =sh_utmp_getutent();1220 (void) sh_utmp_getutent(); 1217 1221 ++this_read; 1218 1222 } -
trunk/src/slib.c
r371 r383 931 931 else if (src == NULL) 932 932 { 933 if ( siz > 0)933 if (dst && siz > 0) 934 934 dst[0] = '\0'; 935 935 return SL_ENONE; … … 2835 2835 */ 2836 2836 bytecount = 0; 2837 bytewritten = 0; 2837 2838 2838 while (bytecount < nbytes) 2839 2839 { 2840 if ((bytewritten = write (fd, msg, nbytes-bytecount)) > 0) 2840 bytewritten = write (fd, msg, nbytes-bytecount); 2841 2842 if (bytewritten > 0) 2841 2843 { 2842 2844 bytecount += bytewritten; -
trunk/src/zAVLTree.c
r363 r383 366 366 depthdiff = R_DEPTH(avlnode) - L_DEPTH(avlnode); 367 367 368 if (depthdiff <= -2 ) {368 if (depthdiff <= -2 && avlnode->left) { 369 369 child = avlnode->left; 370 370 … … 384 384 else { 385 385 gchild = child->right; 386 avlnode->left = gchild->right; 387 if (avlnode->left != NULL) 388 avlnode->left->parent = avlnode; 389 avlnode->depth = CALC_DEPTH(avlnode); 390 child->right = gchild->left; 391 if (child->right != NULL) 392 child->right->parent = child; 393 child->depth = CALC_DEPTH(child); 394 gchild->right = avlnode; 395 if (gchild->right != NULL) 396 gchild->right->parent = gchild; 397 gchild->left = child; 398 if (gchild->left != NULL) 399 gchild->left->parent = gchild; 400 gchild->depth = CALC_DEPTH(gchild); 401 *superparent = gchild; 402 gchild->parent = origparent; 403 } 404 } 405 406 else if (depthdiff >= 2) { 386 if (gchild) 387 { 388 avlnode->left = gchild->right; 389 if (avlnode->left != NULL) 390 avlnode->left->parent = avlnode; 391 avlnode->depth = CALC_DEPTH(avlnode); 392 child->right = gchild->left; 393 if (child->right != NULL) 394 child->right->parent = child; 395 child->depth = CALC_DEPTH(child); 396 gchild->right = avlnode; 397 if (gchild->right != NULL) 398 gchild->right->parent = gchild; 399 gchild->left = child; 400 if (gchild->left != NULL) 401 gchild->left->parent = gchild; 402 gchild->depth = CALC_DEPTH(gchild); 403 *superparent = gchild; 404 gchild->parent = origparent; 405 } 406 } 407 } 408 409 else if (depthdiff >= 2 && avlnode->right) { 407 410 child = avlnode->right; 408 411 … … 422 425 else { 423 426 gchild = child->left; 424 avlnode->right = gchild->left; 425 if (avlnode->right != NULL) 426 avlnode->right->parent = avlnode; 427 avlnode->depth = CALC_DEPTH(avlnode); 428 child->left = gchild->right; 429 if (child->left != NULL) 430 child->left->parent = child; 431 child->depth = CALC_DEPTH(child); 432 gchild->left = avlnode; 433 if (gchild->left != NULL) 434 gchild->left->parent = gchild; 435 gchild->right = child; 436 if (gchild->right != NULL) 437 gchild->right->parent = gchild; 438 gchild->depth = CALC_DEPTH(gchild); 439 *superparent = gchild; 440 gchild->parent = origparent; 427 if (gchild) 428 { 429 avlnode->right = gchild->left; 430 if (avlnode->right != NULL) 431 avlnode->right->parent = avlnode; 432 avlnode->depth = CALC_DEPTH(avlnode); 433 child->left = gchild->right; 434 if (child->left != NULL) 435 child->left->parent = child; 436 child->depth = CALC_DEPTH(child); 437 gchild->left = avlnode; 438 if (gchild->left != NULL) 439 gchild->left->parent = gchild; 440 gchild->right = child; 441 if (gchild->right != NULL) 442 gchild->right->parent = gchild; 443 gchild->depth = CALC_DEPTH(gchild); 444 *superparent = gchild; 445 gchild->parent = origparent; 446 } 441 447 } 442 448 }
Note:
See TracChangeset
for help on using the changeset viewer.