Changeset 40
- Timestamp:
- May 31, 2006, 9:38:30 PM (19 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Makefile.in
r34 r40 484 484 echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's%samhain%@install_name@%'|sed 's%yule%@install_name@%'`"; \ 485 485 $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's%samhain%@install_name@%'|sed 's%yule%@install_name@%'`; \ 486 chmod 0700 $(DESTDIR)$(sbindir)/`echo $$p|sed 's%samhain%@install_name@%'|sed 's%yule%@install_name@%'`; \ 486 487 echo " ./sstrip $(DESTDIR)$(sbindir)/`echo $$p|sed 's%samhain%@install_name@%'|sed 's%yule%@install_name@%'`"; \ 487 488 ./sstrip $(DESTDIR)$(sbindir)/`echo $$p|sed 's%samhain%@install_name@%'|sed 's%yule%@install_name@%'`; \ … … 623 624 exit 1; \ 624 625 fi; \ 625 makeDESTDIR=$$STAGE install-light; \626 $(MAKE) DESTDIR=$$STAGE install-light; \ 626 627 rm -f $$STAGE/@sbindir@/@install_name@_stealth; \ 627 628 echo "#! /bin/sh" > $$STAGE/setup.sh; \ … … 926 927 exit 1; \ 927 928 fi; \ 928 makeDESTDIR=$$STAGE install-light;929 $(MAKE) DESTDIR=$$STAGE install-light; 929 930 $(MAKE) solaris-pkg-finish 930 931 … … 936 937 exit 1; \ 937 938 fi; \ 938 makeDESTDIR=$$STAGE install;939 $(MAKE) DESTDIR=$$STAGE install; 939 940 $(MAKE) solaris-pkg-finish 940 941 … … 946 947 user=`id | sed s,uid=[0123456789]*\(,, | sed s,\).*,,`; \ 947 948 group=`id | sed s,.*gid=[0123456789]*\(,, | sed s,\).*,,`; \ 948 cat prototype | grep -v 'none / ' | grep -v 'none /usr ' | \ 949 grep -v 'none /usr/local ' | grep -v 'none /usr/bin ' | \ 950 grep -v 'none /usr/local/bin ' | grep -v 'none /usr/local/sbin ' | \ 951 grep -v 'none /var ' | grep -v 'none /usr/sbin ' | \ 949 cat prototype | grep -v 'none / ' | \ 950 sed 's,none /etc .*,none /etc ? ? ?,' | \ 951 sed 's,none /etc/init.d .*,none /etc/init.d ? ? ?,' | \ 952 sed 's,none /usr .*,none /usr ? ? ?,' | \ 953 sed 's,none /usr/bin .*,none /usr/bin ? ? ?,' | \ 954 sed 's,none /var .*,none /var ? ? ?,' | \ 955 sed 's,none /var/lib .*,none /var/lib ? ? ?,' | \ 956 sed 's,none /var/log .*,none /var/log ? ? ?,' | \ 957 sed 's,none /var/run .*,none /var/run ? ? ?,' | \ 958 sed 's,none /usr/sbin .*,none /usr/sbin ? ? ?,' | \ 952 959 sed s,$$user\ $$group,root\ sys,g > prototype.1; \ 953 960 rm -f prototype && mv prototype.1 prototype; \ 954 echo "d none /var ? ? ?" >> prototype; \ 961 if test -d /usr/local; then \ 962 cat prototype | \ 963 sed 's,none /usr/local .*,none /usr/local ? ? ?,' >prototype.1;\ 964 rm -f prototype && mv prototype.1 prototype; \ 965 fi; \ 966 if test -d /usr/local/bin; then \ 967 cat prototype | \ 968 sed 's,none /usr/local/bin .*,none /usr/local/bin ? ? ?,' >prototype.1;\ 969 rm -f prototype && mv prototype.1 prototype; \ 970 fi; \ 971 if test -d /usr/local/sbin; then \ 972 cat prototype | \ 973 sed 's,none /usr/local/sbin .*,none /usr/local/sbin ? ? ?,' >prototype.1;\ 974 rm -f prototype && mv prototype.1 prototype; \ 975 fi; \ 976 if test -d /usr/local/man; then \ 977 cat prototype | \ 978 sed 's,none /usr/local/man .*,none /usr/local/man ? ? ?,' >prototype.1;\ 979 rm -f prototype && mv prototype.1 prototype; \ 980 fi; \ 981 if test -d /usr/local/man/man5; then \ 982 cat prototype | \ 983 sed 's,none /usr/local/man/man5 .*,none /usr/local/man/man5 ? ? ?,' >prototype.1;\ 984 rm -f prototype && mv prototype.1 prototype; \ 985 fi; \ 986 if test -d /usr/local/man/man8; then \ 987 cat prototype | \ 988 sed 's,none /usr/local/man/man8 .*,none /usr/local/man/man8 ? ? ?,' >prototype.1;\ 989 rm -f prototype && mv prototype.1 prototype; \ 990 fi; \ 955 991 echo "d none /etc/rc0.d ? ? ?" >> prototype; \ 956 992 echo "d none /etc/rc1.d ? ? ?" >> prototype; \ … … 975 1011 echo; \ 976 1012 cp /tmp/samhain-pkg-staging/@install_name@.pkg $(PACKAGE)-$(VERSION).pkg; \ 977 echo "Package @install_name@.pkg is ready for installation"; \1013 echo "Package $(PACKAGE)-$(VERSION).pkg is ready for installation"; \ 978 1014 echo; \ 979 rm -r /var/spool/pkg/@install_name@ /tmp/samhain-pkg-staging; \1015 rm -rf /var/spool/pkg/@install_name@ /tmp/samhain-pkg-staging; \ 980 1016 else \ 981 1017 echo; \ … … 993 1029 exit 1; \ 994 1030 fi; \ 995 makeDESTDIR=$$STAGE install; \996 makeDESTDIR=$$STAGE install-boot; \1031 $(MAKE) DESTDIR=$$STAGE install; \ 1032 $(MAKE) DESTDIR=$$STAGE install-boot; \ 997 1033 cp hp_ux.psf $$STAGE; \ 998 1034 mkdir $$STAGE/sc; \ … … 1141 1177 cp config.h m_comp/; \ 1142 1178 cp $(srcsrc)/samhain_hide.c m_comp/; \ 1143 cd m_comp && makemodules1179 cd m_comp && $(MAKE) modules 1144 1180 @if test -f m_comp/samhain_hide.ko; then \ 1145 1181 cp -p m_comp/samhain_hide.ko samhain_hide.ko; \ -
trunk/aclocal.m4
r18 r40 1179 1179 ssp_old_cflags="$CFLAGS" 1180 1180 CFLAGS="$CFLAGS -fstack-protector" 1181 AC_TRY_ COMPILE(,,, ssp_cc=no)1181 AC_TRY_LINK(,,, ssp_cc=no) 1182 1182 # echo $ssp_cc 1183 1183 if test "X$ssp_cc" = "Xno"; then -
trunk/configure.ac
r39 r40 37 37 dnl start 38 38 dnl 39 AM_INIT_AUTOMAKE(samhain, 2.2. 0)39 AM_INIT_AUTOMAKE(samhain, 2.2.1) 40 40 AC_CANONICAL_HOST 41 41 -
trunk/docs/Changelog
r38 r40 1 2.2.1: 2 * fix Solaris package creation 3 * recognize Solaris doors and event ports 4 * fix the idmef_inode_t patch: provide required info to avoid stat() 5 * fix bug on database update: fill in dev and rdev fields 6 * fix get_file_infos() in sh_prelude.c: avoid premature return 7 * GCC_STACK_PROTECT_CC: AC_TRY_COMPILE -> AC_TRY_LINK 1 8 * deploy.sh: allow to set a group for hosts upon installation 2 9 * patch by Yoann: fix an issue when setting the idmef_inode_t object -
trunk/dsys/comINSTALL
r27 r40 255 255 printINFO "ssh -x -l root ${host} /bin/sh -c '(cd ${tmpdir} && eval ${is_command} ${tmpdir}/samhain-${src_version}.${realformat} ${tmp_iname})'" 256 256 fi 257 elif test "x$format" = "xsolaris-pkg" 258 then 259 if test x"$simulate" = x0 260 then 261 ssh -x -l "root" "${host}" /bin/sh -c \''(cd "'${tmpdir}'" && PATH="'/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH'" && export PATH && eval "'${is_command}'" "'samhain-${src_version}.${realformat} all'") >/dev/null '\' 262 else 263 printINFO "ssh -x -l root ${host} /bin/sh -c '(cd ${tmpdir} && eval ${is_command} samhain-${src_version}.${realformat}) all'" 264 fi 257 265 elif test "x$format" = "xtbz2" 258 266 then -
trunk/include/samhain.h
r34 r40 45 45 /* Sizes for arrays (user, group, timestamp). 46 46 */ 47 #define SOCKPASS_MAX 14 47 48 #define USER_MAX 20 48 49 #define GROUP_MAX 20 49 50 #define TIM_MAX 32 51 50 52 51 53 /* The number of bytes in a key, … … 262 264 263 265 typedef struct { 264 char sh_sockpass[ 32];266 char sh_sockpass[2*SOCKPASS_MAX+2]; 265 267 char sigkey_old[KEY_LEN+1]; 266 268 char sigkey_new[KEY_LEN+1]; -
trunk/include/sh_unix.h
r27 r40 49 49 SH_FILE_FIFO, 50 50 SH_FILE_SOCKET, 51 SH_FILE_DOOR, 52 SH_FILE_PORT, 51 53 SH_FILE_UNKNOWN 52 54 } ShFileType; … … 77 79 /* hardlinks */ 78 80 #define MODI_HLN (1 << 10) 79 /* device num*/81 /* device type */ 80 82 #define MODI_RDEV (1 << 11) 81 83 /* size may grow */ -
trunk/src/sh_database.c
r35 r40 1492 1492 } 1493 1493 1494 static int is_escaped( char * p) {1494 static int is_escaped(unsigned char * p) { 1495 1495 1496 1496 int escp = 0; … … 1504 1504 } 1505 1505 else if ((*p == '\'' || *p == '\"') && escp == 0) 1506 { 1507 retv = S_FALSE; 1508 } 1509 else if (*p > 0x7F) 1506 1510 { 1507 1511 retv = S_FALSE; … … 1581 1585 p[2] == 'o' && p[3] == 'g') 1582 1586 { 1587 /* 1588 * recursive call 1589 */ 1583 1590 new = SH_ALLOC(sizeof(dbins)); 1584 1591 init_db_entry(new); -
trunk/src/sh_files.c
r34 r40 102 102 long NumCDev; 103 103 long NumBDev; 104 long NumDoor; 105 long NumPort; 104 106 long NumAll; 105 107 long TotalBytes; … … 1607 1609 theDir.NumCDev = 0; 1608 1610 theDir.NumBDev = 0; 1611 theDir.NumDoor = 0; 1612 theDir.NumPort = 0; 1609 1613 theDir.NumAll = 0; 1610 1614 theDir.TotalBytes = 0; … … 1831 1835 else if (checkit == SH_FILE_CDEV) ++theDir.NumCDev; 1832 1836 else if (checkit == SH_FILE_BDEV) ++theDir.NumBDev; 1837 else if (checkit == SH_FILE_DOOR) ++theDir.NumDoor; 1838 else if (checkit == SH_FILE_PORT) ++theDir.NumPort; 1833 1839 1834 1840 SH_FREE(tmpcat); … … 2079 2085 case 'b': SL_RETURN(SH_FILE_BDEV, _("sh_files_filecheck")); 2080 2086 case '|': SL_RETURN(SH_FILE_FIFO, _("sh_files_filecheck")); 2087 case 'D': SL_RETURN(SH_FILE_DOOR, _("sh_files_filecheck")); 2088 case 'P': SL_RETURN(SH_FILE_PORT, _("sh_files_filecheck")); 2081 2089 case 's': SL_RETURN(SH_FILE_SOCKET, _("sh_files_filecheck")); 2082 2090 default: SL_RETURN(SH_FILE_UNKNOWN, _("sh_files_filecheck")); -
trunk/src/sh_hash.c
r34 r40 1998 1998 p.linkmode = (UINT32) buf->linkmode; 1999 1999 p.hardlinks = (UINT32) buf->hardlinks; 2000 p.dev = (UINT64) buf->dev; 2001 p.rdev = (UINT64) buf->rdev; 2000 2002 p.mode = (UINT32) buf->mode; 2001 2003 p.ino = (UINT32) buf->ino; … … 2059 2061 #endif 2060 2062 2061 #ifndef PRIi64 2062 #define PRIi64 "lld" 2063 #ifndef PRIu64 2064 #ifdef HAVE_LONG_32 2065 #define PRIu64 "llu" 2066 #else 2067 #define PRIu64 "lu" 2068 #endif 2063 2069 #endif 2064 2070 … … 2072 2078 #ifdef SH_USE_XML 2073 2079 sl_snprintf(form_rval, 80, _("%s%s%s%s%s"), 2074 _("size_old=\"%"), PRI i64, _("\" size_new=\"%"), PRIi64, "\" ");2080 _("size_old=\"%"), PRIu64, _("\" size_new=\"%"), PRIu64, "\" "); 2075 2081 #else 2076 2082 sl_snprintf(form_rval, 80, _("%s%s%s%s%s"), 2077 _("size_old=<%"), PRI i64, _(">, size_new=<%"), PRIi64, ">, ");2083 _("size_old=<%"), PRIu64, _(">, size_new=<%"), PRIu64, ">, "); 2078 2084 #endif 2079 2085 … … 2124 2130 2125 2131 if (is_new) 2126 format = _("hardlinks_new=\"%l d\" ");2127 else 2128 format = _("hardlinks_old=\"%l d\" ");2132 format = _("hardlinks_new=\"%lu\" "); 2133 else 2134 format = _("hardlinks_old=\"%lu\" "); 2129 2135 sl_snprintf(tmp, SH_BUFSIZE, format, 2130 2136 (unsigned long) theFile->hardlinks); … … 2133 2139 2134 2140 if (is_new) 2135 format = _("idevice_new=\"%l d\" ");2136 else 2137 format = _("idevice_old=\"%l d\" ");2141 format = _("idevice_new=\"%lu\" "); 2142 else 2143 format = _("idevice_old=\"%lu\" "); 2138 2144 sl_snprintf(tmp, SH_BUFSIZE, format, (unsigned long) theFile->rdev); 2139 2145 sl_strlcat(msg, tmp, SH_BUFSIZE); … … 2141 2147 2142 2148 if (is_new) 2143 format = _("inode_new=\"%l d\" ");2144 else 2145 format = _("inode_old=\"%l d\" ");2149 format = _("inode_new=\"%lu\" "); 2150 else 2151 format = _("inode_old=\"%lu\" "); 2146 2152 sl_snprintf(tmp, SH_BUFSIZE, format, (unsigned long) theFile->ino); 2147 2153 sl_strlcat(msg, tmp, SH_BUFSIZE); 2154 2155 /* 2156 * also report device for prelude 2157 */ 2158 #if defined(HAVE_LIBPRELUDE) && defined(HAVE_LIBPRELUDE_9) 2159 if (is_new) 2160 format = _("dev_new=\"%lu,%lu\" "); 2161 else 2162 format = _("dev_old=\"%lu,%lu\" "); 2163 sl_snprintf(tmp, SH_BUFSIZE, format, 2164 (unsigned long) major(theFile->dev), 2165 (unsigned long) minor(theFile->dev)); 2166 sl_strlcat(msg, tmp, SH_BUFSIZE); 2167 #endif 2148 2168 2149 2169 … … 2261 2281 2262 2282 if (is_new) 2263 format = _("hardlinks_new=<%l d>, ");2264 else 2265 format = _("hardlinks_old=<%l d>, ");2283 format = _("hardlinks_new=<%lu>, "); 2284 else 2285 format = _("hardlinks_old=<%lu>, "); 2266 2286 sl_snprintf(tmp, SH_BUFSIZE, format, 2267 2287 (unsigned long) theFile->hardlinks); … … 2270 2290 2271 2291 if (is_new) 2272 format = _("idevice_new=<%l d>, ");2273 else 2274 format = _("idevice_old=<%l d>, ");2292 format = _("idevice_new=<%lu>, "); 2293 else 2294 format = _("idevice_old=<%lu>, "); 2275 2295 sl_snprintf(tmp, SH_BUFSIZE, format, (unsigned long) theFile->rdev); 2276 2296 sl_strlcat(msg, tmp, SH_BUFSIZE); … … 2278 2298 2279 2299 if (is_new) 2280 format = _("inode_new=<%l d>, ");2281 else 2282 format = _("inode_old=<%l d>, ");2300 format = _("inode_new=<%lu>, "); 2301 else 2302 format = _("inode_old=<%lu>, "); 2283 2303 sl_snprintf(tmp, SH_BUFSIZE, format, (unsigned long) theFile->ino); 2284 2304 sl_strlcat(msg, tmp, SH_BUFSIZE); 2285 2305 2306 2307 /* 2308 * also report device for prelude 2309 */ 2310 #if defined(HAVE_LIBPRELUDE) && defined(HAVE_LIBPRELUDE_9) 2311 if (is_new) 2312 format = _("dev_new=<%lu,%lu>, "); 2313 else 2314 format = _("dev_old=<%lu,%lu>, "); 2315 sl_snprintf(tmp, SH_BUFSIZE, format, 2316 (unsigned long) major(theFile->dev), 2317 (unsigned long) minor(theFile->dev)); 2318 sl_strlcat(msg, tmp, SH_BUFSIZE); 2319 #endif 2286 2320 2287 2321 if (is_new) … … 2729 2763 sl_snprintf(tmp, SH_BUFSIZE, 2730 2764 #ifdef SH_USE_XML 2731 _("hardlinks_old=\"%l d\" hardlinks_new=\"%ld\" "),2732 #else 2733 _("hardlinks_old=<%l d>, hardlinks_new=<%ld>, "),2765 _("hardlinks_old=\"%lu\" hardlinks_new=\"%lu\" "), 2766 #else 2767 _("hardlinks_old=<%lu>, hardlinks_new=<%lu>, "), 2734 2768 #endif 2735 2769 (unsigned long) p->theFile.hardlinks, … … 2746 2780 sl_snprintf(tmp, SH_BUFSIZE, 2747 2781 #ifdef SH_USE_XML 2748 _("device_old=\"%l d,%ld\" device_new=\"%ld,%ld\" idevice_old=\"%ld\" idevice_new=\"%ld\" "),2749 #else 2750 _("device_old=<%l d,%ld>, device_new=<%ld,%ld>, "),2782 _("device_old=\"%lu,%lu\" device_new=\"%lu,%lu\" idevice_old=\"%lu\" idevice_new=\"%lu\" "), 2783 #else 2784 _("device_old=<%lu,%lu>, device_new=<%lu,%lu>, "), 2751 2785 #endif 2752 2786 (unsigned long) major(p->theFile.rdev), … … 2770 2804 sl_snprintf(tmp, SH_BUFSIZE, 2771 2805 #ifdef SH_USE_XML 2772 _("inode_old=\"%l d\" inode_new=\"%ld\" "),2773 #else 2774 _("inode_old=<%l d>, inode_new=<%ld>, "),2806 _("inode_old=\"%lu\" inode_new=\"%lu\" "), 2807 #else 2808 _("inode_old=<%lu>, inode_new=<%lu>, "), 2775 2809 #endif 2776 2810 (unsigned long) p->theFile.ino, … … 2779 2813 #ifdef REPLACE_OLD 2780 2814 if (sh.flag.reportonce == S_TRUE && sh.flag.update == S_FALSE) 2781 p->theFile.ino = theFile->ino; 2782 #endif 2783 } 2815 { 2816 p->theFile.ino = theFile->ino; 2817 p->theFile.dev = theFile->dev; 2818 } 2819 #endif 2820 } 2821 2822 2823 /* 2824 * also report device for prelude 2825 */ 2826 #if defined(HAVE_LIBPRELUDE) && defined(HAVE_LIBPRELUDE_9) 2827 if ((modi_mask & MODI_INO) != 0) 2828 { 2829 sl_snprintf(tmp, SH_BUFSIZE, 2830 #ifdef SH_USE_XML 2831 _("dev_old=\"%lu,%lu\" dev_new=\"%lu,%lu\" "), 2832 #else 2833 _("dev_old=<%lu,%lu>, dev_new=<%lu,%lu>, "), 2834 #endif 2835 (unsigned long) major(p->theFile.dev), 2836 (unsigned long) minor(p->theFile.dev), 2837 (unsigned long) major(theFile->dev), 2838 (unsigned long) minor(theFile->dev) 2839 ); 2840 sl_strlcat(msg, tmp, SH_BUFSIZE); 2841 #ifdef REPLACE_OLD 2842 if (sh.flag.reportonce == S_TRUE && sh.flag.update == S_FALSE) 2843 p->theFile.dev = theFile->dev; 2844 #endif 2845 } 2846 #endif 2784 2847 2785 2848 if ( ((modi_mask & MODI_USR) != 0) … … 2790 2853 { 2791 2854 #ifdef SH_USE_XML 2792 sl_snprintf(tmp, SH_BUFSIZE, _("owner_old=\"%s\" owner_new=\"%s\" iowner_old=\"%ld\" iowner_new=\"%ld\" "),2793 #else 2794 sl_snprintf(tmp, SH_BUFSIZE, _("owner_old=<%s>, owner_new=<%s>, "), 2795 #endif 2796 p->theFile.c_owner, theFile->c_owner2797 # ifdef SH_USE_XML2798 , (long) p->theFile.owner, (long) theFile->owner2799 #endif 2855 sl_snprintf(tmp, SH_BUFSIZE, 2856 _("owner_old=\"%s\" owner_new=\"%s\" iowner_old=\"%ld\" iowner_new=\"%ld\" "), 2857 #else 2858 sl_snprintf(tmp, SH_BUFSIZE, 2859 _("owner_old=<%s>, owner_new=<%s>, iowner_old=<%ld>, iowner_new=<%ld>, "), 2860 #endif 2861 p->theFile.c_owner, theFile->c_owner, 2862 (long) p->theFile.owner, (long) theFile->owner 2800 2863 ); 2801 2864 sl_strlcat(msg, tmp, SH_BUFSIZE); … … 2818 2881 { 2819 2882 #ifdef SH_USE_XML 2820 sl_snprintf(tmp, SH_BUFSIZE, _("group_old=\"%s\" group_new=\"%s\" igroup_old=\"%ld\" igroup_new=\"%ld\" "), 2883 sl_snprintf(tmp, SH_BUFSIZE, 2884 _("group_old=\"%s\" group_new=\"%s\" igroup_old=\"%ld\" igroup_new=\"%ld\" "), 2821 2885 p->theFile.c_group, theFile->c_group, 2822 2886 (long) p->theFile.group, (long) theFile->group); 2823 2887 #else 2824 sl_snprintf(tmp, SH_BUFSIZE, _("group_old=<%s>, group_new=<%s>, "), 2825 p->theFile.c_group, theFile->c_group); 2888 sl_snprintf(tmp, SH_BUFSIZE, 2889 _("group_old=<%s>, group_new=<%s>, igroup_old=<%ld>, igroup_new=<%ld>, "), 2890 p->theFile.c_group, theFile->c_group, 2891 (long) p->theFile.group, (long) theFile->group); 2826 2892 #endif 2827 2893 … … 3153 3219 if (ListWithDelimiter == S_TRUE) 3154 3220 { 3155 printf(_("%7ld, % 10s, %5d, %12s, %5d, %3d, %-8s, %5d, %-8s, %5d, "),3156 (unsigned long) p->theFile.ino, 3221 printf(_("%7ld, %7ld, %10s, %5d, %12s, %5d, %3d, %-8s, %5d, %-8s, %5d, "), 3222 (unsigned long) p->theFile.ino, (unsigned long) p->theFile.dev, 3157 3223 p->theFile.c_mode, (int) p->theFile.mode, 3158 3224 p->theFile.c_attributes, (int) p->theFile.attributes, … … 3163 3229 else 3164 3230 { 3165 printf(_("%7ld % 10s %5d %12s %5d %3d %-8s %5d %-8s %5d "),3166 (unsigned long) p->theFile.ino, 3231 printf(_("%7ld %7ld %10s %5d %12s %5d %3d %-8s %5d %-8s %5d "), 3232 (unsigned long) p->theFile.ino, (unsigned long) p->theFile.dev, 3167 3233 p->theFile.c_mode, (int) p->theFile.mode, 3168 3234 p->theFile.c_attributes, (int) p->theFile.attributes, … … 3173 3239 3174 3240 if ('c' == p->theFile.c_mode[0] || 'b' == p->theFile.c_mode[0]) 3175 sl_snprintf(str, 80, "%"PRI i64, p->theFile.rdev);3176 else 3177 sl_snprintf(str, 80, "%"PRI i64, p->theFile.size);3241 sl_snprintf(str, 80, "%"PRIu64, p->theFile.rdev); 3242 else 3243 sl_snprintf(str, 80, "%"PRIu64, p->theFile.size); 3178 3244 3179 3245 printf( _(" %8s"), str); -
trunk/src/sh_prelude.c
r37 r40 39 39 #include <string.h> 40 40 #include <sys/types.h> 41 #include <sys/stat.h>42 41 43 42 #if TIME_WITH_SYS_TIME … … 56 55 #endif 57 56 58 #ifdef MAJOR_IN_MKDEV59 # include <sys/mkdev.h>60 #else61 # ifdef MAJOR_IN_SYSMACROS62 # include <sys/sysmacros.h>63 # endif64 #endif65 66 57 #include <unistd.h> 67 58 #include <syslog.h> 68 59 #include <pwd.h> 69 #include <grp.h>70 60 71 61 int sh_argc_store; … … 412 402 if ( ptr ) { 413 403 ret = idmef_file_new_name(file, &str); 414 if ( ret < 0 ) 415 return; 416 417 prelude_string_set_dup(str, ptr + 1); 404 if ( ret == 0 ) { 405 prelude_string_set_dup(str, ptr + 1); 406 } 418 407 } 419 408 } … … 428 417 if ( ptr ) { 429 418 ret = idmef_time_from_samhain(&time, ptr); 430 if ( ret < 0 ) { 431 free(ptr); 432 return; 433 } 434 435 idmef_file_set_modify_time(file, time); 419 if ( ret == 0 ) { 420 idmef_file_set_modify_time(file, time); 421 } 436 422 free(ptr); 437 423 } … … 440 426 if ( ptr ) { 441 427 ret = idmef_time_from_samhain(&time, ptr); 442 if ( ret < 0 ) { 443 free(ptr); 444 return; 445 } 446 447 idmef_file_set_create_time(file, time); 428 if ( ret == 0 ) { 429 idmef_file_set_create_time(file, time); 430 } 448 431 free(ptr); 449 432 } … … 451 434 ptr = get_value(msg, _("inode"), suffix); 452 435 if ( ptr ) { 453 struct stat st;454 455 ret = lstat(prelude_string_get_string(idmef_file_get_path(file)), &st);456 if ( ret < 0 ) {457 free(ptr);458 return;459 }460 461 436 ret = idmef_file_new_inode(file, &inode); 462 if ( ret < 0 ) { 463 free(ptr); 464 return; 465 } 466 467 idmef_inode_set_major_device(inode, major(st.st_dev)); 468 idmef_inode_set_minor_device(inode, minor(st.st_dev)); 469 idmef_inode_set_number(inode, strtoul(ptr, NULL, 10)); 437 if ( ret == 0 ) { 438 char * dev = get_value(msg, _("dev"), suffix); 439 if (dev) { 440 char * q = strchr(dev, ','); 441 if (*q) { 442 *q = '\0'; ++q; 443 idmef_inode_set_major_device(inode, strtoul(dev, NULL, 0)); 444 idmef_inode_set_minor_device(inode, strtoul( q, NULL, 0)); 445 } 446 free(dev); 447 } 448 idmef_inode_set_number(inode, strtoul(ptr, NULL, 10)); 449 } 470 450 free(ptr); 471 451 } … … 475 455 ret = idmef_file_new_checksum(file, &checksum, IDMEF_LIST_APPEND); 476 456 if ( ret < 0 ) { 477 478 return;457 free(ptr); 458 goto get_mode; 479 459 } 480 460 … … 482 462 483 463 if (hashtype == 0) 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 return;464 idmef_checksum_set_algorithm(checksum, IDMEF_CHECKSUM_ALGORITHM_TIGER); 465 466 else if (hashtype == 1) 467 idmef_checksum_set_algorithm(checksum, IDMEF_CHECKSUM_ALGORITHM_SHA1); 468 469 else if (hashtype == 2) 470 idmef_checksum_set_algorithm(checksum, IDMEF_CHECKSUM_ALGORITHM_MD5); 471 472 else 473 idmef_checksum_set_algorithm(checksum, IDMEF_CHECKSUM_ALGORITHM_TIGER); 474 475 476 ret = idmef_checksum_new_value(checksum, &str); 477 if ( ret < 0 ) { 478 free(ptr); 479 goto get_mode; 500 480 } 501 481 502 482 /* will be freed on destroy() 503 483 */ 504 prelude_string_set_nodup(str, ptr); 505 } 484 prelude_string_set_nodup(str, ptr); 485 } 486 487 get_mode: 506 488 507 489 mode = get_value(msg, _("mode"), suffix); … … 510 492 ret = idmef_file_new_file_access(file, &access, IDMEF_LIST_APPEND); 511 493 if ( ret < 0 ) 512 goto mode_free;494 goto get_owner; 513 495 514 496 /* flawfinder: ignore *//* is part of name, not access() */ 515 497 ret = idmef_file_access_new_user_id(access, &userid); 516 498 if ( ret < 0 ) 517 goto mode_free;499 goto get_owner; 518 500 idmef_user_id_set_type(userid, IDMEF_USER_ID_TYPE_OTHER_PRIVS); 519 501 … … 521 503 get_access_info ( access, mode, 7, 9 ); 522 504 } 505 506 get_owner: 523 507 524 508 ptr = get_value(msg, _("owner"), suffix); 525 509 if ( ptr ) { 526 struct passwd *pw;510 char * uid; 527 511 528 512 /* flawfinder: ignore *//* is part of name, not access() */ … … 530 514 if ( ret < 0 ) { 531 515 free(ptr); 532 goto mode_free;516 goto get_group; 533 517 } 534 518 … … 537 521 if ( ret < 0 ) { 538 522 free(ptr); 539 goto mode_free;523 goto get_group; 540 524 } 541 525 idmef_user_id_set_type(userid, IDMEF_USER_ID_TYPE_USER_PRIVS); … … 544 528 if ( ret < 0 ) { 545 529 free(ptr); 546 goto mode_free;530 goto get_group; 547 531 } 548 532 prelude_string_set_nodup(str, ptr); 549 533 550 pw = getpwnam(ptr);551 if ( ! pw)552 goto mode_free;553 554 idmef_user_id_set_number(userid, pw->pw_uid);534 uid = get_value(msg, _("iowner"), suffix); 535 if ( ! uid ) 536 goto get_group; 537 538 idmef_user_id_set_number(userid, strtoul(uid, NULL, 0)); 555 539 556 540 if ( mode ) { … … 558 542 get_access_info ( access, mode, 1, 3 ); 559 543 } 560 } 544 545 free(uid); 546 } 547 548 get_group: 561 549 562 550 ptr = get_value(msg, _("group"), suffix); 563 551 if ( ptr ) { 564 struct group *gr;552 char *gid; 565 553 566 554 /* flawfinder: ignore *//* is part of name, not access() */ … … 587 575 prelude_string_set_nodup(str, ptr); 588 576 589 g r = getgrnam(ptr);590 if ( ! g r)577 gid = get_value(msg, _("igroup"), suffix); 578 if ( ! gid ) 591 579 goto mode_free; 592 580 593 idmef_user_id_set_number(userid, gr->gr_gid);581 idmef_user_id_set_number(userid, strtoul(gid, NULL, 0)); 594 582 595 583 if ( mode ) { 596 584 get_access_info ( access, mode, 4, 6 ); /* flawfinder: ignore */ 597 585 } 586 587 free(gid); 598 588 } 599 589 -
trunk/src/sh_socket.c
r34 r40 111 111 int pf_unix_fd = -1; 112 112 static char * sh_sockname = NULL; 113 /* static char sh_sockpass[29]; */ 114 static char sh_sockpass_real[15]; 113 static char sh_sockpass_real[SOCKPASS_MAX+1]; 115 114 116 115 struct socket_cmd { … … 226 225 { 227 226 int j = 0; 228 while (skey->sh_sockpass[2*j] != '\0' )227 while (skey->sh_sockpass[2*j] != '\0' && j < sizeof(sh_sockpass_real)) 229 228 { 230 229 sh_sockpass_real[j] = skey->sh_sockpass[2*j]; … … 309 308 310 309 i = sl_strlen(c); 311 if (i > 14) {310 if (i > SOCKPASS_MAX) { 312 311 return -1; 313 312 } 314 for (j = 0; j < 29; ++j)313 for (j = 0; j < (2*SOCKPASS_MAX+1); ++j) 315 314 { 316 315 skey->sh_sockpass[j] = '\0'; … … 556 555 557 556 iov.iov_base = (char *) &message; 558 iov.iov_len = SH_MAXMSG;557 iov.iov_len = sizeof(message); 559 558 560 559 memset (&msg, 0, sizeof (msg)); … … 626 625 #endif 627 626 628 /* nbytes = recv (talkfd, message, SH_MAXMSG, 0); */629 630 message[ SH_MAXMSG-1] = '\0';627 /* msg.msg_iov.iov_base, filled by recvmsg 628 */ 629 message[sizeof(message)-1] = '\0'; 631 630 632 631 if (nbytes < 0) … … 684 683 if (eopw) 685 684 *eopw = '\0'; 686 if (0 == strcmp(goodpassword, message)) 685 /* 686 * message is null-terminated and >> goodpassword 687 */ 688 if (0 == strcmp(goodpassword, message) && 689 strlen(goodpassword) < (sizeof(message)/2)) 687 690 { 688 691 client_uid = sh_socket_flaguid; … … 808 811 while (list_cmd) 809 812 { 810 sl_snprintf(message, SH_MAXMSG, _("SENT %8s %32s %s"),813 sl_snprintf(message, sizeof(message), _("SENT %8s %32s %s"), 811 814 list_cmd->cmd, list_cmd->clt, list_cmd->cti); 812 815 /* … … 835 838 while (list_cmd) 836 839 { 837 sl_snprintf(message, SH_MAXMSG, _(">>>> %8s %32s %s"),840 sl_snprintf(message, sizeof(message), _(">>>> %8s %32s %s"), 838 841 list_cmd->cmd, list_cmd->clt, list_cmd->cti); 839 842 /* … … 964 967 } 965 968 966 sl_strlcpy(cancel_cmd, _("CANCEL"), SH_MAXMSGLEN);969 sl_strlcpy(cancel_cmd, _("CANCEL"), sizeof(cancel_cmd)); 967 970 968 971 while (sh_socket_read (&cmd) > 0) … … 994 997 if (0 == sl_strcmp(new->clt, client_name)) 995 998 { 996 sl_strlcpy(out, new->cmd, SH_MAXMSGLEN);999 sl_strlcpy(out, new->cmd, sizeof(out)); 997 1000 sh_socket_add2run (new); 998 1001 sh_socket_rm2list (client_name); -
trunk/src/sh_unix.c
r34 r40 120 120 #endif 121 121 #endif 122 123 #if defined(S_IFDOOR) && !defined(S_ISDOOR) 124 #define S_ISDOOR(mode) (((mode) & S_IFMT) == S_IFDOOR) 125 #else 126 #if !defined(S_ISDOOR) 127 #define S_ISDOOR(mode) (0) 128 #endif 129 #endif 130 131 #if defined(S_IFPORT) && !defined(S_ISPORT) 132 #define S_ISPORT(mode) (((mode) & S_IFMT) == S_IFPORT) 133 #else 134 #if !defined(S_ISPORT) 135 #define S_ISPORT(mode) (0) 136 #endif 137 #endif 138 122 139 123 140 #undef FIL__ … … 2674 2691 c_mode[0] = 's'; 2675 2692 } 2693 else if ( S_ISDOOR(buf->st_mode) ) { 2694 (*type) = SH_FILE_DOOR; 2695 c_mode[0] = 'D'; 2696 } 2697 else if ( S_ISPORT(buf->st_mode) ) { 2698 (*type) = SH_FILE_PORT; 2699 c_mode[0] = 'P'; 2700 } 2676 2701 else { 2677 2702 (*type) = SH_FILE_UNKNOWN;
Note:
See TracChangeset
for help on using the changeset viewer.