Changeset 381
- Timestamp:
- Dec 2, 2011, 11:18:23 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/docs/Changelog
r380 r381 1 1 3.0.1: 2 * fix an uninitialized variable in the suidcheck code (problem 3 reports by T- Luettgert and Kai) 2 4 * fix a bug in the port check with --disable-ipv6 (reported by C. Westlake) 3 5 * fix potential deadlock in sh_files.c (reported by S. Mirolo) -
trunk/include/sh_unix.h
r379 r381 99 99 #define MODI_AUDIT_ENABLED(a) (((a)&(1 << 15))!=0) 100 100 101 #define MODI_INIT 0xDA000000UL 102 #define MODI_INITIALIZED(a) (((a) & 0xFF000000UL) == MODI_INIT) 101 103 102 104 #define SH_TXT_MAX 9200 … … 120 122 extern unsigned long mask_USER3; 121 123 extern unsigned long mask_USER4; 122 /* like READONLY, but without MTM,CTM,SIZ,INO, a bd with PREL)124 /* like READONLY, but without MTM,CTM,SIZ,INO, and with PREL) 123 125 */ 124 126 #define MASK_PRELINK_ (MASK_ATTRIBUTES_|MODI_HLN|MODI_LNK|MODI_CHK|MODI_PREL) -
trunk/src/sh_files.c
r378 r381 697 697 SL_ENTER(_("sh_files_parse_mask")); 698 698 699 myword[0] = '\0'; 700 699 701 if (str == NULL) 700 702 { … … 705 707 706 708 while (i < l) { 709 707 710 if (str[i] == '\0') 708 711 break; 712 709 713 if (str[i] == ' ' || str[i] == '\t' || str[i] == ',') 710 714 { … … 716 720 { 717 721 act = +1; ++i; 718 continue; 722 myword[0] = '\0'; 723 goto getword; 719 724 } 720 725 else if (str[i] == '-') 721 726 { 722 727 act = -1; ++i; 723 continue; 728 myword[0] = '\0'; 729 goto getword; 724 730 } 725 731 else /* a word */ 726 732 { 733 getword: 727 734 k = 0; 728 735 while (k < 63 && str[i] != ' ' && str[i] != '\t' && str[i] != ',' … … 733 740 myword[k] = '\0'; 734 741 742 if (sl_strlen(myword) == 0) 743 { 744 SL_RETURN ( (-1), _("sh_files_parse_mask")); 745 } 746 735 747 /* checksum */ 736 if (0 == strncmp(myword, _("CHK"), 3))748 if (0 == strcmp(myword, _("CHK"))) 737 749 sh_files_set_mask (mask, MODI_CHK, act); 738 750 /* link */ 739 if (0 == strncmp(myword, _("LNK"), 3))751 else if (0 == strcmp(myword, _("LNK"))) 740 752 sh_files_set_mask (mask, MODI_LNK, act); 741 753 /* inode */ 742 if (0 == strncmp(myword, _("RDEV"), 3))754 else if (0 == strcmp(myword, _("RDEV"))) 743 755 sh_files_set_mask (mask, MODI_RDEV, act); 744 756 /* inode */ 745 if (0 == strncmp(myword, _("INO"), 3))757 else if (0 == strcmp(myword, _("INO"))) 746 758 sh_files_set_mask (mask, MODI_INO, act); 747 759 /* user */ 748 if (0 == strncmp(myword, _("USR"), 3))760 else if (0 == strcmp(myword, _("USR"))) 749 761 sh_files_set_mask (mask, MODI_USR, act); 750 762 /* group */ 751 if (0 == strncmp(myword, _("GRP"), 3))763 else if (0 == strcmp(myword, _("GRP"))) 752 764 sh_files_set_mask (mask, MODI_GRP, act); 753 765 /* mtime */ 754 if (0 == strncmp(myword, _("MTM"), 3))766 else if (0 == strcmp(myword, _("MTM"))) 755 767 sh_files_set_mask (mask, MODI_MTM, act); 756 768 /* ctime */ 757 if (0 == strncmp(myword, _("CTM"), 3))769 else if (0 == strcmp(myword, _("CTM"))) 758 770 sh_files_set_mask (mask, MODI_CTM, act); 759 771 /* atime */ 760 if (0 == strncmp(myword, _("ATM"), 3))772 else if (0 == strcmp(myword, _("ATM"))) 761 773 sh_files_set_mask (mask, MODI_ATM, act); 762 774 /* size */ 763 if (0 == strncmp(myword, _("SIZ"), 3))775 else if (0 == strcmp(myword, _("SIZ"))) 764 776 sh_files_set_mask (mask, MODI_SIZ, act); 765 777 /* file mode */ 766 if (0 == strncmp(myword, _("MOD"), 3))778 else if (0 == strcmp(myword, _("MOD"))) 767 779 sh_files_set_mask (mask, MODI_MOD, act); 768 780 /* hardlinks */ 769 if (0 == strncmp(myword, _("HLN"), 3))781 else if (0 == strcmp(myword, _("HLN"))) 770 782 sh_files_set_mask (mask, MODI_HLN, act); 771 783 /* size may grow */ 772 if (0 == strncmp(myword, _("GROW"), 3))784 else if (0 == strcmp(myword, _("SGROW"))) 773 785 sh_files_set_mask (mask, MODI_SGROW, act); 774 786 /* use prelink */ 775 if (0 == strncmp(myword, _("PRE"), 3))787 else if (0 == strcmp(myword, _("PRE"))) 776 788 sh_files_set_mask (mask, MODI_PREL, act); 777 789 /* get content */ 778 if (0 == strncmp(myword, _("TXT"), 3))790 else if (0 == strcmp(myword, _("TXT"))) 779 791 sh_files_set_mask (mask, MODI_TXT, act); 780 792 /* get content */ 781 if (0 == strncmp(myword, _("AUDIT"), 3))793 else if (0 == strcmp(myword, _("AUDIT"))) 782 794 sh_files_set_mask (mask, MODI_AUDIT, act); 795 else 796 { 797 SL_RETURN ( (-1), _("sh_files_parse_mask")); 798 } 799 act = 0; 800 myword[0] = '\0'; 783 801 } 784 802 } … … 840 858 { 841 859 case SH_LEVEL_READONLY: 842 return (unsigned long) mask_READONLY;860 return (unsigned long) (mask_READONLY | MODI_INIT); 843 861 case SH_LEVEL_ATTRIBUTES: 844 return (unsigned long) mask_ATTRIBUTES;862 return (unsigned long) (mask_ATTRIBUTES | MODI_INIT); 845 863 case SH_LEVEL_LOGFILES: 846 return (unsigned long) mask_LOGFILES;864 return (unsigned long) (mask_LOGFILES | MODI_INIT); 847 865 case SH_LEVEL_LOGGROW: 848 return (unsigned long) mask_LOGGROW;866 return (unsigned long) (mask_LOGGROW | MODI_INIT); 849 867 case SH_LEVEL_ALLIGNORE: 850 return (unsigned long) mask_ALLIGNORE;868 return (unsigned long) (mask_ALLIGNORE | MODI_INIT); 851 869 case SH_LEVEL_NOIGNORE: 852 return (unsigned long) mask_NOIGNORE;870 return (unsigned long) (mask_NOIGNORE | MODI_INIT); 853 871 case SH_LEVEL_USER0: 854 return (unsigned long) mask_USER0;872 return (unsigned long) (mask_USER0 | MODI_INIT); 855 873 case SH_LEVEL_USER1: 856 return (unsigned long) mask_USER1;874 return (unsigned long) (mask_USER1 | MODI_INIT); 857 875 case SH_LEVEL_USER2: 858 return (unsigned long) mask_USER2;876 return (unsigned long) (mask_USER2 | MODI_INIT); 859 877 case SH_LEVEL_USER3: 860 return (unsigned long) mask_USER3;878 return (unsigned long) (mask_USER3 | MODI_INIT); 861 879 case SH_LEVEL_USER4: 862 return (unsigned long) mask_USER4;880 return (unsigned long) (mask_USER4 | MODI_INIT); 863 881 case SH_LEVEL_PRELINK: 864 return (unsigned long) mask_PRELINK;882 return (unsigned long) (mask_PRELINK | MODI_INIT); 865 883 default: 866 884 return (unsigned long) 0; … … 907 925 #endif 908 926 909 int sh_files_push_file_int (int class, const char * str_s, size_t len )927 int sh_files_push_file_int (int class, const char * str_s, size_t len, unsigned long check_mask) 910 928 { 911 929 dirstack_t * new_item_ptr; … … 923 941 new_item_ptr->name = fileName; 924 942 new_item_ptr->class = class; 925 new_item_ptr->check_mask = sh_files_maskof(class);943 new_item_ptr->check_mask = check_mask; 926 944 new_item_ptr->rdepth = 0; 927 945 new_item_ptr->checked = S_FALSE; … … 982 1000 } 983 1001 984 int sh_files_push_dir_int (int class, char * tail, size_t len, int rdepth );1002 int sh_files_push_dir_int (int class, char * tail, size_t len, int rdepth, unsigned long check_mask); 985 1003 986 1004 #ifdef HAVE_GLOB_H … … 1005 1023 1006 1024 int count = 0; 1007 volatile unsigned long check_mask = check_mask_in;1025 volatile unsigned long check_mask = (flag == 0) ? sh_files_maskof(class) : check_mask_in; 1008 1026 1009 1027 SL_ENTER(_("sh_files_pushglob")); … … 1028 1046 new_item_ptr->name = fileName; 1029 1047 new_item_ptr->class = class; 1030 new_item_ptr->check_mask = (flag == 0) ? sh_files_maskof(class) :check_mask;1048 new_item_ptr->check_mask = check_mask; 1031 1049 new_item_ptr->rdepth = rdepth; 1032 1050 new_item_ptr->type = type; … … 1057 1075 { 1058 1076 count += sh_files_push_file_int (class, pglob.gl_pathv[gloop], 1059 sl_strlen(pglob.gl_pathv[gloop]) );1077 sl_strlen(pglob.gl_pathv[gloop]), check_mask); 1060 1078 } 1061 1079 else … … 1064 1082 1065 1083 count += sh_files_push_dir_int (class, pglob.gl_pathv[gloop], 1066 sl_strlen(pglob.gl_pathv[gloop]), rdepth );1084 sl_strlen(pglob.gl_pathv[gloop]), rdepth, check_mask); 1067 1085 } 1068 1086 } … … 1275 1293 if (0 == sh_files_has_metachar(p)) 1276 1294 { 1277 sh_files_push_file_int (class, p, len );1295 sh_files_push_file_int (class, p, len, sh_files_maskof(class)); 1278 1296 } 1279 1297 else … … 1283 1301 1284 1302 #else 1285 sh_files_push_file_int (class, p, len );1303 sh_files_push_file_int (class, p, len, sh_files_maskof(class)); 1286 1304 #endif 1287 1305 … … 1534 1552 } 1535 1553 1536 int sh_files_push_dir_int (int class, char * tail, size_t len, int rdepth )1554 int sh_files_push_dir_int (int class, char * tail, size_t len, int rdepth, unsigned long check_mask) 1537 1555 { 1538 1556 zAVLTree * tree; … … 1550 1568 new_item_ptr->name = dirName; 1551 1569 new_item_ptr->class = class; 1552 new_item_ptr->check_mask = sh_files_maskof(class);1570 new_item_ptr->check_mask = check_mask; 1553 1571 new_item_ptr->rdepth = rdepth; 1554 1572 new_item_ptr->checked = S_FALSE; … … 1600 1618 else 1601 1619 { 1602 unsigned long mask = sh_files_maskof(class); 1603 if (MODI_AUDIT_ENABLED(mask)) 1620 if (MODI_AUDIT_ENABLED(check_mask)) 1604 1621 { 1605 1622 sh_audit_mark(tail); … … 1713 1730 if (0 == sh_files_has_metachar(tail)) 1714 1731 { 1715 sh_files_push_dir_int (class, tail, len, rdepth );1732 sh_files_push_dir_int (class, tail, len, rdepth, sh_files_maskof(class)); 1716 1733 } 1717 1734 else … … 1720 1737 } 1721 1738 #else 1722 sh_files_push_dir_int (class, tail, len, rdepth );1739 sh_files_push_dir_int (class, tail, len, rdepth, sh_files_maskof(class)); 1723 1740 #endif 1724 1741 -
trunk/src/sh_suidchk.c
r370 r381 1188 1188 int dummy; 1189 1189 int class; 1190 unsigned long check_mask ;1190 unsigned long check_mask = 0; 1191 1191 1192 1192 theFile = SH_ALLOC(sizeof(file_type)); -
trunk/src/sh_unix.c
r379 r381 3643 3643 SL_ENTER(_("sh_unix_getinfo")); 3644 3644 3645 if (!MODI_INITIALIZED(theFile->check_mask)) 3646 { 3647 tmp2 = sh_util_safe_name (theFile->fullpath); 3648 SH_MUTEX_LOCK(mutex_thread_nolog); 3649 sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_E_SUBGPATH, 3650 _("Uninitialized check mask"), _("sh_unix_getinfo"), 3651 tmp2); 3652 SH_MUTEX_UNLOCK(mutex_thread_nolog); 3653 SH_FREE(tmp2); 3654 } 3655 3645 3656 /* Take the address to keep gcc from putting it into a register. 3646 3657 * Avoids the 'clobbered by longjmp' warning. … … 3808 3819 sl_strlcpy(fileHash, SH_KEY_NULL, KEY_LEN+1); 3809 3820 } 3810 else if ((theFile->check_mask & MODI_PREL) != 0 && 3821 else if ((theFile->check_mask & MODI_PREL) != 0 && 3811 3822 S_TRUE == sh_prelink_iself(rval_open, fbuf.st_size, 3812 3823 alert_timeout, theFile->fullpath))
Note:
See TracChangeset
for help on using the changeset viewer.