pax_global_header00006660000000000000000000000064121465770660014530gustar00rootroot0000000000000052 comment=4bd9d24d649cca6c5a653f51fdc9f8f6d254676b aide-0.16~a2.git20130520/000077500000000000000000000000001214657706600144005ustar00rootroot00000000000000aide-0.16~a2.git20130520/AUTHORS000066400000000000000000000012011214657706600154420ustar00rootroot00000000000000If you have any questions about aide, it's use or applications please send your inquiries to the mailing list at aide@cs.tut.fi rather than to the individuals named below. The main authors of this package are: * Rami Lehti (rammer@cs.tut.fi) * Pablo Virolainen (pablo@ipi.fi) Other contributors (people who have given us code/patches): * Peter Kelemen (peter.kelemen@cern.ch) * Mike Markley (mike@markley.org) * Steve Grubb (sgrubb@redhat.com) This package is currently maintained by: * Richard van den Berg (richard@vdberg.org) * Hannes von Haugwitz (hannes@vonhaugwitz.com) Thanks to the people who have given good bug reports. aide-0.16~a2.git20130520/COPYING000066400000000000000000000431051214657706600154360ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. aide-0.16~a2.git20130520/ChangeLog000066400000000000000000001112311214657706600161510ustar00rootroot000000000000002013-05-20 Hannes von Haugwitz * Print checksums of databases in verbose level 2 or higher (closes feature request 1502032) * Added new 'database_attrs' option * configure.in: fixed compilation with selinux * src/conf_lex.l, src/db_lex.l: fixed definition of YYDEBUG 2013-05-18 Hannes von Haugwitz * configure.in: removed check for 'libcrypt' * Renamed 'detailed_init_report' option to 'report_detailed_init' 2013-05-17 Hannes von Haugwitz * configure.in: - fixed "suspicious cache-id" warnings - removed 'AC_CONFIG_MACRO_DIR' macro * src/Makefile.am: - replaced INCLUDES with AM_CPPFLAGS 2013-05-16 Hannes von Haugwitz * Handle tilde (~) in database paths and report urls * src/compare_db.c: adjusted report layout 2013-05-14 Hannes von Haugwitz * src/db.c: fixed segfault when dbconf->db_out is NULL * Replaced fopen.c with the version from curl-7.30.0 2013-05-08 Hannes von Haugwitz * src/compare_db.c: - fixed output of checksums - use size_t as the type of for loop variable 2013-05-06 Hannes von Haugwitz * src/compare_db.c: - fixed return value of database initialization - minor code cleanup * src/db_file.c, src/do_md.c: - fixed use of unportable %m format * doc/aide.1.in: - fixed format in NOTES section - documented return value of '--compare' and '--update' command 2013-05-04 Hannes von Haugwitz * src/compare_db.c: - changed minimum verbose level for printing the details about added and removed entries to 7 * README: - updated "Source Code Verification" section * Released version 0.16a2 2012-10-10 Hannes von Haugwitz * Added new default group X * src/gen_list.c: fixed stripping of removed attributes 2012-10-08 Hannes von Haugwitz * src/gen_list.c: fixed handling of renamed files - read in databases in one go - read in old database at the end 2012-10-06 Hannes von Haugwitz * Added new report_base16 option 2012-09-05 Hannes von Haugwitz * src/compare_db.c: support older versions of e2fsprogs 2012-06-19 Hannes von Haugwitz * src/db_file.c: added missing format string to dofprintf calls 2011-10-02 Hannes von Haugwitz * Added new detailed_init_report option 2011-09-29 Hannes von Haugwitz * configure.in, include/aide.h, src/db_file.c: - fixed 'undef' compiler warnings 2011-09-24 Hannes von Haugwitz * src/gen_list.c, include/do_md.h, src/do_md.c: - moved selinux2line function to src/do_md.c - moved xattrs2line function to src/do_md.c * src/db_file.c: - declare db_writeacl only if WITH_ACL is defined 2011-09-23 Hannes von Haugwitz * include/db_disk.h, src/db_disk.c, src/db.c: - fixed 'unused-parameter' compiler warning * include/db_disk.h, src/db_disk.c: - removed unused functions (db_disk_read_spec, db_writespec_disk, db_writeline_disk, db_close_disk) * src/db_file.c: - fixed 'unused-but-set-variable' compiler warnings * src/gen_list.c, include/do_md.h, src/do_md.c: - call acl2line only if WITH_ACL is defined 2011-09-22 Hannes von Haugwitz * src/be.c: - declared static functions static * src/commandconf.c: - fixed 'unused-but-set-variable' compiler warning * src/compare_db.c: - fixed some 'format' compiler warnings * src/db.c: - fixed 'unused-but-set-variable' compiler warnings 2011-09-21 Hannes von Haugwitz * include/aide.h, src/aide.c: - declared static functions static 2011-09-20 Hannes von Haugwitz * include/aide.h, src/db_file.c: - fixed format of 8 bytes off_t type 2011-09-17 Hannes von Haugwitz * src/aide.c: - added missing #include 2011-09-09 Rami Lehti * src/base64.c, src/gen_list.c: - changed verbosity levels to ease debugging 2011-09-07 Hannes von Haugwitz * src/commandconf.c: - added missing spaces to "Cannot access config file" message 2011-09-05 Hannes von Haugwitz * Added new root_prefix option * src/do_md.c: - removed unused function (md_init_fail) 2011-09-04 Hannes von Haugwitz * include/gen_list.h, src/gen_list.c: - removed unused functions (add_file_to_list, traverse_tree, gen_list) 2011-09-03 Hannes von Haugwitz * src/gen_list.c: - print list of added files (verbose level >= 2) and their details (verbose level >= 6) if database has been initialized 2011-07-12 Hannes von Haugwitz * src/gen_list.c: - fixed has_str_changed function * src/util.c: - fixed bad free of hostname variable * src/db_file.c: - removed dead code 2011-04-08 Hannes von Haugwitz * src/gen_list.c: - fixed wrong total number of entries if comparing two databases 2011-03-29 Hannes von Haugwitz * src/compare_db.c: - rewrote gen_report function, changes included: - merged gen_report() and report_tree() - added info about verbose level, ignorelist and report_attributes to report if they differ from standard value - changed report if aide found no changes - added info about number of entries if aide found no changes or the database has been initialized - fixed report of added or removed entries if verbose level is 6 or higher and there are only added or removed entries 2011-03-24 Hannes von Haugwitz * src/compare_db.c: - made ignored_attrs and forced_attrs global - added run time to report 2011-03-22 Hannes von Haugwitz * src/compare_db.c: - print "End timestamp" message in report 2011-03-18 Hannes von Haugwitz * src/db_disk.c: - fixed handling of "/" directory inode - got rid of some static variables 2011-03-01 Hannes von Haugwitz * Removed contrib/mkgitsnapshot.sh 2011-02-16 Hannes von Haugwitz * Released version 0.16a1 2011-02-09 Hannes von Haugwitz * README: - adjusted "Source Code Verification" section 2010-12-30 Hannes von Haugwitz * src/compare_db.c: - print "Looks okay" message also in DO_DIFF mode 2010-12-29 Hannes von Haugwitz * include/compare_db.h, src/compare_db.c: - added gen_report function (code copied from src/aide.c) * src/aide.c: - removed code copied to src/compare_db.c * include/compare_db.h: - removed report_tree function 2010-12-28 Hannes von Haugwitz * src/compare_db.c: - use strftime to format timestamps - made width_details, time_format[] and time_string_len constant - added numeric timezone to the date format 2010-12-27 Hannes von Haugwitz * src/compare_db.c: - added xattrs2array, acl2array and get_attribute_values functions - added print_dbline_attributes function, changes included: - wrap attribute values instead of cut them off - side-by-side output of acl and xattrs values - use '|' to separate the old value from the new one - use node->changed_attributes instead of recalculate the changed attributes - print added or removed attributes of changed entries if forced via report_attributes - removed obsolete code - print details about added and removed entries in verbose level 6 or higher, closes feature request 1460461 - print added and removed attribute values of changed entries in verbose level 6 or higher 2010-12-26 Hannes von Haugwitz * src/compare_db.c: - fixed type of summary_char[] - fixed typo in comment 2010-11-27 Hannes von Haugwitz * doc/aide.1.in: - fixed format in FILES section - added hint on how to decode base64 encoded checksums 2010-11-26 Hannes von Haugwitz * doc/manual.html: - applied changes by Jack Blankenship 2010-11-16 Hannes von Haugwitz * src/compare_db.c: - added missing declaration of aclt variable 2010-11-14 Hannes von Haugwitz * src/conf_yacc.y: - fixed declaration of conftext variable * configure.in: - fixed compilation under Solaris * README: - added hint to use --disable-static under Solaris 10/OpenSolaris 2010-10-12 Hannes von Haugwitz * src/gen_list.c, src/do_md.c: - replaced "File" by "Entry" 2010-10-11 Hannes von Haugwitz * src/aide.c, doc/aide.conf.5.in: - enabled summarize_changes by default 2010-09-29 Hannes von Haugwitz * src/compare_db.c: - rewrote summarize_changes feature to work with node->changed_attrs - replaced "files" by "entries" - made e2fsattrs2string static - use S_IFMT to extract the file type code 2010-09-27 Hannes von Haugwitz * src/gen_list.c: - added bytecmp, has_str_changed, has_md_changed, compare_single_acl, has_acl_changed, cmp_xattr_node, have_xattrs_changed (copied and renamed from src/compare_db.c) - added get_changed_attributes function - use get_changed_attributes instead of compare_dbline - save changed attributes in node->changed_attrs * include/compare_db.h, src/compare_db.c: - removed obsolete compare_dbline function 2010-09-24 Hannes von Haugwitz * include/compare_db.h: removed init_rxlst function * include/db_config.h: include seltree.h after #define DB_ATTR_TYPE * include/seltree.h: - use DB_ATTR_TYPE instead of int for attr - added DB_ATTR_TYPE changed_attrs to seltree struct 2010-09-23 Hannes von Haugwitz * src/compare_db.c: - removed unused functions (find_line_match, init_rxlst, eat_files_indir) - compare ignorelist/forced_attrs with DB_ATTR_UNDEF instead of -1 - renamed e2fsattrs2char function to e2fsattrs2string - use str_has_changed instead of compare_str - added debug output to md_has_changed - use md_has_changed instead of compare_md_entries - removed obsolete functions (compare_str, compare_md_entries) 2010-09-17 Hannes von Haugwitz * src/compare_db.c: fixed compiler warning if WITH_AUDIT is not defined 2010-09-11 Hannes von Haugwitz * Documented '-E' in man page and '--help' text 2010-09-10 Richard van den Berg * Released version 0.15.1 * Changed version to post-0.15.1 2010-09-07 Hannes von Haugwitz * Ignore changed file name if attributes does not match * Allow absence of DB_CHECKINODE if file name has changed 2010-08-08 Richard van den Berg * Added mkgitsnapshot.sh to contrib/ * Released version 0.15 * Changed version to post-0.15 2010-08-06 Hannes von Haugwitz * Updated copyright notices of list.h, list.c, md.h, md,c, symboltable.h, symboltable.c, util.h and util.c * Escaped '-' that really mean '-' in man pages * Updated copyright notices of db_config.h, report.h, url.h, conf_yacc.y, db_lex.l and error.c 2010-08-05 Hannes von Haugwitz * Updated copyright notices of db_file.h, db_file.c, db_sql.h, db_sql.c, do_md.h, do_md.c, gen_list.h and gen_list.c 2010-08-04 Hannes von Haugwitz * Updated copyright notices of commandconf.h, commandconf.c, conf_lex.h, conf_lex.l, db.h, db.c and db_list.h 2010-08-03 Hannes von Haugwitz * Updated copyright notices of aide.h, aide.c, be.c, compare_db.h, compare_db.c and db_disk.c 2010-08-02 Richard van den Berg * Removed ], from version string when --with-curl was used, closes bug 3038382 2010-08-01 Richard van den Berg * Released version 0.15-rc1 * Changed version to post-0.15-rc1 2010-07-30 Hannes von Haugwitz * Removed obsolete compare_db function * Updated documentation of the default groups 2010-07-29 Hannes von Haugwitz * Added ftype and e2fsattrs to the default groups L, R and > 2010-07-25 Hannes von Haugwitz * Fixed sorting of files in report by filename 2010-07-24 Hannes von Haugwitz * Added new grouped option * Sort files in report by filename, see feature request 1337718 2010-07-23 Hannes von Haugwitz * Fixed indent of XAttrs output * Fixed report_attributes for XAttrs * Fixed indent of ACL output * Fixed report_attributes for ACL * Fixed report_attributes for Lname and SELinux 2010-07-22 Hannes von Haugwitz * Fixed report_attributes for checksum values * Replaced 'E2fsAttrs' by 'E2FSAttrs' * Fixed report_attributes for string and long values * summarize_changes: made summary string length also for added/removed files dynamic 2010-07-21 Hannes von Haugwitz * Fixed typo in aide.conf man page * summarize_changes: made length of summary string dynamic * Always save the inode to database (needed for DB_CHECKINODE) * Documented ftype and e2fsattrs in aide.conf * Added TFTYPE token * Prompt for ./configure and make only if autoreconf was successful 2010-07-20 Hannes von Haugwitz * Added ext2 file attributes support 2010-06-12 Hannes von Haugwitz * Always add permissions attribute to database * Added AIDEVERSION to report 2010-06-11 Hannes von Haugwitz * Adjusted old database warning message 2010-06-10 Hannes von Haugwitz * Added file type change detection support * Use DB_ATTR_TYPE for ignorelist and forced_attrs 2010-06-09 Hannes von Haugwitz * Fixed handling of size and growing size bits 2010-06-08 Hannes von Haugwitz * Another fix for the changed permissions are always reported issue 2010-06-07 Hannes von Haugwitz * Replaced 'Permissions' by 'Perm' to fit 9 columns * Fit detailed output in 80 columns, closes feature request 1337759 2010-06-05 Richard van den Berg * Released version 0.14.2 * Changed version to post-0.14.2 2010-06-05 Hannes von Haugwitz * Added missing description for '|' in aide.conf man page * Report correct file type in "Detailed information about changes" section * Fixed strcpy issue on multi-core environments 2010-06-04 Hannes von Haugwitz * Replaced 'File' by 'Entry' in database warnings * Reformatted "Entry ... has different attributes" warnings 2010-06-03 Hannes von Haugwitz * Added missing space and new line to "Error in selective regexp" message, fixes bug 1944700 * Added missing '-' to separator line in the report 2010-05-30 Richard van den Berg * Released version 0.14.1 * Changed version to post-0.14.1 2010-05-20 Richard van den Berg * Support spaces and other characters in file paths in config by Byron Darrah * Added aide-attributes.sh script by Hannes von Haugwitz 2010-05-19 Richard van den Berg * Use exit() instead of abort() by Steve Grubb * Fixed changed permissions are always reported issue by Hannes von Haugwitz 2010-04-09 Richard van den Berg * Use DB_ATTR_TYPE for compare_dbline() by Patrick Neely 2010-03-27 Richard van den Berg * Changed version to post-0.14 * Do not use += in configure, fixes bug 2972100 * Change gzdopen() from wb+ to wb, fixes bug 2976146 * Do not strcat into uninitialized data, fixes bug 2919946 * Add missing db_sql prototypes, and Sun Studio compatibility, fixes bug 2888035 * Initialize gcrypt properly, fixes bug 2763470 2010-03-16 Richard van den Berg * Released version 0.14 2010-02-26 Richard van den Berg * Changed version to post-0.14-rc3 * Fixed some AC_ARG_WITH magic * Define ENOATTR if needed by Hannes von Haugwitz 2010-02-25 Richard van den Berg * Released version 0.14-rc2 * Fix xattrs and selinux bits by Hannes von Haugwitz * Released version 0.14-rc3 2010-02-25 Steve Grubb * Additional checks for snprintf.c * Fix off64_t and other size warnings * Correct linker settings 2010-02-24 Richard van den Berg * Re-enable large file support on 32 bit systems by Steve Grubb 2010-02-23 Richard van den Berg * Show -D in --help by Steve Grubb * Refix line->attr&DB_LINKNAME is always true issue by Hannes von Haugwitz 2010-02-22 Richard van den Berg * Released version 0.14-rc1 * Changed version to post-0.14-rc1 2010-02-21 Richard van den Berg * Replaced snprintf.c with the version from rsync-2.6.9 2010-02-21 Hannes von Haugwitz * Fix checksums letter * Always save the permission to database * summarize_changes: Re-enabled file-type detection for removed files * Fix line->attr&DB_LINKNAME is always true issue * Remove localignorelist for changed nodes * Disable DB_ACL bit if acls are not supported 2010-02-18 Richard van den Berg * Adjust building of fopen.c by Steve Grubb * Fix error handling for prelink by Steve Grubb 2010-02-17 Richard van den Berg * Fix several warnings by Steve Grubb * Check LD in configure by Steve Grubb * Fix xattrs typos by Hannes von Haugwitz * Reworked summarize_changes option by Hannes von Haugwitz 2010-02-13 Richard van den Berg * Added autoconf patch from Steve Grubb * Removed AM_PROG_LIBTOOL from configure.in 2010-02-06 Hannes von Haugwitz * Fixed wrong char array size 2010-02-01 Hannes von Haugwitz * Added new option to summarize changes in output file 2009-05-15 Richard van den Berg * Prelink patch by Peter Vrabec 2007-12-20 Richard van den Berg * Fix equals matches, patch by Brian De Wolf 2007-08-22 Richard van den Berg * Turn CR/LF into LF, patch by Steve Conklin 2007-06-05 Richard van den Berg * Display complete selinux context, patch by Steve Conklin 2007-05-15 Richard van den Berg * Quit autogen.sh if required tools are not found 2007-04-27 Richard van den Berg * Only use optional groups in "make check" when enabled * Prevent segfaults in db_write_byte_base64, patch from James Antill * Fix aide.spec, patch by George Hansper 2006-12-19 Richard van den Berg * Do not warn about files not being directories 2006-12-15 Richard van den Berg * Released version 0.13.1 * Changed version to post-0.13.1 2006-12-14 Richard van den Berg * Use lseek() instead of fseek() on aide.db 2006-12-13 Richard van den Berg * Work around for error while reading gzipped aide.db files 2006-12-08 Richard van den Berg * Removed ustat dead code 2006-12-07 Richard van den Berg * Released version 0.13 * Changed version to post-0.13 2006-11-30 Richard van den Berg * Set meaningful exitcodes when --check is used (Pablo Virolainen) 2006-11-29 Richard van den Berg * Changed version to post-0.13-rc2 * Check for WHIRLPOOL so old mhash can be used (Pablo Virolainen) 2006-11-25 Richard van den Berg * Fix error message about HAVAL and CRC32 with --update and gcrypt * Fix --with and --without logic of configure * Make --without switches of configure work * Released version 0.13-rc2 2006-11-24 Richard van den Berg * Remove stpcpy declaration because it is not defined in util.c * Fix segfault when line->cntx is NULL * Add --without-mhash to configure * Don't use DB_SELINUX and DB_XATTR when not present * Fix use of libgcrypt * Add new group 'l' to detect changed link name * Update documentation with new groups * Supply strnlen in utils.c * Released version 0.13-rc1 2006-11-15 Richard van den Berg * Fix syslog URLs (Yves Mettier ) 2006-10-30 Richard van den Berg * Make --with-selinux work without pkg-config 2006-10-27 Richard van den Berg * Added "Add xattr support" patch from James Antill * Added "report miscompares to Linux Audit System" patch from James Antill * Added "Allow building without mhash library" patch from James Antill * Added "correct db_names" patch from Steve Grubb * Added "memory leaks and performance updates" patch from Steve Grubb * Added "deadcode removal" patch from Steve Grubb * Added "change K&R functions to void functions" patch from Steve Grubb * Added "Memleak fix for ACLs, SELinux, XAttr" patch from James Antill 2006-10-10 Richard van den Berg * Added note about rpl_malloc on AIX 5.3 with mhash * Include version.m4 in distribution tar file * No need for absolute $(srcdir) in configure * Use AC_CONFIG_FILES(files..) instead of AC_OUTPUT(files..) * Removed redundant targets from Makefile.am 2006-10-06 Richard van den Berg * Changed version to post-0.12 * Added file locking for output files 2006-10-05 Richard van den Berg * Released version 0.12 2006-10-04 Richard van den Berg * Close database files earlier * Released version 0.12-rc2 2006-09-24 Richard van den Berg * Fixed filesize stored in postgres (SF bug #1177758) 2006-07-15 Richard van den Berg * Released version 0.12-rc1 * Remove the use of NODE_ADD_CHILDREN, hopefully it is no longer needed * Added syntax changed from 10-manpages.dpatch * Added newlines as per SF bug #1461182 * Added report_attributes group (Pablo Virolainen) 2006-06-13 Richard van den Berg * Fix stat type in report_tree() (Heiko Lehmann ) 2006-05-31 Richard van den Berg * Added support for posix_fadvice() (Pablo Virolainen) 2006-04-22 Richard van den Berg * Fix seg faults on OpenBSD (Axel Rau ) 2006-04-22 Richard van den Berg * Fix mmap on HPUX (fredrik@soderblom.org patch 1474555) 2006-03-31 Richard van den Berg * Abort if aide.db does not have checksum when FORCEDBMD is used * Explain aide.conf and aide.db signing 2006-03-29 Richard van den Berg * Add spaces to error messages (Marc Haber) * Don't warn about rules referring to non-existent directories by default 2006-03-25 Richard van den Berg * Allow aide.db to be supplied on stdin (Pablo Virolainen) * Add patch to allow http/https/ftp URLs through libcurl (Pablo Virolainen) 2006-03-17 Richard van den Berg * Use system strnstr when available * Add --disable-static flag to configure 2006-03-13 Richard van den Berg * Applied manual patch from Marc Haber * Added note about problems with mhash 0.9.x 2006-03-12 Richard van den Berg * Mordernize use of AM_INIT_AUTOMAKE * Use AIDEVERSION to avoid clash with VERSION of other packages 2006-02-26 Richard van den Berg * Use @sysconfdir@ as directory in aide.1, SF bug #1438995 2006-02-23 Richard van den Berg * Set AIDEVERSION right after including config.h * Added note about SIGTERM (Marc Haber) 2006-02-18 Richard van den Berg * Released version 0.11 * Changed version to post-0.11 2006-02-14 Richard van den Berg * Fix the broken @@ifhost and @@ifnhost directives by lcn2 (SF bug #1430482) 2006-02-09 Richard van den Berg * Fall back to strtoimax if strtoll is not available * Protect against non existing syslog facilities * Updated aide.spec.in as suggested in SF bug #1428576 2006-02-08 Richard van den Berg * Explicitly check for readdir64, by Virolainen Pablo * Added note about --disable-lfs in README 2006-01-30 Richard van den Berg * Released version 0.11-rc3 * Changed version to post-0.11-rc3 2006-01-29 Richard van den Berg * Fix layout of aide.conf.5 by Vincent Danen * Cleanup --help output by Vincent Danen * Add separators in --check output by Vincent Danen * Add --disable-lfs option to configure 2006-01-22 Richard van den Berg * Allow report_url to change syslog facility * Only warn when DB_CHECKINODE and DB_CTIME are used together * Added GPG scripts by Vincent Danen 2005-12-19 Richard van den Berg * Revert check_list_for_match to old behaviour (Marc Haber) * Documentation update (Marc Haber) 2005-12-12 Richard van den Berg * Log tree matching verbosely, patch by Virolainen Pablo 2005-11-15 Richard van den Berg * Applied 'allow removed files' patch by Virolainen Pablo 2005-11-13 Richard van den Berg * Applied fix to ANF by Virolainen Pablo 2005-11-07 Richard van den Berg * Applied 'allow new files' patch by Virolainen Pablo 2005-11-03 Richard van den Berg * Remove russian translations; they are out of date and there is no static version of gettext available * Do not stop parsing directory at unescaped . * Fix "make dist" and "make check" * Added gpg scripts to contrib * Released version 0.11-rc2 * Changed version to post-0.11-rc2 2005-10-30 Richard van den Berg * Warn if 'I' and 'c' are used together 2005-10-28 Richard van den Berg * Ignore 'c' when 'I' is in effect * Mention in aide.conf.5 that 'c' and 'I' are incompatible 2005-10-26 Richard van den Berg * Check for ino64_t and dirent64 separately since HPUX does not have them 2005-10-25 Richard van den Berg * Print start and stop timestamp together (Marc Haber ) * Print database_out path with -i and -u * Added bzip2.sh to the contrib directory 2005-10-19 Richard van den Berg * Applied patch from Debian bug #121717: aide spelling fixes 2005-10-16 Richard van den Berg * Applied patch 1124758: fix underquoted m4 * Applied patch 1124757: dist-hook missing file snprintf.h * Applied patch 1124760: cleaner automake initialisation * Applied patch 1124782: gettextize related patch 2005-10-07 Richard van den Berg * If open() with NO_ATIME fails, try open() again without it 2005-10-05 Richard van den Berg * Compile aide as a static executable * Fixed some spelling errors caught by Marc Haber * Changed version to Post 0.11-rc1 * Ignore special characters after backslash in directory names (bug #1162575) 2005-10-04 Richard van den Berg * Released aide 0.11-rc1 2005-09-14 Richard van den Berg * Print detailed error message when mmap() returns MAP_FAILED 2005-09-02 Richard van den Berg * Added patch for cygwin compatibility as per bug #1279818 2005-08-10 Richard van den Berg * Open files with O_NOATIME on Linux (per Vlada Macek ) 2005-08-08 Richard van den Berg * Reset fs.st_rdev in 2 additional places as per bug #1253822 2005-06-30 Richard van den Berg * Removed return in conf_lex.l that caused --after to be ignored 2005-06-12 Richard van den Berg * Applied another aide.1.in from Sven Hoexter 2005-06-11 Richard van den Berg * Applied aide.1.in patch from SF bug #1217483 2005-04-28 Richard van den Berg * Added long long support for portable snprintf * Created aide.conf.5.in and aide.conf.5.ru.in as per bug #1103719 2005-04-27 Richard van den Berg * Fixed sshaide.sh as suggested in bug #1100740 * Removed db_writeacl() from db_disk.c as suggested in bug #1143889 * Set st_rdev to 0 when not used as suggested in bug #1169697 2005-04-18 Richard van den Berg * Correctly parse multiple backslashes in file names 2005-04-08 Richard van den Berg * Use configure to define type for storage of file size in aide.db * Applied fix suggested in Debian Bug #237969 2005-04-06 Richard van den Berg * Always include aide.h before any other include file * Include aide.h instead of config.h to avoid multiple inclusions * Fixed large file under Solaris * Make large file support generic (not just for Solaris) 2005-04-05 Richard van den Berg * Fixed bug where shrinking files with S set where not detected 2005-02-20 Richard van den Berg * Removed extra gen_tree() as suggested in patch 985632 * Allow escaping of spaces in filenames (Virolainen Pablo ) * Allow @@{HOSTNAME} usage in aide.conf (Virolainen Pablo ) 2004-11-16 Richard van den Berg * Applied patch 984424: bug fix for "--check recurses when it shouldn't" * Applied patch 853842: sshaide - contributed script 2004-11-12 Richard van den Berg * Fixed patch from Virolainen Pablo * Applied patch id 931224: Ignoring moved files 2004-11-05 Richard van den Berg * Applied patch from Virolainen Pablo to give more infomation when file attributes have changed before calculating the hash 2004-11-04 Richard van den Berg * Make sure readdir_r is POSIX compliant before we use it 2004-11-03 Richard van den Berg * Applied patch 1058973: Please don't add -I$(prefix)/include * Fixed bug 836253: Manual is wrong about --check command * Applied fix in config parser to avoid 10000 line limit 2004-11-02 Richard van den Berg * Fixed various documentation bugs filed as sf.net 2004-10-29 Richard van den Berg * Use syslog() for systems that do not have vsyslog() * Fixed file system traversing bug for systems without readdir_r * Fixed bug 836257: Line numbers in verbose output off by one 2004-10-28 Richard van den Berg * Removed config.h.in * Added ISO C99 compliant snprintf for systems that do not have it 2004-10-26 Richard van den Berg * Added check for ISO C99 compliant vsnprintf to configure.in 2004-10-23 Richard van den Berg * Applied PSQL patch from Marc Giger * Set version to "Post 0.10" * Removed aide.1 and aide.1.ru since they are created by configure * Moved #endif for WITH_MHASH in commandconf.c thanks to berkeley@octagon.com.au 2003-12-08 Richard van den Berg * Applied patch 853842 "sshaide - contributed script" * Applied patch 855639 "Updated README file" 2003-12-02 Richard van den Berg * Fixed bug 851671 Aide-0.10 --config-check dumps core 2003-11-28 Richard van den Berg * Released aide version 0.10 * Applied patch 849857 "cosmetic report fix" thanks to John Kristoff 2003-11-25 Mike Markley * Applied patch from bug 848664 "crash in db_input_wrapper (gzip)" thanks to Matt Kettler 2003-11-04 Richard van den Berg * Fixed typo in compare_db.c, closes bug 836255 thanks to Michael Schwendt * Applied patch 801860, fixes bug 801857 "=/$ gives segfault" thanks to Michael Schwendt * Applied patch 803001 "Fix for some memory leaks" thanks to Michael Schwendt * Applied patch 801853 "getopt optstring is wrong" thanks to Michael Schwendt 2003-10-03 Richard van den Berg * Moved project over to http://sf.net/projects/aide * Fixed problems in conf_yacc.y * Gzip code now uses best (-9) compression 2002-07-22 Rami Lehti * Fixed Unimplemented error message when conf md not compiled in * Fixed error message about nonexistant files. * Fixed --with-extra-includes --with-extra-libs handling (I hope) * Fixed *stat handling 2002-06-04 Rami Lehti * Released 0.9 2002-05-31 Rami Lehti * Fixed a bug in memory handling causing corrupt md's * Added --without-mmap configure option 2002-05-29 Rami Lehti * Updated version to 0.9 * Fixed loads of bugs * This file should be updated more often * Added support for md checked config and db * Updated Copyright notices * Changed checking algorithm (threading here we come) 2002-02-10 Rami Lehti * Fixed loads and loads of bugs * Added syslog backend * Report format changed * added lots of parameters see man page and configure --help * added ACL support for SunOS 5.x (and compatibles) * Released 0.8 (This is an unstable release) 2000-04-27 Rami Lehti * Added static link flag checking * Released 0.7 2000-04-13 Rami Lehti * Added linkname checking * Removed mhash snefru and fixed haval * Mhash 0.8.1 required. 2000-02-08 Rami Lehti * Changed version to 0.7 2000-02-08 Rami Lehti * Fixed core dump bug in compare_db * Added warning when config has changed * Released 0.6 2000-01-18 Virolainen Pablo * Handles config filename '-' as stdin. Manpage update. 1999-12-30 Rami Lehti * Fixed compilation problem with glibc 2.1 1999-12-29 Rami Lehti * Finally fixed wrong md5 sums. * Fixed nonprintable filename encoding. * Fixed a huge memory leak. 16k per databaseline. 1999-12-08 Pablo Virolainen * Check for [acm]times beeing in future is done correctly now. * blockcount will now be writen to database... 1999-12-02 Pablo Virolainen * Added warning if file's [acm]time is in future (gen_list.c) 1999-11-25 Rami Lehti * Added support for unknown @@ tokens in databases 1999-11-25 Pablo Virolainen * Ignorelist for reports implemented. * Block count added. It might be usefull with file with holes. 1999-11-24 Pablo Virolainen * Added '^' to first charaster of every regexpr * Minor changes do_md.c 1999-11-23 Rami Lehti * Fixed MHASH_COMPATIBILITY problem. Mhash library version 0.6.1 is now required. * Began tidying up the code so that both the internal and mhash hashes can be used at the same time. 1999-11-05 Pablo Virolainen * Fixed bug in tree traverce. Now works without permission check. 1999-10-26 Rami Lehti * Added support for mhash library (done mostly by pablo) * Fixed a --with-config-file bug in configure.in * Fixed md bug when using internal functions * Finally updated the Changelog 1999-08-26 Rami Lehti * Fixed config file handling (Wed, 25 Aug 1999 11:03:34 (EET):rammer) Changed: ChangeLog,configure.in Upped version to 0.4 (Thu, 26 Aug 1999 16:36:14 (EET):rammer) Changed: configure aide.conf.5 compare_db.c,gen_list.c,util.c util.h,conf_lex.l Fixed a bug in gen_seltree Changed default behaviour of verbositylevel 5. Now it prints the detailed info about changed files too. Now on level 5 if a dir is added a warning is shown that foo files were added under the previous dir and not the files themselves. On level 20 the behaviour is still the same. --------------------- aide-0.16~a2.git20130520/INSTALL000066400000000000000000000366001214657706600154360ustar00rootroot00000000000000Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX `make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as `configure' are involved. Use GNU `make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. aide-0.16~a2.git20130520/Makefile.am000066400000000000000000000021431214657706600164340ustar00rootroot00000000000000# # aide, Advanced Intrusion Detection Environment # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING. If not, write to # the Free Software Foundation, 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # SUBDIRS = include src doc datadir = @datadir@ localedir = $(datadir)/locale DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ CLEANFILES = *~ EXTRA_DIST = version.m4 AUTHORS ChangeLog INSTALL README Todo \ contrib/bzip2.sh contrib/gpg2_check.sh contrib/gpg2_update.sh \ contrib/gpg_check.sh contrib/gpg_update.sh contrib/sshaide.sh \ contrib/aide-attributes.sh aide-0.16~a2.git20130520/Makefile.in000066400000000000000000000606511214657706600164550ustar00rootroot00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # # aide, Advanced Intrusion Detection Environment # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING. If not, write to # the Free Software Foundation, 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/aide.spec.in \ $(srcdir)/config.h.in $(top_srcdir)/configure AUTHORS COPYING \ ChangeLog INSTALL NEWS config.guess config.sub depcomp \ install-sh missing mkinstalldirs ylwrap ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/version.m4 $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = aide.spec CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLLIB = @ACLLIB@ ACLOCAL = @ACLOCAL@ AIDE_DEFS = @AIDE_DEFS@ AIDE_USE_LOCALE = @AIDE_USE_LOCALE@ AMTAR = @AMTAR@ ATTRLIB = @ATTRLIB@ AUDITLIB = @AUDITLIB@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CRYPTLIB = @CRYPTLIB@ CYGPATH_W = @CYGPATH_W@ DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ DEPDIR = @DEPDIR@ E2FSATTRSLIB = @E2FSATTRSLIB@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ELFLIB = @ELFLIB@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PSQLLIB = @PSQLLIB@ RANLIB = @RANLIB@ SELINUXLIB = @SELINUXLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ curlconfig = @curlconfig@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = $(datadir)/locale localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = include src doc CLEANFILES = *~ EXTRA_DIST = version.m4 AUTHORS ChangeLog INSTALL README Todo \ contrib/bzip2.sh contrib/gpg2_check.sh contrib/gpg2_update.sh \ contrib/gpg_check.sh contrib/gpg_update.sh contrib/sshaide.sh \ contrib/aide-attributes.sh all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then rm -f stamp-h1; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 aide.spec: $(top_builddir)/config.status $(srcdir)/aide.spec.in cd $(top_builddir) && $(SHELL) ./config.status $@ # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod u+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile config.h installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ ctags-recursive install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-generic \ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ dist-lzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \ distcheck distclean distclean-generic distclean-hdr \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: aide-0.16~a2.git20130520/NEWS000066400000000000000000000067371214657706600151140ustar00rootroot00000000000000Version 0.16 (NOT_YET_RELEASED) * Enabled summarize_changes by default * Compare database entries just once * Added new root_prefix option * Added new database_attrs option * Added new report_detailed_init option * Added new report_base16 option * Wrap attribute values instead of cut them off * Side-by-side output of acl and xattrs values * Use '|' to separate the old value from the new one * Print checksums of databases in verbose level 2 or higher * Print added or removed attributes of changed entries if forced via report_attributes * Print details about added and removed entries in verbose level 7 or higher * Print added and removed attribute values of changed entries in verbose level 6 or higher * Added numeric timezone to time format * Print "End timestamp" message in report * Added run time to report * Added info about verbose level, ignorelist and report_attributes to report if they differ from standard value * Changed report if aide found no changes * Added info about number of entries if aide found no changes or the database has been initialized * Added new default group X * Handle tilde (~) in database paths and report urls * Bug fixes Version 0.15.1 * Fixed bug with DB_CHECKINODE Version 0.15 * Added new grouped option * Sort files in report by filename * Added support for e2fsattrs attribute * Added support for ftype attribute * Bug fixes Version 0.14.2 * Report correct file type in "Detailed information about changes" section * Bug fixes Version 0.14.1 * Added aide-attributes.sh contrib script * Bug fixes Version 0.14 * Renewed autoconf mechanism * Resolved licensing conflicts * New feature to summarize changes * Added prelink support * Many bugfixes Version 0.13.1 * Fixed bug with reading gzipped aide.db files * Removed dead ustat code Version 0.13 * Added support for selinux and xattr attributes (kindly contributed by Red Hat) * Added support for the Linux Audit System (kindly contributed by Red Hat) * Fixed usage of libgcrypt instead of libmhash * Added file locking for output files * Fixed bugs Version 0.12 * Fixed bugs * Allow http/https/ftp URLs through libcurl * Support posix_fadvice() to avoid caching files Version 0.11 * Fixed many bugs * Updated automake/autoconf scripts * Use snprintf by Mark Martinec if not in C library * Support for more (legacy) Unix systems and cygwin * Open files with O_NOATIME on supported Linux systems * Added I/ANF/ARF directives Version 0.10 * Fixed bugs * Moved project over to sourceforge.net * Change of project ownership Version 0.9 * Fixed bugs * Added support for keyed md check of db and config * Removed dependancy on libgcrypt * Added dependancy on mhash Version 0.8 * Fixed loads and loads of bugs * Added syslog backend * Report format changed * added lots of parameters see man page and configure --help * added ACL support for SunOS 5.x (and compatibles) * libgcrypt is now separate and required Version 0.7 * Bug fixes * Compressed database support * Linkname checking * Mhash support (version 0.8.1 of mhash required) Version 0.6 * Bug fixes * Mhash support fixed * MD sums fixed for now Version 0.5 * Bug fixes * ignore_list support * Mhash library support (version 0.6.1 of mhash required) * Disclaimer notices Version 0.4 * Bug fixes Version 0.3 * Added --update command * some bugfixes Version 0.2 * Bugfix release Version 0.1 * Implemented lots of stuff Version 0.0.0.1 * Nothing yet aide-0.16~a2.git20130520/README000066400000000000000000000146061214657706600152670ustar00rootroot00000000000000 AIDE - Advanced Intrusion Detection Environment ------------------------------------------------- Version 0.16a2 This file is free software; as a special exception the author gives unlimited permission to copy and/or distribute it, with or without modifications, as long as this notice is preserved. This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY, to the extend permitted by law; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Introduction ------------ AIDE is a tool for monitoring file system changes. It can be used to detect unauthorized monitored files and directories. AIDE was written to be a simple and free alternative to Tripwire. Features currently included in AIDE are as follows: o File attributes monitored: perissions, inode, user, group file size, mtime, atime, ctime, links and growing size. o Checksums and hashes supported: SHA1, MD5, RMD160, and TIGER. CRC32, HAVAL and GOST if Mhash support is compiled in. o Plain text configuration files and database for simplicity. o Rules, variables and macros that can be customized to local site or system policies. o Powerful regular expression support to selectively include or exclude files and directories to be monitored. o gzip database compression if zlib support is compiled in. o Stand alone static binary for easy client/server monitoring configurations. o Free software licensed under the GNU General Public License. Current Version --------------- AIDE is currently maintained on the SourceForge. Details of the latest version of AIDE can be found on the server project page under http://sourceforge.net/projects/aide/. Documentation ------------- The documentation for AIDE can be found in the doc/ directory. The most up-to-date documentation an be found on the SourceForge project web site. Installation ------------ For generic instructions please see the INSTALL file. For AIX 5.1 or 5.2 it is reported you need to use --with-gnu-regexp when configuring AIDE. For AIX 5.3 it has been reported there is a problem with using mhash which causes an "Undefined symbol: .rpl_malloc" error. This is a problem in mhash_config.h which can be fixed by removing the line that reads #define malloc rpl_malloc For Mac OS X Darwin/Leopard (10.4/10.5) and Solaris 10/OpenSolaris you need to use --disable-static when configuring AIDE. Please note that dynamic linking introduces a security risk and is not recommended. For Mac OS Leopard (10.5) you also need to use --disable-lfs because it handles 64 bit file support out of the box. Source Code Verification ------------------------ We highly recommend checking that the version of AIDE downloaded and installed is an original and unmodified one. You can either verify the source tarball or the git tag. To check the supplied signature with GnuPG: $ gpg --verify aide-.tar.gz.asc This checks that the detached signature file is indeed a signature of aide-.tar.gz. To validate the gpg signature of the git tag: $ git verify-tag v The current public key needed for signature verification is: pub 4096R/68E7B931 2011-06-28 [expires: 2017-06-26] uid Hannes von Haugwitz If you do not have this key, you can get it from one of the well known PGP key servers. You have to make sure that the key you install is not a faked one. You can do this with reasonable assurance by comparing the output of: $ gpg --fingerprint 0x68E7B931 with the fingerprint published elsewhere. Requirements ------------ AIDE requires the following development tools: o C compiler (such as Gcc). o GNU flex. o GNU yacc (bison). o GNU make. o Mhash (optional, but highly recommended). Mhash is currently available from http://mhash.sourceforge.net/. A static version of libmhash needs to be build using the --enable-static=yes configure option. Aide requires at least mhash version 0.9.2 Note: flex version 2.5.31 is broken, you might see the following error conf_lex.c: In function `conflex': conf_lex.c:4728: error: `yy_prev_more_offset' undeclared (first use in this function) conf_lex.c:4728: error: (Each undeclared identifier is reported only once conf_lex.c:4728: error: for each function it appears in.) Either downgrade to flex 2.5.4 or get an updated version that fixes this bug. See also: http://sourceforge.net/tracker/index.php?func=detail&aid=866477&group_id=72099&atid=533377 http://sourceforge.net/mailarchive/message.php?msg_id=5415848 http://sourceforge.net/mailarchive/message.php?msg_id=5561246 Large File Support ----------------- To be able to store the size of files larger than 2GB, aide needs large file support (LFS) to be available in the OS. The configure script automatically checks for the correct defines and functions. If configure fails, and during compile time you see errors containing the number 64, try configure again with the --disable-lfs option. This turns off the large file support. Cross Compilation ----------------- When cross compiling, manually verify the data types defines in config.h as they cannot be accurately determined by configure. Most notably, AIDE_INO_TYPE will be set to "cross". Feedback and Support -------------------- End user support is available on the AIDE mailing list. To subscribe, send a message to majordomo@cs.tut.fi with an empty Subject: line and the following text as the BODY of the message: subscribe aide An archive for the mailing list archive is available online: http://www.mail-archive.com/aide@cs.tut.fi/ To report bugs, contribute patches and contact the current team of developers, visit the SourceForge project web site for additional info: http://sourceforge.net/projects/aide/ Credits ------- Please see the AUTHORS file. aide-0.16~a2.git20130520/Todo000066400000000000000000000006021214657706600152260ustar00rootroot00000000000000Planned Features and TODO list: Multiple database retrieval backends Encrypted databases Return Codes Email report More elaborate report options Recurse=n Interactive db update Is file really deleted or has the config changed. Rewrite for smaller memory footprint. Localization Relative paths in databases Checksum of the binary at the start of the report @@ifdef foo || ( bar && baz ) aide-0.16~a2.git20130520/acinclude.m4000066400000000000000000000025241214657706600165740ustar00rootroot00000000000000dnl Local aide macros dnl AIDE_LINK_FILES( SRC, DEST ) dnl same as AC_LINK_FILES, but collect the files to link in dnl some special variables and do the link dnl when AIDE_DO_LINK_FILES is called dnl This is a workaround for AC_LINK_FILES, because it does not work dnl correct when using a caching scheme dnl define(AIDE_LINK_FILES, [ if test "x$wk_link_files_src" = "x"; then wk_link_files_src="$1" wk_link_files_dst="$2" else wk_link_files_src="$wk_link_files_src $1" wk_link_files_dst="$wk_link_files_dst $2" fi ]) define(AIDE_DO_LINK_FILES, [ AC_LINK_FILES( $wk_link_files_src, $wk_link_files_dst ) ]) dnl AIDE_MSG_PRINT(STRING) dnl print a message dnl define(AIDE_MSG_PRINT, [ echo $ac_n "$1"" $ac_c" 1>&AC_FD_MSG ]) AC_DEFUN([AIDE_CHECK_READDIR_R_ARGS],[ # Check definition of readdir_r AC_CACHE_CHECK(args to readdir_r, aide_cv_readdir_r, AC_TRY_LINK( [#ifndef SCO #define _REENTRANT #endif #define _POSIX_PTHREAD_SEMANTICS #include #include ], [ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result); readdir_r((DIR *) NULL, (struct dirent *) NULL, (struct dirent **) NULL); ], aide_cv_readdir_r=POSIX, aide_cv_readdir_r=other)) if test "$aide_cv_readdir_r" = "POSIX" then AC_DEFINE(HAVE_READDIR_R,1,[Define to 1 if you have the `readdir_r' function.]) fi ]) aide-0.16~a2.git20130520/aclocal.m4000066400000000000000000001050701214657706600162430ustar00rootroot00000000000000# generated automatically by aclocal 1.11.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, # Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software # Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.6], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.6])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, # 2010, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 12 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 8 # AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, # Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, # Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software # Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([acinclude.m4]) aide-0.16~a2.git20130520/aide.spec.in000066400000000000000000000026541214657706600165720ustar00rootroot00000000000000%define name aide %define ver @AIDEVERSION@ %define rel 1 %define prefix /usr Summary: Advanced Intrusion Detection Environment Name: %name Version: %ver Release: %rel Copyright: GPL Group: Console/Security Source: http://prdownloads.sourceforge.net/aide/aide-%ver.tar.gz BuildRoot: /var/tmp/aide-%{PACKAGE_VERSION}-root Obsoletes: %name URL: http://sourceforge.net/projects/aide Docdir: %{prefix}/doc %description aide is an intrusion detection system for checking the integrity of files. %changelog * Fri Nov 28 2003 Richard van den Berg - Changed URLs to point to sourceforge.net * Wed Jan 26 2000 Matthew Kirkwood - Fixes for RH 6.1 and sysconfdir changed to /etc and /var/lib/aide added * Sun Sep 12 1999 Rami Lehti - Some small changes to make this autogeneratable by configure. * Sat Sep 11 1999 Zach Brown - First go %prep %setup %build CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix --sysconfdir=/etc --with-config-file=/etc/aide.conf %install rm -rf $RPM_BUILD_ROOT make prefix=$RPM_BUILD_ROOT%{prefix} install-strip install-man mkdir -p -m700 $RPM_BUILD_ROOT/var/lib/aide %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-, root, root) %doc AUTHORS COPYING ChangeLog NEWS README README-snprintf LICENSE-snprintf.txt Todo doc/aide* %{prefix}/bin/aide %{_mandir}/man1/aide.1* %{_mandir}/man5/aide.conf.5* /var/lib/aide aide-0.16~a2.git20130520/config.guess000077500000000000000000001274321214657706600167310ustar00rootroot00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. timestamp='2012-02-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-gnueabi else echo ${UNAME_MACHINE}-unknown-linux-gnueabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: aide-0.16~a2.git20130520/config.h.in000066400000000000000000000205421214657706600164260ustar00rootroot00000000000000/* config.h.in. Generated from configure.in by autoheader. */ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* Compile-time options displayed in -v output */ #undef AIDECOMPILEOPTIONS /* package version */ #undef AIDEVERSION /* blkcnt_t */ #undef AIDE_BLKCNT_TYPE /* dirent */ #undef AIDE_DIRENT_TYPE /* fstat */ #undef AIDE_FSTAT_FUNC /* syslog ident */ #undef AIDE_IDENT /* ino_t */ #undef AIDE_INO_TYPE /* syslog logopt */ #undef AIDE_LOGOPT /* lstat */ #undef AIDE_LSTAT_FUNC /* off_t */ #undef AIDE_OFF_TYPE /* readdir */ #undef AIDE_READDIR_FUNC /* readdir_r */ #undef AIDE_READDIR_R_FUNC /* stat */ #undef AIDE_STAT_FUNC /* stat type */ #undef AIDE_STAT_TYPE /* syslog facility */ #undef AIDE_SYSLOG_FACILITY /* big endian */ #undef BIG_ENDIAN_HOST /* HMAC key 00 */ #undef CONFHMACKEY_00 /* HMAC key 01 */ #undef CONFHMACKEY_01 /* HMAC key 02 */ #undef CONFHMACKEY_02 /* HMAC key 03 */ #undef CONFHMACKEY_03 /* HMAC key 04 */ #undef CONFHMACKEY_04 /* HMAC key 05 */ #undef CONFHMACKEY_05 /* HMAC key 06 */ #undef CONFHMACKEY_06 /* HMAC key 07 */ #undef CONFHMACKEY_07 /* HMAC key 08 */ #undef CONFHMACKEY_08 /* HMAC key 09 */ #undef CONFHMACKEY_09 /* hash type for config file check */ #undef CONFIGHMACTYPE /* Location of configuration file */ #undef CONFIG_FILE /* DB HMAC key 00 */ #undef DBHMACKEY_00 /* DB HMAC key 01 */ #undef DBHMACKEY_01 /* DB HMAC key 02 */ #undef DBHMACKEY_02 /* DB HMAC key 03 */ #undef DBHMACKEY_03 /* DB HMAC key 04 */ #undef DBHMACKEY_04 /* DB HMAC key 05 */ #undef DBHMACKEY_05 /* DB HMAC key 06 */ #undef DBHMACKEY_06 /* DB HMAC key 07 */ #undef DBHMACKEY_07 /* DB HMAC key 08 */ #undef DBHMACKEY_08 /* DB HMAC key 09 */ #undef DBHMACKEY_09 /* hash type for checking db */ #undef DBHMACTYPE /* Default location of signature database */ #undef DEFAULT_DB /* Default output location for newly-generated signature database */ #undef DEFAULT_DB_OUT /* don't force config checksum */ #undef FORCECONFIGMD /* don't force database checksum */ #undef FORCEDBMD /* Define to 1 if you have the `asprintf' function. */ #undef HAVE_ASPRINTF /* Define to 1 if the system has the type `byte'. */ #undef HAVE_BYTE /* snprintf is ISO C99 compliant */ #undef HAVE_C99_SNPRINTF /* vsnprintf is ISO C99 compliant */ #undef HAVE_C99_VSNPRINTF /* Define to 1 if you have the header file. */ #undef HAVE_CTYPE_H /* Define to 1 if you have the header file. */ #undef HAVE_CURL_CURL_H /* Define to 1 if you have the `fcntl' function. */ #undef HAVE_FCNTL /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `ftruncate' function. */ #undef HAVE_FTRUNCATE /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `gcrypt' library (-lgcrypt). */ #undef HAVE_LIBGCRYPT /* Define to 1 if you have the header file. */ #undef HAVE_LIBINTL_H /* Define to 1 if you have the `pq' library (-lpq). */ #undef HAVE_LIBPQ /* Define to 1 if you have the `z' library (-lz). */ #undef HAVE_LIBZ /* Define to 1 if the type `long double' works and has more range or precision than `double'. */ #undef HAVE_LONG_DOUBLE /* Define to 1 if the type `long double' works and has more range or precision than `double'. */ #undef HAVE_LONG_DOUBLE_WIDER /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* mhash has whirlpool */ #undef HAVE_MHASH_WHIRLPOOL /* Define to 1 if you have the `mmap' function. */ #undef HAVE_MMAP /* have off64_t */ #undef HAVE_OFF64_T /* Define to 1 if you have the O_NOATIME flag. */ #undef HAVE_O_NOATIME /* Define to 1 if you have the `posix_fadvise' function. */ #undef HAVE_POSIX_FADVISE /* Define to 1 if you have the `readdir' function. */ #undef HAVE_READDIR /* Define to 1 if you have the `readdir_r' function. */ #undef HAVE_READDIR_R /* Define to 1 if you have the `regcomp' function. */ #undef HAVE_REGCOMP /* Define to 1 if you have the `regexec' function. */ #undef HAVE_REGEXEC /* Define to 1 if you have the `snprintf' function. */ #undef HAVE_SNPRINTF /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `stricmp' function. */ #undef HAVE_STRICMP /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strnlen' function. */ #undef HAVE_STRNLEN /* Define to 1 if you have the `strnstr' function. */ #undef HAVE_STRNSTR /* Define to 1 if you have the `strtoimax' function. */ #undef HAVE_STRTOIMAX /* Define to 1 if you have the `strtoll' function. */ #undef HAVE_STRTOLL /* syslog available? */ #undef HAVE_SYSLOG /* Define to 1 if you have the header file. */ #undef HAVE_SYSLOG_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if the system has the type `u16'. */ #undef HAVE_U16 /* Define to 1 if the system has the type `u32'. */ #undef HAVE_U32 /* Define to 1 if the system has the type `u64'. */ #undef HAVE_U64 /* Define to 1 if the system has the type `ulong'. */ #undef HAVE_ULONG /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if the system has the type `ushort'. */ #undef HAVE_USHORT /* Define to 1 if you have the `vasprintf' function. */ #undef HAVE_VASPRINTF /* Define to 1 if you have the `va_copy' function. */ #undef HAVE_VA_COPY /* Define to 1 if you have the `vsnprintf' function. */ #undef HAVE_VSNPRINTF /* Define to 1 if you have the `vsyslog' function. */ #undef HAVE_VSYSLOG /* Define to 1 if you have the header file. */ #undef HAVE_ZLIB_H /* Define to 1 if you have the `__va_copy' function. */ #undef HAVE___VA_COPY /* send errors to stderr */ #undef INITIALERRORSTO /* little endian */ #undef LITTLE_ENDIAN_HOST /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* path to prelink */ #undef PRELINK_PATH /* use bundled GNU regex */ #undef REGEX /* The size of `long long', as computed by sizeof. */ #undef SIZEOF_LONG_LONG /* The size of `off64_t', as computed by sizeof. */ #undef SIZEOF_OFF64_T /* The size of `off_t', as computed by sizeof. */ #undef SIZEOF_OFF_T /* The size of `unsigned int', as computed by sizeof. */ #undef SIZEOF_UNSIGNED_INT /* The size of `unsigned long', as computed by sizeof. */ #undef SIZEOF_UNSIGNED_LONG /* The size of `unsigned long long', as computed by sizeof. */ #undef SIZEOF_UNSIGNED_LONG_LONG /* The size of `unsigned short', as computed by sizeof. */ #undef SIZEOF_UNSIGNED_SHORT /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* syslog priority */ #undef SYSLOG_PRIORITY /* Define if LOCALE support should be used */ #undef USE_LOCALE /* Version number of package */ #undef VERSION /* use ACL */ #undef WITH_ACL /* use audit library */ #undef WITH_AUDIT /* use curl */ #undef WITH_CURL /* use e2fsattrs */ #undef WITH_E2FSATTRS /* use gcrypt library */ #undef WITH_GCRYPT /* use mhash library */ #undef WITH_MHASH /* use POSIX ACLs */ #undef WITH_POSIX_ACL /* use prelink */ #undef WITH_PRELINK /* postgresql support */ #undef WITH_PSQL /* use SELinux */ #undef WITH_SELINUX /* use ACL on Solaris */ #undef WITH_SUN_ACL /* use xattr */ #undef WITH_XATTR /* use zlib */ #undef WITH_ZLIB /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a `char[]'. */ #undef YYTEXT_POINTER aide-0.16~a2.git20130520/config.sub000077500000000000000000001053271214657706600163730ustar00rootroot00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. timestamp='2012-04-18' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ | open8 \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: aide-0.16~a2.git20130520/configure000077500000000000000000007624351214657706600163300ustar00rootroot00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for aide 0.16a2-19-g16ed855. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='aide' PACKAGE_TARNAME='aide' PACKAGE_VERSION='0.16a2-19-g16ed855' PACKAGE_STRING='aide 0.16a2-19-g16ed855' PACKAGE_BUGREPORT='' PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS AIDE_DEFS AUDITLIB PSQLLIB CRYPTLIB USE_CURL_FALSE USE_CURL_TRUE curlconfig E2FSATTRSLIB ATTRLIB ELFLIB SELINUXLIB ACLLIB AIDE_USE_LOCALE EGREP GREP CPP PKG_CONFIG LD LEXLIB LEX_OUTPUT_ROOT LEX YFLAGS YACC RANLIB am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_os target_vendor target_cpu target host_os host_vendor host_cpu host build_os build_vendor build_cpu build target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_dependency_tracking with_extra_includes with_extra_libs with_extra_link_libs enable_static with_mmap with_locale with_syslog_ident with_syslog_facility with_syslog_logopt with_syslog_priority with_zlib with_curl with_sun_acl with_posix_acl with_selinux with_prelink with_xattr with_e2fsattrs enable_lfs with_config_file with_gnu_regexp with_mhash with_gcrypt with_confighmactype with_confighmackey with_dbhmactype with_dbhmackey enable_forced_configmd enable_forced_dbmd with_initial_errors_to with_psql with_audit ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS YACC YFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures aide 0.16a2-19-g16ed855 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/aide] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of aide 0.16a2-19-g16ed855:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --disable-static Disable static linking (lowers the security of aide) --disable-lfs Disable large file support on 32-bit platforms --enable-forced-configmd Forces the config to have checksum. Also disables --config-check --enable-forced-dbmd Forces the file/pipe database's to have checksum. This will be the default in the next release. Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-extra-includes Specify additional paths with -I to find headerfiles --with-extra-libs Specify additional paths with -L to find libraries --with-extra-link-libs Specify additional libraries to link --with-mmap use mmap [default=check] --with-locale use locale stuff --with-syslog-ident syslog ident --with-syslog-facility Specify syslog facility, see man syslog for options --with-syslog-logopt Specify syslog logopt, see man syslog for options --with-syslog-priority Specify syslog priority, see man syslog for options --with-zlib use zlib compression --with-curl use curl for http,https and ftp backends --with-sun-acl use ACL on solaris (no checking) --with-posix-acl use POSIX ACLs (no checking) --with-selinux use SELinux (no checking) --with-prelink use prelink (no checking) --with-xattr use xattr (no checking) --with-e2fsattrs use e2fsattrs (no checking) --with-config-file=config-file use config-file as the default config file --with-gnu-regexp use the bundled GNU regexp library. use only if necessary --with-mhash use libmhash, needed for hmacs [default=check] --with-gcrypt use gcrypt library --with-confighmactype=TYPE Hash type to use for checking config. Valid values are md5, sha1, sha256 and sha512. --with-confighmackey=KEY HMAC hash key to use for checking config. Must be a base64 encoded byte stream. Maximum string length is 31 chars. --with-dbhmactype=TYPE Hash type to use for checking db. Valid values are md5 and sha1. --with-dbhmackey=KEY HMAC hash key to use for checking db. Must be a base64 encoded byte stream. Maximum string lentgth is 31 chars. --with-initial-errors-to=URL Where errors should go while checking config. Default is stderr. --with-psql use postgresql library for storing databases --with-audit use audit library Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory YACC The `Yet Another Compiler Compiler' implementation to use. Defaults to the first program found out of: `bison -y', `byacc', `yacc'. YFLAGS The list of arguments that will be passed by default to $YACC. This script will default YFLAGS to the empty string to avoid a default value of `-d' given by some make applications. CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF aide configure 0.16a2-19-g16ed855 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes # INCLUDES, setting VAR accordingly. Returns whether the value could be # computed ac_fn_c_compute_int () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=0 ac_mid=0 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid; break else as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=-1 ac_mid=-1 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=$ac_mid; break else as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid else as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in #(( ?*) eval "$3=\$ac_lo"; ac_retval=0 ;; '') ac_retval=1 ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 static long int longval () { return $2; } static unsigned long int ulongval () { return $2; } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (($2) < 0) { long int i = longval (); if (i != ($2)) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ($2)) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : echo >>conftest.val; read $3 &5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by aide $as_me 0.16a2-19-g16ed855, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 $as_echo_n "checking target system type... " >&6; } if ${ac_cv_target+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 $as_echo "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' set x $ac_cv_target shift target_cpu=$1 target_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: target_os=$* IFS=$ac_save_IFS case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- am__api_version='1.11' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='aide' VERSION='0.16a2-19-g16ed855' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' cat >>confdefs.h <<_ACEOF #define AIDEVERSION "0.16a2-19-g16ed855" _ACEOF ac_config_headers="$ac_config_headers config.h" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi for ac_prog in 'bison -y' byacc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_YACC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_YACC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi YACC=$ac_cv_prog_YACC if test -n "$YACC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 $as_echo "$YACC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" if test "x${YACC}" != "xbison -y"; then echo "AIDE requires GNU bison" exit 5 fi for ac_prog in flex lex do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LEX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LEX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LEX=$ac_cv_prog_LEX if test -n "$LEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LEX" >&5 $as_echo "$LEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$LEX" && break done test -n "$LEX" || LEX=":" if test "x$LEX" != "x:"; then cat >conftest.l <<_ACEOF %% a { ECHO; } b { REJECT; } c { yymore (); } d { yyless (1); } e { /* IRIX 6.5 flex 2.5.4 underquotes its yyless argument. */ yyless ((input () != 0)); } f { unput (yytext[0]); } . { BEGIN INITIAL; } %% #ifdef YYTEXT_POINTER extern char *yytext; #endif int main (void) { return ! yylex () + ! yywrap (); } _ACEOF { { ac_try="$LEX conftest.l" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$LEX conftest.l") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex output file root" >&5 $as_echo_n "checking lex output file root... " >&6; } if ${ac_cv_prog_lex_root+:} false; then : $as_echo_n "(cached) " >&6 else if test -f lex.yy.c; then ac_cv_prog_lex_root=lex.yy elif test -f lexyy.c; then ac_cv_prog_lex_root=lexyy else as_fn_error $? "cannot find output from $LEX; giving up" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_root" >&5 $as_echo "$ac_cv_prog_lex_root" >&6; } LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root if test -z "${LEXLIB+set}"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex library" >&5 $as_echo_n "checking lex library... " >&6; } if ${ac_cv_lib_lex+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_LIBS=$LIBS ac_cv_lib_lex='none needed' for ac_lib in '' -lfl -ll; do LIBS="$ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ `cat $LEX_OUTPUT_ROOT.c` _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_lex=$ac_lib fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext test "$ac_cv_lib_lex" != 'none needed' && break done LIBS=$ac_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lex" >&5 $as_echo "$ac_cv_lib_lex" >&6; } test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether yytext is a pointer" >&5 $as_echo_n "checking whether yytext is a pointer... " >&6; } if ${ac_cv_prog_lex_yytext_pointer+:} false; then : $as_echo_n "(cached) " >&6 else # POSIX says lex can declare yytext either as a pointer or an array; the # default is implementation-dependent. Figure out which it is, since # not all implementations provide the %pointer and %array declarations. ac_cv_prog_lex_yytext_pointer=no ac_save_LIBS=$LIBS LIBS="$LEXLIB $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define YYTEXT_POINTER 1 `cat $LEX_OUTPUT_ROOT.c` _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_prog_lex_yytext_pointer=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_yytext_pointer" >&5 $as_echo "$ac_cv_prog_lex_yytext_pointer" >&6; } if test $ac_cv_prog_lex_yytext_pointer = yes; then $as_echo "#define YYTEXT_POINTER 1" >>confdefs.h fi rm -f conftest.l $LEX_OUTPUT_ROOT.c fi if test "x${LEX}" != "xflex"; then echo "AIDE requires GNU flex" exit 5 fi for ac_prog in ld do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LD"; then ac_cv_prog_LD="$LD" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LD="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LD=$ac_cv_prog_LD if test -n "$LD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$LD" && break done # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="""" ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Check whether --with-extra-includes was given. if test "${with_extra_includes+set}" = set; then : withval=$with_extra_includes; CPPFLAGS="$CPPFLAGS $withval" fi # Check whether --with-extra-libs was given. if test "${with_extra_libs+set}" = set; then : withval=$with_extra_libs; LDFLAGS="$LDFLAGS $withval" fi # Check whether --with-extra-link-libs was given. if test "${with_extra_link_libs+set}" = set; then : withval=$with_extra_link_libs; LIBS="$LIBS $withval" fi AIDE_DEFS="-D_GNU_SOURCE" if test $ac_cv_c_compiler_gnu = yes; then LD_STATIC_FLAG='-static' case "$host_os" in beos* | irix5* | irix6* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; aix*) # Below there is a dirty hack to force normal static linking with -ldl # The problem is because libdl dynamically linked with both libc and # libC (AIX C++ library), which obviously doesn't included in libraries # list by gcc. This cause undefined symbols with -static flags. # This hack allows C programs to be linked with "-static -ldl", but # we not sure about C++ programs. LD_STATIC_FLAG="$LD_STATIC_FLAG ${wl}-lC" ;; cygwin* | mingw* | os2*) # We can build DLLs from non-PIC. ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. ## pic_flag='-m68020 -resident32 -malways-restore-a4' ;; sysv4*MP*) ## if test -d /usr/nec; then ## pic_flag=-Kconform_pic ## fi ;; *) ## pic_flag='-fPIC' ;; esac else # PORTME Check for PIC flags for the system compiler. case "$host_os" in aix3* | aix4*) # All AIX code is PIC. LD_STATIC_FLAG='-bnso -bI:/lib/syscalls.exp' ;; hpux9* | hpux10* | hpux11*) # Is there a better LD_STATIC_FLAG that works with the bundled CC? ## wl='-Wl,' LD_STATIC_FLAG="${wl}-a ${wl}archive" ## pic_flag='+Z' ;; irix5* | irix6*) ## wl='-Wl,' LD_STATIC_FLAG='-non_shared' # PIC (with -KPIC) is the default. ;; cygwin* | mingw* | os2*) # We can build DLLs from non-PIC. ;; osf3* | osf4* | osf5*) # All OSF/1 code is PIC. ## wl='-Wl,' LD_STATIC_FLAG='-non_shared' ;; sco3.2v5*) ## pic_flag='-Kpic' LD_STATIC_FLAG='-dn' ## special_shlib_compile_flags='-belf' ;; solaris*) ## pic_flag='-KPIC' LD_STATIC_FLAG='-Bstatic' ## wl='-Wl,' ;; sunos4*) ## pic_flag='-PIC' LD_STATIC_FLAG='-Bstatic' ## wl='-Qoption ld ' ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) ## pic_flag='-KPIC' LD_STATIC_FLAG='-Bstatic' ## wl='-Wl,' ;; uts4*) ## pic_flag='-pic' LD_STATIC_FLAG='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then ## pic_flag='-Kconform_pic' LD_STATIC_FLAG='-Bstatic' fi ;; *) ## can_build_shared=no ;; esac fi # Check whether static linking has explicitly been disabled # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; aide_static_choice=$enableval else aide_static_choice=yes fi cc_supports_flag() { { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports \"$@\"" >&5 $as_echo_n "checking whether $CC supports \"$@\"... " >&6; } Cfile=/tmp/foo${$} touch ${Cfile}.c $CC -c "$@" ${Cfile}.c -o ${Cfile}.o >/dev/null 2>&1 rc=$? rm -f ${Cfile}.c ${Cfile}.o case $rc in 0) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; };; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; };; esac return $rc } ld_supports_flag() { { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $LD supports \"$@\"" >&5 $as_echo_n "checking whether $LD supports \"$@\"... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int one(void) { return 1; } int two(void) { return 2; } int main () { two(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : _ac_ld_flag_supported=yes else _ac_ld_flag_supported=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$_ac_ld_flag_supported" = "yes"; then rm -f conftest.c touch conftest.c if $CC -c conftest.c; then ld_out=`$LD $@ -o conftest conftest.o 2>&1` ld_ret=$? if test $ld_ret -ne 0 ; then _ac_ld_flag_supported=no elif echo "$ld_out" | egrep 'option ignored|^usage:|unrecognized option|illegal option' >/dev/null ; then _ac_ld_flag_supported=no fi fi rm -f conftest.c conftest.o conftest fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_ac_ld_flag_supported" >&5 $as_echo "$_ac_ld_flag_supported" >&6; } if test "$_ac_ld_flag_supported" = "yes" ; then return 0 else return 1 fi } if test "$aide_static_choice" != "yes"; then LD_STATIC_FLAG="" EXTRA_LDFLAGS="" EXTRA_CFLAGS="" if test x$CC = "xgcc"; then if ld_supports_flag -z,relro; then EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-z,relro" fi if ld_supports_flag -z,now; then EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-z,now" fi if cc_supports_flag -fPIE -DPIE; then EXTRA_CFLAGS="$EXTRA_CFLAGS -fPIE -DPIE" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -pie" fi if cc_supports_flag -Wundef; then EXTRA_CFLAGS="$EXTRA_CFLAGS -Wundef" fi if cc_supports_flag -Wmissing-format-attribute; then EXTRA_CFLAGS="$EXTRA_CFLAGS -Wmissing-format-attribute" fi if cc_supports_flag -Wshadow; then EXTRA_CFLAGS="$EXTRA_CFLAGS -Wshadow" fi if cc_supports_flag -Wlogical-op; then EXTRA_CFLAGS="$EXTRA_CFLAGS -Wlogical-op" fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing syslog" >&5 $as_echo_n "checking for library containing syslog... " >&6; } if ${ac_cv_search_syslog+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char syslog (); int main () { return syslog (); ; return 0; } _ACEOF for ac_lib in '' bsd socket inet; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_syslog=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_syslog+:} false; then : break fi done if ${ac_cv_search_syslog+:} false; then : else ac_cv_search_syslog=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_syslog" >&5 $as_echo "$ac_cv_search_syslog" >&6; } ac_res=$ac_cv_search_syslog if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $as_echo "#define HAVE_SYSLOG 1" >>confdefs.h fi for ac_func in vsyslog do : ac_fn_c_check_func "$LINENO" "vsyslog" "ac_cv_func_vsyslog" if test "x$ac_cv_func_vsyslog" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VSYSLOG 1 _ACEOF fi done ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. ac_arch= ac_prev= for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do if test -n "$ac_prev"; then case $ac_word in i?86 | x86_64 | ppc | ppc64) if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then ac_arch=$ac_word else ac_cv_c_bigendian=universal break fi ;; esac ac_prev= elif test "x$ac_word" = "x-arch"; then ac_prev=arch fi done fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes; then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main () { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_bigendian=no else ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) $as_echo "#define BIG_ENDIAN_HOST 1" >>confdefs.h ;; #( no) $as_echo "#define LITTLE_ENDIAN_HOST 1" >>confdefs.h ;; #( universal) $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) as_fn_error $? "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac ac_fn_c_check_type "$LINENO" "byte" "ac_cv_type_byte" "$ac_includes_default" if test "x$ac_cv_type_byte" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_BYTE 1 _ACEOF fi ac_fn_c_check_type "$LINENO" "ushort" "ac_cv_type_ushort" "$ac_includes_default" if test "x$ac_cv_type_ushort" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_USHORT 1 _ACEOF fi ac_fn_c_check_type "$LINENO" "ulong" "ac_cv_type_ulong" "$ac_includes_default" if test "x$ac_cv_type_ulong" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ULONG 1 _ACEOF fi ac_fn_c_check_type "$LINENO" "u16" "ac_cv_type_u16" "$ac_includes_default" if test "x$ac_cv_type_u16" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_U16 1 _ACEOF fi ac_fn_c_check_type "$LINENO" "u32" "ac_cv_type_u32" "$ac_includes_default" if test "x$ac_cv_type_u32" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_U32 1 _ACEOF fi ac_fn_c_check_type "$LINENO" "u64" "ac_cv_type_u64" "$ac_includes_default" if test "x$ac_cv_type_u64" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_U64 1 _ACEOF fi # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned short" >&5 $as_echo_n "checking size of unsigned short... " >&6; } if ${ac_cv_sizeof_unsigned_short+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned short))" "ac_cv_sizeof_unsigned_short" "$ac_includes_default"; then : else if test "$ac_cv_type_unsigned_short" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (unsigned short) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_unsigned_short=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_short" >&5 $as_echo "$ac_cv_sizeof_unsigned_short" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_UNSIGNED_SHORT $ac_cv_sizeof_unsigned_short _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned int" >&5 $as_echo_n "checking size of unsigned int... " >&6; } if ${ac_cv_sizeof_unsigned_int+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned int))" "ac_cv_sizeof_unsigned_int" "$ac_includes_default"; then : else if test "$ac_cv_type_unsigned_int" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (unsigned int) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_unsigned_int=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_int" >&5 $as_echo "$ac_cv_sizeof_unsigned_int" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_UNSIGNED_INT $ac_cv_sizeof_unsigned_int _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned long" >&5 $as_echo_n "checking size of unsigned long... " >&6; } if ${ac_cv_sizeof_unsigned_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned long))" "ac_cv_sizeof_unsigned_long" "$ac_includes_default"; then : else if test "$ac_cv_type_unsigned_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (unsigned long) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_unsigned_long=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_long" >&5 $as_echo "$ac_cv_sizeof_unsigned_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_UNSIGNED_LONG $ac_cv_sizeof_unsigned_long _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 $as_echo_n "checking size of long long... " >&6; } if ${ac_cv_sizeof_long_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then : else if test "$ac_cv_type_long_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long long) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long_long=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5 $as_echo "$ac_cv_sizeof_long_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned long long" >&5 $as_echo_n "checking size of unsigned long long... " >&6; } if ${ac_cv_sizeof_unsigned_long_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned long long))" "ac_cv_sizeof_unsigned_long_long" "$ac_includes_default"; then : else if test "$ac_cv_type_unsigned_long_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (unsigned long long) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_unsigned_long_long=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_long_long" >&5 $as_echo "$ac_cv_sizeof_unsigned_long_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_UNSIGNED_LONG_LONG $ac_cv_sizeof_unsigned_long_long _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long double with more range or precision than double" >&5 $as_echo_n "checking for long double with more range or precision than double... " >&6; } if ${ac_cv_type_long_double_wider+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include long double const a[] = { 0.0L, DBL_MIN, DBL_MAX, DBL_EPSILON, LDBL_MIN, LDBL_MAX, LDBL_EPSILON }; long double f (long double x) { return ((x + (unsigned long int) 10) * (-1 / x) + a[0] + (x ? f (x) : 'c')); } int main () { static int test_array [1 - 2 * !((0 < ((DBL_MAX_EXP < LDBL_MAX_EXP) + (DBL_MANT_DIG < LDBL_MANT_DIG) - (LDBL_MAX_EXP < DBL_MAX_EXP) - (LDBL_MANT_DIG < DBL_MANT_DIG))) && (int) LDBL_EPSILON == 0 )]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_type_long_double_wider=yes else ac_cv_type_long_double_wider=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_double_wider" >&5 $as_echo "$ac_cv_type_long_double_wider" >&6; } if test $ac_cv_type_long_double_wider = yes; then $as_echo "#define HAVE_LONG_DOUBLE_WIDER 1" >>confdefs.h fi ac_cv_c_long_double=$ac_cv_type_long_double_wider if test $ac_cv_c_long_double = yes; then $as_echo "#define HAVE_LONG_DOUBLE 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi for ac_func in strtoll strtoimax readdir do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # Check definition of readdir_r { $as_echo "$as_me:${as_lineno-$LINENO}: checking args to readdir_r" >&5 $as_echo_n "checking args to readdir_r... " >&6; } if ${aide_cv_readdir_r+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef SCO #define _REENTRANT #endif #define _POSIX_PTHREAD_SEMANTICS #include #include int main () { int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result); readdir_r((DIR *) NULL, (struct dirent *) NULL, (struct dirent **) NULL); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : aide_cv_readdir_r=POSIX else aide_cv_readdir_r=other fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $aide_cv_readdir_r" >&5 $as_echo "$aide_cv_readdir_r" >&6; } if test "$aide_cv_readdir_r" = "POSIX" then $as_echo "#define HAVE_READDIR_R 1" >>confdefs.h fi for ac_func in stricmp strnstr strnlen do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # Check whether --with-mmap was given. if test "${with_mmap+set}" = set; then : withval=$with_mmap; else with_mmap=check fi if test "x$with_mmap" != xno; then : for ac_func in mmap do : ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" if test "x$ac_cv_func_mmap" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MMAP 1 _ACEOF fi done compoptionstring="${compoptionstring}WITH_MMAP\\n" fi for ac_func in fcntl ftruncate posix_fadvise asprintf snprintf \ vasprintf vsnprintf va_copy __va_copy do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C99 compliant snprintf" >&5 $as_echo_n "checking for ISO C99 compliant snprintf... " >&6; } if ${ac_cv_func_snprintf_c99+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_snprintf_c99=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main() { char buf[] = {0, 0, 0, 0}; snprintf(buf, 3, "ABC"); exit ((buf[2] != 0) || (snprintf(NULL, 0, "%d", 100) != 3)); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_snprintf_c99=yes else ac_cv_func_snprintf_c99=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_snprintf_c99" >&5 $as_echo "$ac_cv_func_snprintf_c99" >&6; } if test $ac_cv_func_snprintf_c99 = yes; then $as_echo "#define HAVE_C99_SNPRINTF 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C99 compliant vsnprintf" >&5 $as_echo_n "checking for ISO C99 compliant vsnprintf... " >&6; } if ${ac_cv_func_vsnprintf_c99+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_vsnprintf_c99=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int doit(char *buf, int len, const char *s, ...) { va_list ap; int r; va_start(ap, s); r = vsnprintf(buf, len, s, ap); va_end(ap); return r; } int main() { char buf[] = {0, 0, 0, 0}; doit(buf, 3, "ABC"); exit ((buf[2] != 0) || (doit(NULL, 0, "%d", 100) != 3)); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_vsnprintf_c99=yes else ac_cv_func_vsnprintf_c99=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vsnprintf_c99" >&5 $as_echo "$ac_cv_func_vsnprintf_c99" >&6; } if test $ac_cv_func_vsnprintf_c99 = yes; then $as_echo "#define HAVE_C99_VSNPRINTF 1" >>confdefs.h fi # Linux has the O_NOATIME flag, sometimes { $as_echo "$as_me:${as_lineno-$LINENO}: checking for open/O_NOATIME" >&5 $as_echo_n "checking for open/O_NOATIME... " >&6; } if ${db_cv_open_o_noatime+:} false; then : $as_echo_n "(cached) " >&6 else echo "test for working open/O_NOATIME" > __o_noatime_file if test "$cross_compiling" = yes; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #ifndef O_NOATIME #if defined(__linux__) && (defined(__i386__) || defined(__PPC__)) #define O_NOATIME 01000000 #else #define O_NOATIME 0 #endif #endif int main () { open("__o_noatime_file", O_RDONLY | O_NOATIME, 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : db_cv_open_o_noatime=yes else db_cv_open_o_noatime=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #ifndef O_NOATIME #if defined(__linux__) && (defined(__i386__) || defined(__PPC__)) #define O_NOATIME 01000000 #else #define O_NOATIME 0 #endif #endif main() { int c, fd = open("__o_noatime_file", O_RDONLY | O_NOATIME, 0); exit ((!O_NOATIME) || (fd == -1) || (read(fd, &c, 1) != 1)); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : db_cv_open_o_noatime=yes else db_cv_open_o_noatime=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f __o_noatime_file fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $db_cv_open_o_noatime" >&5 $as_echo "$db_cv_open_o_noatime" >&6; } if test "$db_cv_open_o_noatime" = yes; then $as_echo "#define HAVE_O_NOATIME 1" >>confdefs.h fi for ac_header in syslog.h inttypes.h fcntl.h ctype.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Check whether --with-locale was given. if test "${with_locale+set}" = set; then : withval=$with_locale; else with_locale=no fi if test "x$with_locale" != xno; then : for ac_header in libintl.h do : ac_fn_c_check_header_mongrel "$LINENO" "libintl.h" "ac_cv_header_libintl_h" "$ac_includes_default" if test "x$ac_cv_header_libintl_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBINTL_H 1 _ACEOF $as_echo "#define USE_LOCALE 1" >>confdefs.h AIDE_USE_LOCALE="" compoptionstring="${compoptionstring}WITH_LOCALE\\n" fi done fi # Check whether --with-syslog_ident was given. if test "${with_syslog_ident+set}" = set; then : withval=$with_syslog_ident; cat >>confdefs.h <<_ACEOF #define AIDE_IDENT "$withval" _ACEOF compoptionstring="${compoptionstring}AIDE_IDENT=${withval}\\n" else cat >>confdefs.h <<_ACEOF #define AIDE_IDENT "aide" _ACEOF fi # Check whether --with-syslog_facility was given. if test "${with_syslog_facility+set}" = set; then : withval=$with_syslog_facility; cat >>confdefs.h <<_ACEOF #define AIDE_SYSLOG_FACILITY $withval _ACEOF compoptionstring="${compoptionstring}AIDE_SYSLOG_FACILITY=${withval}\\n" else cat >>confdefs.h <<_ACEOF #define AIDE_SYSLOG_FACILITY LOG_LOCAL0 _ACEOF fi # Check whether --with-syslog_logopt was given. if test "${with_syslog_logopt+set}" = set; then : withval=$with_syslog_logopt; cat >>confdefs.h <<_ACEOF #define AIDE_LOGOPT $withval _ACEOF else cat >>confdefs.h <<_ACEOF #define AIDE_LOGOPT LOG_CONS _ACEOF fi # Check whether --with-syslog_priority was given. if test "${with_syslog_priority+set}" = set; then : withval=$with_syslog_priority; cat >>confdefs.h <<_ACEOF #define SYSLOG_PRIORITY $withval _ACEOF compoptionstring="${compoptionstring}SYSLOG_PRIORITY=${withval}\\n" else cat >>confdefs.h <<_ACEOF #define SYSLOG_PRIORITY LOG_NOTICE _ACEOF fi # Check whether --with-zlib was given. if test "${with_zlib+set}" = set; then : withval=$with_zlib; else with_zlib=yes fi # Check whether --with-curl was given. if test "${with_curl+set}" = set; then : withval=$with_curl; else with_curl=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sun-acl-support" >&5 $as_echo_n "checking for sun-acl-support... " >&6; } # Check whether --with-sun-acl was given. if test "${with_sun_acl+set}" = set; then : withval=$with_sun_acl; else with_sun_acl=no fi if test "x$with_sun_acl" != xno; then : $as_echo "#define WITH_SUN_ACL 1" >>confdefs.h $as_echo "#define WITH_ACL 1" >>confdefs.h ACLLIB="-lsec" compoptionstring="${compoptionstring}WITH_SUN_ACL\\n" aideextragroups="${aideextragroups}+acl" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for posix-acl-support" >&5 $as_echo_n "checking for posix-acl-support... " >&6; } # Check whether --with-posix-acl was given. if test "${with_posix_acl+set}" = set; then : withval=$with_posix_acl; else with_posix_acl_support=no fi if test "x$with_posix_acl_support" != xno; then : $as_echo "#define WITH_POSIX_ACL 1" >>confdefs.h $as_echo "#define WITH_ACL 1" >>confdefs.h ACLLIB="-lacl" compoptionstring="${compoptionstring}WITH_POSIX_ACL\\n" aideextragroups="${aideextragroups}+acl" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for selinux-support" >&5 $as_echo_n "checking for selinux-support... " >&6; } # Check whether --with-selinux was given. if test "${with_selinux+set}" = set; then : withval=$with_selinux; with_selinux_support="$withval" else with_selinux_support=no fi if test "x$with_selinux_support" != xno; then : $as_echo "#define WITH_SELINUX 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } if test -n "$PKG_CONFIG" && $PKG_CONFIG --exists libselinux; then if test "$aide_static_choice" == "yes"; then SELINUXLIB=$(${PKG_CONFIG} --libs libselinux --static) else SELINUXLIB=$(${PKG_CONFIG} --libs libselinux) fi else SELINUXLIB="-lselinux" if test "$aide_static_choice" == "yes"; then saveLIBS=$LIBS LIBS="-static $SELINUXLIB" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing lgetfilecon_raw" >&5 $as_echo_n "checking for library containing lgetfilecon_raw... " >&6; } if ${ac_cv_search_lgetfilecon_raw+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char lgetfilecon_raw (); int main () { return lgetfilecon_raw (); ; return 0; } _ACEOF for ac_lib in '' ; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_lgetfilecon_raw=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_lgetfilecon_raw+:} false; then : break fi done if ${ac_cv_search_lgetfilecon_raw+:} false; then : else ac_cv_search_lgetfilecon_raw=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_lgetfilecon_raw" >&5 $as_echo "$ac_cv_search_lgetfilecon_raw" >&6; } ac_res=$ac_cv_search_lgetfilecon_raw if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" else SELINUXLIB="$SELINUXLIB -lpthread" fi LIBS=$saveLIBS fi fi compoptionstring="${compoptionstring}WITH_SELINUX\\n" aideextragroups="${aideextragroups}+selinux" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for prelink-support" >&5 $as_echo_n "checking for prelink-support... " >&6; } # Check whether --with-prelink was given. if test "${with_prelink+set}" = set; then : withval=$with_prelink; case $with_prelink in yes) cat >>confdefs.h <<_ACEOF #define PRELINK_PATH "/usr/sbin/prelink" _ACEOF $as_echo "#define WITH_PRELINK 1" >>confdefs.h ELFLIB="-lelf" compoptionstring="${compoptionstring}WITH_PRELINK\\n" { $as_echo "$as_me:${as_lineno-$LINENO}: result: /usr/sbin/prelink" >&5 $as_echo "/usr/sbin/prelink" >&6; } ;; no) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; *) cat >>confdefs.h <<_ACEOF #define PRELINK_PATH "$with_prelink" _ACEOF $as_echo "#define WITH_PRELINK 1" >>confdefs.h ELFLIB="-lelf" compoptionstring="${compoptionstring}WITH_PRELINK\\n" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_prelink" >&5 $as_echo "$with_prelink" >&6; } ;; esac else with_prelink=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xattr-support" >&5 $as_echo_n "checking for xattr-support... " >&6; } # Check whether --with-xattr was given. if test "${with_xattr+set}" = set; then : withval=$with_xattr; with_xattr_support="$withval" else with_xattr_support=no fi if test "x$with_xattr_support" != xno; then : $as_echo "#define WITH_XATTR 1" >>confdefs.h ATTRLIB=-lattr compoptionstring="${compoptionstring}WITH_XATTR\\n" aideextragroups="${aideextragroups}+xattr" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for e2fsattrs-support" >&5 $as_echo_n "checking for e2fsattrs-support... " >&6; } # Check whether --with-e2fsattrs was given. if test "${with_e2fsattrs+set}" = set; then : withval=$with_e2fsattrs; with_e2fsattrs_support="$withval" else with_e2fsattrs_support=no fi if test "x$with_e2fsattrs_support" != xno; then : $as_echo "#define WITH_E2FSATTRS 1" >>confdefs.h E2FSATTRSLIB=-le2p compoptionstring="${compoptionstring}WITH_E2FSATTRS\\n" aideextragroups="${aideextragroups}+e2fsattrs" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Check whether LFS has explicitly been disabled # Check whether --enable-lfs was given. if test "${enable_lfs+set}" = set; then : enableval=$enable_lfs; aide_lfs_choice=$enableval else aide_lfs_choice=yes fi if test "$aide_lfs_choice" = "yes"; then # This looks weird because Linux defines lstat64 and then screws it up ac_fn_c_check_func "$LINENO" "lstat64" "ac_cv_func_lstat64" if test "x$ac_cv_func_lstat64" = xyes; then : ac_fn_c_check_func "$LINENO" "stat64" "ac_cv_func_stat64" if test "x$ac_cv_func_stat64" = xyes; then : AIDE_DEFS="$AIDE_DEFS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" AIDE_LSTAT_FUNC="lstat64" compoptionstring="${compoptionstring}WITH_LSTAT64\\n" AIDE_STAT_FUNC="stat64" AIDE_FSTAT_FUNC="fstat64" AIDE_STAT_TYPE="stat64" AIDE_OFF_TYPE="off64_t" $as_echo "#define HAVE_OFF64_T 1" >>confdefs.h AIDE_BLKCNT_TYPE="blkcnt64_t" ac_fn_c_check_func "$LINENO" "readdir64" "ac_cv_func_readdir64" if test "x$ac_cv_func_readdir64" = xyes; then : AIDE_READDIR_FUNC="readdir64" compoptionstring="${compoptionstring}WITH_READDIR64\\n" else AIDE_READDIR_FUNC="readdir" fi ac_fn_c_check_func "$LINENO" "readdir64_r" "ac_cv_func_readdir64_r" if test "x$ac_cv_func_readdir64_r" = xyes; then : AIDE_READDIR_R_FUNC="readdir64_r" else AIDE_READDIR_R_FUNC="readdir_r" fi else AIDE_LSTAT_FUNC="lstat" AIDE_STAT_FUNC="stat" AIDE_FSTAT_FUNC="fstat" AIDE_STAT_TYPE="stat" AIDE_OFF_TYPE="off_t" AIDE_BLKCNT_TYPE="blkcnt_t" AIDE_READDIR_FUNC="readdir" AIDE_READDIR_R_FUNC="readdir_r" compoptionstring="${compoptionstring}WITH_LSTAT\\n" compoptionstring="${compoptionstring}WITH_READDIR\\n" fi else AIDE_LSTAT_FUNC="lstat" AIDE_STAT_FUNC="stat" AIDE_FSTAT_FUNC="fstat" AIDE_STAT_TYPE="stat" AIDE_OFF_TYPE="off_t" AIDE_BLKCNT_TYPE="blkcnt_t" AIDE_READDIR_FUNC="readdir" AIDE_READDIR_R_FUNC="readdir_r" compoptionstring="${compoptionstring}WITH_LSTAT\\n" compoptionstring="${compoptionstring}WITH_READDIR\\n" fi saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $AIDE_DEFS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LFS ino_t" >&5 $as_echo_n "checking for LFS ino_t... " >&6; } if ${ac_cv_ino_type+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_ino_type=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_ino_type=ino64_t else ac_cv_ino_type=ino_t fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_ino_type" >&5 $as_echo "$ac_cv_ino_type" >&6; } AIDE_INO_TYPE=$ac_cv_ino_type { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LFS dirent" >&5 $as_echo_n "checking for LFS dirent... " >&6; } if ${ac_cv_dirent_type+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { struct dirent64 de; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_dirent_type=dirent64 else ac_cv_dirent_type=dirent fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_dirent_type" >&5 $as_echo "$ac_cv_dirent_type" >&6; } AIDE_DIRENT_TYPE=$ac_cv_dirent_type else AIDE_LSTAT_FUNC="lstat" AIDE_STAT_FUNC="stat" AIDE_FSTAT_FUNC="fstat" AIDE_STAT_TYPE="stat" AIDE_OFF_TYPE="off_t" AIDE_BLKCNT_TYPE="blkcnt_t" AIDE_READDIR_FUNC="readdir" AIDE_READDIR_R_FUNC="readdir_r" compoptionstring="${compoptionstring}WITH_LSTAT\\n" compoptionstring="${compoptionstring}WITH_READDIR\\n" AIDE_INO_TYPE=ino_t AIDE_DIRENT_TYPE=dirent fi # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of off_t" >&5 $as_echo_n "checking size of off_t... " >&6; } if ${ac_cv_sizeof_off_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (off_t))" "ac_cv_sizeof_off_t" "$ac_includes_default"; then : else if test "$ac_cv_type_off_t" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (off_t) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_off_t=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_off_t" >&5 $as_echo "$ac_cv_sizeof_off_t" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_OFF_T $ac_cv_sizeof_off_t _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of off64_t" >&5 $as_echo_n "checking size of off64_t... " >&6; } if ${ac_cv_sizeof_off64_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (off64_t))" "ac_cv_sizeof_off64_t" "$ac_includes_default"; then : else if test "$ac_cv_type_off64_t" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (off64_t) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_off64_t=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_off64_t" >&5 $as_echo "$ac_cv_sizeof_off64_t" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_OFF64_T $ac_cv_sizeof_off64_t _ACEOF CFLAGS="$saved_CFLAGS" cat >>confdefs.h <<_ACEOF #define AIDE_LSTAT_FUNC $AIDE_LSTAT_FUNC _ACEOF cat >>confdefs.h <<_ACEOF #define AIDE_STAT_FUNC $AIDE_STAT_FUNC _ACEOF cat >>confdefs.h <<_ACEOF #define AIDE_FSTAT_FUNC $AIDE_FSTAT_FUNC _ACEOF cat >>confdefs.h <<_ACEOF #define AIDE_STAT_TYPE $AIDE_STAT_TYPE _ACEOF cat >>confdefs.h <<_ACEOF #define AIDE_INO_TYPE $AIDE_INO_TYPE _ACEOF cat >>confdefs.h <<_ACEOF #define AIDE_OFF_TYPE $AIDE_OFF_TYPE _ACEOF cat >>confdefs.h <<_ACEOF #define AIDE_BLKCNT_TYPE $AIDE_BLKCNT_TYPE _ACEOF cat >>confdefs.h <<_ACEOF #define AIDE_READDIR_FUNC $AIDE_READDIR_FUNC _ACEOF cat >>confdefs.h <<_ACEOF #define AIDE_READDIR_R_FUNC $AIDE_READDIR_R_FUNC _ACEOF cat >>confdefs.h <<_ACEOF #define AIDE_DIRENT_TYPE $AIDE_DIRENT_TYPE _ACEOF # Check whether --with-config_file was given. if test "${with_config_file+set}" = set; then : withval=$with_config_file; config_file=$withval else if test "x$sysconfdir" != x'${prefix}/etc'; then config_file=`eval echo "$sysconfdir/aide.conf"` elif test "x$prefix" != xNONE; then config_file="$prefix/etc/aide.conf" else config_file="$ac_default_prefix/etc/aide.conf" fi fi cat >>confdefs.h <<_ACEOF #define CONFIG_FILE "$config_file" _ACEOF if test "x$sysconfdir" != x'${prefix}/etc'; then evalled_sysconfdir=`eval echo "$sysconfdir"` default_db="$evalled_sysconfdir/aide.db" default_db_out="$evalled_sysconfdir/aide.db.new" elif test "x$prefix" != xNONE; then default_db="$prefix/etc/aide.db" default_db_out="$prefix/etc/aide.db.new" else default_db="$ac_default_prefix/etc/aide.db" default_db_out="$ac_default_prefix/etc/aide.db.new" fi cat >>confdefs.h <<_ACEOF #define DEFAULT_DB "$default_db" _ACEOF cat >>confdefs.h <<_ACEOF #define DEFAULT_DB_OUT "$default_db_out" _ACEOF LDFLAGS="$LDFLAGS $LD_STATIC_FLAG" if test x$with_zlib = xyes; then for ac_header in zlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" if test "x$ac_cv_header_zlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ZLIB_H 1 _ACEOF else as_fn_error $? "You don't have zlib properly installed. Install it or try --without-zlib." "$LINENO" 5 fi done save_LDFLAGS=$LDFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking for deflate in -lz" >&5 $as_echo_n "checking for deflate in -lz... " >&6; } if ${ac_cv_lib_z_deflate+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char deflate (); int main () { return deflate (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_z_deflate=yes else ac_cv_lib_z_deflate=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_deflate" >&5 $as_echo "$ac_cv_lib_z_deflate" >&6; } if test "x$ac_cv_lib_z_deflate" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBZ 1 _ACEOF LIBS="-lz $LIBS" else as_fn_error $? "You don't have zlib properly installed. Install it or try --without-zlib." "$LINENO" 5 fi $as_echo "#define WITH_ZLIB 1" >>confdefs.h compoptionstring="${compoptionstring}WITH_ZLIB\\n" fi if test x$with_curl = xyes; then # Extract the first word of ""curl-config"", so it can be a program name with args. set dummy "curl-config"; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_curlconfig+:} false; then : $as_echo_n "(cached) " >&6 else case $curlconfig in [\\/]* | ?:[\\/]*) ac_cv_path_curlconfig="$curlconfig" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_curlconfig="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi curlconfig=$ac_cv_path_curlconfig if test -n "$curlconfig"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $curlconfig" >&5 $as_echo "$curlconfig" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "_$curlconfig" != _ ; then CURL_CFLAGS=`$curlconfig --cflags` CURL_LIBS=`$curlconfig --libs` else as_fn_error $? "You don't have curl properly installed. Install it or try --without-curl." "$LINENO" 5 fi for ac_header in curl/curl.h do : ac_fn_c_check_header_mongrel "$LINENO" "curl/curl.h" "ac_cv_header_curl_curl_h" "$ac_includes_default" if test "x$ac_cv_header_curl_curl_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_CURL_CURL_H 1 _ACEOF else as_fn_error $? "You don't have curl properly installed. Install it or try --without-curl." "$LINENO" 5 fi done CFLAGS="$CFLAGS $CURL_CFLAGS" LDFLAGS="$LDFLAGS $CURL_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for curl_easy_init in -lcurl" >&5 $as_echo_n "checking for curl_easy_init in -lcurl... " >&6; } if ${ac_cv_lib_curl_curl_easy_init+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcurl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char curl_easy_init (); int main () { return curl_easy_init (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_curl_curl_easy_init=yes else ac_cv_lib_curl_curl_easy_init=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_curl_curl_easy_init" >&5 $as_echo "$ac_cv_lib_curl_curl_easy_init" >&6; } if test "x$ac_cv_lib_curl_curl_easy_init" = xyes; then : havecurl=yes else as_fn_error $? "You don't have curl properly installed. Install it or try --without-curl." "$LINENO" 5 fi $as_echo "#define WITH_CURL 1" >>confdefs.h compoptionstring="${compoptionstring}WITH_CURL\\n" fi if test x$havecurl = xyes; then USE_CURL_TRUE= USE_CURL_FALSE='#' else USE_CURL_TRUE='#' USE_CURL_FALSE= fi # Check whether --with-gnu-regexp was given. if test "${with_gnu_regexp+set}" = set; then : withval=$with_gnu_regexp; else with_gnu_regexp=check fi if test "x$with_gnu_regexp" = xyes; then : $as_echo "#define REGEX 1" >>confdefs.h compoptionstring="${compoptionstring}WITH_GNU_REGEXP\\n" elif test "x$with_gnu_regexp" = xcheck; then : for ac_func in regexec regcomp do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else $as_echo "#define REGEX 1" >>confdefs.h compoptionstring="${compoptionstring}WITH_GNU_REGEXP\\n" fi done else for ac_func in regexec regcomp do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "--without-gnu-regexp was given, but system regex functions were not found See \`config.log' for more details" "$LINENO" 5; } fi done fi # Check whether --with-mhash was given. if test "${with_mhash+set}" = set; then : withval=$with_mhash; else with_mhash=check fi if test "x$with_mhash" != xno; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mhash_get_block_size in -lmhash" >&5 $as_echo_n "checking for mhash_get_block_size in -lmhash... " >&6; } if ${ac_cv_lib_mhash_mhash_get_block_size+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lmhash $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char mhash_get_block_size (); int main () { return mhash_get_block_size (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_mhash_mhash_get_block_size=yes else ac_cv_lib_mhash_mhash_get_block_size=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mhash_mhash_get_block_size" >&5 $as_echo "$ac_cv_lib_mhash_mhash_get_block_size" >&6; } if test "x$ac_cv_lib_mhash_mhash_get_block_size" = xyes; then : CRYPTLIB="${CRYPTLIB} -lmhash" compoptionstring="${compoptionstring}WITH_MHASH\\n" with_mhash=yes aideextragroups="${aideextragroups}+whirlpool" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int i=MHASH_WHIRLPOOL; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : $as_echo "#define HAVE_MHASH_WHIRLPOOL 1" >>confdefs.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext $as_echo "#define WITH_MHASH 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: No mhash means no hmac." >&5 $as_echo "$as_me: WARNING: No mhash means no hmac." >&2;} fi fi # Check whether --with-gcrypt was given. if test "${with_gcrypt+set}" = set; then : withval=$with_gcrypt; else if test "x$with_mhash" != xyes; then with_gcrypt=check else with_gcrypt=no fi fi if test "x$with_gcrypt" != xno; then : $as_echo "#define WITH_GCRYPT 1" >>confdefs.h if test "x$with_mhash" = xyes; then as_fn_error $? "Using gcrypt together with mhash makes no sense. To disable mhash use --without-mhash" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gpg_strerror in -lgpg-error" >&5 $as_echo_n "checking for gpg_strerror in -lgpg-error... " >&6; } if ${ac_cv_lib_gpg_error_gpg_strerror+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgpg-error $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gpg_strerror (); int main () { return gpg_strerror (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_gpg_error_gpg_strerror=yes else ac_cv_lib_gpg_error_gpg_strerror=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gpg_error_gpg_strerror" >&5 $as_echo "$ac_cv_lib_gpg_error_gpg_strerror" >&6; } if test "x$ac_cv_lib_gpg_error_gpg_strerror" = xyes; then : saveLIBS="$LIBS" LIBS="$LIBS -lgpg-error" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcry_md_hash_buffer in -lgcrypt" >&5 $as_echo_n "checking for gcry_md_hash_buffer in -lgcrypt... " >&6; } if ${ac_cv_lib_gcrypt_gcry_md_hash_buffer+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgcrypt $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gcry_md_hash_buffer (); int main () { return gcry_md_hash_buffer (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_gcrypt_gcry_md_hash_buffer=yes else ac_cv_lib_gcrypt_gcry_md_hash_buffer=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gcrypt_gcry_md_hash_buffer" >&5 $as_echo "$ac_cv_lib_gcrypt_gcry_md_hash_buffer" >&6; } if test "x$ac_cv_lib_gcrypt_gcry_md_hash_buffer" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBGCRYPT 1 _ACEOF LIBS="-lgcrypt $LIBS" else as_fn_error $? "Aide requires mhash or libcrypt to be installed with static libraries." "$LINENO" 5 fi LIBS="$saveLIBS" else as_fn_error $? "You need to have libgpg-error.a installed to use libgcrypt." "$LINENO" 5 fi CRYPTLIB="${CRYPTLIB} -lgcrypt -lgpg-error" with_gcrypt=yes compoptionstring="${compoptionstring}WITH_GCRYPT\\n" else with_gcrypt=no fi # Check whether --with-confighmactype was given. if test "${with_confighmactype+set}" = set; then : withval=$with_confighmactype; if test "x$withval" = "xmd5" ;then CONFIGHMACTYPE="MHASH_MD5" else if test "x$withval" = "xsha1" ;then CONFIGHMACTYPE="MHASH_SHA1" else if test "x$withval" = "xsha256" ;then CONFIGHMACTYPE="MHASH_SHA256" else if test "x$withval" = "xsha512" ;then CONFIGHMACTYPE="MHASH_SHA512" else echo "Valid parameters for --with-confighmactype are md5, sha1, sha256 and sha512" exit 1 fi fi fi fi cat >>confdefs.h <<_ACEOF #define CONFIGHMACTYPE $CONFIGHMACTYPE _ACEOF else cat >>confdefs.h <<_ACEOF #define CONFIGHMACTYPE MHASH_MD5 _ACEOF fi # Check whether --with-confighmackey was given. if test "${with_confighmackey+set}" = set; then : withval=$with_confighmackey; if test "x$withval" = "x" ; then echo "--with-confighmackey requires a value" exit 5 fi key00=`echo $withval|cut -c1-3` key01=`echo $withval|cut -c4-6` key02=`echo $withval|cut -c7-9` key03=`echo $withval|cut -c10-12` key04=`echo $withval|cut -c13-15` key05=`echo $withval|cut -c16-18` key06=`echo $withval|cut -c19-21` key07=`echo $withval|cut -c22-24` key08=`echo $withval|cut -c25-28` key09=`echo $withval|cut -c29-31` cat >>confdefs.h <<_ACEOF #define CONFHMACKEY_00 "$key00" _ACEOF cat >>confdefs.h <<_ACEOF #define CONFHMACKEY_01 "$key01" _ACEOF cat >>confdefs.h <<_ACEOF #define CONFHMACKEY_02 "$key02" _ACEOF cat >>confdefs.h <<_ACEOF #define CONFHMACKEY_03 "$key03" _ACEOF cat >>confdefs.h <<_ACEOF #define CONFHMACKEY_04 "$key04" _ACEOF cat >>confdefs.h <<_ACEOF #define CONFHMACKEY_05 "$key05" _ACEOF cat >>confdefs.h <<_ACEOF #define CONFHMACKEY_06 "$key06" _ACEOF cat >>confdefs.h <<_ACEOF #define CONFHMACKEY_07 "$key07" _ACEOF cat >>confdefs.h <<_ACEOF #define CONFHMACKEY_08 "$key08" _ACEOF cat >>confdefs.h <<_ACEOF #define CONFHMACKEY_09 "$key09" _ACEOF else cat >>confdefs.h <<_ACEOF #define CONFHMACKEY_00 "$key00" _ACEOF cat >>confdefs.h <<_ACEOF #define CONFHMACKEY_01 "$key01" _ACEOF cat >>confdefs.h <<_ACEOF #define CONFHMACKEY_02 "$key02" _ACEOF cat >>confdefs.h <<_ACEOF #define CONFHMACKEY_03 "$key03" _ACEOF cat >>confdefs.h <<_ACEOF #define CONFHMACKEY_04 "$key04" _ACEOF cat >>confdefs.h <<_ACEOF #define CONFHMACKEY_05 "$key05" _ACEOF cat >>confdefs.h <<_ACEOF #define CONFHMACKEY_06 "$key06" _ACEOF cat >>confdefs.h <<_ACEOF #define CONFHMACKEY_07 "$key07" _ACEOF cat >>confdefs.h <<_ACEOF #define CONFHMACKEY_08 "$key08" _ACEOF cat >>confdefs.h <<_ACEOF #define CONFHMACKEY_09 "$key09" _ACEOF fi # Check whether --with-dbhmactype was given. if test "${with_dbhmactype+set}" = set; then : withval=$with_dbhmactype; if test "x$withval" = "xmd5" ;then DBHMACTYPE="MHASH_MD5" else if test "x$withval" = "xsha1" ;then DBHMACTYPE="MHASH_SHA1" else if test "x$withval" = "xsha256" ;then CONFIGHMACTYPE="MHASH_SHA256" else if test "x$withval" = "xsha512" ;then CONFIGHMACTYPE="MHASH_SHA512" else echo "Valid parameters for --with-dbhmactype are md5, sha1, sha256 and sha512" exit 1 fi fi fi fi cat >>confdefs.h <<_ACEOF #define DBHMACTYPE $DBHMACTYPE _ACEOF else cat >>confdefs.h <<_ACEOF #define DBHMACTYPE MHASH_MD5 _ACEOF fi # Check whether --with-dbhmackey was given. if test "${with_dbhmackey+set}" = set; then : withval=$with_dbhmackey; if test "x$withval" = "x" ; then echo "--with-dbhmackey requires a value" exit 5 fi key00=`echo $withval|cut -c1-3` key01=`echo $withval|cut -c4-6` key02=`echo $withval|cut -c7-9` key03=`echo $withval|cut -c10-12` key04=`echo $withval|cut -c13-15` key05=`echo $withval|cut -c16-18` key06=`echo $withval|cut -c19-21` key07=`echo $withval|cut -c22-24` key08=`echo $withval|cut -c25-28` key09=`echo $withval|cut -c29-31` cat >>confdefs.h <<_ACEOF #define DBHMACKEY_00 "$key00" _ACEOF cat >>confdefs.h <<_ACEOF #define DBHMACKEY_01 "$key01" _ACEOF cat >>confdefs.h <<_ACEOF #define DBHMACKEY_02 "$key02" _ACEOF cat >>confdefs.h <<_ACEOF #define DBHMACKEY_03 "$key03" _ACEOF cat >>confdefs.h <<_ACEOF #define DBHMACKEY_04 "$key04" _ACEOF cat >>confdefs.h <<_ACEOF #define DBHMACKEY_05 "$key05" _ACEOF cat >>confdefs.h <<_ACEOF #define DBHMACKEY_06 "$key06" _ACEOF cat >>confdefs.h <<_ACEOF #define DBHMACKEY_07 "$key07" _ACEOF cat >>confdefs.h <<_ACEOF #define DBHMACKEY_08 "$key08" _ACEOF cat >>confdefs.h <<_ACEOF #define DBHMACKEY_09 "$key09" _ACEOF else cat >>confdefs.h <<_ACEOF #define DBHMACKEY_00 "$key00" _ACEOF cat >>confdefs.h <<_ACEOF #define DBHMACKEY_01 "$key01" _ACEOF cat >>confdefs.h <<_ACEOF #define DBHMACKEY_02 "$key02" _ACEOF cat >>confdefs.h <<_ACEOF #define DBHMACKEY_03 "$key03" _ACEOF cat >>confdefs.h <<_ACEOF #define DBHMACKEY_04 "$key04" _ACEOF cat >>confdefs.h <<_ACEOF #define DBHMACKEY_05 "$key05" _ACEOF cat >>confdefs.h <<_ACEOF #define DBHMACKEY_06 "$key06" _ACEOF cat >>confdefs.h <<_ACEOF #define DBHMACKEY_07 "$key07" _ACEOF cat >>confdefs.h <<_ACEOF #define DBHMACKEY_08 "$key08" _ACEOF cat >>confdefs.h <<_ACEOF #define DBHMACKEY_09 "$key09" _ACEOF fi # Check whether --enable-forced_configmd was given. if test "${enable_forced_configmd+set}" = set; then : enableval=$enable_forced_configmd; $as_echo "#define FORCECONFIGMD 1" >>confdefs.h else $as_echo "#define FORCECONFIGMD 0" >>confdefs.h fi # Check whether --enable-forced_dbmd was given. if test "${enable_forced_dbmd+set}" = set; then : enableval=$enable_forced_dbmd; $as_echo "#define FORCEDBMD 1" >>confdefs.h else $as_echo "#define FORCEDBMD 0" >>confdefs.h fi # Check whether --with-initial_errors_to was given. if test "${with_initial_errors_to+set}" = set; then : withval=$with_initial_errors_to; cat >>confdefs.h <<_ACEOF #define INITIALERRORSTO "$withval" _ACEOF compoptionstring="${compoptionstring}INITIALERRORSTO=${withval}\\n" else cat >>confdefs.h <<_ACEOF #define INITIALERRORSTO "stderr" _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PostgresSQL support" >&5 $as_echo_n "checking for PostgresSQL support... " >&6; } # Check whether --with-psql was given. if test "${with_psql+set}" = set; then : withval=$with_psql; else with_psql=no fi if test "x$with_psql" != xno; then : $as_echo "#define WITH_PSQL 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PQclear in -lpq" >&5 $as_echo_n "checking for PQclear in -lpq... " >&6; } if ${ac_cv_lib_pq_PQclear+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpq $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char PQclear (); int main () { return PQclear (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pq_PQclear=yes else ac_cv_lib_pq_PQclear=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pq_PQclear" >&5 $as_echo "$ac_cv_lib_pq_PQclear" >&6; } if test "x$ac_cv_lib_pq_PQclear" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPQ 1 _ACEOF LIBS="-lpq $LIBS" else with_psql=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 $as_echo "not found" >&6; } fi PSQLLIB="-lpq" compoptionstring="${compoptionstring}WITH_PSQL\\n" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else PSQLLIB="" with_psql=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Check for Linux auditing API # # Check whether --with-audit was given. if test "${with_audit+set}" = set; then : withval=$with_audit; else with_audit=no fi if test "x$with_audit" != xno; then : $as_echo "#define WITH_AUDIT 1" >>confdefs.h ac_fn_c_check_header_mongrel "$LINENO" "libaudit.h" "ac_cv_header_libaudit_h" "$ac_includes_default" if test "x$ac_cv_header_libaudit_h" = xyes; then : else as_fn_error $? "You don't have libaudit properly installed. Install it if you need it." "$LINENO" 5 fi AUDITLIB="-laudit" compoptionstring="${compoptionstring}WITH_AUDIT\\n" else with_audit=no fi extrasub="s&@aideextragroups@&$aideextragroups&;t t s&@AIDEVERSION@&$PACKAGE_VERSION&;t t" ac_sources="$wk_link_files_src" ac_dests="$wk_link_files_dst " while test -n "$ac_sources"; do set $ac_dests; ac_dest=$1; shift; ac_dests=$* set $ac_sources; ac_source=$1; shift; ac_sources=$* ac_config_links_1="$ac_config_links_1 $ac_dest:$ac_source" done ac_config_links="$ac_config_links $ac_config_links_1" compoptionstring="${compoptionstring}CONFIG_FILE = \\\"${config_file}\\\"\\n" cat >>confdefs.h <<_ACEOF #define AIDECOMPILEOPTIONS "${compoptionstring}" _ACEOF LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS" CFLAGS="$CFLAGS $EXTRA_CFLAGS" ac_config_files="$ac_config_files Makefile src/Makefile include/Makefile doc/Makefile doc/aide.conf doc/aide.1 doc/aide.conf.5 aide.spec" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_CURL_TRUE}" && test -z "${USE_CURL_FALSE}"; then as_fn_error $? "conditional \"USE_CURL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by aide $as_me 0.16a2-19-g16ed855, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_links="$ac_config_links" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration links: $config_links Configuration commands: $config_commands Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ aide config.status 0.16a2-19-g16ed855 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "$ac_config_links_1") CONFIG_LINKS="$CONFIG_LINKS $ac_config_links_1" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "doc/aide.conf") CONFIG_FILES="$CONFIG_FILES doc/aide.conf" ;; "doc/aide.1") CONFIG_FILES="$CONFIG_FILES doc/aide.1" ;; "doc/aide.conf.5") CONFIG_FILES="$CONFIG_FILES doc/aide.conf.5" ;; "aide.spec") CONFIG_FILES="$CONFIG_FILES aide.spec" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_LINKS+set}" = set || CONFIG_LINKS=$config_links test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :L $CONFIG_LINKS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :L) # # CONFIG_LINK # if test "$ac_source" = "$ac_file" && test "$srcdir" = '.'; then : else # Prefer the file from the source tree if names are identical. if test "$ac_source" = "$ac_file" || test ! -r "$ac_source"; then ac_source=$srcdir/$ac_source fi { $as_echo "$as_me:${as_lineno-$LINENO}: linking $ac_source to $ac_file" >&5 $as_echo "$as_me: linking $ac_source to $ac_file" >&6;} if test ! -r "$ac_source"; then as_fn_error $? "$ac_source: file not found" "$LINENO" 5 fi rm -f "$ac_file" # Try a relative symlink, then a hard link, then a copy. case $ac_source in [\\/$]* | ?:[\\/]* ) ac_rel_source=$ac_source ;; *) ac_rel_source=$ac_top_build_prefix$ac_source ;; esac ln -s "$ac_rel_source" "$ac_file" 2>/dev/null || ln "$ac_source" "$ac_file" 2>/dev/null || cp -p "$ac_source" "$ac_file" || as_fn_error $? "cannot link or copy $ac_source to $ac_file" "$LINENO" 5 fi ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi aide-0.16~a2.git20130520/configure.in000066400000000000000000000722531214657706600167220ustar00rootroot00000000000000m4_include([version.m4]) dnl Initialize autoconf/automake AC_INIT(aide, AIDE_VERSION) AC_CANONICAL_TARGET AM_INIT_AUTOMAKE AC_DEFINE_UNQUOTED(AIDEVERSION, "AIDE_VERSION") AH_TEMPLATE([AIDEVERSION], [package version]) dnl The name of the configure h-file. AM_CONFIG_HEADER(config.h) dnl Checks for programs. AC_PROG_CC AC_PROG_MAKE_SET AC_PROG_RANLIB AC_PROG_INSTALL AC_PROG_YACC if test "x${YACC}" != "xbison -y"; then echo "AIDE requires GNU bison" exit 5 fi AC_PROG_LEX if test "x${LEX}" != "xflex"; then echo "AIDE requires GNU flex" exit 5 fi AC_CHECK_PROGS(LD, ld) AC_PATH_PROG(PKG_CONFIG, pkg-config, "") dnl AC_ARG_PROGRAM AC_ARG_WITH(extra-includes, AC_HELP_STRING([--with-extra-includes], [Specify additional paths with -I to find headerfiles]), [CPPFLAGS="$CPPFLAGS $withval"] ) AC_ARG_WITH(extra-libs, AC_HELP_STRING([--with-extra-libs], [Specify additional paths with -L to find libraries]), [LDFLAGS="$LDFLAGS $withval"] ) AC_ARG_WITH(extra-link-libs, AC_HELP_STRING([--with-extra-link-libs], [Specify additional libraries to link]), [LIBS="$LIBS $withval"] ) dnl Do the right thing for glibc... AIDE_DEFS="-D_GNU_SOURCE" dnl This is borrowed from libtool if test $ac_cv_prog_gcc = yes; then LD_STATIC_FLAG='-static' case "$host_os" in beos* | irix5* | irix6* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; aix*) # Below there is a dirty hack to force normal static linking with -ldl # The problem is because libdl dynamically linked with both libc and # libC (AIX C++ library), which obviously doesn't included in libraries # list by gcc. This cause undefined symbols with -static flags. # This hack allows C programs to be linked with "-static -ldl", but # we not sure about C++ programs. LD_STATIC_FLAG="$LD_STATIC_FLAG ${wl}-lC" ;; cygwin* | mingw* | os2*) # We can build DLLs from non-PIC. ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. ## pic_flag='-m68020 -resident32 -malways-restore-a4' ;; sysv4*MP*) ## if test -d /usr/nec; then ## pic_flag=-Kconform_pic ## fi ;; *) ## pic_flag='-fPIC' ;; esac else # PORTME Check for PIC flags for the system compiler. case "$host_os" in aix3* | aix4*) # All AIX code is PIC. LD_STATIC_FLAG='-bnso -bI:/lib/syscalls.exp' ;; hpux9* | hpux10* | hpux11*) # Is there a better LD_STATIC_FLAG that works with the bundled CC? ## wl='-Wl,' LD_STATIC_FLAG="${wl}-a ${wl}archive" ## pic_flag='+Z' ;; irix5* | irix6*) ## wl='-Wl,' LD_STATIC_FLAG='-non_shared' # PIC (with -KPIC) is the default. ;; cygwin* | mingw* | os2*) # We can build DLLs from non-PIC. ;; osf3* | osf4* | osf5*) # All OSF/1 code is PIC. ## wl='-Wl,' LD_STATIC_FLAG='-non_shared' ;; sco3.2v5*) ## pic_flag='-Kpic' LD_STATIC_FLAG='-dn' ## special_shlib_compile_flags='-belf' ;; solaris*) ## pic_flag='-KPIC' LD_STATIC_FLAG='-Bstatic' ## wl='-Wl,' ;; sunos4*) ## pic_flag='-PIC' LD_STATIC_FLAG='-Bstatic' ## wl='-Qoption ld ' ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) ## pic_flag='-KPIC' LD_STATIC_FLAG='-Bstatic' ## wl='-Wl,' ;; uts4*) ## pic_flag='-pic' LD_STATIC_FLAG='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then ## pic_flag='-Kconform_pic' LD_STATIC_FLAG='-Bstatic' fi ;; *) ## can_build_shared=no ;; esac fi # Check whether static linking has explicitly been disabled AC_ARG_ENABLE(static,[ --disable-static Disable static linking (lowers the security of aide)], [aide_static_choice=$enableval], [aide_static_choice=yes]) dnl Borrowed from dbus cc_supports_flag() { AC_MSG_CHECKING(whether $CC supports "$@") Cfile=/tmp/foo${$} touch ${Cfile}.c $CC -c "$@" ${Cfile}.c -o ${Cfile}.o >/dev/null 2>&1 rc=$? rm -f ${Cfile}.c ${Cfile}.o case $rc in 0) AC_MSG_RESULT(yes);; *) AC_MSG_RESULT(no);; esac return $rc } dnl Borrowed from dbus ld_supports_flag() { AC_MSG_CHECKING([whether $LD supports "$@"]) AC_TRY_LINK([ int one(void) { return 1; } int two(void) { return 2; } ], [ two(); ] , [_ac_ld_flag_supported=yes], [_ac_ld_flag_supported=no]) if test "$_ac_ld_flag_supported" = "yes"; then rm -f conftest.c touch conftest.c if $CC -c conftest.c; then ld_out=`$LD $@ -o conftest conftest.o 2>&1` ld_ret=$? if test $ld_ret -ne 0 ; then _ac_ld_flag_supported=no elif echo "$ld_out" | egrep 'option ignored|^usage:|unrecognized option|illegal option' >/dev/null ; then _ac_ld_flag_supported=no fi fi rm -f conftest.c conftest.o conftest fi AC_MSG_RESULT($_ac_ld_flag_supported) if test "$_ac_ld_flag_supported" = "yes" ; then return 0 else return 1 fi } if test "$aide_static_choice" != "yes"; then LD_STATIC_FLAG="" EXTRA_LDFLAGS="" EXTRA_CFLAGS="" if test x$CC = "xgcc"; then if ld_supports_flag -z,relro; then EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-z,relro" fi if ld_supports_flag -z,now; then EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-z,now" fi if cc_supports_flag -fPIE -DPIE; then EXTRA_CFLAGS="$EXTRA_CFLAGS -fPIE -DPIE" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -pie" fi dnl Check for some optional warnings if cc_supports_flag -Wundef; then EXTRA_CFLAGS="$EXTRA_CFLAGS -Wundef" fi if cc_supports_flag -Wmissing-format-attribute; then EXTRA_CFLAGS="$EXTRA_CFLAGS -Wmissing-format-attribute" fi if cc_supports_flag -Wshadow; then EXTRA_CFLAGS="$EXTRA_CFLAGS -Wshadow" fi if cc_supports_flag -Wlogical-op; then EXTRA_CFLAGS="$EXTRA_CFLAGS -Wlogical-op" fi fi fi dnl This macro is new in autoconf-2.13 AC_SEARCH_LIBS(syslog, bsd socket inet, [AC_DEFINE(HAVE_SYSLOG,1,[syslog available?])]) AC_CHECK_FUNCS(vsyslog) AC_C_BIGENDIAN([AC_DEFINE(BIG_ENDIAN_HOST,1,[big endian])], [AC_DEFINE(LITTLE_ENDIAN_HOST,1,[little endian])]) AC_CHECK_TYPES([byte, ushort, ulong, u16, u32, u64]) AC_CHECK_SIZEOF(unsigned short, 2) AC_CHECK_SIZEOF(unsigned int, 4) AC_CHECK_SIZEOF(unsigned long, 4) AC_CHECK_SIZEOF(long long, 8) AC_CHECK_SIZEOF(unsigned long long, 8) AC_C_LONG_DOUBLE AC_HEADER_STDC AC_CHECK_FUNCS(strtoll strtoimax readdir) AIDE_CHECK_READDIR_R_ARGS AC_CHECK_FUNCS(stricmp strnstr strnlen) AC_ARG_WITH([mmap], [AC_HELP_STRING([--with-mmap], [use mmap @<:@default=check@:>@])], [], [with_mmap=check] ) AS_IF([test "x$with_mmap" != xno], [AC_CHECK_FUNCS(mmap)] compoptionstring="${compoptionstring}WITH_MMAP\\n" ) AC_CHECK_FUNCS(fcntl ftruncate posix_fadvise asprintf snprintf \ vasprintf vsnprintf va_copy __va_copy) AC_CACHE_CHECK(for ISO C99 compliant snprintf,ac_cv_func_snprintf_c99, [AC_TRY_RUN([ #include int main() { char buf[] = {0, 0, 0, 0}; snprintf(buf, 3, "ABC"); exit ((buf[2] != 0) || (snprintf(NULL, 0, "%d", 100) != 3)); }],ac_cv_func_snprintf_c99=yes,ac_cv_func_snprintf_c99=no,ac_cv_func_snprintf_c99=no)]) if test $ac_cv_func_snprintf_c99 = yes; then AC_DEFINE(HAVE_C99_SNPRINTF,1,[snprintf is ISO C99 compliant]) fi AC_CACHE_CHECK(for ISO C99 compliant vsnprintf,ac_cv_func_vsnprintf_c99, [AC_TRY_RUN([ #include #include int doit(char *buf, int len, const char *s, ...) { va_list ap; int r; va_start(ap, s); r = vsnprintf(buf, len, s, ap); va_end(ap); return r; } int main() { char buf[] = {0, 0, 0, 0}; doit(buf, 3, "ABC"); exit ((buf[2] != 0) || (doit(NULL, 0, "%d", 100) != 3)); }],ac_cv_func_vsnprintf_c99=yes,ac_cv_func_vsnprintf_c99=no,ac_cv_func_vsnprintf_c99=no)]) if test $ac_cv_func_vsnprintf_c99 = yes; then AC_DEFINE(HAVE_C99_VSNPRINTF,1,[vsnprintf is ISO C99 compliant]) fi # Linux has the O_NOATIME flag, sometimes AC_CACHE_CHECK([for open/O_NOATIME], db_cv_open_o_noatime, [ echo "test for working open/O_NOATIME" > __o_noatime_file AC_TRY_RUN([ #include #include #ifndef O_NOATIME #if defined(__linux__) && (defined(__i386__) || defined(__PPC__)) #define O_NOATIME 01000000 #else #define O_NOATIME 0 #endif #endif main() { int c, fd = open("__o_noatime_file", O_RDONLY | O_NOATIME, 0); exit ((!O_NOATIME) || (fd == -1) || (read(fd, &c, 1) != 1)); }], [db_cv_open_o_noatime=yes], [db_cv_open_o_noatime=no], AC_TRY_LINK([ #include #include #ifndef O_NOATIME #if defined(__linux__) && (defined(__i386__) || defined(__PPC__)) #define O_NOATIME 01000000 #else #define O_NOATIME 0 #endif #endif], [ open("__o_noatime_file", O_RDONLY | O_NOATIME, 0); ], [db_cv_open_o_noatime=yes], [db_cv_open_o_noatime=no])) rm -f __o_noatime_file]) if test "$db_cv_open_o_noatime" = yes; then AC_DEFINE(HAVE_O_NOATIME) AH_TEMPLATE(HAVE_O_NOATIME, [Define to 1 if you have the O_NOATIME flag.]) fi AC_CHECK_HEADERS(syslog.h inttypes.h fcntl.h ctype.h) AC_ARG_WITH([locale], [AC_HELP_STRING([--with-locale], [use locale stuff])], [], [with_locale=no] ) AS_IF([test "x$with_locale" != xno], [AC_CHECK_HEADERS(libintl.h, [AC_DEFINE(USE_LOCALE,1,[Define if LOCALE support should be used]) AIDE_USE_LOCALE="" compoptionstring="${compoptionstring}WITH_LOCALE\\n" dnl AC_DEFINE_UNQUOTED(LOCALEDIR,"$prefix/lib/locale",[Localedir to use])], )] ) AC_SUBST(AIDE_USE_LOCALE) AC_ARG_WITH([syslog_ident], AC_HELP_STRING([--with-syslog-ident], [syslog ident]), [AC_DEFINE_UNQUOTED(AIDE_IDENT,"$withval",[syslog ident])] compoptionstring="${compoptionstring}AIDE_IDENT=${withval}\\n", [AC_DEFINE_UNQUOTED(AIDE_IDENT,"aide",[syslog ident])] ) AC_ARG_WITH([syslog_facility], AC_HELP_STRING([--with-syslog-facility], [Specify syslog facility, see man syslog for options]), [AC_DEFINE_UNQUOTED(AIDE_SYSLOG_FACILITY,$withval,[syslog facility])] compoptionstring="${compoptionstring}AIDE_SYSLOG_FACILITY=${withval}\\n", [AC_DEFINE_UNQUOTED(AIDE_SYSLOG_FACILITY,LOG_LOCAL0,[syslog facility])] ) AC_ARG_WITH([syslog_logopt], AC_HELP_STRING([--with-syslog-logopt], [Specify syslog logopt, see man syslog for options]), [AC_DEFINE_UNQUOTED(AIDE_LOGOPT,$withval,[syslog logopt])], [AC_DEFINE_UNQUOTED(AIDE_LOGOPT,LOG_CONS,[syslog logopt])] ) AC_ARG_WITH([syslog_priority], AC_HELP_STRING([--with-syslog-priority], [Specify syslog priority, see man syslog for options]), [AC_DEFINE_UNQUOTED(SYSLOG_PRIORITY,$withval,[syslog priority])] compoptionstring="${compoptionstring}SYSLOG_PRIORITY=${withval}\\n", [AC_DEFINE_UNQUOTED(SYSLOG_PRIORITY,LOG_NOTICE,[syslog priority])] ) AC_ARG_WITH([zlib], AC_HELP_STRING([--with-zlib], [use zlib compression]), , [with_zlib=yes] ) AC_ARG_WITH([curl], AC_HELP_STRING([--with-curl], [use curl for http,https and ftp backends]), , [with_curl=no] ) AC_MSG_CHECKING(for sun-acl-support) AC_ARG_WITH([sun-acl], [AC_HELP_STRING([--with-sun-acl], [use ACL on solaris (no checking)])], [], [with_sun_acl=no] ) AS_IF([test "x$with_sun_acl" != xno], [AC_DEFINE(WITH_SUN_ACL,1,[use ACL on Solaris]) AC_DEFINE(WITH_ACL,1,[use ACL]) ACLLIB="-lsec" compoptionstring="${compoptionstring}WITH_SUN_ACL\\n" aideextragroups="${aideextragroups}+acl" AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)] ) AC_MSG_CHECKING(for posix-acl-support) AC_ARG_WITH([posix-acl], [AC_HELP_STRING([--with-posix-acl], [use POSIX ACLs (no checking)])], [], [with_posix_acl_support=no] ) AS_IF([test "x$with_posix_acl_support" != xno], [AC_DEFINE(WITH_POSIX_ACL,1,[use POSIX ACLs]) AC_DEFINE(WITH_ACL,1,[use ACL]) ACLLIB="-lacl" compoptionstring="${compoptionstring}WITH_POSIX_ACL\\n" aideextragroups="${aideextragroups}+acl" AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)] ) AC_SUBST(ACLLIB) AC_MSG_CHECKING(for selinux-support) AC_ARG_WITH([selinux], [AC_HELP_STRING([--with-selinux], [use SELinux (no checking)])], [with_selinux_support="$withval"], [with_selinux_support=no] ) AS_IF([test "x$with_selinux_support" != xno], AC_DEFINE(WITH_SELINUX,1,[use SELinux]) [AC_MSG_RESULT(yes) if test -n "$PKG_CONFIG" && $PKG_CONFIG --exists libselinux; then if test "$aide_static_choice" == "yes"; then SELINUXLIB=$(${PKG_CONFIG} --libs libselinux --static) else SELINUXLIB=$(${PKG_CONFIG} --libs libselinux) fi else SELINUXLIB="-lselinux" if test "$aide_static_choice" == "yes"; then saveLIBS=$LIBS LIBS="-static $SELINUXLIB" AC_SEARCH_LIBS([lgetfilecon_raw], [], [], [SELINUXLIB="$SELINUXLIB -lpthread"]) LIBS=$saveLIBS fi fi compoptionstring="${compoptionstring}WITH_SELINUX\\n" aideextragroups="${aideextragroups}+selinux" ], [AC_MSG_RESULT(no)] ) AC_SUBST(SELINUXLIB) AC_MSG_CHECKING(for prelink-support) AC_ARG_WITH([prelink], [AC_HELP_STRING([--with-prelink],[use prelink (no checking)])], [case $with_prelink in yes) AC_DEFINE_UNQUOTED(PRELINK_PATH, "/usr/sbin/prelink", [path to prelink]) AC_DEFINE(WITH_PRELINK,1,[use prelink]) ELFLIB="-lelf" compoptionstring="${compoptionstring}WITH_PRELINK\\n" AC_MSG_RESULT([/usr/sbin/prelink]) ;; no) AC_MSG_RESULT(no) ;; *) AC_DEFINE_UNQUOTED(PRELINK_PATH, "$with_prelink", [path to prelink]) AC_DEFINE(WITH_PRELINK,1,[use prelink]) ELFLIB="-lelf" compoptionstring="${compoptionstring}WITH_PRELINK\\n" AC_MSG_RESULT([$with_prelink]) ;; esac], [with_prelink=no AC_MSG_RESULT(no) ] ) AC_SUBST(ELFLIB) AC_MSG_CHECKING(for xattr-support) AC_ARG_WITH([xattr], [AC_HELP_STRING([--with-xattr], [use xattr (no checking)])], [with_xattr_support="$withval"], [with_xattr_support=no] ) AS_IF([test "x$with_xattr_support" != xno], [AC_DEFINE(WITH_XATTR,1,[use xattr]) ATTRLIB=-lattr compoptionstring="${compoptionstring}WITH_XATTR\\n" aideextragroups="${aideextragroups}+xattr" AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)] ) AC_SUBST(ATTRLIB) AC_MSG_CHECKING(for e2fsattrs-support) AC_ARG_WITH([e2fsattrs], [AC_HELP_STRING([--with-e2fsattrs], [use e2fsattrs (no checking)])], [with_e2fsattrs_support="$withval"], [with_e2fsattrs_support=no] ) AS_IF([test "x$with_e2fsattrs_support" != xno], [AC_DEFINE(WITH_E2FSATTRS,1,[use e2fsattrs]) E2FSATTRSLIB=-le2p compoptionstring="${compoptionstring}WITH_E2FSATTRS\\n" aideextragroups="${aideextragroups}+e2fsattrs" AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)] ) AC_SUBST(E2FSATTRSLIB) # Check whether LFS has explicitly been disabled AC_ARG_ENABLE(lfs,[ --disable-lfs Disable large file support on 32-bit platforms], [aide_lfs_choice=$enableval], [aide_lfs_choice=yes]) if test "$aide_lfs_choice" = "yes"; then # This looks weird because Linux defines lstat64 and then screws it up AC_CHECK_FUNC(lstat64, [AC_CHECK_FUNC(stat64, AIDE_DEFS="$AIDE_DEFS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" AIDE_LSTAT_FUNC="lstat64" compoptionstring="${compoptionstring}WITH_LSTAT64\\n" AIDE_STAT_FUNC="stat64" AIDE_FSTAT_FUNC="fstat64" AIDE_STAT_TYPE="stat64" AIDE_OFF_TYPE="off64_t" AC_DEFINE(HAVE_OFF64_T,1,[have off64_t]) AIDE_BLKCNT_TYPE="blkcnt64_t" [AC_CHECK_FUNC(readdir64, AIDE_READDIR_FUNC="readdir64" compoptionstring="${compoptionstring}WITH_READDIR64\\n", AIDE_READDIR_FUNC="readdir")] [AC_CHECK_FUNC(readdir64_r, AIDE_READDIR_R_FUNC="readdir64_r", AIDE_READDIR_R_FUNC="readdir_r")], AIDE_LSTAT_FUNC="lstat" AIDE_STAT_FUNC="stat" AIDE_FSTAT_FUNC="fstat" AIDE_STAT_TYPE="stat" AIDE_OFF_TYPE="off_t" AIDE_BLKCNT_TYPE="blkcnt_t" AIDE_READDIR_FUNC="readdir" AIDE_READDIR_R_FUNC="readdir_r" compoptionstring="${compoptionstring}WITH_LSTAT\\n" compoptionstring="${compoptionstring}WITH_READDIR\\n" )], [AIDE_LSTAT_FUNC="lstat" AIDE_STAT_FUNC="stat" AIDE_FSTAT_FUNC="fstat" AIDE_STAT_TYPE="stat" AIDE_OFF_TYPE="off_t" AIDE_BLKCNT_TYPE="blkcnt_t" AIDE_READDIR_FUNC="readdir" AIDE_READDIR_R_FUNC="readdir_r" compoptionstring="${compoptionstring}WITH_LSTAT\\n" compoptionstring="${compoptionstring}WITH_READDIR\\n"] ) saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $AIDE_DEFS" AC_CACHE_CHECK([for LFS ino_t],ac_cv_ino_type,[ AC_TRY_RUN([ #include #include #include #include main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }], ac_cv_ino_type=ino64_t,ac_cv_ino_type=ino_t,ac_cv_ino_type=cross)]) AIDE_INO_TYPE=$ac_cv_ino_type AC_CACHE_CHECK([for LFS dirent],ac_cv_dirent_type,[ AC_TRY_COMPILE([ #include #include #include ], [struct dirent64 de;], ac_cv_dirent_type=dirent64,ac_cv_dirent_type=dirent)]) AIDE_DIRENT_TYPE=$ac_cv_dirent_type else AIDE_LSTAT_FUNC="lstat" AIDE_STAT_FUNC="stat" AIDE_FSTAT_FUNC="fstat" AIDE_STAT_TYPE="stat" AIDE_OFF_TYPE="off_t" AIDE_BLKCNT_TYPE="blkcnt_t" AIDE_READDIR_FUNC="readdir" AIDE_READDIR_R_FUNC="readdir_r" compoptionstring="${compoptionstring}WITH_LSTAT\\n" compoptionstring="${compoptionstring}WITH_READDIR\\n" AIDE_INO_TYPE=ino_t AIDE_DIRENT_TYPE=dirent fi AC_CHECK_SIZEOF(off_t) AC_CHECK_SIZEOF(off64_t) CFLAGS="$saved_CFLAGS" AC_DEFINE_UNQUOTED(AIDE_LSTAT_FUNC,$AIDE_LSTAT_FUNC,[lstat]) AC_DEFINE_UNQUOTED(AIDE_STAT_FUNC,$AIDE_STAT_FUNC,[stat]) AC_DEFINE_UNQUOTED(AIDE_FSTAT_FUNC,$AIDE_FSTAT_FUNC,[fstat]) AC_DEFINE_UNQUOTED(AIDE_STAT_TYPE,$AIDE_STAT_TYPE,[stat type]) AC_DEFINE_UNQUOTED(AIDE_INO_TYPE,$AIDE_INO_TYPE,[ino_t]) AC_DEFINE_UNQUOTED(AIDE_OFF_TYPE,$AIDE_OFF_TYPE,[off_t]) AC_DEFINE_UNQUOTED(AIDE_BLKCNT_TYPE,$AIDE_BLKCNT_TYPE,[blkcnt_t]) AC_DEFINE_UNQUOTED(AIDE_READDIR_FUNC,$AIDE_READDIR_FUNC,[readdir]) AC_DEFINE_UNQUOTED(AIDE_READDIR_R_FUNC,$AIDE_READDIR_R_FUNC,[readdir_r]) AC_DEFINE_UNQUOTED(AIDE_DIRENT_TYPE,$AIDE_DIRENT_TYPE,[dirent]) AC_ARG_WITH([config_file], AC_HELP_STRING([--with-config-file=config-file], [use config-file as the default config file]), [config_file=$withval], [if test "x$sysconfdir" != x'${prefix}/etc'; then config_file=`eval echo "$sysconfdir/aide.conf"` elif test "x$prefix" != xNONE; then config_file="$prefix/etc/aide.conf" else config_file="$ac_default_prefix/etc/aide.conf" fi] ) AC_DEFINE_UNQUOTED(CONFIG_FILE,"$config_file",[Location of configuration file]) if test "x$sysconfdir" != x'${prefix}/etc'; then evalled_sysconfdir=`eval echo "$sysconfdir"` default_db="$evalled_sysconfdir/aide.db" default_db_out="$evalled_sysconfdir/aide.db.new" elif test "x$prefix" != xNONE; then default_db="$prefix/etc/aide.db" default_db_out="$prefix/etc/aide.db.new" else default_db="$ac_default_prefix/etc/aide.db" default_db_out="$ac_default_prefix/etc/aide.db.new" fi AC_DEFINE_UNQUOTED(DEFAULT_DB,"$default_db",[Default location of signature database]) AC_DEFINE_UNQUOTED(DEFAULT_DB_OUT,"$default_db_out",[Default output location for newly-generated signature database]) dnl Do the library tests with the static flag LDFLAGS="$LDFLAGS $LD_STATIC_FLAG" if test x$with_zlib = xyes; then AC_CHECK_HEADERS(zlib.h,[], [AC_MSG_ERROR([You don't have zlib properly installed. Install it or try --without-zlib.])]) save_LDFLAGS=$LDFLAGS AC_CHECK_LIB(z, deflate,[], [AC_MSG_ERROR([You don't have zlib properly installed. Install it or try --without-zlib.])] ) AC_DEFINE(WITH_ZLIB,1,[use zlib]) compoptionstring="${compoptionstring}WITH_ZLIB\\n" fi if test x$with_curl = xyes; then AC_PATH_PROG(curlconfig, "curl-config") if test "_$curlconfig" != _ ; then CURL_CFLAGS=`$curlconfig --cflags` CURL_LIBS=`$curlconfig --libs` else AC_MSG_ERROR([You don't have curl properly installed. Install it or try --without-curl.]) fi AC_CHECK_HEADERS(curl/curl.h,, [AC_MSG_ERROR([You don't have curl properly installed. Install it or try --without-curl.])]) CFLAGS="$CFLAGS $CURL_CFLAGS" LDFLAGS="$LDFLAGS $CURL_LIBS" AC_CHECK_LIB(curl,curl_easy_init,havecurl=yes, [AC_MSG_ERROR([You don't have curl properly installed. Install it or try --without-curl.])] ) AC_DEFINE(WITH_CURL,1,[use curl]) compoptionstring="${compoptionstring}WITH_CURL\\n" fi AM_CONDITIONAL(USE_CURL, test x$havecurl = xyes) AC_ARG_WITH([gnu-regexp], [AC_HELP_STRING([--with-gnu-regexp], [use the bundled GNU regexp library. use only if necessary])], [], [with_gnu_regexp=check] ) AS_IF([test "x$with_gnu_regexp" = xyes], [AC_DEFINE(REGEX, 1, [use bundled GNU regex]) compoptionstring="${compoptionstring}WITH_GNU_REGEXP\\n"], [test "x$with_gnu_regexp" = xcheck], [AC_CHECK_FUNCS(regexec regcomp,[], [AC_DEFINE(REGEX,1,[use bundled GNU regex]) compoptionstring="${compoptionstring}WITH_GNU_REGEXP\\n"] )], [AC_CHECK_FUNCS(regexec regcomp,, [AC_MSG_FAILURE([--without-gnu-regexp was given, but system regex functions were not found])] )] ) AC_ARG_WITH(mhash, AC_HELP_STRING([--with-mhash], [use libmhash, needed for hmacs @<:@default=check@:>@]), [], [with_mhash=check] ) AS_IF([test "x$with_mhash" != xno], AC_CHECK_LIB([mhash],[mhash_get_block_size], [CRYPTLIB="${CRYPTLIB} -lmhash" compoptionstring="${compoptionstring}WITH_MHASH\\n" with_mhash=yes aideextragroups="${aideextragroups}+whirlpool" AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[#include int i=MHASH_WHIRLPOOL; ]])],AC_DEFINE(HAVE_MHASH_WHIRLPOOL,1,[mhash has whirlpool])) AC_DEFINE(WITH_MHASH,1,[use mhash library])], [AC_MSG_WARN(No mhash means no hmac.)] ) ) AC_ARG_WITH([gcrypt], [AC_HELP_STRING([--with-gcrypt], [use gcrypt library])], [], [if test "x$with_mhash" != xyes; then with_gcrypt=check else with_gcrypt=no fi] ) AS_IF([test "x$with_gcrypt" != xno], [AC_DEFINE(WITH_GCRYPT,1,[use gcrypt library]) if test "x$with_mhash" = xyes; then AC_MSG_ERROR([Using gcrypt together with mhash makes no sense. To disable mhash use --without-mhash]) fi AC_CHECK_LIB([gpg-error], [gpg_strerror], [saveLIBS="$LIBS" LIBS="$LIBS -lgpg-error" AC_CHECK_LIB([gcrypt], [gcry_md_hash_buffer],[], AC_MSG_ERROR([Aide requires mhash or libcrypt to be installed with static libraries.]) ) LIBS="$saveLIBS"], [AC_MSG_ERROR([You need to have libgpg-error.a installed to use libgcrypt.])] ) CRYPTLIB="${CRYPTLIB} -lgcrypt -lgpg-error" with_gcrypt=yes compoptionstring="${compoptionstring}WITH_GCRYPT\\n"], [with_gcrypt=no] ) AC_SUBST(CRYPTLIB) AC_ARG_WITH([confighmactype], AC_HELP_STRING([--with-confighmactype=TYPE], [Hash type to use for checking config. Valid values are md5, sha1, sha256 and sha512.]), [if test "x$withval" = "xmd5" ;then CONFIGHMACTYPE="MHASH_MD5" else if test "x$withval" = "xsha1" ;then CONFIGHMACTYPE="MHASH_SHA1" else if test "x$withval" = "xsha256" ;then CONFIGHMACTYPE="MHASH_SHA256" else if test "x$withval" = "xsha512" ;then CONFIGHMACTYPE="MHASH_SHA512" else echo "Valid parameters for --with-confighmactype are md5, sha1, sha256 and sha512" exit 1 fi fi fi fi AC_DEFINE_UNQUOTED(CONFIGHMACTYPE,$CONFIGHMACTYPE,[hash type for config file check])], [ AC_DEFINE_UNQUOTED(CONFIGHMACTYPE,MHASH_MD5,[hash type for config file check])] , ) AC_ARG_WITH([confighmackey], AC_HELP_STRING([--with-confighmackey=KEY HMAC], [hash key to use for checking config. Must be a base64 encoded byte stream. Maximum string length is 31 chars.]), [if test "x$withval" = "x" ; then echo "--with-confighmackey requires a value" exit 5 fi key00=`echo $withval|cut -c1-3` key01=`echo $withval|cut -c4-6` key02=`echo $withval|cut -c7-9` key03=`echo $withval|cut -c10-12` key04=`echo $withval|cut -c13-15` key05=`echo $withval|cut -c16-18` key06=`echo $withval|cut -c19-21` key07=`echo $withval|cut -c22-24` key08=`echo $withval|cut -c25-28` key09=`echo $withval|cut -c29-31` AC_DEFINE_UNQUOTED(CONFHMACKEY_00,"$key00",[HMAC key 00]) AC_DEFINE_UNQUOTED(CONFHMACKEY_01,"$key01",[HMAC key 01]) AC_DEFINE_UNQUOTED(CONFHMACKEY_02,"$key02",[HMAC key 02]) AC_DEFINE_UNQUOTED(CONFHMACKEY_03,"$key03",[HMAC key 03]) AC_DEFINE_UNQUOTED(CONFHMACKEY_04,"$key04",[HMAC key 04]) AC_DEFINE_UNQUOTED(CONFHMACKEY_05,"$key05",[HMAC key 05]) AC_DEFINE_UNQUOTED(CONFHMACKEY_06,"$key06",[HMAC key 06]) AC_DEFINE_UNQUOTED(CONFHMACKEY_07,"$key07",[HMAC key 07]) AC_DEFINE_UNQUOTED(CONFHMACKEY_08,"$key08",[HMAC key 08]) AC_DEFINE_UNQUOTED(CONFHMACKEY_09,"$key09",[HMAC key 09])], [ AC_DEFINE_UNQUOTED(CONFHMACKEY_00,"$key00",[HMAC key 00]) AC_DEFINE_UNQUOTED(CONFHMACKEY_01,"$key01",[HMAC key 01]) AC_DEFINE_UNQUOTED(CONFHMACKEY_02,"$key02",[HMAC key 02]) AC_DEFINE_UNQUOTED(CONFHMACKEY_03,"$key03",[HMAC key 03]) AC_DEFINE_UNQUOTED(CONFHMACKEY_04,"$key04",[HMAC key 04]) AC_DEFINE_UNQUOTED(CONFHMACKEY_05,"$key05",[HMAC key 05]) AC_DEFINE_UNQUOTED(CONFHMACKEY_06,"$key06",[HMAC key 06]) AC_DEFINE_UNQUOTED(CONFHMACKEY_07,"$key07",[HMAC key 07]) AC_DEFINE_UNQUOTED(CONFHMACKEY_08,"$key08",[HMAC key 08]) AC_DEFINE_UNQUOTED(CONFHMACKEY_09,"$key09",[HMAC key 09])] ) AC_ARG_WITH([dbhmactype], AC_HELP_STRING([--with-dbhmactype=TYPE], [Hash type to use for checking db. Valid values are md5 and sha1.]), [if test "x$withval" = "xmd5" ;then DBHMACTYPE="MHASH_MD5" else if test "x$withval" = "xsha1" ;then DBHMACTYPE="MHASH_SHA1" else if test "x$withval" = "xsha256" ;then CONFIGHMACTYPE="MHASH_SHA256" else if test "x$withval" = "xsha512" ;then CONFIGHMACTYPE="MHASH_SHA512" else echo "Valid parameters for --with-dbhmactype are md5, sha1, sha256 and sha512" exit 1 fi fi fi fi AC_DEFINE_UNQUOTED(DBHMACTYPE,$DBHMACTYPE,[hash type for checking db])], [ AC_DEFINE_UNQUOTED(DBHMACTYPE,MHASH_MD5,[hash type for checking db])] ) AC_ARG_WITH([dbhmackey], AC_HELP_STRING([--with-dbhmackey=KEY HMAC], [hash key to use for checking db. Must be a base64 encoded byte stream. Maximum string lentgth is 31 chars.]), [if test "x$withval" = "x" ; then echo "--with-dbhmackey requires a value" exit 5 fi key00=`echo $withval|cut -c1-3` key01=`echo $withval|cut -c4-6` key02=`echo $withval|cut -c7-9` key03=`echo $withval|cut -c10-12` key04=`echo $withval|cut -c13-15` key05=`echo $withval|cut -c16-18` key06=`echo $withval|cut -c19-21` key07=`echo $withval|cut -c22-24` key08=`echo $withval|cut -c25-28` key09=`echo $withval|cut -c29-31` AC_DEFINE_UNQUOTED(DBHMACKEY_00,"$key00",[DB HMAC key 00]) AC_DEFINE_UNQUOTED(DBHMACKEY_01,"$key01",[DB HMAC key 01]) AC_DEFINE_UNQUOTED(DBHMACKEY_02,"$key02",[DB HMAC key 02]) AC_DEFINE_UNQUOTED(DBHMACKEY_03,"$key03",[DB HMAC key 03]) AC_DEFINE_UNQUOTED(DBHMACKEY_04,"$key04",[DB HMAC key 04]) AC_DEFINE_UNQUOTED(DBHMACKEY_05,"$key05",[DB HMAC key 05]) AC_DEFINE_UNQUOTED(DBHMACKEY_06,"$key06",[DB HMAC key 06]) AC_DEFINE_UNQUOTED(DBHMACKEY_07,"$key07",[DB HMAC key 07]) AC_DEFINE_UNQUOTED(DBHMACKEY_08,"$key08",[DB HMAC key 08]) AC_DEFINE_UNQUOTED(DBHMACKEY_09,"$key09",[DB HMAC key 09])], [ AC_DEFINE_UNQUOTED(DBHMACKEY_00,"$key00",[DB HMAC key 00]) AC_DEFINE_UNQUOTED(DBHMACKEY_01,"$key01",[DB HMAC key 01]) AC_DEFINE_UNQUOTED(DBHMACKEY_02,"$key02",[DB HMAC key 02]) AC_DEFINE_UNQUOTED(DBHMACKEY_03,"$key03",[DB HMAC key 03]) AC_DEFINE_UNQUOTED(DBHMACKEY_04,"$key04",[DB HMAC key 04]) AC_DEFINE_UNQUOTED(DBHMACKEY_05,"$key05",[DB HMAC key 05]) AC_DEFINE_UNQUOTED(DBHMACKEY_06,"$key06",[DB HMAC key 06]) AC_DEFINE_UNQUOTED(DBHMACKEY_07,"$key07",[DB HMAC key 07]) AC_DEFINE_UNQUOTED(DBHMACKEY_08,"$key08",[DB HMAC key 08]) AC_DEFINE_UNQUOTED(DBHMACKEY_09,"$key09",[DB HMAC key 09])] ) AC_ARG_ENABLE(forced_configmd, AC_HELP_STRING([--enable-forced-configmd], [Forces the config to have checksum. Also disables --config-check]), [AC_DEFINE(FORCECONFIGMD,1,[force config checksum])], [AC_DEFINE(FORCECONFIGMD,0,[don't force config checksum])] ) AC_ARG_ENABLE(forced_dbmd, AC_HELP_STRING([--enable-forced-dbmd], [Forces the file/pipe database's to have checksum. This will be the default in the next release.]), AC_DEFINE(FORCEDBMD,1,[force database checksum]), AC_DEFINE(FORCEDBMD,0,[don't force database checksum]) ) AC_ARG_WITH(initial_errors_to, AC_HELP_STRING([--with-initial-errors-to=URL], [Where errors should go while checking config. Default is stderr.]), AC_DEFINE_UNQUOTED(INITIALERRORSTO,"$withval",[send errors here]) compoptionstring="${compoptionstring}INITIALERRORSTO=${withval}\\n", AC_DEFINE_UNQUOTED(INITIALERRORSTO,"stderr",[send errors to stderr]) ) AC_MSG_CHECKING(for PostgresSQL support) AC_ARG_WITH([psql], [AC_HELP_STRING([--with-psql], [use postgresql library for storing databases])], [], [with_psql=no] ) AS_IF([test "x$with_psql" != xno], AC_DEFINE(WITH_PSQL,1,[postgresql support]) AC_CHECK_LIB(pq,PQclear,[], with_psql=no AC_MSG_RESULT([not found]) ) PSQLLIB="-lpq" compoptionstring="${compoptionstring}WITH_PSQL\\n" AC_MSG_RESULT(yes), PSQLLIB="" [with_psql=no] AC_MSG_RESULT([no]) ) AC_SUBST(PSQLLIB) # Check for Linux auditing API # AC_ARG_WITH([audit], [AC_HELP_STRING([--with-audit], [use audit library])], [], [with_audit=no] ) AS_IF([test "x$with_audit" != xno], [AC_DEFINE(WITH_AUDIT,1,[use audit library]) AC_CHECK_HEADER(libaudit.h,, AC_MSG_ERROR(You don't have libaudit properly installed. Install it if you need it.) ) AUDITLIB="-laudit" compoptionstring="${compoptionstring}WITH_AUDIT\\n"], [with_audit=no] ) AC_SUBST(AUDITLIB) extrasub="s&@aideextragroups@&$aideextragroups&;t t s&@AIDEVERSION@&$PACKAGE_VERSION&;t t" AIDE_DO_LINK_FILES compoptionstring="${compoptionstring}CONFIG_FILE = \\\"${config_file}\\\"\\n" AC_DEFINE_UNQUOTED(AIDECOMPILEOPTIONS, "${compoptionstring}",[Compile-time options displayed in -v output]) dnl Add in the optional compiler features LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS" CFLAGS="$CFLAGS $EXTRA_CFLAGS" AC_SUBST(AIDE_DEFS) AC_OUTPUT(Makefile src/Makefile include/Makefile doc/Makefile doc/aide.conf doc/aide.1 doc/aide.conf.5 aide.spec) aide-0.16~a2.git20130520/contrib/000077500000000000000000000000001214657706600160405ustar00rootroot00000000000000aide-0.16~a2.git20130520/contrib/aide-attributes.sh000066400000000000000000000042221214657706600214620ustar00rootroot00000000000000#!/bin/bash # Copyright © 2010 Hannes von Haugwitz # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA set -e set -u attributes=( "filename" "linkname" "perm" "uid" "gid" "size" "atime" \ "ctime" "mtime" "inode" "bcount" "lnkcount" "md5" "sha1" \ "rmd160" "tiger" "crc32" "haval" "gost" "crc32b" "attr" \ "acl" "bsize" "rdev" "dev" "checkmask" "growingsize" "checkinode" \ "allownewfile" "allowrmfile" "sha256" "sha512" "selinux" \ "xattrs" "whirlpool" "ftype" "e2fsattrs" ) NAME="aide-attributes" err() { echo "$NAME: $1!" >&2 echo "usage: $NAME HEX_NUMBER [HEX_NUMBER]" exit $2 } dec2hex() { let hex=0x$1 2> /dev/null || err "argument '$1' is no valid hex number" 2 if [ "$hex" -lt "0" ] || [ "$hex" -gt "$((2**${#attributes[@]}))" ] ; then err "argument '$1' too large (> 2^${#attributes[@]})" 3 fi echo "$hex" } COMPARE=false if [ -n "${1:-}" ] ; then a=$(dec2hex $1) if [ -n "${2:-}" ] ; then COMPARE=true b=$(dec2hex $2) [ -n "${3:-}" ] && err "Too much arguments provided" 4 fi else err "Not enough arguments provided" 1; fi for (( i=0; i<${#attributes[@]}; i++ )) ; do if $COMPARE ; then if (( 2**$i & $a )) && ! (( 2**$i & $b )) ; then echo "-"${attributes[$i]} elif ! (( 2**$i & $a )) && (( 2**$i & $b )) ; then echo "+"${attributes[$i]} fi else if (( 2**$i & $a )) ; then echo "${attributes[$i]}" fi fi done exit 0 aide-0.16~a2.git20130520/contrib/bzip2.sh000066400000000000000000000005121214657706600174200ustar00rootroot00000000000000#!/bin/bash # # Lifted from E-mails by Sven.Hartrumpf@fernuni-hagen.de # # The idea is to set database_out=stderr in aide.conf you can then use # this one liner to decompress aide.db and recompress aide.db.new bzcat aide.db.bz2 | ( /media/floppy/aide -c aide.conf --verbose=0 -u 1> /tmp/aideu.log ) 2>&1 | bzip2 -9 > aide.db.new aide-0.16~a2.git20130520/contrib/gpg2_check.sh000066400000000000000000000016531214657706600203750ustar00rootroot00000000000000#!/bin/sh # $Id$ # Script by Vincent Danen hostname=`uname -n` echo "AIDE integrity check for ${hostname} beginning (`date`)" echo "" if [ ! -e /var/lib/aide/aide.db ] ; then echo "**** Error: AIDE database for ${hostname} not found." echo "**** Run 'aide --init' and move the appropriate database file." else if [ -f /etc/aide.conf ]; then if [ -f /var/lib/aide/aide.db.sig ]; then pushd /var/lib/aide >/dev/null echo "Verifying the GPG signature on the database..." echo "" gpg --verify aide.db.sig echo "" if [ "$?" == "1" ]; then echo "************************************************************" echo "GPG signature FAILED! Your database has been tampered with!" echo "************************************************************" exit 1 fi popd >/dev/null fi nice -20 /usr/sbin/aide --check 2>/dev/null fi fi exit 0 aide-0.16~a2.git20130520/contrib/gpg2_update.sh000066400000000000000000000025631214657706600206030ustar00rootroot00000000000000#!/bin/sh # $Id$ # # script to update and rotate the AIDE database files and, optionally # create a detached GPG signature to verify the database file # # written by Vincent Danen 01/21/2006 usegpg=0 if [ -f /root/.gnupg/secring.gpg ]; then usegpg=1 fi if [ ! -d /var/lib/aide ]; then echo "The AIDE database directory /var/lib/aide does not exist!" exit 1 fi pushd /var/lib/aide >/dev/null # copy the old database if [ -f aide.db ]; then newfile="aide-`hostname`-`date +%Y%m%d-%H%M%S`.db" if [ "${usegpg}" == 1 -a -f aide.db.sig ]; then # do an integrity check gpg --verify aide.db.sig if [ "$?" == "1" ]; then echo "************************************************************" echo "GPG signature FAILED! Your database has been tampered with!" echo "************************************************************" exit 1 fi fi cp -av aide.db ${newfile} /usr/sbin/aide --update -B "database=file:/var/lib/aide/${newfile}" if [ "${usegpg}" == "1" ]; then # create the signature file [[ -f aide.db.sig ]] && rm -f aide.db.sig gpg --detach-sign aide.db if [ "$?" == "1" ]; then echo "FATAL: Error occurred when creating the signature file!" exit 1 fi fi gzip -9f ${newfile} else echo "The AIDE database does not exist, can't update!" exit 1 fi popd >/dev/null aide-0.16~a2.git20130520/contrib/gpg_check.sh000066400000000000000000000017141214657706600203110ustar00rootroot00000000000000#!/bin/bash # $Id$ # aide check script # Written by: charlie heselton # Email: echo "hfouvyAdpy/ofu" | perl -pe 's/(.)/chr(ord($1)-1)/ge' # 09/23/2005 # Set up some variables DBDIR="/your/aide/db/directory" DBFILE="${DBDIR}/aide.db" ENC_DBFILE="${DBDIR}/aide.db.gpg" # make the assumption that the database exists and is encrypted # but test for it ;-) [[ -f ${ENC_DBFILE} ]] && /usr/bin/gpg --batch -d ${ENC_DBFILE} > ${DBFILE} rm -f ${ENC_DBFILE} # (for now, we'll assume that encrypting the file includes an integrity check ) # Run the check. /usr/bin/aide -C > /tmp/aide_check.out 2>&1 # mail out the results /usr/bin/cat /tmp/aide_check.out | /usr/bin/mutt -s "AIDE Check for `date`" your_valid_email@somewhere.com # cleanup # if the mail was successful, delete the output file if [ $? -eq 0 ] then rm -f /tmp/aide_check.out fi # re-encrypt the database and delete the unencrypted version /usr/bin/gpg --batch -se -r gentoo_root ${DBFILE} rm -f ${DBFILE} aide-0.16~a2.git20130520/contrib/gpg_update.sh000066400000000000000000000021571214657706600205200ustar00rootroot00000000000000#!/bin/bash # $Id$ # aide update script # Written by: charlie heselton # Email: echo "hfouvyAdpy/ofu" | perl -pe 's/(.)/chr(ord($1)-1)/ge' # 09/23/2005 DBDIR="/etc/aide/db" DBFILE="${DBDIR}/aide.db" ENC_DBFILE="${DBDIR}/aide.db.gpg" # make the assumption that the database exists and is encrypted # but test for it ;-) [[ -f ${ENC_DBFILE} ]] && /usr/bin/gpg --batch -d ${ENC_DBFILE} > ${DBFILE} rm -f ${ENC_DBFILE} # (for now, we'll assume that encrypting the file includes an integrity check ) # Run the update. /usr/bin/aide --update > /tmp/aide_update.out 2>&1 # mail out the results # set the "Reply-to" address REPLYTO="root@charlesheselton.no-ip.org" export REPLYTO # send the mail /usr/bin/cat /tmp/aide_update.out | /usr/bin/mutt -s "AIDE Update for `date`" your_valid_email@somewhere.com # cleanup # if the mailing was successful then delete the output file if [ $? -eq 0 ] then rm -f /tmp/aide_update.out fi # move the aide.db.new file to the aide.db mv ${DBDIR}/aide.db.new ${DBFILE} # encrypt the new db file and remove the unencrypted version /usr/bin/gpg --batch -se -r gentoo_root ${DBFILE} rm -f ${DBFILE} aide-0.16~a2.git20130520/contrib/sshaide.sh000066400000000000000000000363771214657706600200340ustar00rootroot00000000000000#!/bin/sh # # $Id$ # # NAME # sshaide.sh - SSH/AIDE remote integrity monitoring script # # SYNOPSIS # sshaide.sh -check|-init ALL| # # DESCRIPTION # sshaide.sh uses AIDE and SSH to remotely run integrity checks # on ALL configured client systems or those specifically listed on # the command line from a centralized manager station. sshaide.sh # stores all binaries, databases and reports on a secure, centralized # manager station. Database initialization or periodic checks are # run on demand or via cron jobs from the manager stations based on # local policy requirements. # # sshaide.sh requires a valid account on the remote system and uses # SSH RSA authentication with public/private password-less key pairs # to obtain automated, scripted access to a remote system. Naturally # the account(s), sshaide.sh keys and manager system must be heavily # protected from compromise. To minimize potential problems, it is # recommended that sshaide.sh use non-privileged accounts. While # this limits access to verify some files and diretories on remote # systems, we believe it is an acceptable trade-off. Most critical # files and directories can be effectively monitored without having # privileged access. It is recommended that an unprivileged, but # dedicated account on the manager station also be setup to manage # AIDE databases, AIDE reports, remote logins and other sshaide.sh # requirements. # # Remote clients must have the public SSH RSA key that will be used # by the sshaide.sh manager. The sshaide.sh manager must have the # managed client's SSH server RSA public key in known_hosts or # hostkeys file. Refer to your SSH documentation for instructions # on setting up public SSH RSA keys. # # OPTIONS # The option must be given in the proper order and with proper # syntax. # # -init Initialize or re-initialize the AIDE database for the # listed host or hosts. # # -check Run an integrity check on the specified system or systems. # The database for any host being checked must have already # been intialized. # # DIRECTORIES and FILES # ~/ # This is the home directory of the user running sshaide.sh. # By default, this is retrieved from the $HOME environment # variable. # # ~/bin # The directory where the sshaide.sh script and AIDE # binaries are stored. Required. # # ~/bin/sshaide.sh # The sshaide.sh program. This file. Required. # # ~/bin/aide.[platform] # The AIDE binary for a [platform]. For example, a Linux # 2.4 binary may be named aide.linux-2.4. These binaries # will be linked to from the independent client directories # based on their platform requirements. Required. # # ~/configs # The directory where the AIDE configuration files are # stored. Common AIDE configurations are stored here and # can be linked to from the independent client directories # based on policy requirements. Required. # # ~/reports # This directory will store the initialization logs and # integrity check reports. Integrity reports will be # tar.gz'd by year-month-day-hour. Required, but created # automatically by sshaide.sh. # # ~/clients # This is the parent directory for all client hosts being # managed. Required. # # ~/clients/[client-host] # This directory is a specific client host to be managed by # sshaide.sh. [client-host] is a host name. Short host name # is usually sufficient, but a fully qualified domain name # may be used if there may be host name overlap from different # subdomains. Required for each client to be managed by # sshaide.sh. # # ~/clients/[client-host]/aide.db_[client_host] # This file is the AIDE database for the [client-host] being # managed by sshaide.sh. Required, but created automatically # by the -init process. # # ~/clients/[client-host]/aide.db_[client-host].old # This file is the previous AIDE database before the last # -init process. Not required. Created automatically after # the second or additional database initialization. # # ~/clients/[client-host]/sshaide.conf # This file contains client specific configuration information. # Optional. The following three options are available: # # emaillist comma-separated-list-of-addresses # This option specifies the email addresses that # sshaide.sh output should be delivered to. # homedir full-home-diretory-path-on-client # This option specifies the fully qualified path # used on the client host. This would be equivalanet # to the $HOME environment variable on the client # system. # userid remote-user-id # This option specifies the remote login id with # which to login to the remote system with. # # All configuration options are optional, but if present, # they must be begin in column 1 with whitespace separting # the desired value(s). # # ~/clients/[client-host]/reinit # The existence of this file indicates that the AIDE database # for this client host should be reinitialized through the # -init process on the next run. Simply `touch` this file # whenever you want to reinitialize the client host database. # This file will be automaticaly removed after the next -init # process. Optional. # # ~/clients/[client-host]/aide.conf # This is a soft link to the appropriate AIDE configuration # file in ~/configs. The following two lines are required # for each configuration file: # # database=file:./aide.db # database_out=file:./aide.newdb # # ~/clients/[client-host]/aide # This is a soft link to the appropriate AIDE binary for # the client host platform in ~/bin. Required. # # ~/tmp # This is a temporary work directory for sshaide.sh. # Required. # # Original concept and coding from: # Judith A Freeman # University of Chicago # Network Security Center # # 28 June 1998 to 16 May 2000 # # Updates by: # John Kristoff # # Northwestern University # Telecommunications and Network Services # # 2003-12-03,jtk: updated for AIDE v0.10 and Linux # newly packaged as sshaide.sh # adjusted default path to something more reasonable for linux # replaced tripwire references with aide naming conventions # replaced hard coded root user id with $userid variable from whoami # added LC_ALL=C for grep to work with traditional [] interpretations # added a cd to remote_aidedir on remote machine # forced remote_aidedir directory creation (with 'mkdir -p') # added quotes to ssh commands # changed the email subject and header format # changed mail delivery and email creation handling # minor commenting edits # adjusted wordlist for Linux and Solaris, exiting if file not found # removed $1 for wordlist # implemented config file for remote_aidedir and emaillist per machine # changed reinit check from read (-r) to write (-w) check # fixed tar/gzip'ing of reports only on -check mode # removed unncessary root directory variable, use just aidedir # 2003-12-06,jtk:minor configuration updates # added userid option to config and created $useriddefault # set default remote home directory with $homedefault # 2003-12-16,jtk: fixed sshaide.conf usage # added doc about userid config in sshaide.conf # changed order of sshaide.conf config options so remote_aidedir works # 2004-02-12,jtk: minor doc editing ### ### Basic setup ### # Get a limited path PATH=/bin:/usr/bin:/usr/local/bin:/usr/ucb # For debugging only # set -x ### ### Local variable declarations ### # set the remote username to login and run aide as useriddefault=`whoami` # Who gets the mail if not set in client dir? maildefault=root@localhost # remote home directory homedefault=/home/${useriddefault} # $date in the form year-month-day-hour date=`date +%Y-%m-%d-%H` # Where are we running out of aidedir=${HOME} # Setup local directories and files for use clientdir=${aidedir}/clients tmpdir=${aidedir}/tmp progname=`basename $0` ### ### Functions ### # Give usage statement usage () { echo "" echo "Usage: `${progname}` ALL|" echo " run-mode: -init | -check" echo " machine-list: space separated list in quotes" echo "" } ## gen_rand_word - returns a semi-random word ## only returns words that are all lowercase letters gen_rand_word () { # Set the word list if test -r "/usr/share/dict/words" ; then # For Linux _wordlist="/usr/share/dict/words" elif test -r "/usr/dict/words" ; then # For Solaris _wordlist="/usr/dict/words" else echo ERROR: words file not found! Exiting... exit 0 fi _randnum=`date +%H%S%Y%m%H%d%S%S` _listlines=`cat ${_wordlist} | wc -l` _linenum=`expr ${_randnum} % ${_listlines}` # If we picked line 0, change it to 1 'cause line 0 doesn't exist if test ${_linenum} -eq 0 ; then _linenum=1 fi _randword=`grep -n . ${_wordlist} | grep "^${_linenum}:" | cut -d: -f2` # If $_randword has anything other than lower-case chars, try again (echo ${_randword} | LC_ALL=C grep '[^a-z]' 2>&1 >> /dev/null \ && gen_rand_word ) || \ # Return the word echo ${_randword} } init_cmds () { if test ! -d ${aidedir}/reports/initlogs/ ; then mkdir -p ${aidedir}/reports/initlogs/ fi ssh -l $userid $machine "(umask 077 ; cd ${remote_aidedir}; ${remote_aidedir}/aide --init --config=${remote_aidedir}/aide.conf 2>&1 | tee ${remote_aidedir}/initoutput >> /dev/null)" # Copy output back to file mkdir -p ${tmpdir}/initoutput/${date} scp -q ${userid}@${machine}:${remote_aidedir}/initoutput ${inittmp}/${machine} # backup old database if it exists if test -r ${clientdir}/${machine}/aide.db_${machine} ; then mv ${clientdir}/${machine}/aide.db_${machine} ${clientdir}/${machine}/aide.db_${machine}.old fi scp -q ${userid}@${machine}:${remote_aidedir}/aide.newdb ${clientdir}/${machine}/aide.db_${machine} } check_cmds () { scp -q $db ${userid}@${machine}:${remote_aidedir}/aide.db ssh -l $userid $machine "umask 077 && cd ${remote_aidedir} && ${remote_aidedir}/aide --config=${remote_aidedir}/aide.conf 2>&1 | tee ${remote_aidedir}/report >> /dev/null" # Copy output back to file if test ! -d ${aidedir}/reports/${date} ; then mkdir ${aidedir}/reports/${date} fi scp -q ${userid}@${machine}:${remote_aidedir}/report $reports/${machine} } ### ### The program ### # From the commandline case $# in 2) mode=$1; thehosts=$2 ;; *) usage; exit 1 ;; esac # Set mode specific variables case $mode in -init) initlogs=${aidedir}/reports/initlogs inittmp=${tmpdir}/initoutput/${date} mail_fordir=${inittmp} ;; -check) reports=${aidedir}/reports/${date} mail_fordir=${reports} ;; esac # case $thehosts in ALL) forcmd=`ls ${clientdir}` ;; *) forcmd=$thehosts ;; esac for machine in $forcmd ; do sleep 2 # so we get a different random word ( ## background it (this is so it runs in parellel) # Set up local directories and files for use config=${clientdir}/${machine}/aide.conf db=${clientdir}/${machine}/aide.db_${machine} binary=${clientdir}/${machine}/aide log=${clientdir}/${machine}/log sshaide_conf=${clientdir}/${machine}/sshaide.conf # Set up temporary directory name for remote machine rand_word=`gen_rand_word` # Apply client host configuration options if test ! -r ${sshaide_conf} ; then remote_aidedir=${homedefault}/${rand_word}.$$ mailrcpts=${maildefault} userid=${useriddefault} else # Get the email addresses to send reports to grep '^emaillist' ${sshaide_conf} if [ $? != 0 ] ; then mailrcpts=${maildefault} else mailrcpts=`grep -m1 '^emaillist' ${sshaide_conf} | \ awk '{print $2}'` fi # Get the remote user id grep '^userid' ${sshaide_conf} if [ $? != 0 ] ; then userid=${useriddefault} else userid=`grep -m1 '^userid' ${sshaide_conf} | \ awk '{print $2}'` fi # Get home directory to use on remote machine grep '^homedir' ${sshaide_conf} if [ $? != 0 ] ; then remote_aidedir=/home/${userid}/${rand_word}.$$ else remote_aidedir=`grep -m1 '^homedir' ${sshaide_conf} | \ awk '{print $2}'`/${rand_word}.$$ fi fi # Do the dirty work ssh -l $userid $machine "mkdir -p $remote_aidedir" scp -q $config ${userid}@${machine}:${remote_aidedir} scp -q $binary ${userid}@${machine}:${remote_aidedir} case $mode in -init) init_cmds ;; -check) check_cmds ;; esac # Delete remote directory ssh -l $userid $machine "rm -rf $remote_aidedir" # If $mail_fordir doesn't exist, don't continue if test ! -d "${mail_fordir}" ; then echo "${progname}:${mail_fordir} doesn't exist," echo "exiting now, not sending mail" exit 1 fi ### ### Mail reports out ### cat ${mail_fordir}/${machine} \ | mail -s "### AIDE ${mode} ${machine} ${date}" ${mailrcpts} ) done # Wait for all bg processes to finish before continuing wait # Tar and compress the reports if test $mode = -check ; then tar cf ${reports}.tar ${reports} rm -rf ${reports} gzip -9 ${reports}.tar fi # If mode is check, examine clientdir for reinit file, and # reinitialize if it exists if test $mode = -check ; then for host in $forcmd ; do if test -w ${clientdir}/${host}/reinit ; then ${aidedir}/bin/${progname} -init ${host} & rm ${clientdir}/${host}/reinit fi done fi ### ### Clean up init stuff ### if test $mode = -init ; then # Concatenate inittmp directories into initlogs for host in `ls -A ${mail_fordir}` ; do ( echo "********************************************" echo ${host} $date ${mode} echo "********************************************" echo "" cat ${mail_fordir}/${host} echo "" )| tee -a $initlogs/`date +%Y-%m` >> /dev/null done # Delete inittmp directory rm -rf ${tmpdir}/initoutput fi aide-0.16~a2.git20130520/depcomp000077500000000000000000000506431214657706600157650ustar00rootroot00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2012-03-27.16; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # A tabulation character. tab=' ' # A newline character. nl=' ' if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' "$nl" < "$tmpdepfile" | ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependent.h'. # Do two passes, one to just change these to # '$object: dependent.h' and one to simply 'dependent.h:'. sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'. # However on # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\': # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... # tcc 0.9.26 (FIXME still under development at the moment of writing) # will emit a similar output, but also prepend the continuation lines # with horizontal tabulation characters. "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form 'foo.o: dependent.h', # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'. # Do two passes, one to just change these to # '$object: dependent.h' and one to simply 'dependent.h:'. sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \ < "$tmpdepfile" > "$depfile" sed ' s/[ '"$tab"'][ '"$tab"']*/ /g s/^ *// s/ *\\*$// s/^[^:]*: *// /^$/d /:$/d s/$/ :/ ' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test "$stat" = 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' "$nl" < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: aide-0.16~a2.git20130520/doc/000077500000000000000000000000001214657706600151455ustar00rootroot00000000000000aide-0.16~a2.git20130520/doc/Makefile.am000066400000000000000000000015201214657706600171770ustar00rootroot00000000000000# # aide, Advanced Intrusion Detection Environment # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING. If not, write to # the Free Software Foundation, 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # CLEANFILES = *~ man_MANS = aide.1 aide.conf.5 EXTRA_DIST = $(man_MANS) manual.html aide-0.16~a2.git20130520/doc/Makefile.in000066400000000000000000000413601214657706600172160ustar00rootroot00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # # aide, Advanced Intrusion Detection Environment # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING. If not, write to # the Free Software Foundation, 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = doc DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/aide.1.in $(srcdir)/aide.conf.5.in \ $(srcdir)/aide.conf.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/version.m4 $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = aide.conf aide.1 aide.conf.5 CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man1dir = $(mandir)/man1 am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)" man5dir = $(mandir)/man5 NROFF = nroff MANS = $(man_MANS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLLIB = @ACLLIB@ ACLOCAL = @ACLOCAL@ AIDE_DEFS = @AIDE_DEFS@ AIDE_USE_LOCALE = @AIDE_USE_LOCALE@ AMTAR = @AMTAR@ ATTRLIB = @ATTRLIB@ AUDITLIB = @AUDITLIB@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CRYPTLIB = @CRYPTLIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ E2FSATTRSLIB = @E2FSATTRSLIB@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ELFLIB = @ELFLIB@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PSQLLIB = @PSQLLIB@ RANLIB = @RANLIB@ SELINUXLIB = @SELINUXLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ curlconfig = @curlconfig@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ CLEANFILES = *~ man_MANS = aide.1 aide.conf.5 EXTRA_DIST = $(man_MANS) manual.html all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): aide.conf: $(top_builddir)/config.status $(srcdir)/aide.conf.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ aide.1: $(top_builddir)/config.status $(srcdir)/aide.1.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ aide.conf.5: $(top_builddir)/config.status $(srcdir)/aide.conf.5.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-man1: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.1[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) install-man5: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man5dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man5dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man5dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.5[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man5dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man5dir)" || exit $$?; }; \ done; } uninstall-man5: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man5dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.5[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man5dir)'; $(am__uninstall_files_from_dir) tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(MANS) installdirs: for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man1 install-man5 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-man uninstall-man: uninstall-man1 uninstall-man5 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-man1 install-man5 install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am uninstall uninstall-am uninstall-man \ uninstall-man1 uninstall-man5 # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: aide-0.16~a2.git20130520/doc/aide.1000066400000000000000000000074341214657706600161410ustar00rootroot00000000000000.TH "aide" "1" .SH NAME \fBaide\fP \- Advanced Intrusion Detection Environment .SH SYNOPSIS \fBaide\fP \%[\fBparameters\fP] \%\fBcommand\fP .SH DESCRIPTION \fBaide\fP is an intrusion detection system for checking the integrity of files. .SH COMMANDS .PP .IP "--check, -C" Checks the database for inconsistencies. You must have an initialized database to do this. This is also the default command. Without any command \fBaide\fP does a check. .IP "--init, -i" Initialize the database. You must initialize a database and move it to the appropriate place before you can use the \-\-check command. .IP "--update, -u" Checks the database and updates the database non-interactively. The input and output databases must be different. .IP "--compare, -E" Compares two databases. They must be defined in configfile with database= and database_new=. .IP "--config-check, -D" Stops after reading in the configuration file. Any errors will be reported. If \fBaide\fP was compiled with the \(dq\fB--with-dbhmackey\fR\(dq option, a hash for the config file will be calculated. See the aide manual for more information. .SH PARAMETERS .IP "--config=\fBconfigfile\fR , -c \fBconfigfile\fR" Configuration is read from file \fBconfigfile\fR instead of "./aide.conf". Use '-' for stdin. .IP "--before=\(dq\fBconfigparameters\fR\(dq , -B \(dq\fBconfigparameters\fR\(dq" These \fBconfigparameters\fR are handled before the reading of the configuration file. See aide.conf (5) for more details on what to put here. .IP "--after=\(dq\fBconfigparameters\fR\(dq , -A \(dq\fBconfigparameters\fR\(dq" These \fBconfigparameters\fR are handled after the reading of the configuration file. See aide.conf (5) for more details on what to put here. .IP --verbose=\fBverbosity_level\fR,-V\fBverbosity_level\fR Controls how verbose \fBaide\fP is. Value must [0-255]. The default is 5. With no argument Value is set to 20. This parameter overrides the value set in a configuration file. .IP "--report=\fBreporter\fR,-r \fBreporter\fR" \fBreporter\fR is a URL which tells \fBaide\fP where to send it's output. See aide.conf (5) section URLS for available values. .IP "--version,-v" \fBaide\fP prints out its version number .IP "--help,-h" Prints out the standard help message. .PP .SH DIAGNOSTICS Normally, the exit status is 0 if no errors occurred. Except when the .BR --check, .BR --compare " or" .B --update command was requested, in which case the exit status is defined as: .IP "1 * (new files detected?) +" .IP "2 * (removed files detected?) +" .IP "4 * (changed files detected?)" .PP Additionally, the following exit codes are defined for generic error conditions: .IP "14 Error writing error" .IP "15 Invalid argument error" .IP "16 Unimplemented function error" .IP "17 Invalid configureline error" .IP "18 IO error" .IP "19 Version mismatch error" .PP .SH NOTES Please note that due to mmap issues, aide cannot be terminated with SIGTERM. Use SIGKILL to terminate. The checksums in the database and in the output are by default base64 encoded (see also report_base16 option). To decode them you can use the following shell command: echo | base64 \-d | hexdump \-v \-e '32/1 "%02x" "\\n"' .PP .SH FILES .IP \fB${prefix}/etc/aide.conf\fR Default aide configuration file. .IP \fB${prefix}/etc/aide.db\fR Default aide database. .IP \fB${prefix}/etc/aide.db.new\fR Default aide output database. .SH SEE ALSO .BR aide.conf (5) .BR http://www.cs.tut.fi/~rammer/aide/manual.html .SH BUGS There are probably bugs in this release. Please report them at http://sourceforge.net/projects/aide . Bug fixes are more than welcome. Unified diffs are preferred. .SH DISCLAIMER All trademarks are the property of their respective owners. No animals were harmed while making this webpage or this piece of software. Although some pizza delivery guy's feelings were hurt. .BR aide-0.16~a2.git20130520/doc/aide.1.in000066400000000000000000000074311214657706600165430ustar00rootroot00000000000000.TH "aide" "1" .SH NAME \fBaide\fP \- Advanced Intrusion Detection Environment .SH SYNOPSIS \fBaide\fP \%[\fBparameters\fP] \%\fBcommand\fP .SH DESCRIPTION \fBaide\fP is an intrusion detection system for checking the integrity of files. .SH COMMANDS .PP .IP "--check, -C" Checks the database for inconsistencies. You must have an initialized database to do this. This is also the default command. Without any command \fBaide\fP does a check. .IP "--init, -i" Initialize the database. You must initialize a database and move it to the appropriate place before you can use the \-\-check command. .IP "--update, -u" Checks the database and updates the database non-interactively. The input and output databases must be different. .IP "--compare, -E" Compares two databases. They must be defined in configfile with database= and database_new=. .IP "--config-check, -D" Stops after reading in the configuration file. Any errors will be reported. If \fBaide\fP was compiled with the \(dq\fB--with-dbhmackey\fR\(dq option, a hash for the config file will be calculated. See the aide manual for more information. .SH PARAMETERS .IP "--config=\fBconfigfile\fR , -c \fBconfigfile\fR" Configuration is read from file \fBconfigfile\fR instead of "./aide.conf". Use '-' for stdin. .IP "--before=\(dq\fBconfigparameters\fR\(dq , -B \(dq\fBconfigparameters\fR\(dq" These \fBconfigparameters\fR are handled before the reading of the configuration file. See aide.conf (5) for more details on what to put here. .IP "--after=\(dq\fBconfigparameters\fR\(dq , -A \(dq\fBconfigparameters\fR\(dq" These \fBconfigparameters\fR are handled after the reading of the configuration file. See aide.conf (5) for more details on what to put here. .IP --verbose=\fBverbosity_level\fR,-V\fBverbosity_level\fR Controls how verbose \fBaide\fP is. Value must [0-255]. The default is 5. With no argument Value is set to 20. This parameter overrides the value set in a configuration file. .IP "--report=\fBreporter\fR,-r \fBreporter\fR" \fBreporter\fR is a URL which tells \fBaide\fP where to send it's output. See aide.conf (5) section URLS for available values. .IP "--version,-v" \fBaide\fP prints out its version number .IP "--help,-h" Prints out the standard help message. .PP .SH DIAGNOSTICS Normally, the exit status is 0 if no errors occurred. Except when the .BR --check, .BR --compare " or" .B --update command was requested, in which case the exit status is defined as: .IP "1 * (new files detected?) +" .IP "2 * (removed files detected?) +" .IP "4 * (changed files detected?)" .PP Additionally, the following exit codes are defined for generic error conditions: .IP "14 Error writing error" .IP "15 Invalid argument error" .IP "16 Unimplemented function error" .IP "17 Invalid configureline error" .IP "18 IO error" .IP "19 Version mismatch error" .PP .SH NOTES Please note that due to mmap issues, aide cannot be terminated with SIGTERM. Use SIGKILL to terminate. The checksums in the database and in the output are by default base64 encoded (see also report_base16 option). To decode them you can use the following shell command: echo | base64 \-d | hexdump \-v \-e '32/1 "%02x" "\\n"' .PP .SH FILES .IP \fB@sysconfdir@/aide.conf\fR Default aide configuration file. .IP \fB@sysconfdir@/aide.db\fR Default aide database. .IP \fB@sysconfdir@/aide.db.new\fR Default aide output database. .SH SEE ALSO .BR aide.conf (5) .BR http://www.cs.tut.fi/~rammer/aide/manual.html .SH BUGS There are probably bugs in this release. Please report them at http://sourceforge.net/projects/aide . Bug fixes are more than welcome. Unified diffs are preferred. .SH DISCLAIMER All trademarks are the property of their respective owners. No animals were harmed while making this webpage or this piece of software. Although some pizza delivery guy's feelings were hurt. .BR aide-0.16~a2.git20130520/doc/aide.conf.5000066400000000000000000000310111214657706600170550ustar00rootroot00000000000000.TH "aide.conf" "5" .SH NAME aide.conf - The configuration file for Advanced Intrusion Detection Environment .PP .SH SYNOPSIS \fBaide.conf\fP is the configuration file for Advanced Intrusion Detection Environment. \fBaide.conf\fP contains the runtime configuration aide uses to initiailize or check the aide database. .PP .SH "FILE FORMAT" \fBaide.conf\fP is similar in to Tripwire(tm)'s configuration file. With little effort tw.conf can be converted to aide.conf. .PP aide.conf is case-sensitive. Leading and trailing whitespaces are ignored. .PP There are three types of lines in \fBaide.conf\fP. First there are the configuration lines which are used to set configuration parameters and define/undefine variables. Second, there are selection lines that are used to indicate which files are added to the database. Third, macro lines define or undefine variables within the config file. Lines beginning with # are ignored as comments. .PP .SH "CONFIG LINES" .PP These lines have the format parameter=value. See URLS for a list of valid urls. .PP .IP "database" The url from which database is read. There can only be one of these lines. If there are multiple database lines then the first is used. The default value is "/usr/local/etc/aide.db". .IP "database_out" The url to which the new database is written to. There can only be one of these lines. If there are multiple database_out lines then the first is used. The default value is "/usr/local/etc/aide.db.new". .IP "database_new" The url from which the other database for \-\-compare is read. There is no default for this one. .IP "database_attrs" The attributes of the (uncompressed) database files which are to be added to the final report in verbose level 2 or higher. Only checksum attributes are supported. To disable set .I database_attrs to .RB ' E '. By default all compiled in checksums are added to the report. .IP "verbose" The level of messages that is output. This value can be 0-255 inclusive. This parameter can only be given once. Value from the first occurence is used. If \-\-verbose or \-V is used then the value from that is used. The default is 5. If verbosity is 20 then additional report output is written when doing \-\-check, \-\-update or \-\-compare. .IP "report_url" The url that the output is written to. There can be multiple instances of this parameter. Output is written to all of them. The default is stdout. .IP "report_base16" Whether to base16 encode the checksums in the report or not. Valid values are yes, true, no and false. The default is to report checksums not in base16 but in base64 encoding. .IP "report_detailed_init" Whether to report added files (verbose level >= 2) and their details (verbose level >=6) in initialization mode or not. Valid values are yes, true, no and false. The default is to not report added files or their details in init mode. .IP "gzip_dbout" Whether the output to the database is gzipped or not. Valid values are yes,true,no and false. The default is no. This option is available only if zlib support is compiled in. .IP "root_prefix" The prefix to strip from each file name in the file system before applying the rules and writing to database. Aide removes a trailing slash from the prefix. The default is no (an empty) prefix. This option has no effect in compare mode. .IP "acl_no_symlink_follow" Whether to check ACLs for symlinks or not. Valid values are yes,true,no and false. The default is to follow symlinks. This option is available only if acl support is compiled in. .IP "warn_dead_symlinks" Whether to warn about dead symlinks or not. Valid values are yes,true,no and false. The default is not to warn about dead symlinks. .IP "grouped" Whether to group the files in the report by added, removed and changed files or not. Valid values are yes, true, no and false. The default is to group the files in the report. .IP "summarize_changes" Whether to summarize changes in the added, removed and changed files sections of the report or not. Valid values are yes,true,no and false. The default is to summarize the changes. The general format is like the string YlZbpugamcinCAXSE, where Y is replaced by the file-type (\fBf\fP for a regular file, \fBd\fP for a directory, \fBL\fP for a symbolic link, \fBD\fP for a character device, \fBB\fP for a block device, \fBF\fP for a FIFO, \fBs\fP for a unix socket, \fB|\fP for a Solaris door, \fB!\fP if file type has changed and \fB?\fP otherwise). The Z is replaced as follows: A \fB=\fP means that the size has not changed, a \fB<\fP reports a shrinked size and a \fB>\fP reports a grown size. The other letters in the string are the actual letters that will be output if the associated attribute for the item has been changed or a "." for no change, a "+" if the attribute has been added, a "-" if it has been removed, a ":" if the attribute is listed in ignore_list or a " " if the attribute has not been checked. The exceptions to this are: (1) a newly created file replaces each letter with a "+", and (2) a removed file replaces each letter with a "-". The attribute that is associated with each letter is as follows: .RS .IP o A \fBl\fP means that the link name has changed. .IP o A \fBb\fP means that the block count has changed. .IP o A \fBp\fP means that the permissions have changed. .IP o An \fBu\fP means that the uid has changed. .IP o A \fBg\fP means that the gid has changed. .IP o An \fBa\fP means that the access time has changed. .IP o A \fBm\fP means that the modification time has changed. .IP o A \fBc\fP means that the change time has changed. .IP o An \fBi\fP means that the inode has changed. .IP o A \fBn\fP means that the link count has changed. .IP o A \fBC\fP means that one or more checksums have changed. .RE .RS The following letters are only available when explicitly enabled using configure: .RE .RS .IP o A \fBA\fP means that the access control list has changed. .IP o A \fBX\fP means that the extended attributes have changed. .IP o A \fBS\fP means that the SELinux attributes have changed. .IP o A \fBE\fP means that the file attributes on a second extended file system have changed. .RE .IP "report_attributes" Special group definition that lists parameters which are always printed in the final report for changed files. .IP "ignore_list" Special group definition that lists parameters which are to be ignored from the final report. .IP "config_version" The value of config_version is printed in the report and also printed to the database. This is for informational purposes only. It has no other functionality. .IP "Group definitions" If the parameter is not one of the previous parameters then it is regarded as a group definition. Value is then regarded as an expression. Expression is of the following form. .IP .nf | + | - .fi .IP See DEFAULT GROUPS for an explanation of default predefined groups. Note that this is different from the way Tripwire(tm) does it. .IP There is also a special group named "ignore_list". The predefined \-groups listed in it are NOT displayed in the final report. .PP .SH "SELECTION LINES" .PP aide supports three types of selection lines (regular, negative, equals) Lines beginning with "/" are regular selection lines. Lines beginning with "=" are equals selection lines. And lines beginning with "!" are negative selection lines. The string following the first character is taken as a regular expression matching to a complete filename, including the path. In a regular selection rule the "/" is included in the regular expression. Special characters in your filenames can be escaped using two-digit URL encoding (for example, %20 to represent a space). Following the regular expression is a group definition as explained above. See EXAMPLES and doc/aide.conf for examples. .PP More in-depth discussion of the selection algorithm can be found in the aide manual. .IP .PP .SH "MACRO LINES" .PP .IP "@@define \fBVAR\fR \fBval\fR" Define variable \fBVAR\fR to value \fBval\fR. .IP "@@undef \fBVAR\fR" Undefine variable \fBVAR\fR. .IP "@@ifdef \fBVAR\fR, @@ifndef \fBVAR\fR" @@ifdef begins an if statement. It must be terminated with an @@endif statement. The lines between @@ifdef and @@endif are used if variable \fBVAR\fR is defined. If there is an @@else statement then the part between @@ifdef and @@else is used is \fBVAR\fR is defined otherwise the part between @@else and @@endif is used. @@ifndef reverses the logic of @@ifdef statement but otherwise works similarly. .IP "@@ifhost \fBhostname\fR, @@ifnhost \fBhostname\fR" @@ifhost works like @@ifdef only difference is that it checks whether \fBhostname\fR equals the name of the host that aide is running on. \fBhostname\fR is the name of the host without the domainname (hostname, not hostname.aide.org). .IP "@@{\fBVAR\fR}" @@{\fBVAR\fR} is replaced with the value of the variable \fBVAR\fR. If variable \fBVAR\fR is not defined an empty string is used. Unlike Tripwire(tm) @@VAR is NOT supported. One special \fBVAR\fR is @@{HOSTNAME} which is substituted for the hostname of the current system. .IP "@@else" Begins the else part of an if statement. .IP "@@endif" Ends an if statement. .IP "@@include \fBVAR\fR" Includes the file \fBVAR\fR. The content of the file is used as if it were inserted in this part of the config file. .PP .SH URLS Urls can be one of the following. Input urls cannot be used as outputs and vice versa. .IP "stdout" .IP "stderr" Output is sent to stdout,stderr respectively. .IP "stdin" Input is read from stdin. .IP "file://\fBfilename\fR" Input is read from \fBfilename\fR or output is written to \fBfilename\fR. .IP "fd:\fBnumber\fR" Input is read from filedescriptor \fBnumber\fR or output is written to \fBnumber\fR. .PP .SH "DEFAULT GROUPS" .PP .IP "p: permissions" .IP "ftype: file type" .IP "i: inode" .IP "l: link name" .IP "n: number of links" .IP "u: user" .IP "g: group" .IP "s: size" .IP "b: block count" .IP "m: mtime" .IP "a: atime" .IP "c: ctime" .IP "S: check for growing size" .IP "I: ignore changed filename" .IP "ANF: allow new files .IP "ARF: allow removed files .IP "md5: md5 checksum" .IP "sha1: sha1 checksum" .IP "sha256: sha256 checksum" .IP "sha512: sha512 checksum" .IP "rmd160: rmd160 checksum" .IP "tiger: tiger checksum" .IP "haval: haval checksum" .IP "crc32: crc32 checksum" .IP "R: p+ftype+i+l+n+u+g+s+m+c+md5+X" .IP "L: p+ftype+i+l+n+u+g+X" .IP "E: Empty group" .IP "X: acl+selinux+xattrs+e2fsattrs (if groups are explicitly enabled)" .IP ">: Growing logfile p+ftype+l+u+g+i+n+S+X" .LP And also the following if you have mhash support enabled .IP "gost: gost checksum" .IP "whirlpool: whirlpool checksum" .LP The following are available only when explicitly enabled using configure .IP "acl: access control list" .IP "selinux: selinux attributes" .IP "xattrs: extended attributes" .IP "e2fsattrs: file attributes on a second extended file system .LP Please note that 'I' and 'c' are incompatible. When the name of a file is changed, it's ctime is updated as well. When you put 'c' and 'I' in the same rule the, a changed ctime is silently ignored. .LP When 'ANF' is used, new files are added to the new database, but are ignored in the report. .LP When 'ARF' is used, files missing on disk are omitted from the new database, but are ignored in the report. .PP .SH EXAMPLES .IP .B "/ R" .LP This adds all files on your machine to the database. This is one line is a fully qualified configuration file. .IP .B "!/dev" .LP This ignores the /dev directory structure. .IP .B "=/tmp" .LP Only /tmp is taken into the database. None of its children are added. .IP .B "\fBAll\fR=p+i+n+u+g+s+m+c+a+md5+sha1+tiger+rmd160" .LP This line defines group \fBAll\fR. It has all attributes and all md checksum functions. If you absolutely want all digest functions then you should enable mhash support and add +crc32+haval+gost to the end of the definition for \fBAll\fR. Mhash support can only be enabled at compile-time. .PP .SH HINTS .IP .B "=/foo p+i+l+n+u+g+s+m+c+md5" .IP .B "/foo/bar p+i+l+n+u+g+s+m+c+md5" .LP This config adds all files under /foo because they match to regex /foo, which is equivalent to /foo.* . What you probably want is: .IP .B "=/foo$ p+i+l+n+u+g+s+m+c+md5" .IP .B "/foo/bar p+i+l+n+u+g+s+m+c+md5" .LP Note that the following still works as expected because =/foo$ stop recuring of directory /foo. .IP .B "=/foo p+i+l+n+u+g+s+m+c+md5" .LP In the following, the first is not allowed in AIDE. Use the latter instead. .IP .B "/foo epug" .IP .B "/foo e+p+u+g" .PP .SH "SEE ALSO" .BR aide (1) .BR http://www.cs.tut.fi/~rammer/aide/manual.html .SH DISCLAIMER All trademarks are the property of their respective owners. No animals were harmed while making this webpage or this piece of software. aide-0.16~a2.git20130520/doc/aide.conf.5.in000066400000000000000000000310051214657706600174650ustar00rootroot00000000000000.TH "aide.conf" "5" .SH NAME aide.conf - The configuration file for Advanced Intrusion Detection Environment .PP .SH SYNOPSIS \fBaide.conf\fP is the configuration file for Advanced Intrusion Detection Environment. \fBaide.conf\fP contains the runtime configuration aide uses to initiailize or check the aide database. .PP .SH "FILE FORMAT" \fBaide.conf\fP is similar in to Tripwire(tm)'s configuration file. With little effort tw.conf can be converted to aide.conf. .PP aide.conf is case-sensitive. Leading and trailing whitespaces are ignored. .PP There are three types of lines in \fBaide.conf\fP. First there are the configuration lines which are used to set configuration parameters and define/undefine variables. Second, there are selection lines that are used to indicate which files are added to the database. Third, macro lines define or undefine variables within the config file. Lines beginning with # are ignored as comments. .PP .SH "CONFIG LINES" .PP These lines have the format parameter=value. See URLS for a list of valid urls. .PP .IP "database" The url from which database is read. There can only be one of these lines. If there are multiple database lines then the first is used. The default value is "@prefix@/etc/aide.db". .IP "database_out" The url to which the new database is written to. There can only be one of these lines. If there are multiple database_out lines then the first is used. The default value is "@prefix@/etc/aide.db.new". .IP "database_new" The url from which the other database for \-\-compare is read. There is no default for this one. .IP "database_attrs" The attributes of the (uncompressed) database files which are to be added to the final report in verbose level 2 or higher. Only checksum attributes are supported. To disable set .I database_attrs to .RB ' E '. By default all compiled in checksums are added to the report. .IP "verbose" The level of messages that is output. This value can be 0-255 inclusive. This parameter can only be given once. Value from the first occurence is used. If \-\-verbose or \-V is used then the value from that is used. The default is 5. If verbosity is 20 then additional report output is written when doing \-\-check, \-\-update or \-\-compare. .IP "report_url" The url that the output is written to. There can be multiple instances of this parameter. Output is written to all of them. The default is stdout. .IP "report_base16" Whether to base16 encode the checksums in the report or not. Valid values are yes, true, no and false. The default is to report checksums not in base16 but in base64 encoding. .IP "report_detailed_init" Whether to report added files (verbose level >= 2) and their details (verbose level >=6) in initialization mode or not. Valid values are yes, true, no and false. The default is to not report added files or their details in init mode. .IP "gzip_dbout" Whether the output to the database is gzipped or not. Valid values are yes,true,no and false. The default is no. This option is available only if zlib support is compiled in. .IP "root_prefix" The prefix to strip from each file name in the file system before applying the rules and writing to database. Aide removes a trailing slash from the prefix. The default is no (an empty) prefix. This option has no effect in compare mode. .IP "acl_no_symlink_follow" Whether to check ACLs for symlinks or not. Valid values are yes,true,no and false. The default is to follow symlinks. This option is available only if acl support is compiled in. .IP "warn_dead_symlinks" Whether to warn about dead symlinks or not. Valid values are yes,true,no and false. The default is not to warn about dead symlinks. .IP "grouped" Whether to group the files in the report by added, removed and changed files or not. Valid values are yes, true, no and false. The default is to group the files in the report. .IP "summarize_changes" Whether to summarize changes in the added, removed and changed files sections of the report or not. Valid values are yes,true,no and false. The default is to summarize the changes. The general format is like the string YlZbpugamcinCAXSE, where Y is replaced by the file-type (\fBf\fP for a regular file, \fBd\fP for a directory, \fBL\fP for a symbolic link, \fBD\fP for a character device, \fBB\fP for a block device, \fBF\fP for a FIFO, \fBs\fP for a unix socket, \fB|\fP for a Solaris door, \fB!\fP if file type has changed and \fB?\fP otherwise). The Z is replaced as follows: A \fB=\fP means that the size has not changed, a \fB<\fP reports a shrinked size and a \fB>\fP reports a grown size. The other letters in the string are the actual letters that will be output if the associated attribute for the item has been changed or a "." for no change, a "+" if the attribute has been added, a "-" if it has been removed, a ":" if the attribute is listed in ignore_list or a " " if the attribute has not been checked. The exceptions to this are: (1) a newly created file replaces each letter with a "+", and (2) a removed file replaces each letter with a "-". The attribute that is associated with each letter is as follows: .RS .IP o A \fBl\fP means that the link name has changed. .IP o A \fBb\fP means that the block count has changed. .IP o A \fBp\fP means that the permissions have changed. .IP o An \fBu\fP means that the uid has changed. .IP o A \fBg\fP means that the gid has changed. .IP o An \fBa\fP means that the access time has changed. .IP o A \fBm\fP means that the modification time has changed. .IP o A \fBc\fP means that the change time has changed. .IP o An \fBi\fP means that the inode has changed. .IP o A \fBn\fP means that the link count has changed. .IP o A \fBC\fP means that one or more checksums have changed. .RE .RS The following letters are only available when explicitly enabled using configure: .RE .RS .IP o A \fBA\fP means that the access control list has changed. .IP o A \fBX\fP means that the extended attributes have changed. .IP o A \fBS\fP means that the SELinux attributes have changed. .IP o A \fBE\fP means that the file attributes on a second extended file system have changed. .RE .IP "report_attributes" Special group definition that lists parameters which are always printed in the final report for changed files. .IP "ignore_list" Special group definition that lists parameters which are to be ignored from the final report. .IP "config_version" The value of config_version is printed in the report and also printed to the database. This is for informational purposes only. It has no other functionality. .IP "Group definitions" If the parameter is not one of the previous parameters then it is regarded as a group definition. Value is then regarded as an expression. Expression is of the following form. .IP .nf | + | - .fi .IP See DEFAULT GROUPS for an explanation of default predefined groups. Note that this is different from the way Tripwire(tm) does it. .IP There is also a special group named "ignore_list". The predefined \-groups listed in it are NOT displayed in the final report. .PP .SH "SELECTION LINES" .PP aide supports three types of selection lines (regular, negative, equals) Lines beginning with "/" are regular selection lines. Lines beginning with "=" are equals selection lines. And lines beginning with "!" are negative selection lines. The string following the first character is taken as a regular expression matching to a complete filename, including the path. In a regular selection rule the "/" is included in the regular expression. Special characters in your filenames can be escaped using two-digit URL encoding (for example, %20 to represent a space). Following the regular expression is a group definition as explained above. See EXAMPLES and doc/aide.conf for examples. .PP More in-depth discussion of the selection algorithm can be found in the aide manual. .IP .PP .SH "MACRO LINES" .PP .IP "@@define \fBVAR\fR \fBval\fR" Define variable \fBVAR\fR to value \fBval\fR. .IP "@@undef \fBVAR\fR" Undefine variable \fBVAR\fR. .IP "@@ifdef \fBVAR\fR, @@ifndef \fBVAR\fR" @@ifdef begins an if statement. It must be terminated with an @@endif statement. The lines between @@ifdef and @@endif are used if variable \fBVAR\fR is defined. If there is an @@else statement then the part between @@ifdef and @@else is used is \fBVAR\fR is defined otherwise the part between @@else and @@endif is used. @@ifndef reverses the logic of @@ifdef statement but otherwise works similarly. .IP "@@ifhost \fBhostname\fR, @@ifnhost \fBhostname\fR" @@ifhost works like @@ifdef only difference is that it checks whether \fBhostname\fR equals the name of the host that aide is running on. \fBhostname\fR is the name of the host without the domainname (hostname, not hostname.aide.org). .IP "@@{\fBVAR\fR}" @@{\fBVAR\fR} is replaced with the value of the variable \fBVAR\fR. If variable \fBVAR\fR is not defined an empty string is used. Unlike Tripwire(tm) @@VAR is NOT supported. One special \fBVAR\fR is @@{HOSTNAME} which is substituted for the hostname of the current system. .IP "@@else" Begins the else part of an if statement. .IP "@@endif" Ends an if statement. .IP "@@include \fBVAR\fR" Includes the file \fBVAR\fR. The content of the file is used as if it were inserted in this part of the config file. .PP .SH URLS Urls can be one of the following. Input urls cannot be used as outputs and vice versa. .IP "stdout" .IP "stderr" Output is sent to stdout,stderr respectively. .IP "stdin" Input is read from stdin. .IP "file://\fBfilename\fR" Input is read from \fBfilename\fR or output is written to \fBfilename\fR. .IP "fd:\fBnumber\fR" Input is read from filedescriptor \fBnumber\fR or output is written to \fBnumber\fR. .PP .SH "DEFAULT GROUPS" .PP .IP "p: permissions" .IP "ftype: file type" .IP "i: inode" .IP "l: link name" .IP "n: number of links" .IP "u: user" .IP "g: group" .IP "s: size" .IP "b: block count" .IP "m: mtime" .IP "a: atime" .IP "c: ctime" .IP "S: check for growing size" .IP "I: ignore changed filename" .IP "ANF: allow new files .IP "ARF: allow removed files .IP "md5: md5 checksum" .IP "sha1: sha1 checksum" .IP "sha256: sha256 checksum" .IP "sha512: sha512 checksum" .IP "rmd160: rmd160 checksum" .IP "tiger: tiger checksum" .IP "haval: haval checksum" .IP "crc32: crc32 checksum" .IP "R: p+ftype+i+l+n+u+g+s+m+c+md5+X" .IP "L: p+ftype+i+l+n+u+g+X" .IP "E: Empty group" .IP "X: acl+selinux+xattrs+e2fsattrs (if groups are explicitly enabled)" .IP ">: Growing logfile p+ftype+l+u+g+i+n+S+X" .LP And also the following if you have mhash support enabled .IP "gost: gost checksum" .IP "whirlpool: whirlpool checksum" .LP The following are available only when explicitly enabled using configure .IP "acl: access control list" .IP "selinux: selinux attributes" .IP "xattrs: extended attributes" .IP "e2fsattrs: file attributes on a second extended file system .LP Please note that 'I' and 'c' are incompatible. When the name of a file is changed, it's ctime is updated as well. When you put 'c' and 'I' in the same rule the, a changed ctime is silently ignored. .LP When 'ANF' is used, new files are added to the new database, but are ignored in the report. .LP When 'ARF' is used, files missing on disk are omitted from the new database, but are ignored in the report. .PP .SH EXAMPLES .IP .B "/ R" .LP This adds all files on your machine to the database. This is one line is a fully qualified configuration file. .IP .B "!/dev" .LP This ignores the /dev directory structure. .IP .B "=/tmp" .LP Only /tmp is taken into the database. None of its children are added. .IP .B "\fBAll\fR=p+i+n+u+g+s+m+c+a+md5+sha1+tiger+rmd160" .LP This line defines group \fBAll\fR. It has all attributes and all md checksum functions. If you absolutely want all digest functions then you should enable mhash support and add +crc32+haval+gost to the end of the definition for \fBAll\fR. Mhash support can only be enabled at compile-time. .PP .SH HINTS .IP .B "=/foo p+i+l+n+u+g+s+m+c+md5" .IP .B "/foo/bar p+i+l+n+u+g+s+m+c+md5" .LP This config adds all files under /foo because they match to regex /foo, which is equivalent to /foo.* . What you probably want is: .IP .B "=/foo$ p+i+l+n+u+g+s+m+c+md5" .IP .B "/foo/bar p+i+l+n+u+g+s+m+c+md5" .LP Note that the following still works as expected because =/foo$ stop recuring of directory /foo. .IP .B "=/foo p+i+l+n+u+g+s+m+c+md5" .LP In the following, the first is not allowed in AIDE. Use the latter instead. .IP .B "/foo epug" .IP .B "/foo e+p+u+g" .PP .SH "SEE ALSO" .BR aide (1) .BR http://www.cs.tut.fi/~rammer/aide/manual.html .SH DISCLAIMER All trademarks are the property of their respective owners. No animals were harmed while making this webpage or this piece of software. aide-0.16~a2.git20130520/doc/aide.conf.in000066400000000000000000000064631214657706600173340ustar00rootroot00000000000000# # AIDE @VERSION@ # # example configuration file # # IMPORTANT NOTE!! PLEASE READ # # This configuration file checks the integrity of the # AIDE package. # # This file is not intended to be used as the primary aide.conf file for # your system. This file is intended to be a showcase for different # features for aide.conf file. # # WRITE YOUR OWN CONFIGURATION FILE AND UNDERSTAND WHAT YOU ARE WRITING # # # Default values for the parameters are in comments before the # corresponding line. # @@define TOPDIR @abs_top_srcdir@ @@ifndef TOPDIR @@define TOPDIR / @@endif @@ifdef DEBUG @@define DEBUG ison @@undef NOT_DEBUG @@else @@define NOT_DEBUG true @@undef DEBUG @@endif @@ifhost korppi @@define KORPPI yes @@endif @@ifnhost ftp @@define BUMMER true @@endif # The location of the database to be read. #database=file:aide.db database=file:@@{TOPDIR}/doc/aide.db # The location of the database to be written. #database_out=sql:host:port:database:login_name:passwd:table #database_out=file:aide.db.new database_out=file:aide.db.new # Whether to gzip the output to database # gzip_dbout=no #verbose=5 verbose=20 #report_url=stdout #other possibilities #report_url=stderr #NOT IMPLEMENTED report_url=mailto:root@foo.com #report_url=file:/tmp/some_file.txt #report_url=syslog:LOG_AUTH report_url=stdout # @@{TOPDIR} is replaced with @abs_top_srcdir@ when # read by aide. #p: permissions #ftype: file type #i: inode #n: number of links #l: link name #u: user #g: group #s: size #b: block count #m: mtime #a: atime #c: ctime #S: check for growing size #I: ignore changed filename #md5: md5 checksum #sha1: sha1 checksum #sha256: sha256 checksum #sha512: sha512 checksum #rmd160: rmd160 checksum #tiger: tiger checksum #haval: haval checksum #crc32: crc32 checksum #R: p+ftype+i+l+n+u+g+s+m+c+md5 #L: p+ftype+i+l+n+u+g #E: Empty group #>: Growing logfile p+ftype+l+u+g+i+n+S #The following are available if you have mhash support enabled: #gost: gost checksum #whirlpool: whirlpool checksum #The following are available and added to the default groups R, L and > #only when explicitly enabled using configure: #acl: access control list #selinux SELinux security context #xattrs: extended file attributes #e2fsattrs: file attributes on a second extended file system # Rule definition All=R+a+sha1+rmd160+sha256+sha512+tiger@aideextragroups@ # report_attributes is a special rule definition # the attributes listed in it are alway displayed for changed files # in the final report #report_attributes = u+g # ignore_list is a special rule definition # the attributes listed in it are not displayed in the # final report, it overrules report_attributes where they conflict #ignore_list = b # Attributes that can be used to verify that aide in intact # by people that have downloaded it from the web. # Let's be paranoid Norm=l+s+n+b+md5+sha1+rmd160+sha256+sha512+tiger@aideextragroups@ # The commented rules are just examples the rest are used by # make check #Selection regexp rule @@{TOPDIR}/.* Norm #Equals selection only the directory doc is checked and not it's children #=@@{TOPDIR}/doc L #Negative selection no rule is necessary but ignored if there !@@{TOPDIR}/.*~ !@@{TOPDIR}/src/.*\.o !@@{TOPDIR}/src/(aide|core)$ L !@@{TOPDIR}/.*RCS !@@{TOPDIR}/.*CVS !@@{TOPDIR}/.*aide\.db.* !@@{TOPDIR}/.*\.cvsignore.* # @@{TOPDIR}/doc/.* All aide-0.16~a2.git20130520/doc/manual.html000066400000000000000000000605121214657706600173140ustar00rootroot00000000000000 AIDE Manual version 0.16a2

The AIDE manual

About this document

This manual is by no means complete, usable, readable, comprehensible, or error free.

If you have any corrections, additions or constructive comments, please report them as bugs, patches or feature requests here.

This document was originally written by Rami Lehti <rammer@cs.tut.fi> with additions made by Marc Haber <mh+aide-manual@zugschlus.de> and Richard van den Berg <richard@vdberg.org> .

Table of Contents

  1. About this document
  2. Table of Contents
  3. What is AIDE?
  4. Compiling AIDE
  5. Configuration
  6. Usage
  7. Database and config signing
  8. General guidelines for security

What is AIDE?

AIDE (Advanced Intrusion Detection Environment) is an intrusion detection program. More specifically a file integrity checker.

AIDE constructs a database of the files specified in aide.conf, AIDE's configuration file. The AIDE database stores various file attributes including: permissions, inode number, user, group, file size, mtime and ctime, atime, growing size, number of links and link name. AIDE also creates a cryptographic checksum or hash of each file using one or a combination of the following message digest algorithms: sha1, sha256, sha512, md5, rmd160, tiger (gost and whirlpool can be compiled in if mhash support is available). Additionaly, the extended attributes acl, xattr and selinux can be used when expliticly enabled during compile time.

Typically, a system administrator will create an AIDE database on a new system before it is brought onto the network. This first AIDE database is a snapshot of the system in it's normal state and the yardstick by which all subsequent updates and changes will be measured. The database should contain information about key system binaries, libraries, header files, all files that are expected to remain the same over time. The database probably should not contain information about files which change frequently like log files, mail spools, proc filesystems, user's home directories, or temporary directories.

After a break-in, an administrator may begin by examinining the system using system tools like ls, ps, netstat, and who --- the very tools most likely to be trojaned. Imagine that ls has been doctored to not show any file named "sniffedpackets.log" and that ps and netstat have been rewritten to not show any information for a process named "sniffdaemond". Even an administrator who had previously printed out on paper the dates and sizes of these key system files can not be certain by comparison that they have not been modified in some way. File dates and sizes can be manipulated, some better root-kits make this trivial.

While it is possible to manipulate file dates and sizes, it is much more difficult to manipulate a single cryptographic checksum like md5, and exponentially more difficult to manipulate each of the entire array of checksums that AIDE supports. By rerunning AIDE after a break-in, a system administrator can quickly identify changes to key files and have a fairly high degree of confidence as to the accuracy of these findings.

Unfortunately, AIDE can not provide absolute sureness about change in files. Like any other system file, AIDE's binary and/or database can also be altered.

Compiling AIDE

I'm in a hurry. Bottomline about compilation.

After you have installed all the necessary sofware do ./configure;make;make install in the main AIDE directory of the unpacked source tree. You should carefully think about the configuration and what a possible hacker can do if he/her/they/it has root access.

Getting all that is needed

Before you can compile AIDE you must have certain things.

Please check to see if there are mirrors available.

Once you have the source code of AIDE you should unpack it. If you have GNU tar then the command is tar zxvf aide-version.tar.gz .

Compile-time configuration

Next you must use the configure script found in AIDE's source code package to configure the compilation process.

There are several options you can select to configure. You can find out what options are available with ./configure --help command. Most of the time you do not need to give any options. You can just use configure without any parameters.

If you want to use the bundled gnu regular expression package you can give the --with-gnu-regexp option. Some OS's that a buggy regexp implementation you must use this option.

If you want to change the directory where AIDE is installed you can use --prefix option. For example ./configure --prefix=/usr

Compilation and installation

The compilation is done by simply typing make. You can now type make install to install the binary and the manual pages. The binary however should be installed on read-only media or in some other tamperproof place. Also the databases should be kept somewhere where a possible intruder cannot change them.

Configuration

Next you have to create a configuration file. You can find more documentation for this in aide.conf(5) manual page.

There are three types of lines in aide.conf:

  • configuration lines - used to set configuration parameters and define/undefine variables
  • selection lines - indicate which files will be added to the database
  • macro lines - define or undefine variables within the the config file
Lines beginning with # are ignored as comments.

Here is an example configuration.

#AIDE conf

   # Here are all the things we can check - these are the default rules 
   #
   #p:      permissions
   #ftype:  file type
   #i:      inode
   #n:      number of links
   #l:      link name
   #u:      user
   #g:      group
   #s:      size
   #b:      block count
   #m:      mtime
   #a:      atime
   #c:      ctime
   #S:      check for growing size
   #I:      ignore changed filename
   #md5:    md5 checksum
   #sha1:   sha1 checksum
   #sha256: sha256 checksum
   #sha512: sha512 checksum
   #rmd160: rmd160 checksum
   #tiger:  tiger checksum
   #haval:  haval checksum
   #crc32:  crc32 checksum
   #R:      p+ftupe+i+l+n+u+g+s+m+c+md5
   #L:      p+ftype+i+l+n+u+g
   #E:      Empty group
   #>:      Growing logfile p+ftype+l+u+g+i+n+S
   #The following are available if you have mhash support enabled:
   #gost:   gost checksum
   #whirlpool: whirlpool checksum
   #The following are available and added to the default groups R, L and >
   #only when explicitly enabled using configure:
   #acl:    access control list
   #selinux SELinux security context
   #xattrs:  extended file attributes
   #e2fsattrs: file attributes on a second extended file system

   # You can alse create custom rules - my home made rule definition goes like this 
   #
   MyRule = p+i+n+u+g+s+b+m+c+md5+sha1 

   # Next decide what directories/files you want in the database

   /etc p+i+u+g     #check only permissions, inode, user and group for etc
   /bin MyRule      # apply the custom rule to the files in bin 
   /sbin MyRule     # apply the same custom rule to the files in sbin 
   /var MyRule		
   !/var/log/.*     # ignore the log dir it changes too often
   !/var/spool/.*   # ignore spool dirs as they change too often
   !/var/adm/utmp$  # ignore the file /var/adm/utmp


Here we include files in /etc, /bin and /sbin. We also include /var but ignore /var/log, /var/spool and a single file /var/adm/utmp.

It is generally a good idea to ignore directories that frequently change, unless you want to read long reports. It is good practice to exclude tmp directories, mail spools, log directories, proc filesystems, user's home directories, web content directories, anything that changes regularly. It is also good practice to include all system binaries, libraries, include files, system source files. It will also be a good idea to include directories you don't often look in like /dev /usr/man/.*usr/. Of course you'll want to include as many files as practical, but think about what you include.

One example: If you have a block device whose owner is changing frequently, you can configure aide to just check the attributes that do not normally change (inode, number of links, ctime).

Note that if you are referring to a single file you should add $ to the end of the regexp. This matches to the name of the file exactly and does not include any other files that might have the same beginning. In the example, all filenames beginning with /var/adm/utmp would be ignored if there were no dollar sign at the end of the last line. An intruder could then create a directory called /var/adm/utmp_root_kit and place all the files he/she/they wanted there and they would be ignored by AIDE.

There are two special group definitions to tweak what attributes are printed in the report. First report_attributes lists those attributes that are always printed from changed files. For example, if you say

report_attributes = u+g
and the size of a file changes, it's user and group id will also be printed in the report. Secondly, ignore_list defines which attributes to ignore from the report. For example, if you define
ignore_list = b
and this size of a file changes, it's block count will not be printed in the report, even if it did change as well. Ignore_list overrules report_attributes where they conflict.

Troubleshooting your config

Making a config file is a lot of hard work and must be done on a case by case bases. Don't give up simply because you don't get it right the first time around. This section gives you a few hints on how to debug your config.

You can use aide --verbose=255 to generate a lot of debug output to help you see which files get added and which are discarded. The following section gives some more information about AIDE's rule matching algorithm.

Understanding AIDE rule matching

Before reading this you should have basic understanding of how regular expressions work. There are several good books about this. Several Perl-books also have decent explanations about this subject. Just remember that Perl has some extensions to the standard regexps. There are also some differences in how different platforms handle regexps if you are using your platforms own regexp implementation. For example GNU regexps have their own extensions. Try reading the manual page of your system in this case. It might be a pain to read but it is worth it.

As you already know, aide has three types of selection lines:

  • Regular selection lines, beginning with "/".
  • Equals selection lines, beginning with "=".
  • Negative selection lines, beginning with "!".
The string following the first character is taken as a regular expression matching to a complete filename, including the path. In a regular selection rule, the slash is included in the regular expression. An implicit ^ is added in front of each rule. A group definition follows the regular expression.

When reading the configuration file, aide internally builds a tree that roughly resembles the directory tree to be checked. Each node corresponds to a directory, and each node has one rule list for the associated regular selection lines, one for the associated negative selection lines and one for the associated equals selection lines. If there is no associated rule, the respective list may be empty.

aide tries to place a rule as far down in the tree as possible while still assuring that it is above all files that it matches. This is determined by the first "special" regexp character in the rule. For example, !/proc would be placed in the root node, !/proc/.* would be placed in the /proc node, !/var/log/syslog* is placed in the /var/log node and, finally, !/home/[a-z0-9]+/.bashrc$ is placed in the /home node.

The algorithm that aide uses for rule matching is described in the following paragraphs. The pseudocode is an adaption from src/gen_list.c.

check_node_for_match(node,filename,first_time)
	if (first_time)
        	check(equals list for this node)

	check(regular list for this node)

	if (node is not the root node)
		check_node_for_match(nodes parent,filename,false)

	if (this file is about to be added)
		check(negative list for this node)

	return (info about whether this file should be added or not and how)
When aide needs to determine whether a file found in the file system is to be checked, it first determines the deepest possible node x to match the current file against (that algorithm is not part of the pseudocode above), and then calls check-node_for_match(x, filename, true). So, the recursion starts at the deepest possible match.

As it can also be seen, equals selection lines are only checked in the first recursion step, thus providing some kind of speed optimization by reducing the number of necessary regular expression evaluations, which is a quite expensive operation.

Pitfalls

There are some side-effects from this algorithm that might seem strange at first. For example if you have the following rules:

/ R
=/etc R+a
!/etc/ppp/logs
The result would be that /etc and all files in it and in /etc/ppp except /etc/ppp/logs would be added to the database. This is perfectly normal. This happens because the =/etc matches not only /etc but all the files under it. Remember that regexps match always just the part they are referring to. The rest of the line is included by default. So =/etc$ R+a would be the correct form. If you don't have the !/etc/ppp/logs you would get the results that you are looking for because there is no node /etc in the regexp tree and there for it is not checked when AIDE constructs the list of files to add to the database. But when you have the negative rules the nodes /etc and /etc/ppp get created and they get checked when the file list is generated. So the =/etc is used to find a match in those nodes and it succeeds.

Consider the following rules:

/ R
=/var/log/messages$ R+a
!/var/log/messages.*
This is what you might write if you want to check /var/log/messages but not /var/log/messages.0 and /var/log/messages.1 etc. However since the negative selection rules are checked last and .* can match to an empty string /var/log/messages is not added to the database. The following is a more correct way of doing it.
/ R
=/var/log/messages$ R+a
!/var/log/messages\.[0-9]$
Now only messages files ending in number 0-9 are not included in the database. Note an intruder could disguise a rootkit by creating a directory called messages.9. If messages.9 does not already exist that is.

Consider the following rules:

/ n+p+l+i+u+g+s+b+m+c+md5+sha1+rmd160+haval+gost+crc32+tiger
/etc$ n+p+l+i+u+g
/etc/resolv.conf$ n+p+l+u+g
This way, changing /etc/resolv.conf will also report /etc as having their mtime and ctime changed, even if /etc is configured not to be checked for mtime and ctime. The reason is that aide only uses a deepest-match algorithm to find the tree node to search, but a first-match algorithm inside the node. Since /etc is in the / directory, /etc will match the rule for the root directory and ignore the specialized /etc rule.

Rearranging the configuration like this:

/etc/resolv.conf$ n+p+l+u+g
/etc$ n+p+l+i+u+g
/ n+p+l+i+u+g+s+b+m+c+md5+sha1+rmd160+haval+gost+crc32+tiger
will solve the issue. It is generally a good idea to write the most general rules last.

Usage

First you must create a database against which future checks are performed. This should be done immediately after the operating system and applications have been installed, before the machine is plugged into a network. You can do this by giving the command aide --init. This creates a database that contains all of the files that you selected in your config file. The newly created database should now be moved to a secure location such as read-only media. You should also place the configuration file and the AIDE binary and preferably the manual pages and this manual on that media also. Please remember to edit the configuration file so that the input database is read from that read-only media. The config file should not be kept on the target machine. The attacker could read the config file and alter it and if he does alter it he could place his rootkit in a place that AIDE does not check. So the read-only media should be accessible only during the check.

Now you are all set to go. You can now check the integrity of the files. This can be done by giving the command aide --check. AIDE now reads the database and compares it to the files found on the disk. AIDE may find changes in places that might not expect. For instance tty devices often change owners and permissions. You may want to read long reports and that is up to you to decide. But most of us do not have the time or the inclination read through tons of garbage every day, so you should trim the config file to include only the files and attributes of certain files that should not change. But keep in mind that you should not ignore too much as that leaves you open for an attack. An intruder might place his/her/its/their root kit in a directory that you have ignored completely. One good example is /var/spool/lp or something similar. This is the place that lp daemon stores its temporary files. You should not ignore it completely however. You should only ignore the format of files that you lp daemon keeps creating. And remember to use the $-sign at the end of your regexps. This stops someone from creating a directory that is ignored along with its contents.

Now that you have trimmed your config file you should update the database. This can be done by: aide --update The update command also does the same thing as check but it creates a new database. This database should now be placed on that read-only media along with the new config file. The check, trim, update cycle should be repeated as long as necessary. I recommend that the config file should be reviewed once in a while. The definition of "a while" depends on your paranoia. Some might want do it daily after each check. Some might want to do it weekly.

There is usually some drift in the databases. What I mean by drift is that new files are created, config files of applications are edited, tons of small changes pile up until the report becomes unreadable. This can be avoided by updating the database once in a while. I myself run the update every night. But, I don't replace the input database nearly as often. The replacement of the input datbase should always be a manual operation. This should not be automated.

There is also an alternative way of doing this. This method may be preferable for people that have lots of machines that run aide. You can run aide --init on all of the hosts and move the generated databases to a central host where you compare different versions of the databases with aide --compare This has the benefit of freeing up resources on the monitored machines.

Database and config signing

The security of AIDE can be increased by signing the configuration and/or database. When a database is signed, and it is changed manually, AIDE will refuse to use it. Likewise, if a configuration is signed, AIDE will not use it until the embedded hash is updated as well.

To make use of the signing features, use these options to the configure script:

--with-confighmactype=TYPE
Hash type to use for checking config. Valid values are md5 and sha1.
--with-confighmackey=KEY
HMAC hash key to use for checking config. Must be a base64 encoded byte stream. Maximum string length is 31 chars.
--with-dbhmactype=TYPE
Hash type to use for checking db. Valid values are md5 and sha1.
--with-dbhmackey=KEY
HMAC hash key to use for checking db. Must be a base64 encoded byte stream. Maximum string lentgth is 31 chars.
The base64 encoding was chosen so that the keys are not limited to printable characters. You can use a local base64 tool or an online base64 encoder to convert the keys to the right format. Then run configure, for example:

./configure --with-confighmactype=sha1 -with-confighmackey="YWlkZSBhaWRlIGFpZGUgYWlkZQo=" --with-dbhmactype=sha1 --with-dbhmackey="YWlkZSBhaWRlIGFpZGUgYWlkZQo="

To make the presence of a valid signature mandatory, the following configure options can be used:

--enable-forced_dbmd
Forces the file/pipe database's to have checksum.
--enable-forced_configmd
Forces the config to have checksum. Also disables --config-check
It is also possible to edit the config.h file by hand, and changing the values of the FORCEDBMD and FORCECONFIGMD macros.

Creating the hash for the aide.db database is done by running aide --init or aide --update. The hash for the aide.conf configuration file can be obtained by running aide --config-check:

$ aide --config-check
Config checked. Use the following to patch your config file.
0a1
> @@begin_config 27GF0+oKj1CvP4tltuibhu8YGIU=
13a15
> @@end_config
The @@begin_config and @@end_config can be added to the aide.conf file manually, or the output of aide --config-check can be directly piped into patch:
$ aide --config-check | patch
can't find file to patch at input line 2
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|Config checked. Use the following to patch your config file.
--------------------------
File to patch: /etc/aide.conf
patching file /etc/aide.conf
Using forced_configmd will make AIDE refuse to use unsigned configuration files. This also disables the --config-check option. This only makes sense if you already have a signed configuration, or if you have an AIDE executable on another machine that can create the signed configurations for you.

Miscellaneous

The AIDE database can be used to find the real names and places of files that have been moved to lost+found directory by fsck.

General guidelines for security

  1. Do not assume anything
  2. Trust no-one,nothing
  3. Nothing is secure
  4. Security is a trade-off with usability
  5. Paranoia is your friend
aide-0.16~a2.git20130520/include/000077500000000000000000000000001214657706600160235ustar00rootroot00000000000000aide-0.16~a2.git20130520/include/Makefile.am000066400000000000000000000020121214657706600200520ustar00rootroot00000000000000# # aide, Advanced Intrusion Detection Environment # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING. If not, write to # the Free Software Foundation, 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # noinst_HEADERS = aide.h base64.h be.h commandconf.h compare_db.h \ conf_lex.h db_config.h db_disk.h db_file.h db.h db_list.h \ db_sql.h do_md.h fopen.h gen_list.h getopt.h gnu_regex.h \ list.h locale-aide.h md.h report.h seltree.h \ symboltable.h types.h url.h util.h aide-0.16~a2.git20130520/include/Makefile.in000066400000000000000000000314401214657706600200720ustar00rootroot00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # # aide, Advanced Intrusion Detection Environment # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING. If not, write to # the Free Software Foundation, 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = include DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/version.m4 $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLLIB = @ACLLIB@ ACLOCAL = @ACLOCAL@ AIDE_DEFS = @AIDE_DEFS@ AIDE_USE_LOCALE = @AIDE_USE_LOCALE@ AMTAR = @AMTAR@ ATTRLIB = @ATTRLIB@ AUDITLIB = @AUDITLIB@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CRYPTLIB = @CRYPTLIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ E2FSATTRSLIB = @E2FSATTRSLIB@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ELFLIB = @ELFLIB@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PSQLLIB = @PSQLLIB@ RANLIB = @RANLIB@ SELINUXLIB = @SELINUXLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ curlconfig = @curlconfig@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_HEADERS = aide.h base64.h be.h commandconf.h compare_db.h \ conf_lex.h db_config.h db_disk.h db_file.h db.h db_list.h \ db_sql.h do_md.h fopen.h gen_list.h getopt.h gnu_regex.h \ list.h locale-aide.h md.h report.h seltree.h \ symboltable.h types.h url.h util.h all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu include/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ ctags distclean distclean-generic distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: aide-0.16~a2.git20130520/include/aide.h000066400000000000000000000055011214657706600170770ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2002,2004-2006,2010,2011 Rami Lehti, Pablo * Virolainen, Richard van den Berg, Hannes von Haugwitz * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AIDE_H_INCLUDED #define _AIDE_H_INCLUDED #include "config.h" #include "types.h" #include "db_config.h" #include #include #if HAVE_INTTYPES_H # include #endif #if HAVE_FCNTL_H # include #endif #include "report.h" #ifndef TEMP_FAILURE_RETRY /* Evaluate EXPRESSION, and repeat as long as it returns -1 with errno' set to EINTR. */ # define TEMP_FAILURE_RETRY(expression) \ (__extension__ \ ({ long int __result; \ do __result = (long int) (expression); \ while (__result == -1L && errno == EINTR); \ __result; })) #endif #if !defined HAVE_VSNPRINTF || !defined HAVE_C99_VSNPRINTF #define vsnprintf rsync_vsnprintf int vsnprintf(char *str, size_t count, const char *fmt, va_list args); #endif #if !defined HAVE_SNPRINTF || !defined HAVE_C99_VSNPRINTF #define snprintf rsync_snprintf int snprintf(char *str,size_t count,const char *fmt,...); #endif #ifndef O_NOATIME #if defined(__linux__) && (defined(__i386__) || defined(__PPC__)) #define O_NOATIME 01000000 #else #define O_NOATIME 0 #endif #endif #ifdef strtoimax # define HAVE_STRTOIMAX #endif #if defined HAVE_OFF64_TYPE && SIZEOF_OFF64_T == SIZEOF_LONG_LONG || !defined HAVE_OFF64_TYPE && SIZEOF_OFF_T == SIZEOF_LONG_LONG # ifdef HAVE_STRTOLL # define AIDE_STRTOLL_FUNC strtoll # else # ifdef HAVE_STRTOIMAX # define AIDE_STRTOLL_FUNC strtoimax # else # define AIDE_STRTOLL_FUNC strtol # endif # endif #else # define AIDE_STRTOLL_FUNC strtol #endif #ifndef __NetBSD__ #ifndef _POSIX_C_SOURCE /* For _POSIX_THREAD_SEMANTICS _REENTRANT */ #define _POSIX_C_SOURCE 199506L #endif /* _POSIX_C_SOURCE */ #endif /* __NetBSD__ */ #define ARGUMENT_SIZE 65536 /* This is a structure that has all configuration info */ extern db_config* conf; #endif aide-0.16~a2.git20130520/include/base64.h000066400000000000000000000030311214657706600172550ustar00rootroot00000000000000/* ** ** Copyright (C) 1994 Swedish University Network (SUNET) ** Modified by Rami Lehti (C) 1999 ** $Header$ ** ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITTNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** ** ** Martin.Wendel@udac.uu.se ** Torbjorn.Wictorin@udac.uu.se ** ** UDAC ** P.O. Box 174 ** S-751 04 Uppsala ** Sweden ** */ #ifndef _BASE64_H_INCLUDED #define _BASE64_H_INCLUDED #include #include #include "types.h" #define B64_BUF 16384 #define FAIL -1 #define SKIP -2 char* encode_base64(byte* src,size_t ssize); byte* decode_base64(char* src,size_t ssize,size_t *); /* Returns decoded length */ size_t length_base64(char* src,size_t ssize); #endif /* _BASE64_H_INCLUDED */ aide-0.16~a2.git20130520/include/be.h000066400000000000000000000017471214657706600165730ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999,2000,2001,2002 Rami Lehti, Pablo Virolainen * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _BE_H_INCLUDED #define _BE_H_INCLUDED #include "db_config.h" FILE* be_init(int inout,url_t* u,int iszipped); #endif /* _BE_H_INCLUDED */ aide-0.16~a2.git20130520/include/commandconf.h000066400000000000000000000046071214657706600204670ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2002,2006,2011 Rami Lehti, Pablo Virolainen, * Richard van den Berg, Hannes von Haugwitz * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _COMMANDCONF_H_INCLUDED #define _COMMANDCONF_H_INCLUDED #include "list.h" #include "db_config.h" extern long conf_lineno; extern int newlinelastinconfig; int commandconf(const char mode,const char* line); int conf_input_wrapper(char* buf, int max_size, FILE* in); int db_input_wrapper(char* buf, int max_size, int db); list* append_rxlist(char*,DB_ATTR_TYPE,list*); void do_define(char*,char*); void do_undefine(char*); int do_ifxdef(int,char*); int do_ifxhost(int,char*); void do_groupdef(char*,DB_ATTR_TYPE); DB_ATTR_TYPE get_groupval(char*); void putbackvariable(char*); int handle_endif(int doit,int allow_else); void do_dbdef(int, char*); void do_verbdef(char*); void do_replevdef(char*); void do_repurldef(char*); void do_rootprefix(char*); int check_db_order(DB_FIELD*,int, DB_FIELD); void* get_db_key(void); void* get_conf_key(void); size_t get_db_key_len(void); size_t get_conf_key_len(void); extern const char* aide_key_1; extern const char* aide_key_2; extern const char* aide_key_3; extern const char* aide_key_4; extern const char* aide_key_5; extern const char* aide_key_6; extern const char* aide_key_7; extern const char* aide_key_8; extern const char* aide_key_9; extern const char* aide_key_0; extern const char* db_key_1; extern const char* db_key_2; extern const char* db_key_3; extern const char* db_key_4; extern const char* db_key_5; extern const char* db_key_6; extern const char* db_key_7; extern const char* db_key_8; extern const char* db_key_9; extern const char* db_key_0; #endif aide-0.16~a2.git20130520/include/compare_db.h000066400000000000000000000021471214657706600202730ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2002,2006,2010 Rami Lehti, Pablo Virolainen, * Richard van den Berg, Hannes von Haugwitz * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _COMPARE_DB_H_INCLUDED #define _COMPARE_DB_H_INCLUDED #include "list.h" #include "db_config.h" #include "seltree.h" /* * gen_report() * Generate report based on the given node */ int gen_report(seltree* node); #endif aide-0.16~a2.git20130520/include/conf_lex.h000066400000000000000000000021231214657706600177670ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2002,2006 Rami Lehti, Pablo Virolainen, Richard * van den Berg * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _CONF_LEX_H_INCLUDED_ #define _CONF_LEX_H_INCLUDED_ void conf_put_token(const char* s); extern int conferror(const char*); extern int conflex(void); extern int confparse(void); extern void* conf_scan_string(char*); #endif aide-0.16~a2.git20130520/include/db.h000066400000000000000000000032401214657706600165600ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2002,2004,2005,2013 Rami Lehti, Pablo Virolainen, * Richard van den Berg, Hannes von Haugwitz * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _DB_H_INCLUDED #define _DB_H_INCLUDED #include #include "db_config.h" int db_init(int); db_line* db_readline(int); int db_writespec(db_config*); int db_writeline(db_line*,db_config*); void db_close(); void free_db_line(db_line* dl); extern const char* db_names[]; extern const int db_value[]; #define DB_OLD (1<<0) #define DB_WRITE (1<<1) #define DB_NEW (1<<2) #define NODE_ADDED (1<<4) #define NODE_REMOVED (1<<5) #define NODE_CHANGED (1<<6) #define NODE_ADD_CHILDREN (1<<7) #define DB_DISK (1<<8) #define NODE_TRAVERSE (1<<9) #define NODE_CHECKED (1<<10) #define NODE_MOVED_OUT (1<<11) #define NODE_MOVED_IN (1<<12) #define NODE_ALLOW_NEW (1<<13) #define NODE_ALLOW_RM (1<<14) #endif aide-0.16~a2.git20130520/include/db_config.h000066400000000000000000000237321214657706600201150ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2002,2004-2006,2010-2013 Rami Lehti, Pablo Virolainen, * Richard van den Berg, Hannes von Haugwitz * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _DB_CONFIG_H_INCLUDED #define _DB_CONFIG_H_INCLUDED #include "aide.h" #include "types.h" #include #include #define E2O(n) (1< typedef struct acl_type{ int entries; aclent_t* acl; } acl_type; #endif #ifdef WITH_POSIX_ACL /* POSIX acl works for Sun ACL, AIUI but anyway... */ #include #ifndef WITH_ACL # error "No ACL support ... but POSIX ACL support." #endif #endif typedef struct acl_type { char *acl_a; /* ACCESS */ char *acl_d; /* DEFAULT, directories only */ } acl_type; #ifdef WITH_XATTR /* Do generic user Xattrs. */ #include #include #endif typedef struct xattr_node { char *key; byte *val; size_t vsz; } xattr_node; typedef struct xattrs_type { size_t num; size_t sz; struct xattr_node *ents; } xattrs_type; #ifdef WITH_SELINUX #include #ifndef ENOATTR # define ENOATTR ENODATA #endif #endif #ifdef WITH_E2FSATTRS #include #endif #ifdef WITH_MHASH #include #endif #ifdef WITH_ZLIB #include #endif #define RETOK 0 #define RETFAIL -1 #define DO_INIT (1<<0) #define DO_COMPARE (1<<1) #define DO_DIFF (1<<2) #include "url.h" /* typedef enum { url_file, url_stdout, url_stdin, url_stderr, url_fd, url_http, url_sql, url_syslog, url_database, url_multiplexer , url_unknown } URL_TYPE; */ /* typedef struct url_t {*/ /* Everything before the first ':' */ /* URL_TYPE type; char* value; } url_t; */ typedef enum { db_filename=0, /* "name", */ db_linkname, /* "lname", */ db_perm, /* "perm", */ db_uid, /* "uid", */ db_gid, /* "gid", */ db_size, /* "size", */ db_atime, /* "atime", */ db_ctime, /* "ctime", */ db_mtime, /* "mtime", */ db_inode, /* "inode", */ db_bcount, /* "bcount", */ db_lnkcount, /* "lcount", */ db_md5, /* "md5", */ db_sha1, /* "sha1", */ db_rmd160, /* "rmd160", */ db_tiger, /* "tiger", */ db_crc32, /* "crc32", */ db_haval, /* "haval", */ db_gost, /* "gost", */ db_crc32b, /* "crc32b", */ db_attr, /* attributes */ db_acl, /* access control list */ db_bsize, /* "bsize" */ db_rdev, /* "rdev" */ db_dev, /* "dev" */ db_checkmask, /* "checkmask"*/ db_allownewfile, /* "allownewfile */ db_allowrmfile, /* "allowrmfile" */ db_sha256, /* "sha256", */ db_sha512, /* "sha512", */ db_whirlpool, /* "whirlpool", */ db_selinux, /* "selinux", */ db_xattrs, /* "xattrs", */ db_e2fsattrs, /* "e2fsattrs" */ db_unknown } DB_FIELD; /* "unknown" */ /* db_unknown must be last because it is used to determine size of DB_FILED */ /* FIXME: THIS IS A HACK, sometimes we use AIDE_OFF_TYPE instead * because that's what internal functions take. This bitmap needs to die. */ #define DB_ATTR_TYPE unsigned long long #define DB_ATTR_UNDEF ((DB_ATTR_TYPE) -1) /* WE need this for rx_rules since enums are not orrable (horrible) */ #define DB_FILENAME (1LLU<<0) /* "name", */ #define DB_LINKNAME (1LLU<<1) /* "lname", */ #define DB_PERM (1LLU<<2) /* "perm", */ #define DB_UID (1LLU<<3) /* "uid", */ #define DB_GID (1LLU<<4) /* "gid", */ #define DB_SIZE (1LLU<<5) /* "size", */ #define DB_ATIME (1LLU<<6) /* "atime", */ #define DB_CTIME (1LLU<<7) /* "ctime", */ #define DB_MTIME (1LLU<<8) /* "mtime", */ #define DB_INODE (1LLU<<9) /* "inode", */ #define DB_BCOUNT (1LLU<<10) /* "bcount", */ #define DB_LNKCOUNT (1LLU<<11) /* "lcount", */ #define DB_MD5 (1LLU<<12) /* "md5", */ #define DB_SHA1 (1LLU<<13) /* "sha1", */ #define DB_RMD160 (1LLU<<14) /* "rmd160", */ #define DB_TIGER (1LLU<<15) /* "tiger", */ /* We want to matk these newertheless we have a hash-functon or not. */ #define DB_CRC32 (1LLU<<16) /* "crc32", */ #define DB_HAVAL (1LLU<<17) /* "haval", */ #define DB_GOST (1LLU<<18) /* "gost", */ #define DB_CRC32B (1LLU<<19) /* "crc32b", */ // #define DB_ATTR (1LLU<<20) /* "attr" */ #define DB_ACL (1LLU<<21) /* "acl" */ #define DB_BSIZE (1LLU<<22) /* "bsize" */ #define DB_RDEV (1LLU<<23) /* "rdev" */ #define DB_DEV (1LLU<<24) /* "dev" */ #define DB_CHECKMASK (1LLU<<25) /* "checkmask"*/ #define DB_SIZEG (1LLU<<26) /* "unknown" */ #define DB_CHECKINODE (1LLU<<27) /* "checkinode"*/ #define DB_NEWFILE (1LLU<<28) /* "allow new file" */ #define DB_RMFILE (1LLU<<29) /* "allot rm file" */ #define DB_SHA256 (1LLU<<30) /* "sha256", */ #define DB_SHA512 (1LLU<<31) /* "sha512", */ #define DB_SELINUX (1LLU<<32) /* "selinux", */ #define DB_XATTRS (1LLU<<33) /* "xattrs", */ #define DB_WHIRLPOOL (1LLU<<34) /* "whirlpool", */ #define DB_FTYPE (1LLU<<35) /* "file type", */ #define DB_E2FSATTRS (1LLU<<36) /* "ext2 file system attributes" */ #define DB_HASHES (DB_MD5|DB_SHA1|DB_RMD160|DB_TIGER|DB_CRC32|DB_HAVAL| \ DB_GOST|DB_CRC32B|DB_SHA256|DB_SHA512|DB_WHIRLPOOL) extern const char* db_names[db_unknown+1]; extern const int db_value[db_unknown+1]; /* db_namealias && db_aliasvalue are here to support earlier database * names that are no longer used. */ #define db_alias_size 1 extern const char* db_namealias[db_alias_size]; extern const int db_aliasvalue[db_alias_size]; /* TIMEBUFSIZE should be exactly ceil(sizeof(time_t)*8*ln(2)/ln(10)) * Now it is ceil(sizeof(time_t)*2.5) * And of course we add one for end of string char */ #define TIMEBUFSIZE (((sizeof(time_t)*5+1)>>1)+1) /* New db_config Not used yet, maybe someday. */ /* typedef struct _db_config { */ /* url_t* url; */ /* config* conf; */ /* int inout; */ /* int (*init)(url*,int,config*); */ /* char** (*readline)(_db_config*); */ /* int (*writeline)(_db_config*,db_line* line); */ /* int (*close)(_db_config*); */ /* int db_size; */ /* DB_FIELD* db_order; */ /* void* local; */ /* }_db_config ; */ #include "seltree.h" typedef struct db_line { byte* md5; byte* sha1; byte* rmd160; byte* tiger; byte* sha256; byte* sha512; byte* crc32; /* MHASH only */ byte* haval; byte* gost; byte* crc32b; byte* whirlpool; acl_type* acl; /* Something here.. */ mode_t perm; mode_t perm_o; /* Permission for tree traverse */ uid_t uid; gid_t gid; time_t atime; time_t ctime; time_t mtime; AIDE_INO_TYPE inode; nlink_t nlink; AIDE_OFF_TYPE size; AIDE_OFF_TYPE size_o; /* ... */ AIDE_BLKCNT_TYPE bcount; char* filename; char* fullpath; char* linkname; char *cntx; xattrs_type* xattrs; unsigned long e2fsattrs; /* Attributes .... */ DB_ATTR_TYPE attr; } db_line; typedef struct db_config { url_t* db_in_url; FILE* db_in; url_t* db_new_url; FILE* db_new; url_t* db_out_url; FILE* db_out; int config_check; struct md_container *mdc_in; struct md_container *mdc_out; struct db_line *line_db_in; struct db_line *line_db_out; DB_ATTR_TYPE db_attrs; #ifdef WITH_ZLIB gzFile db_gzin; gzFile db_gznew; gzFile db_gzout; /* Is dbout gzipped or not */ int gzip_dbout; #endif int db_in_size; DB_FIELD* db_in_order; int db_new_size; DB_FIELD* db_new_order; int db_out_size; DB_FIELD* db_out_order; char* config_file; char* config_version; int do_dbnewmd; int do_dboldmd; #ifdef WITH_MHASH int do_configmd; MHASH confmd; hashid confhmactype; char* old_confmdstr; hashid dbhmactype; MHASH dbnewmd; MHASH dboldmd; #endif char* old_dbnewmdstr; char* old_dboldmdstr; /* The following three a lists of rx_rule*s */ list* selrxlst; list* equrxlst; list* negrxlst; int verbose_level; int report_detailed_init; int report_base16; int use_initial_errorsto; url_t* initial_report_url; FILE* initial_report_fd; /* report_url is a list of url_t*s */ list* report_url; /* report_fd is a list of FILE*s */ list* report_fd; /* Report syslog */ int report_syslog; int report_db; /* defsyms is a list of symba*s */ list* defsyms; /* so is groupsyms */ list* groupsyms; /* What are we supposed to do */ int action; /* Should we catch errors from mmapping */ int catch_mmap; time_t start_time; time_t end_time; int symlinks_found; DB_ATTR_TYPE attr; #ifdef WITH_ACL int no_acl_on_symlinks; #endif int warn_dead_symlinks; int grouped; int summarize_changes; char* root_prefix; int root_prefix_length; struct seltree* tree; } db_config; #ifdef WITH_PSQL #include "libpq-fe.h" typedef struct psql_data{ PGconn* conn; char* table; PGresult *res; int des[db_unknown]; int curread; int maxread; } psql_data; #endif #endif aide-0.16~a2.git20130520/include/db_disk.h000066400000000000000000000017551214657706600176030ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2002,2011 Rami Lehti, Pablo Virolainen, Hannes von * Haugwitz * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _DB_DISK_H_INCLUDED #define _DB_DISK_H_INCLUDED #include "db.h" db_line* db_readline_disk(); int db_disk_init(void); #endif aide-0.16~a2.git20130520/include/db_file.h000066400000000000000000000025511214657706600175630ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2002,2006 Rami Lehti, Pablo Virolainen, Richard * van den Berg * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _DB_FILE_H_INCLUDED #define _DB_FILE_H_INCLUDED #include "db.h" extern void db_buff(int, FILE*); extern int db_scan(void); /* Rumaa.... */ extern char* dbtext; /* Todella rumaa... */ extern long* db_lineno; extern long db_in_lineno; extern long db_new_lineno; char** db_readline_file(int); int db_writespec_file(db_config*); int db_writeline_file(db_line* line,db_config* conf,url_t* url); int db_close_file(db_config* conf); #ifdef WITH_ZLIB void handle_gzipped_input(int out,gzFile*); #endif #endif aide-0.16~a2.git20130520/include/db_list.h000066400000000000000000000023461214657706600176210ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2002,2010 Rami Lehti,Pablo Virolainen, Richard van * den Berg * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _DB_LIST_H_INCLUDED #define _DB_LIST_H_INCLUDED #include /* for NULL */ typedef struct db_list{ struct db_list* next; struct db_list* prev; struct db_list* head; struct db_list* tail; } db_list; /* Only the head knows for sure where the tail is */ static db_list* db_list_head=NULL; void db_list_append(db_list*item); #endif /* _DB_LIST_H_INCLUDED */ aide-0.16~a2.git20130520/include/db_sql.h000066400000000000000000000040451214657706600174430ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2002,2004,2006,2010 Rami Lehti, Pablo Virolainen, * Richard van den Berg * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _DB_SQL_H_INCLUDED #define _DB_SQL_H_INCLUDED static const char* db_sql_types[] = { "text unique primary key",/* "name", */ "text", /* "lname", */ "int", /* "perm", */ "int", /* "uid", */ "int", /* "gid", */ "bigint", /* "size", */ "text", /* "atime", */ "text", /* "ctime", */ "text", /* "mtime", */ "int", /* "inode", */ "int", /* "bcount", */ "int", /* "lcount", */ "text", /* "md5", */ "text", /* "sha1", */ "text", /* "rmd160", */ "text", /* "tiger", */ "text", /* "crc32", */ "text", /* "haval", */ "text", /* "gost", */ "text", /* "crc32b", */ "int", /* "attr", */ "text", /* "acl", */ "int", /* "checkmask", */ "text" /* "unknown" */ }; int db_close_sql(void*); db_line* db_readline_sql(int db, db_config* conf); int db_writeline_sql(db_line* line,db_config* conf); int db_writespec_sql(db_config* conf); #endif aide-0.16~a2.git20130520/include/do_md.h000066400000000000000000000025501214657706600172600ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2002,2006,2010,2011 Rami Lehti, Pablo Virolainen, * Richard van den Berg, Hannes von Haugwitz * * $Header$ * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _DO_MD_H_INCLUDED #define _DO_MD_H_INCLUDED #ifdef WITH_MHASH #include "mhash.h" #endif #include "list.h" #include "db_config.h" #define BUFSIZE 16384 list* do_md(list* file_lst,db_config* conf); #ifdef WITH_ACL void acl2line(db_line* line); #endif #ifdef WITH_XATTR void xattrs2line(db_line *line); #endif #ifdef WITH_SELINUX void selinux2line(db_line *line); #endif #ifdef WITH_E2FSATTRS void e2fsattrs2line(db_line* line); #endif #endif /* _DO_MD_H_INCLUDED */ aide-0.16~a2.git20130520/include/fopen.h000066400000000000000000000021551214657706600173060ustar00rootroot00000000000000/* see src/fopen.c for copyright information */ #ifndef _FOPEN_H_INCLUDED #define _FOPEN_H_INCLUDED #include #include #ifndef WIN32 # include #endif #include #include #include enum fcurl_type_e { CFTYPE_NONE=0, CFTYPE_FILE=1, CFTYPE_CURL=2 }; struct fcurl_data { enum fcurl_type_e type; /* type of handle */ union { CURL *curl; FILE *file; } handle; /* handle */ char *buffer; /* buffer to store cached data*/ size_t buffer_len; /* currently allocated buffers length */ size_t buffer_pos; /* end of data in buffer*/ int still_running; /* Is background url fetch still in progress */ }; typedef struct fcurl_data URL_FILE; /* exported functions */ URL_FILE *url_fopen(const char *url,const char *operation); int url_fclose(URL_FILE *file); int url_feof(URL_FILE *file); size_t url_fread(void *ptr, size_t size, size_t nmemb, URL_FILE *file); char * url_fgets(char *ptr, size_t size, URL_FILE *file); void url_rewind(URL_FILE *file); #endif /* _FOPEN_H_INCLUDED */ aide-0.16~a2.git20130520/include/gen_list.h000066400000000000000000000037661214657706600200140ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2002,2006,2010 Rami Lehti,Pablo Virolainen, * Richard van den Berg, Hannes von Haugwitz * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _GEN_LIST_H_INCLUDED #define _GEN_LIST_H_INCLUDED #include "seltree.h" #include "list.h" #include "gnu_regex.h" /* DB_FOO are anded together to form rx_rule's attr */ typedef struct rx_rule { char* rx; /* Regular expression in text form */ regex_t* crx; /* Compiled regexp */ DB_ATTR_TYPE attr; /* Which attributes to save */ long conf_lineno; /* line no. of rule definition*/ } rx_rule; int compare_node_by_path(const void *n1, const void *n2); /* * gen_tree() * Generates the file tree * from rx_rule's */ seltree* gen_tree(list* prxlist,list* nrxlist,list* erxlist); /* * populate_tree() * Populate tree with data from disk and db * Also do comparing while adding to the tree */ void populate_tree(seltree* tree); /* * strrxtok() * return a pointer to a copy of the non-regexp path part of the argument */ char* strrxtok(char*); int check_list_for_match(list*,char*,DB_ATTR_TYPE*); int check_rxtree(char* filename,seltree* tree, DB_ATTR_TYPE* attr); db_line* get_file_attrs(char* filename,DB_ATTR_TYPE attr); seltree* get_seltree_node(seltree* tree,char* path); #endif /*_GEN_LIST_H_INCLUDED*/ aide-0.16~a2.git20130520/include/getopt.h000066400000000000000000000133461214657706600175050ustar00rootroot00000000000000/* Declarations for getopt. Copyright (C) 1989,90,91,92,93,94,96,97,98 Free Software Foundation, Inc. This file was part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _GETOPT_H #ifndef __need_getopt # define _GETOPT_H 1 #endif #ifdef __cplusplus extern "C" { #endif /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ extern char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ extern int optind; /* Callers store zero here to inhibit the error message `getopt' prints for unrecognized options. */ extern int opterr; /* Set to an option character which was unrecognized. */ extern int optopt; #ifndef __need_getopt /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector of `struct option' terminated by an element containing a name which is zero. The field `has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field. */ struct option { # if defined __STDC__ && __STDC__ const char *name; # else char *name; # endif /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* Names for the values of the `has_arg' field of `struct option'. */ # define no_argument 0 # define required_argument 1 # define optional_argument 2 #endif /* need getopt */ /* Get definitions and prototypes for functions to process the arguments in ARGV (ARGC of them, minus the program name) for options given in OPTS. Return the option character from OPTS just read. Return -1 when there are no more options. For unrecognized options, or options missing arguments, `optopt' is set to the option letter, and '?' is returned. The OPTS string is a list of characters which are recognized option letters, optionally followed by colons, specifying that that letter takes an argument, to be placed in `optarg'. If a letter in OPTS is followed by two colons, its argument is optional. This behavior is specific to the GNU `getopt'. The argument `--' causes premature termination of argument scanning, explicitly telling `getopt' that there are no more options. If OPTS begins with `--', then non-option arguments are treated as arguments to the option '\0'. This behavior is specific to the GNU `getopt'. */ #if defined __STDC__ && __STDC__ # ifdef __GNU_LIBRARY__ /* Many other libraries have conflicting prototypes for getopt, with differences in the consts, in stdlib.h. To avoid compilation errors, only prototype getopt for the GNU C library. */ extern int getopt (int __argc, char *const *__argv, const char *__shortopts); # else /* not __GNU_LIBRARY__ */ extern int getopt (); # endif /* __GNU_LIBRARY__ */ # ifndef __need_getopt extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, const struct option *__longopts, int *__longind); extern int getopt_long_only (int __argc, char *const *__argv, const char *__shortopts, const struct option *__longopts, int *__longind); /* Internal only. Users should not call this directly. */ extern int _getopt_internal (int __argc, char *const *__argv, const char *__shortopts, const struct option *__longopts, int *__longind, int __long_only); # endif #else /* not __STDC__ */ extern int getopt (); # ifndef __need_getopt extern int getopt_long (); extern int getopt_long_only (); extern int _getopt_internal (); # endif #endif /* __STDC__ */ #ifdef __cplusplus } #endif /* Make sure we later can get all the definitions and declarations. */ #undef __need_getopt #endif /* getopt.h */ aide-0.16~a2.git20130520/include/gnu_regex.h000066400000000000000000000445341214657706600201710ustar00rootroot00000000000000/* Definitions for data structures and routines for the regular expression library, version 0.12. Copyright (C) 1985, 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __REGEXP_LIBRARY_H__ #define __REGEXP_LIBRARY_H__ /* POSIX says that must be included (by the caller) before . */ #ifdef VMS /* VMS doesn't have `size_t' in , even though POSIX says it should be there. */ #include #endif #ifdef _WIN32 /* Same for Microsoft Visual C++ */ #include #endif /* The following bits are used to determine the regexp syntax we recognize. The set/not-set meanings are chosen so that Emacs syntax remains the value 0. The bits are given in alphabetical order, and the definitions shifted by one from the previous bit; thus, when we add or remove a bit, only one other definition need change. */ typedef unsigned reg_syntax_t; /* If this bit is not set, then \ inside a bracket expression is literal. If set, then such a \ quotes the following character. */ #define RE_BACKSLASH_ESCAPE_IN_LISTS (1) /* If this bit is not set, then + and ? are operators, and \+ and \? are literals. If set, then \+ and \? are operators and + and ? are literals. */ #define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1) /* If this bit is set, then character classes are supported. They are: [:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:], [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:]. If not set, then character classes are not supported. */ #define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1) /* If this bit is set, then ^ and $ are always anchors (outside bracket expressions, of course). If this bit is not set, then it depends: ^ is an anchor if it is at the beginning of a regular expression or after an open-group or an alternation operator; $ is an anchor if it is at the end of a regular expression, or before a close-group or an alternation operator. This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because POSIX draft 11.2 says that * etc. in leading positions is undefined. We already implemented a previous draft which made those constructs invalid, though, so we haven't changed the code back. */ #define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1) /* If this bit is set, then special characters are always special regardless of where they are in the pattern. If this bit is not set, then special characters are special only in some contexts; otherwise they are ordinary. Specifically, * + ? and intervals are only special when not after the beginning, open-group, or alternation operator. */ #define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1) /* If this bit is set, then *, +, ?, and { cannot be first in an re or immediately after an alternation or begin-group operator. */ #define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1) /* If this bit is set, then . matches newline. If not set, then it doesn't. */ #define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1) /* If this bit is set, then . doesn't match NUL. If not set, then it does. */ #define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1) /* If this bit is set, nonmatching lists [^...] do not match newline. If not set, they do. */ #define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1) /* If this bit is set, either \{...\} or {...} defines an interval, depending on RE_NO_BK_BRACES. If not set, \{, \}, {, and } are literals. */ #define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1) /* If this bit is set, +, ? and | aren't recognized as operators. If not set, they are. */ #define RE_LIMITED_OPS (RE_INTERVALS << 1) /* If this bit is set, newline is an alternation operator. If not set, newline is literal. */ #define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1) /* If this bit is set, then `{...}' defines an interval, and \{ and \} are literals. If not set, then `\{...\}' defines an interval. */ #define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1) /* If this bit is set, (...) defines a group, and \( and \) are literals. If not set, \(...\) defines a group, and ( and ) are literals. */ #define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1) /* If this bit is set, then \ matches . If not set, then \ is a back-reference. */ #define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1) /* If this bit is set, then | is an alternation operator, and \| is literal. If not set, then \| is an alternation operator, and | is literal. */ #define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1) /* If this bit is set, then an ending range point collating higher than the starting range point, as in [z-a], is invalid. If not set, then when ending range point collates higher than the starting range point, the range is ignored. */ #define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1) /* If this bit is set, then an unmatched ) is ordinary. If not set, then an unmatched ) is invalid. */ #define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1) /* This global variable defines the particular regexp syntax to use (for some interfaces). When a regexp is compiled, the syntax used is stored in the pattern buffer, so changing this does not affect already-compiled regexps. */ extern reg_syntax_t re_syntax_options; /* Define combinations of the above bits for the standard possibilities. (The [[[ comments delimit what gets put into the Texinfo file, so don't delete them!) */ /* [[[begin syntaxes]]] */ #define RE_SYNTAX_EMACS 0 #define RE_SYNTAX_AWK \ (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \ | RE_NO_BK_PARENS | RE_NO_BK_REFS \ | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \ | RE_UNMATCHED_RIGHT_PAREN_ORD) #define RE_SYNTAX_POSIX_AWK \ (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS) #define RE_SYNTAX_GREP \ (RE_BK_PLUS_QM | RE_CHAR_CLASSES \ | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \ | RE_NEWLINE_ALT) #define RE_SYNTAX_EGREP \ (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \ | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \ | RE_NEWLINE_ALT | RE_NO_BK_PARENS \ | RE_NO_BK_VBAR) #define RE_SYNTAX_POSIX_EGREP \ (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES) /* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */ #define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC #define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC /* Syntax bits common to both basic and extended POSIX regex syntax. */ #define _RE_SYNTAX_POSIX_COMMON \ (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \ | RE_INTERVALS | RE_NO_EMPTY_RANGES) #define RE_SYNTAX_POSIX_BASIC \ (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM) /* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this isn't minimal, since other operators, such as \`, aren't disabled. */ #define RE_SYNTAX_POSIX_MINIMAL_BASIC \ (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS) #define RE_SYNTAX_POSIX_EXTENDED \ (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \ | RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \ | RE_NO_BK_PARENS | RE_NO_BK_VBAR \ | RE_UNMATCHED_RIGHT_PAREN_ORD) /* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INVALID_OPS replaces RE_CONTEXT_INDEP_OPS and RE_NO_BK_REFS is added. */ #define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \ (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \ | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \ | RE_NO_BK_PARENS | RE_NO_BK_REFS \ | RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD) /* [[[end syntaxes]]] */ /* Maximum number of duplicates an interval can allow. Some systems (erroneously) define this in other header files, but we want our value, so remove any previous define. */ #ifdef RE_DUP_MAX #undef RE_DUP_MAX #endif #define RE_DUP_MAX ((1 << 15) - 1) /* POSIX `cflags' bits (i.e., information for `regcomp'). */ /* If this bit is set, then use extended regular expression syntax. If not set, then use basic regular expression syntax. */ #define REG_EXTENDED 1 /* If this bit is set, then ignore case when matching. If not set, then case is significant. */ #define REG_ICASE (REG_EXTENDED << 1) /* If this bit is set, then anchors do not match at newline characters in the string. If not set, then anchors do match at newlines. */ #define REG_NEWLINE (REG_ICASE << 1) /* If this bit is set, then report only success or fail in regexec. If not set, then returns differ between not matching and errors. */ #define REG_NOSUB (REG_NEWLINE << 1) /* POSIX `eflags' bits (i.e., information for regexec). */ /* If this bit is set, then the beginning-of-line operator doesn't match the beginning of the string (presumably because it's not the beginning of a line). If not set, then the beginning-of-line operator does match the beginning of the string. */ #define REG_NOTBOL 1 /* Like REG_NOTBOL, except for the end-of-line. */ #define REG_NOTEOL (1 << 1) /* If any error codes are removed, changed, or added, update the `re_error_msg' table in regex.c. */ typedef enum { REG_NOERROR = 0, /* Success. */ REG_NOMATCH, /* Didn't find a match (for regexec). */ /* POSIX regcomp return error codes. (In the order listed in the standard.) */ REG_BADPAT, /* Invalid pattern. */ REG_ECOLLATE, /* Not implemented. */ REG_ECTYPE, /* Invalid character class name. */ REG_EESCAPE, /* Trailing backslash. */ REG_ESUBREG, /* Invalid back reference. */ REG_EBRACK, /* Unmatched left bracket. */ REG_EPAREN, /* Parenthesis imbalance. */ REG_EBRACE, /* Unmatched \{. */ REG_BADBR, /* Invalid contents of \{\}. */ REG_ERANGE, /* Invalid range end. */ REG_ESPACE, /* Ran out of memory. */ REG_BADRPT, /* No preceding re for repetition op. */ /* Error codes we've added. */ REG_EEND, /* Premature end. */ REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */ REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */ } reg_errcode_t; /* This data structure represents a compiled pattern. Before calling the pattern compiler, the fields `buffer', `allocated', `fastmap', `translate', and `no_sub' can be set. After the pattern has been compiled, the `re_nsub' field is available. All other fields are private to the regex routines. */ struct re_pattern_buffer { /* [[[begin pattern_buffer]]] */ /* Space that holds the compiled pattern. It is declared as `unsigned char *' because its elements are sometimes used as array indexes. */ unsigned char *buffer; /* Number of bytes to which `buffer' points. */ unsigned long allocated; /* Number of bytes actually used in `buffer'. */ unsigned long used; /* Syntax setting with which the pattern was compiled. */ reg_syntax_t syntax; /* Pointer to a fastmap, if any, otherwise zero. re_search uses the fastmap, if there is one, to skip over impossible starting points for matches. */ char *fastmap; /* Either a translate table to apply to all characters before comparing them, or zero for no translation. The translation is applied to a pattern when it is compiled and to a string when it is matched. */ char *translate; /* Number of subexpressions found by the compiler. */ size_t re_nsub; /* Zero if this pattern cannot match the empty string, one else. Well, in truth it's used only in `re_search_2', to see whether or not we should use the fastmap, so we don't set this absolutely perfectly; see `re_compile_fastmap' (the `duplicate' case). */ unsigned can_be_null : 1; /* If REGS_UNALLOCATED, allocate space in the `regs' structure for `max (RE_NREGS, re_nsub + 1)' groups. If REGS_REALLOCATE, reallocate space if necessary. If REGS_FIXED, use what's there. */ #define REGS_UNALLOCATED 0 #define REGS_REALLOCATE 1 #define REGS_FIXED 2 unsigned regs_allocated : 2; /* Set to zero when `regex_compile' compiles a pattern; set to one by `re_compile_fastmap' if it updates the fastmap. */ unsigned fastmap_accurate : 1; /* If set, `re_match_2' does not return information about subexpressions. */ unsigned no_sub : 1; /* If set, a beginning-of-line anchor doesn't match at the beginning of the string. */ unsigned not_bol : 1; /* Similarly for an end-of-line anchor. */ unsigned not_eol : 1; /* If true, an anchor at a newline matches. */ unsigned newline_anchor : 1; /* [[[end pattern_buffer]]] */ }; typedef struct re_pattern_buffer regex_t; /* search.c (search_buffer) in Emacs needs this one opcode value. It is defined both in `regex.c' and here. */ #define RE_EXACTN_VALUE 1 /* Type for byte offsets within the string. POSIX mandates this. */ typedef int regoff_t; /* This is the structure we store register match data in. See regex.texinfo for a full description of what registers match. */ struct re_registers { unsigned num_regs; regoff_t *start; regoff_t *end; }; /* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer, `re_match_2' returns information about at least this many registers the first time a `regs' structure is passed. */ #ifndef RE_NREGS #define RE_NREGS 30 #endif /* POSIX specification for registers. Aside from the different names than `re_registers', POSIX uses an array of structures, instead of a structure of arrays. */ typedef struct { regoff_t rm_so; /* Byte offset from string's start to substring's start. */ regoff_t rm_eo; /* Byte offset from string's start to substring's end. */ } regmatch_t; /* Declarations for routines. */ /* To avoid duplicating every routine declaration -- once with a prototype (if we are ANSI), and once without (if we aren't) -- we use the following macro to declare argument types. This unfortunately clutters up the declarations a bit, but I think it's worth it. */ #if __STDC__ #define _RE_ARGS(args) args #else /* not __STDC__ */ #define _RE_ARGS(args) () #endif /* not __STDC__ */ /* Sets the current default syntax to SYNTAX, and return the old syntax. You can also simply assign to the `re_syntax_options' variable. */ extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax)); /* Compile the regular expression PATTERN, with length LENGTH and syntax given by the global `re_syntax_options', into the buffer BUFFER. Return NULL if successful, and an error string if not. */ extern const char *re_compile_pattern _RE_ARGS ((const char *pattern, int length, struct re_pattern_buffer *buffer)); /* Compile a fastmap for the compiled pattern in BUFFER; used to accelerate searches. Return 0 if successful and -2 if was an internal error. */ extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer)); /* Search in the string STRING (with length LENGTH) for the pattern compiled into BUFFER. Start searching at position START, for RANGE characters. Return the starting position of the match, -1 for no match, or -2 for an internal error. Also return register information in REGS (if REGS and BUFFER->no_sub are nonzero). */ extern int re_search _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string, int length, int start, int range, struct re_registers *regs)); /* Like `re_search', but search in the concatenation of STRING1 and STRING2. Also, stop searching at index START + STOP. */ extern int re_search_2 _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, int length1, const char *string2, int length2, int start, int range, struct re_registers *regs, int stop)); /* Like `re_search', but return how many characters in STRING the regexp in BUFFER matched, starting at position START. */ extern int re_match _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string, int length, int start, struct re_registers *regs)); /* Relates to `re_match' as `re_search_2' relates to `re_search'. */ extern int re_match_2 _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, int length1, const char *string2, int length2, int start, struct re_registers *regs, int stop)); /* Set REGS to hold NUM_REGS registers, storing them in STARTS and ENDS. Subsequent matches using BUFFER and REGS will use this memory for recording register information. STARTS and ENDS must be allocated with malloc, and must each be at least `NUM_REGS * sizeof (regoff_t)' bytes long. If NUM_REGS == 0, then subsequent matches should allocate their own register data. Unless this function is called, the first search or match using PATTERN_BUFFER will allocate its own register data, without freeing the old data. */ extern void re_set_registers _RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs, unsigned num_regs, regoff_t *starts, regoff_t *ends)); /* 4.2 bsd compatibility. */ extern char *re_comp _RE_ARGS ((const char *)); extern int re_exec _RE_ARGS ((const char *)); /* POSIX compatibility. */ extern int regcomp _RE_ARGS ((regex_t *preg, const char *pattern, int cflags)); extern int regexec _RE_ARGS ((const regex_t *preg, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags)); extern size_t regerror _RE_ARGS ((int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)); extern void regfree _RE_ARGS ((regex_t *preg)); #endif /* not __REGEXP_LIBRARY_H__ */ /* Local variables: make-backup-files: t version-control: t trim-versions-without-asking: nil End: */ aide-0.16~a2.git20130520/include/list.h000066400000000000000000000026261214657706600171550ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2002,2010 Rami Lehti,Pablo Virolainen, Hannes von * Haugwitz * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _LIST_H_INCLUDED #define _LIST_H_INCLUDED typedef struct list { struct list* next; struct list* prev; struct list_header* header; /* struct list* head; struct list* tail; */ void* data; } list; typedef struct list_header{ struct list* head; struct list* tail; }list_header; list* list_sorted_insert(list* listp, void* data, int (*compare) (const void*, const void*)); list* list_append(list* listp,void*data); /* list* new_list_item(void*); */ list* list_delete_item(list* item); #endif /* _DB_LIST_H_INCLUDED */ aide-0.16~a2.git20130520/include/locale-aide.h000066400000000000000000000021041214657706600203300ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 2000,2001,2002 Rami Lehti, Pablo Virolainen * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _LOCALE_AIDE_H_INCLUDED #define _LOCALE_AIDE_H_INCLUDED #ifdef USE_LOCALE #include #include #define _(Text) gettext(Text) #else #define _(Text) Text #endif /* USE_LOCALE */ #endif /* _LOCALE_AIDE_H_INCLUDED*/ aide-0.16~a2.git20130520/include/md.h000066400000000000000000000073631214657706600166050ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 2000-2002,2005,2006 Rami Lehti,Pablo Virolainen, * Richard van den Berg * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MD_H_INCLUDED #define _MD_H_INCLUDED #include "aide.h" /* This should come from configure-script. */ #include "db_config.h" #ifdef WITH_MHASH #include #ifdef HAVE_MHASH_WHIRLPOOL # define HASH_MHASH_COUNT MHASH_WHIRLPOOL /* WHIRLPOOL == 22 on 2006-10-11 */ #else # define HASH_MHASH_COUNT MHASH_RIPEMD320 #endif #define MHASH_RMD160 MHASH_RIPEMD160 #define MHASH_HAVAL MHASH_HAVAL256 #endif #ifdef WITH_GCRYPT #include #define HASH_GCRYPT_COUNT GCRY_MD_CRC32 #ifndef WITH_MHASH #define HASH_USE_GCRYPT (DB_MD5|DB_SHA1|DB_RMD160|DB_TIGER|DB_CRC32|\ DB_HAVAL|DB_CRC32|DB_SHA256|DB_SHA512) #endif #endif /* Lengths. Hope I got there right :) */ #define HASH_MD5_LEN 16 #define HASH_SHA1_LEN 20 #define HASH_RMD160_LEN 20 #define HASH_TIGER_LEN 24 #define HASH_GOST_LEN 32 #define HASH_HAVAL224_LEN 28 #define HASH_HAVAL192_LEN 24 #define HASH_HAVAL160_LEN 20 #define HASH_HAVAL128_LEN 16 #define HASH_HAVAL256_LEN 32 #define HASH_TIGER128_LEN 16 #define HASH_TIGER160_LEN 20 #define HASH_MD4_LEN 16 #define HASH_SHA256_LEN 32 #define HASH_SHA512_LEN 64 #define HASH_WHIRLPOOL_LEN 64 #define HASH_ADLER32_LEN 4 #define HASH_CRC32B_LEN 4 #define HASH_CRC32_LEN 4 /* What we use from what library? */ #ifdef WITH_MHASH #define HASH_USE_MHASH (DB_MD5|DB_SHA1|DB_RMD160|DB_TIGER|DB_CRC32|\ DB_HAVAL|DB_GOST|DB_CRC32|\ DB_SHA256|DB_SHA512|DB_WHIRLPOOL) #define HASH_USE_GCRYPT (0) #endif /* This struct hold's internal data needed for md-calls. */ typedef struct md_container { /* final hashes. There might be more these than AIDE currently supports, but that should be an easy task. */ char crc32[HASH_CRC32_LEN]; char md5[HASH_MD5_LEN]; char sha1[HASH_SHA1_LEN]; char haval[HASH_HAVAL256_LEN]; char rmd160[HASH_RMD160_LEN]; char tiger[HASH_TIGER_LEN]; char gost[HASH_GOST_LEN]; char crc32b[HASH_CRC32B_LEN]; char haval224[HASH_HAVAL224_LEN]; char haval192[HASH_HAVAL192_LEN]; char haval160[HASH_HAVAL160_LEN]; char haval128[HASH_HAVAL128_LEN]; char tiger128[HASH_TIGER128_LEN]; char tiger160[HASH_TIGER160_LEN]; char md4[HASH_MD4_LEN]; char sha256[HASH_SHA256_LEN]; char sha512[HASH_SHA512_LEN]; char adler32[HASH_ADLER32_LEN]; char whirlpool[HASH_WHIRLPOOL_LEN]; /* Attr which are to be calculated. */ DB_ATTR_TYPE calc_attr; /* Attr which are not (yet) to be calculated. After init hold's hashes which are not calculated :) */ DB_ATTR_TYPE todo_attr; /* Variables needed to cope with the library. */ #ifdef WITH_MHASH MHASH mhash_mdh[HASH_MHASH_COUNT+1]; #endif #ifdef WITH_GCRYPT gcry_md_hd_t mdh; #endif } md_container; int init_md(struct md_container*); int update_md(struct md_container*,void*,ssize_t); int close_md(struct md_container*); void md2line(struct md_container*,struct db_line*); #endif /*_MD_H_INCLUDED*/ aide-0.16~a2.git20130520/include/report.h000066400000000000000000000027351214657706600175160ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2002,2010 Rami Lehti, Pablo Virolainen, Richard * van den Berg * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _ERROR_H_INCLUDED #define _ERROR_H_INCLUDED #include #include #include "db_config.h" #include "url.h" /* Exitcodes */ #define ERROR_WRITING_ERROR 14 #define INVALID_ARGUMENT_ERROR 15 #define UNIMPLEMENTED_FUNCTION_ERROR 16 #define INVALID_CONFIGURELINE_ERROR 17 #define IO_ERROR 18 #define VERSION_MISMATCH_ERROR 19 /* Errorcodes */ #define HASH_ALGO_ERROR 30 void error(int errorlevel, char* error_msg,...) #ifdef __GNUC__ __attribute__ ((format (printf, 2, 3))); #else ; #endif int error_init(url_t*,int); void write_error_stderr(int errorlevel, char*error_msg,va_list ap); #endif aide-0.16~a2.git20130520/include/seltree.h000066400000000000000000000035001214657706600176350ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2002,2010 Rami Lehti,Pablo Virolainen, Hannes von * Haugwitz * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _SELTREE_H_INCLUDED #define _SELTREE_H_INCLUDED struct seltree; #include "db_config.h" #include "list.h" /* seltree structure * lists have regex_t* in them * checked is whether or not the node has been checked yet and status * when added * path is the path of the node * parent is the parent, NULL if root * childs is list of seltree*:s * new_data is this nodes new attributes (read from disk or db in --compare) * old_data is this nodes old attributes (read from db) * attr attributes to add for this node and possibly for its children * changed_attrs changed attributes between new_data and old_data */ typedef struct seltree { list* sel_rx_lst; list* neg_rx_lst; list* equ_rx_lst; list* childs; struct seltree* parent; char* path; int checked; long conf_lineno; char* rx; DB_ATTR_TYPE attr; struct db_line* new_data; struct db_line* old_data; DB_ATTR_TYPE changed_attrs; } seltree; #endif /* _SELTREE_H_INCLUDED*/ aide-0.16~a2.git20130520/include/symboltable.h000066400000000000000000000020751214657706600205150ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2002,2006 Rami Lehti,Pablo Virolainen, Richard van * den Berg * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _SYMBOLTABLE_H_INCLUDED #define _SYMBOLTABLE_H_INCLUDED #include "list.h" typedef struct symba { char* name; char* value; DB_ATTR_TYPE ival; } symba; list* list_find(char* s,list* item); #endif aide-0.16~a2.git20130520/include/types.h000066400000000000000000000056731214657706600173530ustar00rootroot00000000000000/* types.h - some common typedefs * Copyright (C) 1998 Free Software Foundation, Inc. * * This file was part of GNUPG. * $Header$ * * GNUPG is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * GNUPG is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef _TYPES_H_INCLUDED #define _TYPES_H_INCLUDED /* The AC_CHECK_SIZEOF() in configure fails for some machines. * we provide some fallback values here */ #if !SIZEOF_UNSIGNED_SHORT # undef SIZEOF_UNSIGNED_SHORT # define SIZEOF_UNSIGNED_SHORT 2 #endif #if !SIZEOF_UNSIGNED_INT # undef SIZEOF_UNSIGNED_INT # define SIZEOF_UNSIGNED_INT 4 #endif #if !SIZEOF_UNSIGNED_LONG # undef SIZEOF_UNSIGNED_LONG # define SIZEOF_UNSIGNED_LONG 4 #endif #include #ifndef HAVE_BYTE # undef byte /* maybe there is a macro with this name */ typedef unsigned char byte; # define HAVE_BYTE #endif #ifndef HAVE_USHORT # undef ushort /* maybe there is a macro with this name */ typedef unsigned short ushort; # define HAVE_USHORT #endif #ifndef HAVE_ULONG # undef ulong /* maybe there is a macro with this name */ typedef unsigned long ulong; # define HAVE_ULONG #endif #ifndef HAVE_U16 # undef u16 /* maybe there is a macro with this name */ # if SIZEOF_UNSIGNED_INT == 2 typedef unsigned int u16; # elif SIZEOF_UNSIGNED_SHORT == 2 typedef unsigned short u16; # else # error no typedef for u16 # endif # define HAVE_U16 #endif #ifndef HAVE_U32 # undef u32 /* maybe there is a macro with this name */ # if SIZEOF_UNSIGNED_INT == 4 typedef unsigned int u32; # elif SIZEOF_UNSIGNED_LONG == 4 typedef unsigned long u32; # else # error no typedef for u32 # endif # define HAVE_U32 #endif #ifndef HAVE_U64 # undef u64 /* maybe there is a macro with this name */ # if SIZEOF_UNSIGNED_INT == 8 typedef unsigned int u64; # define HAVE_U64 # elif SIZEOF_UNSIGNED_LONG == 8 typedef unsigned long u64; # define HAVE_U64 # elif __GNUC__ >= 2 || defined(__SUNPRO_C) || defined(_AIX) && defined(_LONGLONG) typedef unsigned long long u64; # define HAVE_U64 # endif #endif typedef union { int a; short b; char c[1]; long d; # ifdef HAVE_U64 u64 e; # endif float f; double g; } PROPERLY_ALIGNED_TYPE; typedef struct string_list { struct string_list *next; unsigned int flags; char d[1]; } *STRLIST; #endif /*_INCLUDED_TYPES_H*/ aide-0.16~a2.git20130520/include/url.h000066400000000000000000000024331214657706600170000ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 2002,2006 Rami Lehti, Pablo Virolainen, Richard van den * Berg * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _URL_H_INCLUDED #define _URL_H_INCLUDED typedef enum { url_file, url_stdout, url_stdin, url_stderr, url_fd, url_http, url_sql, url_syslog, url_database, url_multiwriter, url_gzip, url_string, url_ftp, url_https, url_unknown } URL_TYPE; typedef struct url_t { /* Everything before the first ':' */ URL_TYPE type; char* value; void* data; /* We might want to pass some list's to multiwriter */ } url_t; #endif aide-0.16~a2.git20130520/include/util.h000066400000000000000000000035431214657706600171560ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2002,2006,2013 Rami Lehti, Pablo Virolainen, Richard * van den Berg, Hannes von Haugwitz * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _UTIL_H_INCLUDED #define _UTIL_H_INCLUDED #include #include #include "db_config.h" #define HEXD2ASC(x) (((x) < 10) ? ((x) + '0') : ((x) - 10 + 'A')) #define ASC2HEXD(x) (((x) >= '0' && (x) <= '9') ? \ ((x) - '0') : (toupper(x) - 'A' + 10)) #define ISXDIGIT(x) isxdigit ((unsigned char)(x)) #define CLEANDUP(x) (contains_unsafe (x) ? encode_string (x) : strdup (x)) #ifndef HAVE_STRICMP # define stricmp(a,b) strcasecmp( (a), (b) ) #endif int cmpurl(url_t*, url_t*); url_t* parse_url(char*); int contains_unsafe(const char*); void decode_string(char*); char* encode_string(const char*); char* perm_to_char(mode_t perm); void sig_handler(int signal); void init_sighandler(void); char *expand_tilde(char * path); #ifndef HAVE_STRNSTR char* strnstr(char* haystack,char* needle,int n); #endif #ifndef HAVE_STRNLEN size_t strnlen(const char *s, size_t maxlen); #endif int syslog_facility_lookup(char *); #endif aide-0.16~a2.git20130520/install-sh000077500000000000000000000332561214657706600164150ustar00rootroot00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-01-19.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for `test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: aide-0.16~a2.git20130520/missing000077500000000000000000000241521214657706600160030ustar00rootroot00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2012-01-06.13; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, # 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file yacc create \`y.tab.[ch]', if possible, from existing .[ch] Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and \`g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # normalize program name to check for. program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). This is about non-GNU programs, so use $1 not # $program. case $1 in lex*|yacc*) # Not GNU programs, they don't have --version. ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG=\${$#} case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG=\${$#} case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit $? fi ;; makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: aide-0.16~a2.git20130520/mkinstalldirs000077500000000000000000000067221214657706600172150ustar00rootroot00000000000000#! /bin/sh # mkinstalldirs --- make directory hierarchy scriptversion=2009-04-28.21; # UTC # Original author: Noah Friedman # Created: 1993-05-16 # Public domain. # # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' IFS=" "" $nl" errstatus=0 dirmode= usage="\ Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... Create each directory DIR (with mode MODE, if specified), including all leading file name components. Report bugs to ." # process command line arguments while test $# -gt 0 ; do case $1 in -h | --help | --h*) # -h for help echo "$usage" exit $? ;; -m) # -m PERM arg shift test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } dirmode=$1 shift ;; --version) echo "$0 $scriptversion" exit $? ;; --) # stop option processing shift break ;; -*) # unknown option echo "$usage" 1>&2 exit 1 ;; *) # first non-opt arg break ;; esac done for file do if test -d "$file"; then shift else break fi done case $# in 0) exit 0 ;; esac # Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and # mkdir -p a/c at the same time, both will detect that a is missing, # one will create a, then the other will try to create a and die with # a "File exists" error. This is a problem when calling mkinstalldirs # from a parallel make. We use --version in the probe to restrict # ourselves to GNU mkdir, which is thread-safe. case $dirmode in '') if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then echo "mkdir -p -- $*" exec mkdir -p -- "$@" else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. test -d ./-p && rmdir ./-p test -d ./--version && rmdir ./--version fi ;; *) if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && test ! -d ./--version; then echo "mkdir -m $dirmode -p -- $*" exec mkdir -m "$dirmode" -p -- "$@" else # Clean up after NextStep and OpenStep mkdir. for d in ./-m ./-p ./--version "./$dirmode"; do test -d $d && rmdir $d done fi ;; esac for file do case $file in /*) pathcomp=/ ;; *) pathcomp= ;; esac oIFS=$IFS IFS=/ set fnord $file shift IFS=$oIFS for d do test "x$d" = x && continue pathcomp=$pathcomp$d case $pathcomp in -*) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr else if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" lasterr= chmod "$dirmode" "$pathcomp" || lasterr=$? if test ! -z "$lasterr"; then errstatus=$lasterr fi fi fi fi pathcomp=$pathcomp/ done done exit $errstatus # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: aide-0.16~a2.git20130520/src/000077500000000000000000000000001214657706600151675ustar00rootroot00000000000000aide-0.16~a2.git20130520/src/Makefile.am000066400000000000000000000034541214657706600172310ustar00rootroot00000000000000# # aide, Advanced Intrusion Detection Environment # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING. If not, write to # the Free Software Foundation, 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # bin_PROGRAMS = aide noinst_HEADERS = conf_yacc.h BUILT_SOURCES = conf_yacc.h AM_YFLAGS= -d #AM_LFLAGS= -d LEX_OUTPUT_ROOT = lex.yy LDADD = -lm @CRYPTLIB@ @ACLLIB@ @SELINUXLIB@ @AUDITLIB@ @ATTRLIB@ @E2FSATTRSLIB@ @ELFLIB@ AM_CFLAGS = @AIDE_DEFS@ -W -Wall -g CLEANFILES = conf_yacc.h conf_yacc.c conf_lex.c db_lex.c *~ AM_CPPFLAGS = -I$(top_srcdir) \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src \ -I$(top_builddir)/src aide_SOURCES = aide.c \ base64.c \ be.c \ commandconf.c \ compare_db.c \ conf_lex.l \ conf_yacc.y \ db.c \ db_disk.c \ db_file.c \ db_lex.l \ db_list.c \ db_sql.c \ do_md.c \ error.c \ gen_list.c \ getopt1.c \ getopt.c \ gnu_regex.c \ list.c \ md.c \ snprintf.c \ symboltable.c \ util.c if USE_CURL aide_SOURCES += fopen.c endif conf_yacc.c: conf_yacc.y $(YACC) $(AM_YFLAGS) -o $@ -p conf $< conf_lex.c: conf_lex.l conf_yacc.c $(LEX) $(AM_LFLAGS) -o$@ -Pconf $< conf_lex2.c: conf_lex.c db_lex.c: db_lex.l conf_yacc.h $(LEX) $(AM_LFLAGS) -o$@ -Pdb $< db_lex2.c: db_lex.c aide-0.16~a2.git20130520/src/Makefile.in000066400000000000000000000502451214657706600172420ustar00rootroot00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # # aide, Advanced Intrusion Detection Environment # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING. If not, write to # the Free Software Foundation, 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ bin_PROGRAMS = aide$(EXEEXT) @USE_CURL_TRUE@am__append_1 = fopen.c subdir = src DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in conf_lex.c conf_yacc.c conf_yacc.h \ db_lex.c ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/version.m4 $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am__aide_SOURCES_DIST = aide.c base64.c be.c commandconf.c \ compare_db.c conf_lex.l conf_yacc.y db.c db_disk.c db_file.c \ db_lex.l db_list.c db_sql.c do_md.c error.c gen_list.c \ getopt1.c getopt.c gnu_regex.c list.c md.c snprintf.c \ symboltable.c util.c fopen.c @USE_CURL_TRUE@am__objects_1 = fopen.$(OBJEXT) am_aide_OBJECTS = aide.$(OBJEXT) base64.$(OBJEXT) be.$(OBJEXT) \ commandconf.$(OBJEXT) compare_db.$(OBJEXT) conf_lex.$(OBJEXT) \ conf_yacc.$(OBJEXT) db.$(OBJEXT) db_disk.$(OBJEXT) \ db_file.$(OBJEXT) db_lex.$(OBJEXT) db_list.$(OBJEXT) \ db_sql.$(OBJEXT) do_md.$(OBJEXT) error.$(OBJEXT) \ gen_list.$(OBJEXT) getopt1.$(OBJEXT) getopt.$(OBJEXT) \ gnu_regex.$(OBJEXT) list.$(OBJEXT) md.$(OBJEXT) \ snprintf.$(OBJEXT) symboltable.$(OBJEXT) util.$(OBJEXT) \ $(am__objects_1) aide_OBJECTS = $(am_aide_OBJECTS) aide_LDADD = $(LDADD) aide_DEPENDENCIES = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ LEXCOMPILE = $(LEX) $(AM_LFLAGS) $(LFLAGS) YLWRAP = $(top_srcdir)/ylwrap YACCCOMPILE = $(YACC) $(AM_YFLAGS) $(YFLAGS) SOURCES = $(aide_SOURCES) DIST_SOURCES = $(am__aide_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLLIB = @ACLLIB@ ACLOCAL = @ACLOCAL@ AIDE_DEFS = @AIDE_DEFS@ AIDE_USE_LOCALE = @AIDE_USE_LOCALE@ AMTAR = @AMTAR@ ATTRLIB = @ATTRLIB@ AUDITLIB = @AUDITLIB@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CRYPTLIB = @CRYPTLIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ E2FSATTRSLIB = @E2FSATTRSLIB@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ELFLIB = @ELFLIB@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ #AM_LFLAGS= -d LEX_OUTPUT_ROOT = lex.yy LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PSQLLIB = @PSQLLIB@ RANLIB = @RANLIB@ SELINUXLIB = @SELINUXLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ curlconfig = @curlconfig@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_HEADERS = conf_yacc.h BUILT_SOURCES = conf_yacc.h AM_YFLAGS = -d LDADD = -lm @CRYPTLIB@ @ACLLIB@ @SELINUXLIB@ @AUDITLIB@ @ATTRLIB@ @E2FSATTRSLIB@ @ELFLIB@ AM_CFLAGS = @AIDE_DEFS@ -W -Wall -g CLEANFILES = conf_yacc.h conf_yacc.c conf_lex.c db_lex.c *~ AM_CPPFLAGS = -I$(top_srcdir) \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src \ -I$(top_builddir)/src aide_SOURCES = aide.c base64.c be.c commandconf.c compare_db.c \ conf_lex.l conf_yacc.y db.c db_disk.c db_file.c db_lex.l \ db_list.c db_sql.c do_md.c error.c gen_list.c getopt1.c \ getopt.c gnu_regex.c list.c md.c snprintf.c symboltable.c \ util.c $(am__append_1) all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .l .o .obj .y $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) conf_yacc.h: conf_yacc.c @if test ! -f $@; then rm -f conf_yacc.c; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) conf_yacc.c; else :; fi aide$(EXEEXT): $(aide_OBJECTS) $(aide_DEPENDENCIES) $(EXTRA_aide_DEPENDENCIES) @rm -f aide$(EXEEXT) $(LINK) $(aide_OBJECTS) $(aide_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aide.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base64.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/be.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/commandconf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compare_db.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf_lex.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf_yacc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/db.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/db_disk.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/db_file.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/db_lex.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/db_list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/db_sql.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/do_md.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fopen.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnu_regex.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snprintf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symboltable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .l.c: $(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) .y.c: $(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(PROGRAMS) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -rm -f conf_lex.c -rm -f conf_yacc.c -rm -f conf_yacc.h -rm -f db_lex.c -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: all check install install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-binPROGRAMS conf_yacc.c: conf_yacc.y $(YACC) $(AM_YFLAGS) -o $@ -p conf $< conf_lex.c: conf_lex.l conf_yacc.c $(LEX) $(AM_LFLAGS) -o$@ -Pconf $< conf_lex2.c: conf_lex.c db_lex.c: db_lex.l conf_yacc.h $(LEX) $(AM_LFLAGS) -o$@ -Pdb $< db_lex2.c: db_lex.c # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: aide-0.16~a2.git20130520/src/aide.c000066400000000000000000000365401214657706600162450ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2006,2010-2013 Rami Lehti, Pablo Virolainen, Mike * Markley, Richard van den Berg, Hannes von Haugwitz * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "aide.h" #include #include #include #include #include #include #include #include #include #if HAVE_UNISTD_H #include #endif #include "md.h" #include "commandconf.h" #include "compare_db.h" #include "db_config.h" #include "db_file.h" #include "do_md.h" #include "report.h" #include "gen_list.h" #include "getopt.h" #include "list.h" #include "util.h" #include "base64.h" /*for locale support*/ #include "locale-aide.h" /*for locale support*/ db_config* conf; #ifndef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 256 #endif static void usage(int exitvalue) { fprintf(stderr, _("Aide " AIDEVERSION" \n\n" "Usage: aide [options] command\n\n" "Commands:\n" " -i, --init\t\tInitialize the database\n" " -C, --check\t\tCheck the database\n" " -u, --update\t\tCheck and update the database non-interactively\n" " -E, --compare\t\tCompare two databases\n\n" "Miscellaneous:\n" " -D, --config-check\tTest the configuration file\n" " -v, --version\t\tShow version of AIDE and compilation options\n" " -h, --help\t\tShow this help message\n\n" "Options:\n" " -c [cfgfile]\t--config=[cfgfile]\tGet config options from [cfgfile]\n" " -B \"OPTION\"\t--before=\"OPTION\"\tBefore configuration file is read define OPTION\n" " -A \"OPTION\"\t--after=\"OPTION\"\tAfter configuration file is read define OPTION\n" " -r [reporter]\t--report=[reporter]\tWrite report output to [reporter] url\n" " -V[level]\t--verbose=[level]\tSet debug message level to [level]\n" "\n") ); exit(exitvalue); } static void print_version(void) { fprintf(stderr, "Aide " AIDEVERSION "\n\n" "Compiled with the following options:\n\n" AIDECOMPILEOPTIONS "\n"); exit(0); } static int read_param(int argc,char**argv) { int option = -1; char* err=NULL; int i=0; static struct option options[] = { { "help", no_argument, NULL, 'h' }, { "verbose", optional_argument, NULL, 'V'}, { "version", no_argument, NULL, 'v'}, { "config", required_argument, NULL, 'c'}, { "before", required_argument, NULL, 'B'}, { "after", required_argument, NULL, 'A'}, { "report", required_argument, NULL, 'r'}, { "init", no_argument, NULL, 'i'}, { "check", no_argument, NULL, 'C'}, { "update", no_argument, NULL, 'u'}, { "config-check", no_argument, NULL, 'D'}, { "compare", no_argument, NULL, 'E'}, { NULL,0,NULL,0 } }; while(1){ option = getopt_long(argc, argv, "hV::vc:B:A:r:iCuDE", options, &i); if(option==-1) break; switch(option) { case 'h':{ usage(0); break; } case 'v':{ print_version(); break; } case 'V':{ if(optarg!=NULL){ conf->verbose_level=strtol(optarg,&err,10); if(*err!='\0' || conf->verbose_level>255 || conf->verbose_level<0 || errno==ERANGE){ error(0, _("Illegal verbosity level:%s\n"),optarg); exit(INVALID_ARGUMENT_ERROR); } error(230,_("Setting verbosity to %s\n"),optarg); }else{ conf->verbose_level=20; } break; } case 'c':{ if(optarg!=NULL){ conf->config_file=optarg; }else{ error(0,_("No config-file name given!\n")); exit(INVALID_ARGUMENT_ERROR); } break; } case 'B': { if (optarg!=NULL) { int errorno=commandconf('B',optarg); if (errorno!=0){ error(0,_("Configuration error in before statement:%s\n"),optarg); exit(INVALID_CONFIGURELINE_ERROR); } } else { error(0,_("-B must have a parameter\n")); exit(INVALID_ARGUMENT_ERROR); } break; } case 'A': { if (optarg!=NULL) { int errorno=commandconf('A',optarg); if (errorno!=0){ error(0,_("Configuration error in after statement:%s\n"),optarg); exit(INVALID_CONFIGURELINE_ERROR); } } else { error(0,_("-A must have a parameter\n")); exit(INVALID_ARGUMENT_ERROR); } break; } case 'r': { if(optarg!=NULL) { do_repurldef(optarg); }else { error(0,_("-r must have an argument\n")); } break; } case 'i': { if(conf->action==0){ conf->action=DO_INIT; }else { error(0, _("Cannot have multiple commands on a single commandline.\n")); exit(INVALID_ARGUMENT_ERROR); }; break; } case 'C': { if(conf->action==0){ conf->action=DO_COMPARE; }else { error(0, _("Cannot have multiple commands on a single commandline.\n")); exit(INVALID_ARGUMENT_ERROR); }; break; } case 'u': { if(conf->action==0){ conf->action=DO_INIT|DO_COMPARE; }else { error(0, _("Cannot have multiple commands on a single commandline.\n")); exit(INVALID_ARGUMENT_ERROR); }; break; } case 'E': { if(conf->action==0){ conf->action=DO_DIFF; }else { error(0, _("Cannot have multiple commands on a single commandline.\n")); exit(INVALID_ARGUMENT_ERROR); }; break; } case 'D': { conf->config_check=1; break; } default: error(0,_("Unknown option given. Exiting\n")); exit(INVALID_ARGUMENT_ERROR); } } if(optinddefsyms=NULL; if (gethostname(s,MAXHOSTNAMELEN)==-1) { error(0,_("Couldn't get hostname")); free(s); } else { s=(char*)realloc((void*)s,strlen(s)+1); do_define("HOSTNAME",s); } /* Setting some defaults */ conf->report_db=0; conf->tree=NULL; conf->config_check=0; conf->verbose_level=-1; conf->report_detailed_init=0; conf->report_base16=0; conf->use_initial_errorsto=1; conf->report_url=NULL; conf->report_fd=NULL; conf->report_syslog=0; conf->report_db=0; u=parse_url(urlstr); error_init(u,1); conf->config_file=CONFIG_FILE; conf->config_version=NULL; #ifdef WITH_ACL conf->no_acl_on_symlinks=0; /* zero means don't do ACLs on symlinks */ #endif #ifdef WITH_MHASH conf->do_configmd=0; conf->confmd=NULL; conf->confhmactype=CONFIGHMACTYPE; conf->old_confmdstr=NULL; conf->dbhmactype=DBHMACTYPE; conf->dbnewmd=NULL; conf->dboldmd=NULL; #endif conf->do_dbnewmd=0; conf->do_dboldmd=0; conf->old_dbnewmdstr=NULL; conf->old_dboldmdstr=NULL; conf->db_out_order=(DB_FIELD*)malloc(sizeof(DB_FIELD)*db_unknown); conf->db_out_size=1; conf->db_out_order[0]=db_filename; conf->symlinks_found=0; conf->db_in_size=0; conf->db_in_order=NULL; conf->db_in_url=NULL; conf->db_in=NULL; conf->db_new_size=0; conf->db_new_order=NULL; conf->db_new_url=NULL; conf->db_new=NULL; conf->db_out_url=NULL; conf->db_out=NULL; conf->mdc_in=NULL; conf->mdc_out=NULL; conf->line_db_in=NULL; conf->line_db_out=NULL; conf->db_attrs = 0; #if defined(WITH_MHASH) || defined(WITH_GCRYPT) conf->db_attrs |= DB_MD5|DB_TIGER|DB_HAVAL|DB_CRC32|DB_SHA1|DB_RMD160|DB_SHA256|DB_SHA512; #ifdef WITH_MHASH conf->db_attrs |= DB_GOST; #ifdef HAVE_MHASH_WHIRLPOOL conf->db_attrs |= DB_WHIRLPOOL; #endif #endif #endif #ifdef WITH_ZLIB conf->db_gzin=0; conf->db_gznew=0; conf->gzip_dbout=0; conf->db_gzout=0; #endif conf->action=0; conf->catch_mmap=0; conf->warn_dead_symlinks=0; conf->grouped=1; conf->summarize_changes=1; conf->root_prefix=""; conf->root_prefix_length=0; conf->selrxlst=NULL; conf->equrxlst=NULL; conf->negrxlst=NULL; conf->groupsyms=NULL; conf->start_time=time(&(conf->start_time)); do_groupdef("ANF",DB_NEWFILE); do_groupdef("ARF",DB_RMFILE); do_groupdef("p",DB_PERM); do_groupdef("i",DB_INODE); do_groupdef("I",DB_CHECKINODE); do_groupdef("n",DB_LNKCOUNT); do_groupdef("u",DB_UID); do_groupdef("g",DB_GID); do_groupdef("l",DB_LINKNAME); do_groupdef("s",DB_SIZE); do_groupdef("S",DB_SIZEG); do_groupdef("b",DB_BCOUNT); do_groupdef("m",DB_MTIME); do_groupdef("c",DB_CTIME); do_groupdef("a",DB_ATIME); #if defined(WITH_MHASH) || defined(WITH_GCRYPT) do_groupdef("md5",DB_MD5); do_groupdef("tiger",DB_TIGER); do_groupdef("haval",DB_HAVAL); do_groupdef("crc32",DB_CRC32); do_groupdef("sha1",DB_SHA1); do_groupdef("rmd160",DB_RMD160); do_groupdef("sha256",DB_SHA256); do_groupdef("sha512",DB_SHA512); #endif #ifdef WITH_ACL do_groupdef("acl",DB_ACL); #endif #ifdef WITH_XATTR do_groupdef("xattrs",DB_XATTRS); #endif #ifdef WITH_SELINUX do_groupdef("selinux",DB_SELINUX); #endif #ifdef WITH_MHASH do_groupdef("gost",DB_GOST); #ifdef HAVE_MHASH_WHIRLPOOL do_groupdef("whirlpool",DB_WHIRLPOOL); #endif #endif do_groupdef("ftype",DB_FTYPE); #ifdef WITH_E2FSATTRS do_groupdef("e2fsattrs",DB_E2FSATTRS); #endif X=0LLU; #ifdef WITH_ACL X|=DB_ACL; #endif #ifdef WITH_SELINUX X|=DB_SELINUX; #endif #ifdef WITH_XATTR X|=DB_XATTRS; #endif #ifdef WITH_E2FSATTRS X|=DB_E2FSATTRS; #endif do_groupdef("R",DB_PERM|DB_FTYPE|DB_INODE|DB_LNKCOUNT|DB_UID|DB_GID|DB_SIZE| DB_LINKNAME|DB_MTIME|DB_CTIME #if defined(WITH_MHASH) || defined(WITH_GCRYPT) |DB_MD5 #endif |X); do_groupdef("L",DB_PERM|DB_FTYPE|DB_INODE|DB_LNKCOUNT|DB_UID|DB_GID|DB_LINKNAME|X); do_groupdef(">",DB_PERM|DB_FTYPE|DB_INODE|DB_LNKCOUNT|DB_UID|DB_GID|DB_SIZEG| DB_LINKNAME|X); do_groupdef("X",X); do_groupdef("E",0); } static void setdefaults_after_config() { if(conf->db_in_url==NULL){ url_t* u=NULL; u=(url_t*)malloc(sizeof(url_t)); u->type=url_file; u->value=DEFAULT_DB; conf->db_in_url=u; } if(conf->db_out_url==NULL){ url_t* u=NULL; u=(url_t*)malloc(sizeof(url_t)); u->type=url_file; u->value=DEFAULT_DB_OUT; conf->db_out_url=u; } if(conf->report_url==NULL){ url_t* u=NULL; /* Don't free this one because conf->report_url needs it */ u=(url_t*)malloc(sizeof(url_t)); u->type=url_stdout; u->value=""; error_init(u,0); } if(conf->action==0){ conf->action=DO_COMPARE; } if(conf->verbose_level==-1){ conf->verbose_level=5; } } int main(int argc,char**argv) { int errorno=0; byte* dig=NULL; char* digstr=NULL; #ifdef USE_LOCALE setlocale(LC_ALL,""); bindtextdomain(PACKAGE,LOCALEDIR); textdomain(PACKAGE); #endif umask(0177); init_sighandler(); setdefaults_before_config(); if(read_param(argc,argv)==RETFAIL){ error(0, _("Invalid argument\n") ); exit(INVALID_ARGUMENT_ERROR); } errorno=commandconf('C',conf->config_file); errorno=commandconf('D',""); if (errorno==RETFAIL){ error(0,_("Configuration error\n")); exit(INVALID_CONFIGURELINE_ERROR); } setdefaults_after_config(); /* This won't actualy work, because conf->tree is not constructed. Now we construct it. And we have THE tree. */ conf->tree=gen_tree(conf->selrxlst,conf->negrxlst,conf->equrxlst); /* Let's do some sanity checks for the config */ if(cmpurl(conf->db_in_url,conf->db_out_url)==RETOK){ error(4,_("WARNING:Input and output database urls are the same.\n")); if((conf->action&DO_INIT)&&(conf->action&DO_COMPARE)){ error(0,_("Input and output database urls cannot be the same " "when doing database update\n")); exit(INVALID_ARGUMENT_ERROR); } if(conf->action&DO_DIFF){ error(0,_("Both input databases cannot be the same " "when doing database compare\n")); exit(INVALID_ARGUMENT_ERROR); } }; if((conf->action&DO_DIFF)&&(!(conf->db_new_url)||!(conf->db_in_url))){ error(0,_("Must have both input databases defined for " "database compare.\n")); exit(INVALID_ARGUMENT_ERROR); } if (conf->action&(DO_INIT|DO_COMPARE) && conf->root_prefix_length > 0) { DIR *dir; if((dir = opendir(conf->root_prefix)) != NULL) { closedir(dir); } else { char* er=strerror(errno); if (er!=NULL) { error(0,"opendir() for root prefix %s failed: %s\n", conf->root_prefix,er); } else { error(0,"opendir() for root prefix %s failed: %i\n", conf->root_prefix,errno); } exit(INVALID_ARGUMENT_ERROR); } } #ifdef WITH_MHASH if(conf->config_check&&FORCECONFIGMD){ error(0,"Can't give config checksum when compiled with --enable-forced_configmd\n"); exit(INVALID_ARGUMENT_ERROR); } if((conf->do_configmd||conf->config_check)&& conf->confmd!=0){ /* The patch automatically adds a newline so will also have to add it. */ if(newlinelastinconfig==0){ mhash(conf->confmd,"\n",1); }; mhash(conf->confmd, NULL,0); dig=(byte*)malloc(sizeof(byte)*mhash_get_block_size(conf->confhmactype)); mhash_deinit(conf->confmd,(void*)dig); digstr=encode_base64(dig,mhash_get_block_size(conf->confhmactype)); if(!conf->config_check||FORCECONFIGMD){ if(strncmp(digstr,conf->old_confmdstr,strlen(digstr))!=0){ /* FIXME Don't use error and add configurability */ error(0,_("Config checksum mismatch\n")); exit(INVALID_ARGUMENT_ERROR); } } } else { if(FORCECONFIGMD){ error(0,_("Config checksum not found. Exiting..\n")); exit(INVALID_ARGUMENT_ERROR); } } #endif conf->use_initial_errorsto=0; if (!conf->config_check) { if(conf->action&DO_INIT){ if(db_init(DB_WRITE)==RETFAIL) { exit(IO_ERROR); } /* FIXME db_out_order info should be taken from tree/config */ /* update_db_out_order(-1); OOPS. It was allready done by append_rxlist :) */ if(db_writespec(conf)==RETFAIL){ error(0,_("Error while writing database. Exiting..\n")); exit(IO_ERROR); } } if((conf->action&DO_INIT)||(conf->action&DO_COMPARE)){ if(db_init(DB_DISK)==RETFAIL) exit(IO_ERROR); } if((conf->action&DO_COMPARE)||(conf->action&DO_DIFF)){ if(db_init(DB_OLD)==RETFAIL) exit(IO_ERROR); } if(conf->action&DO_DIFF){ if(db_init(DB_NEW)==RETFAIL) exit(IO_ERROR); } populate_tree(conf->tree); db_close(); exit(gen_report(conf->tree)); }else { #ifdef WITH_MHASH if(conf->confmd){ error(0,"Config checked. Use the following to patch your config file.\n"); error(0,"0a1\n"); if(newlinelastinconfig==1){ error(0,"> @@begin_config %s\n%lia%li\n> @@end_config\n",digstr,conf_lineno-1,conf_lineno+1); }else { error(0,"> @@begin_config %s\n%lia%li\n> @@end_config\n",digstr,conf_lineno,conf_lineno+2); } free(dig); free(digstr); } #endif } return RETOK; } const char* aide_key_3=CONFHMACKEY_03; const char* db_key_3=DBHMACKEY_03; // vi: ts=8 sw=8 aide-0.16~a2.git20130520/src/base64.c000066400000000000000000000155161214657706600164270ustar00rootroot00000000000000/* ** ** Copyright (C) 1994 Swedish University Network (SUNET) ** Modified by Rami Lehti (C) 1999 ** $Header$ ** ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITTNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** ** ** Martin.Wendel@udac.uu.se ** Torbjorn.Wictorin@udac.uu.se ** ** UDAC ** P.O. Box 174 ** S-751 04 Uppsala ** Sweden ** */ #include "aide.h" #include #include #include #include "base64.h" #include "report.h" /*for locale support*/ #include "locale-aide.h" /*for locale support*/ char tob64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; int fromb64[] = { FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, SKIP, SKIP, FAIL, FAIL, SKIP, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, SKIP, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, 0x3e, FAIL, FAIL, FAIL, 0x3f, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, FAIL, FAIL, FAIL, SKIP, FAIL, FAIL, FAIL, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL }; /* Returns NULL on error */ /* FIXME Possible buffer overflow on outputs larger than B64_BUF */ char* encode_base64(byte* src,size_t ssize) { char* outbuf; char* retbuf; int pos; int i, l, left; unsigned long triple; byte *inb; error(210, "encode base64"); /* Exit on empty input */ if (!ssize||src==NULL){ error(240,"\n"); return NULL; } outbuf = (char *)malloc(sizeof(char)*B64_BUF); /* Initialize working pointers */ inb = src; i = 0; triple = 0; pos = 0; left = ssize; error(210, ", data length: %d\n", left); /* * Process entire inbuf. */ while (left != 0) { i++; left--; triple = (triple <<8) | *inb; if (i == 3 || left == 0) { switch (i) { case 1: triple = triple<<4; break; case 2: triple = triple<<2; break; default: break; } for (l = i; l >= 0; l--){ /* register */ int rr; rr = 0x3f & (triple>>(6*l)); assert (rr < 64); outbuf[pos]=tob64[rr]; pos++; } if (left == 0) switch(i) { case 2: outbuf[pos]='='; pos++; break; case 1: outbuf[pos]='='; pos++; outbuf[pos]='='; pos++; break; default: break; } triple = 0; i = 0; } inb++; } /* outbuf is not completely used so we use retbuf */ retbuf=(char*)malloc(sizeof(char)*(pos+1)); memcpy(retbuf,outbuf,pos); retbuf[pos]='\0'; free(outbuf); return retbuf; } /* FIXME Possible buffer overflow on outputs larger than B64_BUF */ byte* decode_base64(char* src,size_t ssize, size_t *ret_len) { byte* outbuf; byte* retbuf; char* inb; int i; int l; int left; int pos; unsigned long triple; error(210, "decode base64\n"); /* Exit on empty input */ if (!ssize||src==NULL) return NULL; /* Initialize working pointers */ inb = src; outbuf = (byte *)malloc(sizeof(byte)*B64_BUF); l = 0; triple = 0; pos=0; left = ssize; /* * Process entire inbuf. */ while (left != 0) { left--; i = fromb64[(unsigned char)*inb]; switch(i) { case FAIL: error(3, "decode_base64: Illegal character: %c\n", *inb); error(230, "decode_base64: Illegal line:\n%s\n", src); return NULL; break; case SKIP: break; default: triple = triple<<6 | (0x3f & i); l++; break; } if (l == 4 || left == 0) { switch(l) { case 2: triple = triple>>4; break; case 3: triple = triple>>2; break; default: break; } for (l -= 2; l >= 0; l--) { outbuf[pos]=( 0xff & (triple>>(l*8))); pos++; } triple = 0; l = 0; } inb++; } retbuf=(byte*)malloc(sizeof(byte)*(pos+1)); memcpy(retbuf,outbuf,pos); retbuf[pos]='\0'; free(outbuf); if (ret_len) *ret_len = pos; return retbuf; } size_t length_base64(char* src,size_t ssize) { char* inb; int i; int l; int left; size_t pos; unsigned long triple; error(210, "decode base64\n"); /* Exit on empty input */ if (!ssize||src==NULL) return 0; /* Initialize working pointers */ inb = src; l = 0; triple = 0; pos=0; left = ssize; /* * Process entire inbuf. */ while (left != 0) { left--; i = fromb64[(unsigned char)*inb]; switch(i) { case FAIL: error(3, "length_base64: Illegal character: %c\n", *inb); error(230, "length_base64: Illegal line:\n%s\n", src); return 0; break; case SKIP: break; default: triple = triple<<6 | (0x3f & i); l++; break; } if (l == 4 || left == 0) { switch(l) { case 2: triple = triple>>4; break; case 3: triple = triple>>2; break; default: break; } for (l -= 2; l >= 0; l--) { pos++; } triple = 0; l = 0; } inb++; } return pos; } aide-0.16~a2.git20130520/src/be.c000066400000000000000000000213731214657706600157270ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2003,2005,2006,2010,2011,2013 Rami Lehti, Pablo * Virolainen, Richard van den Berg, Hannes von Haugwitz * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "aide.h" #include #include #include #include #include #include #include "db_config.h" #include "db_file.h" #include "report.h" #include "util.h" #ifdef WITH_CURL #include "fopen.h" #endif #include "be.h" #ifdef WITH_PSQL #include "libpq-fe.h" #endif /*for locale support*/ #include "locale-aide.h" /*for locale support*/ #ifdef WITH_PSQL static int be_sql_readinit(psql_data* ret) { /* Yes.. we don't want to know about two first result.. and we want no memoryleaking. */ int i,j,nFields; char* s; char declare []="DECLARE aidecursor CURSOR FOR select * from "; s = (char*)malloc(strlen(declare)+strlen(ret->table)+1); s[0]=0; s=strcat(s,declare); s=strcat(s,ret->table); ret->res=PQexec(ret->conn,s); if (!ret->res || PQresultStatus(ret->res) != PGRES_COMMAND_OK) { if (ret->res!=NULL) { error(255,"Psql error: %s\n",PQresStatus(PQresultStatus(ret->res))); PQclear(ret->res); } return RETFAIL; } PQclear(ret->res); ret -> res = PQexec(ret->conn, "FETCH ALL in aidecursor"); if (!ret->res || PQresultStatus(ret->res) != PGRES_TUPLES_OK) { error(0, "FETCH ALL command didn't return tuples properly\n"); PQclear(ret->res); abort(); } /* first, print out the attribute names */ nFields = PQnfields(ret->res); for (i = 0; i < nFields; i++) error(255,"%-15s", PQfname(ret->res, i)); error(255,"\n\n"); for(i=0;ides[i]=PQfnumber(ret->res,db_names[i]); if (ret->des[i]!=-1) { error(255,"Field %i,%s \n",ret->des[i],db_names[i]); } } ret->curread=0; ret->maxread=PQntuples(ret->res); /* And now we know how many fields we have.. */ error(0,"%i tuples\n",ret->maxread); return RETOK; } static char* get_first_value(char** in){ int i=0; char* ret = (*in); while((*in)[i]!=':' && (*in)[i]!='\0') { i++; } if ((*in)[i]!='\0') { /* Lets not go beond the sting.. */ (*in)[i]='\0'; (*in)+=i+1; } return ret; } #endif FILE* be_init(int inout,url_t* u,int iszipped) { FILE* fh=NULL; long a=0; char* err=NULL; int fd; #if HAVE_FCNTL && HAVE_FTRUNCATE struct flock fl; #endif if (u==NULL) { return NULL; } switch (u->type) { case url_file : { u->value = expand_tilde(u->value); error(200,_("Opening file \"%s\" for %s\n"),u->value,inout?"r":"w+"); #if HAVE_FCNTL && HAVE_FTRUNCATE fd=open(u->value,inout?O_RDONLY:O_CREAT|O_RDWR,0666); #else fd=open(u->value,inout?O_RDONLY:O_CREAT|O_RDWR|O_TRUNC,0666); #endif error(255,"Opened file \"%s\" with fd=%i\n",u->value,fd); if(fd==-1) { error(0,_("Couldn't open file %s for %s"),u->value, inout?"reading\n":"writing\n"); return NULL; } #if HAVE_FCNTL && HAVE_FTRUNCATE if(!inout) { fl.l_type = F_WRLCK; fl.l_whence = SEEK_SET; fl.l_start = 0; fl.l_len = 0; if (fcntl(fd, F_SETLK, &fl) == -1) { if (fcntl(fd, F_SETLK, &fl) == -1) error(0,_("File %s is locked by another process.\n"),u->value); else error(0,_("Cannot get lock for file %s"),u->value); return NULL; } if(ftruncate(fd,0)==-1) error(0,_("Error truncating file %s"),u->value); } #endif #ifdef WITH_ZLIB if(iszipped && !inout){ fh=gzdopen(fd,"wb9"); if(fh==NULL){ error(0,_("Couldn't open file %s for %s"),u->value, inout?"reading\n":"writing\n"); } } else{ #endif fh=fdopen(fd,inout?"r":"w+"); if(fh==NULL){ error(0,_("Couldn't open file %s for %s"),u->value, inout?"reading\n":"writing\n"); } #ifdef WITH_ZLIB } #endif return fh; } case url_stdout : { #ifdef WITH_ZLIB if(iszipped){ return gzdopen(fileno(stdout),"wb"); } else{ #endif return stdout; #ifdef WITH_ZLIB } #endif } case url_stdin : { #ifdef WITH_ZLIB if(iszipped){ return gzdopen(fileno(stdin),"r"); } else{ #endif return stdin; #ifdef WITH_ZLIB } #endif } case url_stderr : { #ifdef WITH_ZLIB if(iszipped){ return gzdopen(fileno(stderr),"wb"); } else{ #endif return stderr; #ifdef WITH_ZLIB } #endif } case url_fd : { a=strtol(u->value,&err,10); if(*err!='\0'||errno==ERANGE){ error(0,"Illegal file descriptor value:%s\n",u->value); } #ifdef WITH_ZLIB if(iszipped && !inout){ fh=gzdopen(a,"w"); if(fh==NULL){ error(0,"Couldn't reopen file descriptor %li\n",a); } } else{ #endif fh=fdopen(a,inout?"r":"w"); if(fh==NULL){ error(0,"Couldn't reopen file descriptor %li\n",a); } #ifdef WITH_ZLIB } #endif return fh; } #ifdef WITH_PSQL case url_sql : { char *pghost, *pgport, *pgoptions, *pgtty, *dbName, *login, *pwd; char *tmp,*tmp2; psql_data* ret = (psql_data*) malloc(sizeof(psql_data)*1); if (ret==NULL) { error(0,"Not enough memory for postgres sql connection\n"); return ret; } tmp=strdup(u->value); tmp2=tmp; pgtty=NULL;pgoptions=NULL; if ((pghost=get_first_value(&tmp)) == NULL) { error(0,"Must define host for Postgres sql connection\n"); free(tmp2); return NULL; } else { error(100,"Psql host is %s\n",pghost); if ((pgport=get_first_value(&tmp)) == NULL) { error(0,"Must define port for Postgres sql connection\n"); free(tmp2); return NULL; } else { error(100,"Psql port is %s\n",pgport); if ((dbName=get_first_value(&tmp)) == NULL) { error(0,"Must define name for database for Postgres sql connection\n"); free(tmp2); return NULL; } else { error(100,"Psql db is %s\n",dbName); if ((login=get_first_value(&tmp)) == NULL) { error(0,"Must define login for Postgres sql connection\n"); free(tmp2); return NULL; } else { error(100,"Psql login is %s\n",login); if ((pwd=get_first_value(&tmp)) == NULL) { error(0,"Must define password for database for Postgres sql connection\n"); free(tmp2); return NULL; } else { error(100,"Psql passwd is %s\n",pwd); if ((ret->table=get_first_value(&tmp))==NULL) { error(0,"Must define table for sql..\n"); free(tmp2); return NULL; } else { if (ret->table[0]=='\0') { error(0,"Must define table for sql..\n"); free(tmp2); return NULL; } else { /* everything went ok.. */ } } } } } } } if (login[0] == '\0' ) { login = NULL; } if (pwd[0] == '\0' ) { pwd = NULL; } ret->conn = PQsetdbLogin(pghost,pgport,pgoptions,pgtty,dbName,login,pwd); if (PQstatus(ret->conn) == CONNECTION_BAD){ error(0,"Postgres sql error during connection\n"); free(tmp2); return NULL; } /* Otherwise we would become to situation that name of table would be freeed */ ret->table = strdup(ret->table); /* And now we have made a connection to database.. Next thing we do is to begin a new transaction block */ ret->res = PQexec(ret->conn, "BEGIN"); if (!ret->res || PQresultStatus(ret->res) != PGRES_COMMAND_OK) { error(0,"BEGIN command failed... \n"); PQclear(ret->res); free(ret); ret=NULL; } else { PQclear(ret->res); if ((inout?be_sql_readinit(ret):RETOK)!=RETOK) { error(255,"Something went wrong with sql backend init.\n"); return NULL; } } free(tmp2); return ret; } #endif #ifdef WITH_CURL case url_http: case url_https: case url_ftp: { error(200,_("Opening curl \"%s\" for %s\n"),u->value,inout?"r":"w+"); if (iszipped) { return NULL; } return url_fopen(u->value,inout?"r":"w+"); } #endif /* WITH CURL */ default:{ error(0,"Unsupported backend: %i", u->type); return NULL; } } /* Not reached */ return NULL; } const char* aide_key_8=CONFHMACKEY_08; const char* db_key_8=DBHMACKEY_08; aide-0.16~a2.git20130520/src/commandconf.c000066400000000000000000000546171214657706600176340ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2006,2010,2011,2013 Rami Lehti, Pablo Virolainen, * Richard van den Berg, Hannes von Haugwitz * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "aide.h" #include #include #include #include #include #include #include "commandconf.h" #include "conf_lex.h" #include "conf_yacc.h" #include "db.h" #include "db_config.h" #include "gen_list.h" #include "symboltable.h" #include "md.h" #include "util.h" #include "base64.h" /*for locale support*/ #include "locale-aide.h" /*for locale support*/ #ifdef WITH_CURL #include "fopen.h" #endif #define BUFSIZE 4096 #define ZBUFSIZE 16384 #ifndef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 256 #endif int commandconf(const char mode,const char* line) { static char* before=NULL; static char* config=NULL; static char* after=NULL; char* all=NULL; char* tmp=NULL; int l=0; switch(mode){ case 'B':{ if(before==NULL){ before=strdup(line); } else { tmp=(char*)malloc(sizeof(char) *(strlen(before)+strlen(line)+2)); tmp[0]='\0'; strcat(tmp,before); strcat(tmp,"\n"); strcat(tmp,line); free(before); before=tmp; } break; } case 'C':{ config=strdup(line); break; } case 'A':{ if(after==NULL){ after=strdup(line); } else { tmp=(char*)malloc(sizeof(char) *(strlen(after)+strlen(line)+2)); strcpy(tmp,after); strcat(tmp,"\n"); strcat(tmp,line); free(after); after=tmp; } break; } case 'D': { /* Let's do it */ int rv=-1; config = expand_tilde(config); if (config!=NULL && strcmp(config,"-")==0) { error(255,_("Config from stdin\n")); rv=0; } else { rv=access(config,R_OK); if(rv==-1){ error(0,_("Cannot access config file: %s: %s\n"),config,strerror(errno)); } } if(before==NULL&&after==NULL&& (config==NULL||strcmp(config,"")==0||rv==-1)){ error(0,_("No config defined\n")); return RETFAIL; } if(before!=NULL) { l+=strlen(before); } if(config!=NULL) { l+=strlen(config); } if(after!=NULL) { l+=strlen(after); } l+=strlen("@@include \n\n\n")+1; all=(char*)malloc(sizeof(char)*l); memset(all,0,l); if(before!=NULL){ strcat(all,before); strcat(all,"\n"); } strcat(all,"@@include "); strcat(all,config); strcat(all,"\n"); if(after!=NULL){ strcat(all,after); strcat(all,"\n"); } error(200,"commandconf():%s\n",all); conf_scan_string(all); if(confparse()){ free(all); return RETFAIL; } free(all); break; } default: { error(0,_("Illegal argument %c to commmandconf()\n"),mode); break; } } return RETOK; } int conf_input_wrapper(char* buf, int max_size, FILE* in) { int retval=0; int c=0; char* tmp=NULL; void* key=NULL; int keylen=0; /* FIXME Add support for gzipped config. :) */ #ifdef WITH_MHASH /* Read a character at a time until we are doing md */ if(conf->do_configmd){ retval=fread(buf,1,max_size,in); }else { c=fgetc(in); retval= (c==EOF) ? 0 : (buf[0] = c,1); } #else retval=fread(buf,1,max_size,in); #endif #ifdef WITH_MHASH if(conf->do_configmd||conf->config_check){ if(((conf->do_configmd==1)&&conf->config_check)||!conf->confmd){ if(conf->do_configmd==1){ conf->do_configmd+=1; } if((key=get_conf_key())!=NULL){ keylen=get_conf_key_len(); if( (conf->confmd= mhash_hmac_init(conf->confhmactype, key, keylen, mhash_get_hash_pblock(conf->confhmactype)))== MHASH_FAILED){ error(0, "mhash_hmac_init() failed for %i for config check. Aborting\n", conf->confhmactype); exit(EXIT_FAILURE); } } else { conf->do_configmd=0; return retval; } } /* FIXME This does not handle the case that @@end_config is on buffer boundary. */ if((tmp=strnstr(buf,"@@end_config",retval))!=NULL){ /* We have end of config don't feed the last line to mhash */ mhash(conf->confmd,(void*)buf,tmp-buf); } else { mhash(conf->confmd,(void*)buf,retval); } } #endif return retval; } int db_input_wrapper(char* buf, int max_size, int db) { int retval=0; int c=0; int err=0; int* domd=NULL; #ifdef WITH_CURL url_t* db_url=NULL; #endif #ifdef WITH_MHASH char* tmp=NULL; MHASH* md=NULL; void* key=NULL; int keylen; #endif FILE** db_filep=NULL; #ifdef WITH_ZLIB gzFile* db_gzp=NULL; #endif struct md_container *mdc; switch(db) { case DB_OLD: { #ifdef WITH_CURL db_url=conf->db_in_url; #endif domd=&(conf->do_dboldmd); #ifdef WITH_MHASH md=&(conf->dboldmd); #endif db_filep=&(conf->db_in); #ifdef WITH_ZLIB db_gzp=&(conf->db_gzin); #endif break; } case DB_NEW: { #ifdef WITH_CURL db_url=conf->db_new_url; #endif domd=&(conf->do_dbnewmd); #ifdef WITH_MHASH md=&(conf->dbnewmd); #endif db_filep=&(conf->db_new); #ifdef WITH_ZLIB db_gzp=&(conf->db_gznew); #endif break; } } #ifdef WITH_CURL switch (db_url->type) { case url_http: case url_https: case url_ftp: { retval=url_fread(buf,1,max_size,(URL_FILE *)*db_filep); if ((mdc = (db == DB_OLD ? conf->mdc_in : conf->mdc_out))) { update_md(mdc, buf, retval); } break; } default: #endif /* WITH CURL */ /* Read a character at a time until we are doing md */ #ifdef WITH_ZLIB if((*db_gzp==NULL)&&(*domd)){ retval=fread(buf,1,max_size,*db_filep); } if((*db_gzp!=NULL)&&(*domd)){ if(gzeof(*db_gzp)){ retval=0; buf[0]='\0'; }else { if((retval=gzread(*db_gzp,buf,max_size))<0){ error(0,_("gzread() failed: gzerr=%s!\n"),gzerror(*db_gzp,&err)); retval=0; buf[0]='\0'; } else { /* gzread returns 0 even if uncompressed bytes were read*/ error(240,"nread=%d,strlen(buf)=%lu,errno=%s,gzerr=%s\n", retval,(unsigned long)strnlen((char*)buf, max_size), strerror(errno),gzerror(*db_gzp,&err)); if(retval==0){ retval=strnlen((char*)buf, max_size); } } } } if((*db_gzp!=NULL)&&!(*domd)){ c=gzgetc(*db_gzp); retval= (c==EOF) ? 0 : (buf[0] = c,1); } if((*db_gzp==NULL)&&!(*domd)){ c=fgetc(*db_filep); if(c==(unsigned char)'\037'){ c=fgetc(*db_filep); if(c==(unsigned char)'\213'){ /* We got gzip header. */ error(255,"Got Gzip header. Handling..\n"); lseek(fileno(*db_filep),0L,SEEK_SET); *db_gzp=gzdopen(fileno(*db_filep),"rb"); c=gzgetc(*db_gzp); error(255,"First character after gzip header is: %c(%#X)\n",c,c); if(c==-1) { int xx; error(0,"Error reading gzipped file: %s\n",gzerror(*db_gzp,&xx)); exit(EXIT_FAILURE); } }else { /* False alarm */ ungetc(c,*db_filep); } } retval= (c==EOF) ? 0 : (buf[0] = c,1); } #else /* WITH_ZLIB */ #ifdef WITH_MHASH if(*domd){ retval=fread(buf,1,max_size,*db_filep); }else { c=fgetc(*db_filep); retval= (c==EOF) ? 0 : (buf[0] = c,1); } #else /* WITH_MHASH */ retval=fread(buf,1,max_size,*db_filep); #endif /* WITH_MHASH */ #endif /* WITH_ZLIB */ if ((mdc = (db == DB_OLD ? conf->mdc_in : conf->mdc_out))) { update_md(mdc, buf, retval); } #ifdef WITH_MHASH if(*domd){ if(!*md){ if((key=get_db_key())!=NULL){ keylen=get_db_key_len(); if( (*md= mhash_hmac_init(conf->dbhmactype, key, keylen, mhash_get_hash_pblock(conf->dbhmactype)))== MHASH_FAILED){ error(0, "mhash_hmac_init() failed for db check. Aborting\n"); exit(EXIT_FAILURE); } } else { *domd=0; } } /* FIXME This does not handle the case that @@end_config is on buffer boundary. */ if (*domd!=0) { if((tmp=strnstr(buf,"@@end_db",retval))!=NULL){ /* We have end of db don't feed the last line to mhash */ mhash(*md,(void*)buf,tmp-buf); /* We don't want to come here again after the *md has been deinited by db_readline_file() */ *domd=0; } else { mhash(*md,(void*)buf,retval); } } } #endif #ifdef WITH_CURL } #endif /* WITH CURL */ return retval; } int check_db_order(DB_FIELD* d,int size, DB_FIELD a) { int i; for(i=0;idb_out_order,conf->db_out_size,a); } void update_db_out_order(DB_ATTR_TYPE attr) { /* First we add those attributes that must be there */ if (check_dboo(db_linkname)==RETOK) { conf->db_out_order[conf->db_out_size++]=db_linkname; } if (check_dboo(db_attr)==RETOK) { conf->db_out_order[conf->db_out_size++]=db_attr; } if(check_dboo(db_perm)==RETOK){ conf->db_out_order[conf->db_out_size++]=db_perm; } if(check_dboo(db_inode)==RETOK){ conf->db_out_order[conf->db_out_size++]=db_inode; } if((attr&DB_BCOUNT) && (check_dboo(db_bcount)!=RETFAIL)){ conf->db_out_order[conf->db_out_size++]=db_bcount; } if((attr&DB_UID) && (check_dboo(db_uid)!=RETFAIL)){ conf->db_out_order[conf->db_out_size++]=db_uid; } if((attr&DB_GID) && (check_dboo(db_gid)!=RETFAIL)){ conf->db_out_order[conf->db_out_size++]=db_gid; } if((attr&DB_SIZE) && (check_dboo(db_size)!=RETFAIL)){ conf->db_out_order[conf->db_out_size++]=db_size; } if((attr&DB_SIZEG) && (check_dboo(db_size)!=RETFAIL)){ conf->db_out_order[conf->db_out_size++]=db_size; } if((attr&DB_ATIME) && (check_dboo(db_atime)!=RETFAIL)){ conf->db_out_order[conf->db_out_size++]=db_atime; } if((attr&DB_MTIME) && (check_dboo(db_mtime)!=RETFAIL)){ conf->db_out_order[conf->db_out_size++]=db_mtime; } if((attr&DB_CTIME) && (check_dboo(db_ctime)!=RETFAIL)){ conf->db_out_order[conf->db_out_size++]=db_ctime; } if((attr&DB_LNKCOUNT) && (check_dboo(db_lnkcount)!=RETFAIL)){ conf->db_out_order[conf->db_out_size++]=db_lnkcount; } if((attr&DB_MD5) && (check_dboo(db_md5)!=RETFAIL)){ conf->db_out_order[conf->db_out_size++]=db_md5; } if((attr&DB_SHA1) && (check_dboo(db_sha1)!=RETFAIL)){ conf->db_out_order[conf->db_out_size++]=db_sha1; } if((attr&DB_RMD160) && (check_dboo(db_rmd160)!=RETFAIL)){ conf->db_out_order[conf->db_out_size++]=db_rmd160; } if((attr&DB_TIGER) && (check_dboo(db_tiger)!=RETFAIL)){ conf->db_out_order[conf->db_out_size++]=db_tiger; } if((attr&DB_CRC32) && (check_dboo(db_crc32)!=RETFAIL)){ conf->db_out_order[conf->db_out_size++]=db_crc32; } if((attr&DB_HAVAL) && (check_dboo(db_haval)!=RETFAIL)){ conf->db_out_order[conf->db_out_size++]=db_haval; } /* #ifdef WITH_MHASH */ if((attr&DB_GOST) && (check_dboo(db_gost)!=RETFAIL)){ conf->db_out_order[conf->db_out_size++]=db_gost; } if((attr&DB_WHIRLPOOL) && (check_dboo(db_whirlpool)!=RETFAIL)){ conf->db_out_order[conf->db_out_size++]=db_whirlpool; } if((attr&DB_CRC32B) && (check_dboo(db_crc32b)!=RETFAIL)){ conf->db_out_order[conf->db_out_size++]=db_crc32b; } /* #endif */ if((attr&DB_SHA256) && (check_dboo(db_sha256)!=RETFAIL)){ conf->db_out_order[conf->db_out_size++]=db_sha256; } if((attr&DB_SHA512) && (check_dboo(db_sha512)!=RETFAIL)){ conf->db_out_order[conf->db_out_size++]=db_sha512; } #ifdef WITH_ACL if((attr&DB_ACL) && (check_dboo(db_acl)!=RETFAIL)){ conf->db_out_order[conf->db_out_size++]=db_acl; } #endif if((attr&DB_XATTRS) && (check_dboo(db_xattrs)!=RETFAIL)){ conf->db_out_order[conf->db_out_size++]=db_xattrs; } if((attr&DB_SELINUX) && (check_dboo(db_selinux)!=RETFAIL)){ conf->db_out_order[conf->db_out_size++]=db_selinux; } if((attr&DB_E2FSATTRS) && (check_dboo(db_e2fsattrs)!=RETFAIL)){ conf->db_out_order[conf->db_out_size++]=db_e2fsattrs; } if((attr&DB_CHECKMASK) && (check_dboo(db_checkmask)!=RETFAIL)){ conf->db_out_order[conf->db_out_size++]=db_checkmask; } } char* get_variable_value(char* var) { list* r=NULL; if((r=list_find(var,conf->defsyms))){ return (((symba*)r->data)->value); }; return NULL; } void putbackvariable(char* var) { char* a=NULL; char* v=strdup(var); char* subst_begin=strstr(v,"@@{"); char* subst_end=strstr(subst_begin,"}"); char* tmp=(char*)malloc((subst_end-subst_begin)+1); tmp = strncpy(tmp,subst_begin+3,subst_end-subst_begin-3); tmp[subst_end-subst_begin-3]='\0'; conf_put_token(subst_end+1); if((a=get_variable_value(tmp))!=NULL){ conf_put_token(a); } else { error(230,_("Variable %s not defined\n"),tmp); /* * We can use nondefined variable */ } subst_begin[0]='\0'; conf_put_token(v); conf_put_token("\n"); free(v); free(tmp); } void do_define(char* name, char* value) { symba* s=NULL; list* l=NULL; if(!(l=list_find(name,conf->defsyms))){ s=(symba*)malloc(sizeof(symba)); s->name=name; s->value=value; conf->defsyms=list_append(conf->defsyms,(void*)s); } else { free(((symba*)l->data)->value); ((symba*)l->data)->value=NULL; ((symba*)l->data)->value=value; } } void do_undefine(char* name) { list*r=NULL; if((r=list_find(name,conf->defsyms))){ free(((symba*)r->data)->value); free((symba*)r->data); r->data=NULL; conf->defsyms=list_delete_item(r); } } int handle_endif(int doit,int allow_else){ if(doit){ int count=1; error(230,_("\nEating until @@endif\n")); do { int i = conflex(); switch (i) { case TIFDEF : { count++; break; } case TIFNDEF : { count++; break; } case TENDIF : { count--; break; } case TIFHOST : { count++; break; } case TIFNHOST : { count++; break; } case TELSE : { if (count==1) { /* * We have done enough */ if (allow_else) { return 0; } else { conferror("Ambigous else"); return -1; } } break; } case 0 : { conferror("@@endif or @@else expected"); return -1; count=0; } default : { /* * empty default */ } } } while (count!=0); conf_put_token("\n@@endif\n"); error(230,"\nEating done\n"); } return 0; } int do_ifxdef(int mode,char* name) { int doit; doit=mode; if((list_find(name,conf->defsyms))){ doit=1-doit; } return (handle_endif(doit,1)); } int do_ifxhost(int mode,char* name) { int doit; char* s=NULL; char *p; doit=mode; s=(char*)malloc(sizeof(char)*MAXHOSTNAMELEN+1); if (s == NULL) { error(0,_("Couldn't malloc hostname buffer")); } s[MAXHOSTNAMELEN] = '\0'; if(gethostname(s,MAXHOSTNAMELEN)==-1){ error(0,_("Couldn't get hostname %s"),name); free(s); return -1; } /* strip off everything past the . */ p = strchr(s, '.'); if (p != NULL) { *p = '\0'; } if(strcmp(name,s)==0) { doit=1-doit; } free(s); return (handle_endif(doit,1)); } list* append_rxlist(char* rx,DB_ATTR_TYPE attr,list* rxlst) { extern long conf_lineno; /* defined & set in conf_lex.l */ rx_rule* r=NULL; r=(rx_rule*)malloc(sizeof(rx_rule)); r->rx=rx; r->attr=attr; r->conf_lineno = conf_lineno; if (attr&DB_CHECKINODE && attr&DB_CTIME) error(20,"Rule at line %li has c and I flags enabled at the same time. If same inode is found, flag c is ignored\n",conf_lineno); update_db_out_order(r->attr); rxlst=list_append(rxlst,(void*)r); return rxlst; } void do_groupdef(char* group,DB_ATTR_TYPE value) { list* r=NULL; symba* s=NULL; if((r=list_find(group,conf->groupsyms))){ ((symba*)r->data)->ival=value; return; } /* This is a new group */ s=(symba*)malloc(sizeof(symba)); s->name=group; s->ival=value; conf->groupsyms=list_append(conf->groupsyms,(void*)s); } DB_ATTR_TYPE get_groupval(char* group) { list* r=NULL; if((r=list_find(group,conf->groupsyms))){ return (((symba*)r->data)->ival); } return -1; } void do_dbdef(int dbtype,char* val) { url_t* u=NULL; url_t** conf_db_url; error(255,"do_dbdef (%i) called with (%s)\n",dbtype,val); switch(dbtype) { case DB_OLD: { conf_db_url=&(conf->db_in_url); break; } case DB_WRITE: { conf_db_url=&(conf->db_out_url); break; } case DB_NEW: { conf_db_url=&(conf->db_new_url); break; } default : { error(0,"Invalid call of do_dbdef\n"); return; } } if(*conf_db_url==NULL){ u=parse_url(val); /* FIXME Check the URL if you add support for databases that cannot be * both input and output urls */ switch (dbtype) { case DB_OLD: case DB_NEW:{ if(u==NULL||u->type==url_unknown||u->type==url_stdout ||u->type==url_stderr) { error(0,_("Unsupported input URL-type:%s\n"),val); } else { *conf_db_url=u; } break; } case DB_WRITE: { if(u==NULL||u->type==url_unknown||u->type==url_stdin){ error(0,_("Unsupported output URL-type:%s\n"),val); } else{ conf->db_out_url=u; error(200,_("Output database set to \"%s\" \"%s\"\n"),val,u->value); } break; } } } free(val); } void do_dbindef(char* val) { url_t* u=NULL; if(conf->db_in_url==NULL){ u=parse_url(val); /* FIXME Check the URL if you add support for databases that cannot be * both input and output urls */ if(u==NULL||u->type==url_unknown||u->type==url_stdout ||u->type==url_stderr) { error(0,_("Unsupported input URL-type:%s\n"),val); } else { conf->db_in_url=u; } } free(val); } void do_dboutdef(char* val) { url_t* u=NULL; error(200,_("Setting output database \"%s\"\n"),val); if(conf->db_out_url==NULL){ u=parse_url(val); /* FIXME Check the URL if you add support for databases that cannot be * both input and output urls */ if(u==NULL||u->type==url_unknown||u->type==url_stdin){ error(0,_("Unsupported output URL-type:%s\n"),val); } else{ conf->db_out_url=u; error(200,_("Output database set to \"%s\" \"%s\"\n"),val,u->value); } } else { error(200,_("Output database already set\n")); } free(val); } void do_repurldef(char* val) { url_t* u=NULL; u=parse_url(val); /* FIXME Check the URL if you add support for databases that cannot be * both input and output urls */ if(u==NULL||u->type==url_unknown||u->type==url_stdin){ error(0,_("Unsupported output URL-type:%s\n"),val); } else { error_init(u,0); } } void do_verbdef(char* val) { char* err=NULL; long a=0; a=strtol(val,&err,10); if(*err!='\0' || a>255 || a<0 || errno==ERANGE){ error(0, _("Illegal verbosity level:%s\n"),val); error(10,_("Using previous value:%i\n"),conf->verbose_level); return; } else { if(conf->verbose_level==-1){ conf->verbose_level=a; }else { error(210,_("Verbosity already defined to %i\n"),conf->verbose_level); } } } void do_rootprefix(char* val) { if (conf->root_prefix_length == 0) { conf->root_prefix=val; conf->root_prefix_length=strlen(conf->root_prefix); if (conf->root_prefix_length && conf->root_prefix[conf->root_prefix_length-1] == '/') { conf->root_prefix[--conf->root_prefix_length] = '\0'; error(200,_("Removed trailing '/' from root prefix \n")); } error(200,_("Root prefix set to '%s'\n"), conf->root_prefix); } else { error(200,_("Root prefix already set to '%s'\n"), conf->root_prefix); } } const char* aide_key_7=CONFHMACKEY_07; const char* db_key_7=DBHMACKEY_07; void* get_conf_key(void) { void* r; char* m=(char*)malloc(strlen(aide_key_1)+ strlen(aide_key_2)+ strlen(aide_key_3)+ strlen(aide_key_4)+ strlen(aide_key_5)+ strlen(aide_key_6)+ strlen(aide_key_7)+ strlen(aide_key_8)+ strlen(aide_key_9)+ strlen(aide_key_0)+1); m[0]=0; strcat(m,aide_key_0); strcat(m,aide_key_1); strcat(m,aide_key_2); strcat(m,aide_key_3); strcat(m,aide_key_4); strcat(m,aide_key_5); strcat(m,aide_key_6); strcat(m,aide_key_7); strcat(m,aide_key_8); strcat(m,aide_key_9); r=decode_base64(m,strlen(m),NULL); memset(m,0,strlen(m)); free(m); return r; } size_t get_conf_key_len(void) { size_t len=0; char* m=(char*)malloc(strlen(aide_key_1)+ strlen(aide_key_2)+ strlen(aide_key_3)+ strlen(aide_key_4)+ strlen(aide_key_5)+ strlen(aide_key_6)+ strlen(aide_key_7)+ strlen(aide_key_8)+ strlen(aide_key_9)+ strlen(aide_key_0)+1); m[0]=0; strcat(m,aide_key_0); strcat(m,aide_key_1); strcat(m,aide_key_2); strcat(m,aide_key_3); strcat(m,aide_key_4); strcat(m,aide_key_5); strcat(m,aide_key_6); strcat(m,aide_key_7); strcat(m,aide_key_8); strcat(m,aide_key_9); len=length_base64(m,strlen(m)); memset(m,0,strlen(m)); free(m); return len; } void* get_db_key(void) { void* r; char* m=(char*)malloc(strlen(db_key_1)+ strlen(db_key_2)+ strlen(db_key_3)+ strlen(db_key_4)+ strlen(db_key_5)+ strlen(db_key_6)+ strlen(db_key_7)+ strlen(db_key_8)+ strlen(db_key_9)+ strlen(db_key_0)+1); m[0]=0; strcat(m,db_key_0); strcat(m,db_key_1); strcat(m,db_key_2); strcat(m,db_key_3); strcat(m,db_key_4); strcat(m,db_key_5); strcat(m,db_key_6); strcat(m,db_key_7); strcat(m,db_key_8); strcat(m,db_key_9); r=decode_base64(m,strlen(m),NULL); memset(m,0,strlen(m)); free(m); return r; } size_t get_db_key_len(void) { size_t len=0; char* m=(char*)malloc(strlen(db_key_1)+ strlen(db_key_2)+ strlen(db_key_3)+ strlen(db_key_4)+ strlen(db_key_5)+ strlen(db_key_6)+ strlen(db_key_7)+ strlen(db_key_8)+ strlen(db_key_9)+ strlen(db_key_0)+1); m[0]=0; strcat(m,db_key_0); strcat(m,db_key_1); strcat(m,db_key_2); strcat(m,db_key_3); strcat(m,db_key_4); strcat(m,db_key_5); strcat(m,db_key_6); strcat(m,db_key_7); strcat(m,db_key_8); strcat(m,db_key_9); len=length_base64(m,strlen(m)); memset(m,0,strlen(m)); free(m); return len; } aide-0.16~a2.git20130520/src/compare_db.c000066400000000000000000000605201214657706600174310ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2007,2010-2013 Rami Lehti, Pablo Virolainen, * Richard van den Berg, Mike Markley, Hannes von Haugwitz * $Id$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "aide.h" #include #include #include #include #include #ifdef WITH_AUDIT #include #ifdef HAVE_SYSLOG #include #endif #endif #include "base64.h" #include "report.h" #include "db_config.h" #include "gnu_regex.h" #include "gen_list.h" #include "list.h" #include "db.h" #include "util.h" #include "commandconf.h" #include "gen_list.h" #include "compare_db.h" /*for locale support*/ #include "locale-aide.h" /*for locale support*/ #include "md.h" /*************/ /* construction area for report lines */ const int width_details = 80; const char time_format[] = "%Y-%m-%d %H:%M:%S %z"; const int time_string_len = 26; long ntotal, nadd, nrem, nchg = 0; const char* report_top_format = "\n\n---------------------------------------------------\n%s:\n---------------------------------------------------\n"; DB_ATTR_TYPE ignored_attrs, forced_attrs; const DB_ATTR_TYPE summary_attributes[] = { DB_FTYPE, DB_LINKNAME, DB_SIZE|DB_SIZEG, DB_BCOUNT, DB_PERM, DB_UID, DB_GID, DB_ATIME, DB_MTIME, DB_CTIME, DB_INODE, DB_LNKCOUNT, DB_HASHES #ifdef WITH_ACL , DB_ACL #endif #ifdef WITH_XATTR , DB_XATTRS #endif #ifdef WITH_SELINUX , DB_SELINUX #endif #ifdef WITH_E2FSATTRS , DB_E2FSATTRS #endif }; const char summary_char[] = { '!' ,'l', '>', 'b', 'p', 'u', 'g', 'a', 'm', 'c', 'i', 'n', 'C' #ifdef WITH_ACL , 'A' #endif #ifdef WITH_XATTR , 'X' #endif #ifdef WITH_SELINUX , 'S' #endif #ifdef WITH_E2FSATTRS , 'E' #endif }; const DB_ATTR_TYPE details_attributes[] = { DB_FTYPE, DB_LINKNAME, DB_SIZE, DB_SIZEG, DB_BCOUNT, DB_PERM, DB_UID, DB_GID, DB_ATIME, DB_MTIME, DB_CTIME, DB_INODE, DB_LNKCOUNT, DB_MD5, DB_SHA1, DB_RMD160, DB_TIGER, DB_SHA256, DB_SHA512 #ifdef WITH_MHASH , DB_CRC32, DB_HAVAL, DB_GOST, DB_CRC32B, DB_WHIRLPOOL #endif #ifdef WITH_ACL , DB_ACL #endif #ifdef WITH_XATTR , DB_XATTRS #endif #ifdef WITH_SELINUX , DB_SELINUX #endif #ifdef WITH_E2FSATTRS , DB_E2FSATTRS #endif }; const char* details_string[] = { _("File type") , _("Lname"), _("Size"), _("Size (>)"), _("Bcount"), _("Perm"), _("Uid"), _("Gid"), _("Atime"), _("Mtime"), _("Ctime"), _("Inode"), _("Linkcount"), _("MD5"), _("SHA1"), _("RMD160"), _("TIGER"), _("SHA256"), _("SHA512") #ifdef WITH_MHASH , _("CRC32"), _("HAVAL"), _("GOST"), _("CRC32B"), _("WHIRLPOOL") #endif #ifdef WITH_ACL , _("ACL") #endif #ifdef WITH_XATTR , _("XAttrs") #endif #ifdef WITH_SELINUX , _("SELinux") #endif #ifdef WITH_E2FSATTRS , _("E2FSAttrs") #endif }; #ifdef WITH_E2FSATTRS /* flag->character mappings defined in lib/e2p/pf.c (part of e2fsprogs-1.41.12 sources) */ unsigned long flag_bits[] = { EXT2_SECRM_FL, EXT2_UNRM_FL, EXT2_SYNC_FL, EXT2_DIRSYNC_FL, EXT2_IMMUTABLE_FL, EXT2_APPEND_FL, EXT2_NODUMP_FL, EXT2_NOATIME_FL, EXT2_COMPR_FL, EXT2_COMPRBLK_FL, EXT2_DIRTY_FL, EXT2_NOCOMPR_FL, EXT2_ECOMPR_FL, EXT3_JOURNAL_DATA_FL, EXT2_INDEX_FL, EXT2_NOTAIL_FL, EXT2_TOPDIR_FL #ifdef EXT4_EXTENTS_FL , EXT4_EXTENTS_FL #endif #ifdef EXT4_HUGE_FILE_FL , EXT4_HUGE_FILE_FL #endif }; char flag_char[] = { 's', 'u', 'S', 'D', 'i', 'a', 'd', 'A', 'c', 'B', 'Z', 'X', 'E', 'j', 'I', 't', 'T' #ifdef EXT4_EXTENTS_FL , 'e' #endif #ifdef EXT4_HUGE_FILE_FL , 'h' #endif }; #endif /*************/ static DB_ATTR_TYPE get_ignorelist() { DB_ATTR_TYPE ignorelist = get_groupval("ignore_list"); return ignorelist==DB_ATTR_UNDEF?0:ignorelist; } static DB_ATTR_TYPE get_report_attributes() { DB_ATTR_TYPE forced_attrs = get_groupval("report_attributes"); return forced_attrs==DB_ATTR_UNDEF?0:forced_attrs; } static char get_file_type_char(mode_t mode) { switch (mode & S_IFMT) { case S_IFREG: return 'f'; case S_IFDIR: return 'd'; #ifdef S_IFIFO case S_IFIFO: return 'F'; #endif case S_IFLNK: return 'L'; case S_IFBLK: return 'B'; case S_IFCHR: return 'D'; #ifdef S_IFSOCK case S_IFSOCK: return 's'; #endif #ifdef S_IFDOOR case S_IFDOOR: return '|'; #endif default: return '?'; } } #ifdef WITH_XATTR static size_t xstrnspn(const char *s1, size_t len, const char *srch) { const char *os1 = s1; while (len-- && strchr(srch, *s1)) ++s1; return (s1 - os1); } #define PRINTABLE_XATTR_VALS \ "0123456789" \ "abcdefghijklmnopqrstuvwxyz" \ "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \ ".-_:;,[]{}<>()!@#$%^&*|\\/?~" static int xattrs2array(xattrs_type* xattrs, char* **values) { int n = 0; if (xattrs==NULL) { n=1; } else { n=1+xattrs->num; } *values = malloc(n * sizeof(char*)); (*values)[0]=malloc((6+floor(log10(n)))*sizeof(char)); snprintf((*values)[0], 6+floor(log10(n)), "num=%d", n-1); if (n>1) { size_t num = 0; int width, length; width = log10(xattrs->num); /* make them the same width */ while (num++ < xattrs->num) { char *val = NULL; size_t len = 0; val = (char *)xattrs->ents[num - 1].val; len = xstrnspn(val, xattrs->ents[num - 1].vsz, PRINTABLE_XATTR_VALS); if ((len == xattrs->ents[num - 1].vsz) || ((len == (xattrs->ents[num - 1].vsz - 1)) && !val[len])) { length = 8 + width + strlen(xattrs->ents[num - 1].key) + strlen(val); (*values)[num]=malloc(length *sizeof(char)); snprintf((*values)[num], length , "[%.*zd] %s = %s", width, num, xattrs->ents[num - 1].key, val); } else { val = encode_base64(xattrs->ents[num - 1].val, xattrs->ents[num - 1].vsz); length = 10 + width + strlen(xattrs->ents[num - 1].key) + strlen(val); (*values)[num]=malloc( length *sizeof(char)); snprintf((*values)[num], length , "[%.*zd] %s <=> %s", width, num, xattrs->ents[num - 1].key, val); free(val); } } } return n; } #endif #ifdef WITH_ACL static int acl2array(acl_type* acl, char* **values) { int n = 0; #ifdef WITH_POSIX_ACL #define easy_posix_acl(x,y) \ if (acl->x) { \ i = k = 0; \ while (acl->x[i]) { \ if (acl->x[i]=='\n') { \ (*values)[j]=malloc(4+(i-k)*sizeof(char)); \ snprintf((*values)[j], 4+(i-k), "%c: %s", y, &acl->x[k]); \ j++; \ k=i+1; \ } \ i++; \ } \ } if (acl->acl_a || acl->acl_d) { int j, k, i; if (acl->acl_a) { i = 0; while (acl->acl_a[i]) { if (acl->acl_a[i++]=='\n') { n++; } } } if (acl->acl_d) { i = 0; while (acl->acl_d[i]) { if (acl->acl_d[i++]=='\n') { n++; } } } *values = malloc(n * sizeof(char*)); j = 0; easy_posix_acl(acl_a, 'A') easy_posix_acl(acl_d, 'D') } #endif #ifdef WITH_SUN_ACL /* FIXME: readd sun acl support */ #endif return n; } #endif #ifdef WITH_E2FSATTRS static char* e2fsattrs2string(unsigned long flags) { int length = sizeof(flag_bits)/sizeof(long); char* string = malloc ((length+1) * sizeof (char)); int i; for (i = 0 ; i < length ; i++) { if (flag_bits[i] & flags) { string[i]=flag_char[i]; } else { string[i]='-'; } } string[length] = '\0'; return string; } #endif static char* get_file_type_string(mode_t mode) { switch (mode & S_IFMT) { case S_IFREG: return _("File"); case S_IFDIR: return _("Directory"); #ifdef S_IFIFO case S_IFIFO: return _("FIFO"); #endif case S_IFLNK: return _("Link"); case S_IFBLK: return _("Block device"); case S_IFCHR: return _("Character device"); #ifdef S_IFSOCK case S_IFSOCK: return _("Socket"); #endif #ifdef S_IFDOOR case S_IFDOOR: return _("Door"); #endif case 0: return NULL; default: return _("Unknown file type"); } } static char* byte_to_base16(byte* src, size_t ssize) { char* str = malloc((2*ssize+1) * sizeof (char)); size_t i; for(i=0; i < ssize; ++i) { snprintf(&str[2*i], 3, "%02x", src[i]); } return str; } static int get_attribute_values(DB_ATTR_TYPE attr, db_line* line, char* **values) { #define easy_string(s) \ l = strlen(s)+1; \ *values[0] = malloc(l * sizeof (char)); \ snprintf(*values[0], l, "%s",s); #define easy_md(a,b,c) \ } else if (a&attr) { \ if (conf->report_base16) { \ *values[0] = byte_to_base16(line->b, c); \ } else { \ *values[0] = encode_base64(line->b, c); \ } #define easy_number(a,b,c) \ } else if (a&attr) { \ l = 2+floor(line->b?log10(line->b):0); \ *values[0] = malloc(l * sizeof (char)); \ snprintf(*values[0], l, c,line->b); #define easy_time(a,b) \ } else if (a&attr) { \ *values[0] = malloc(time_string_len * sizeof (char)); \ strftime(*values[0], time_string_len, time_format, localtime(&(line->b))); int l; if (line==NULL || !(line->attr&attr)) { *values = NULL; return 0; #ifdef WITH_ACL } else if (DB_ACL&attr) { return acl2array(line->acl, &*values); #endif #ifdef WITH_XATTR } else if (DB_XATTRS&attr) { return xattrs2array(line->xattrs, &*values); #endif } else { *values = malloc(1 * sizeof (char*)); if (DB_FTYPE&attr) { easy_string(get_file_type_string(line->perm)) } else if (DB_LINKNAME&attr) { easy_string(line->linkname) easy_number((DB_SIZE|DB_SIZEG),size,"%llu") } else if (DB_PERM&attr) { *values[0] = perm_to_char(line->perm); easy_time(DB_ATIME,atime) easy_time(DB_MTIME,mtime) easy_time(DB_CTIME,ctime) easy_number(DB_BCOUNT,bcount,"%i") easy_number(DB_UID,uid,"%i") easy_number(DB_GID,gid,"%i") easy_number(DB_INODE,inode,"%i") easy_number(DB_LNKCOUNT,nlink,"%i") easy_md(DB_MD5,md5,HASH_MD5_LEN) easy_md(DB_SHA1,sha1,HASH_SHA1_LEN) easy_md(DB_RMD160,rmd160,HASH_RMD160_LEN) easy_md(DB_TIGER,tiger,HASH_TIGER_LEN) easy_md(DB_SHA256,sha256,HASH_SHA256_LEN) easy_md(DB_SHA512,sha512,HASH_SHA512_LEN) #ifdef WITH_MHASH easy_md(DB_CRC32,crc32,HASH_CRC32_LEN) easy_md(DB_HAVAL,haval,HASH_HAVAL256_LEN) easy_md(DB_GOST,gost,HASH_GOST_LEN) easy_md(DB_CRC32B,crc32b,HASH_CRC32B_LEN) easy_md(DB_WHIRLPOOL,whirlpool,HASH_WHIRLPOOL_LEN) #endif #ifdef WITH_SELINUX } else if (DB_SELINUX&attr) { easy_string(line->cntx) #endif #ifdef WITH_E2FSATTRS } else if (DB_E2FSATTRS&attr) { *values[0]=e2fsattrs2string(line->e2fsattrs); #endif } else { easy_string("unknown attribute") } return 1; } } static void print_line(seltree* node) { if(conf->summarize_changes==1) { int i; int length = sizeof(summary_attributes)/sizeof(DB_ATTR_TYPE); char* summary = malloc ((length+1) * sizeof (char)); if (node->checked&(NODE_ADDED|NODE_REMOVED)) { summary[0]=get_file_type_char((node->checked&NODE_REMOVED?node->old_data:node->new_data)->perm); for(i=1;ichecked&NODE_ADDED?'+':'-'; } } else if (node->checked&NODE_CHANGED) { char c, u, a, r, g, s; for(i=0;inew_data)->perm); break; case 2: if (summary_attributes[i]&(node->changed_attrs&(~ignored_attrs)) && (node->old_data)->size > (node->new_data)->size) { c = '<'; } u = '='; break; } if (summary_attributes[i]&node->changed_attrs&(~ignored_attrs)) { summary[i]=c; } else if (summary_attributes[i]&((node->old_data)->attr&~((node->new_data)->attr))) { summary[i]=r; } else if (summary_attributes[i]&~((node->old_data)->attr)&(node->new_data)->attr) { summary[i]=a; } else if (summary_attributes[i]&(((node->old_data)->attr&(node->new_data)->attr)&ignored_attrs)) { summary[i]=g; } else if (summary_attributes[i]&((node->old_data)->attr&(node->new_data)->attr)) { summary[i]=u; } else { summary[i]=s; } } } summary[length]='\0'; error(2,"\n%s: %s", summary, (node->checked&NODE_REMOVED?node->old_data:node->new_data)->filename); free(summary); summary=NULL; } else { if (node->checked&NODE_ADDED) { error(2,"added: %s\n",(node->new_data)->filename); } else if (node->checked&NODE_REMOVED) { error(2,"removed: %s\n",(node->old_data)->filename); } else if (node->checked&NODE_CHANGED) { error(2,"changed: %s\n",(node->new_data)->filename); } } } static void print_dbline_attributes(db_line* oline, db_line* nline, DB_ATTR_TYPE changed_attrs, DB_ATTR_TYPE report_attrs) { char **ovalue, **nvalue; int onumber, nnumber, olen, nlen, i, j, k, c; int length = sizeof(details_attributes)/sizeof(DB_ATTR_TYPE); int p = (width_details-(width_details%2?13:14))/2; DB_ATTR_TYPE attrs; error(2,"\n"); char *file_type = get_file_type_string((nline==NULL?oline:nline)->perm); if (file_type) { error(2,"%s: ", file_type); } error(2,"%s\n", (nline==NULL?oline:nline)->filename); attrs=(~(ignored_attrs))&(report_attrs|changed_attrs)&((oline==NULL?0:oline->attr)|(nline==NULL?0:nline->attr)); for (j=0; j < length; ++j) { if (details_attributes[j]&attrs) { onumber=get_attribute_values(details_attributes[j], oline, &ovalue); nnumber=get_attribute_values(details_attributes[j], nline, &nvalue); i = 0; while (i= 0 || nlen-p*k >= 0) { c = k*(p-1); if (!onumber) { error(2," %s%-9s%c %-*c %.*s\n", width_details%2?"":" ", i+k?"":details_string[j], i+k?' ':':', p, ' ', p-1, nlen-c>0?&nvalue[i][c]:""); } else if (!nnumber) { error(2," %s%-9s%c %.*s\n", width_details%2?"":" ", i+k?"":details_string[j], i+k?' ':':', p-1, olen-c>0?&ovalue[i][c]:""); } else { error(2," %s%-9s%c %-*.*s| %.*s\n", width_details%2?"":" ", i+k?"":details_string[j], i+k?' ':':', p, p-1, olen-c>0?&ovalue[i][c]:"", p-1, nlen-c>0?&nvalue[i][c]:""); } k++; } ++i; } for(i=0; i < onumber; ++i) { free(ovalue[i]); ovalue[i]=NULL; } free(ovalue); ovalue=NULL; for(i=0; i < nnumber; ++i) { free(nvalue[i]); nvalue[i]=NULL; } free(nvalue); nvalue=NULL; } } } static void print_attributes_added_node(db_line* line) { print_dbline_attributes(NULL, line, line->attr, 0); } static void print_attributes_removed_node(db_line* line) { print_dbline_attributes(line, NULL, line->attr, 0); } static void terse_report(seltree* node) { list* r=NULL; /* If this node has been touched checked !=0 If checked == 0 there is nothing to report */ if (node->checked!=0){ ntotal++; if ((node->checked&DB_OLD)&&(node->checked&DB_NEW) && (node->old_data==NULL)&&(node->new_data==NULL)){ /* Node was added to twice and discovered to be not changed*/ } else if (!(node->checked&DB_OLD)&&(node->checked&DB_NEW)){ /* File is in new db but not old. (ADDED) */ /* unless it was moved in */ if (!((node->checked&NODE_ALLOW_NEW)||(node->checked&NODE_MOVED_IN))) { nadd++; node->checked|=NODE_ADDED; } } else if ((node->checked&DB_OLD)&&!(node->checked&DB_NEW)){ /* File is in old db but not new. (REMOVED) */ /* unless it was moved out */ if (!((node->checked&NODE_ALLOW_RM)||(node->checked&NODE_MOVED_OUT))) { nrem++; node->checked|=NODE_REMOVED; } } else if ((node->checked&DB_OLD)&&(node->checked&DB_NEW)&& (node->old_data!=NULL)&&(node->new_data!=NULL)){ /* File is in both db's and the data is still there. (CHANGED) */ if (!(node->checked&(NODE_MOVED_IN|NODE_MOVED_OUT))){ nchg++; node->checked|=NODE_CHANGED; }else if (!((node->checked&NODE_ALLOW_NEW)||(node->checked&NODE_MOVED_IN))) { nadd++; node->checked|=NODE_ADDED; }else if (!((node->checked&NODE_ALLOW_RM)||(node->checked&NODE_MOVED_OUT))) { nrem++; node->checked|=NODE_REMOVED; } } } for (r=node->childs;r;r=r->next) { terse_report((seltree*)r->data); } } static void print_report_list(seltree* node, const int node_status) { list* r=NULL; if (node->checked&node_status) { print_line(node); } for(r=node->childs;r;r=r->next){ print_report_list((seltree*)r->data, node_status); } } static void print_report_details(seltree* node) { list* r=NULL; if (conf->verbose_level>=5) { if (node->checked&NODE_CHANGED) { print_dbline_attributes(node->old_data, node->new_data, node->changed_attrs, (conf->verbose_level>=6?(((node->old_data)->attr)^((node->new_data)->attr)):0)|forced_attrs); } else if ((conf->verbose_level>=7)) { if (node->checked&NODE_ADDED) { print_attributes_added_node(node->new_data); } if (node->checked&NODE_REMOVED) { print_attributes_removed_node(node->old_data); } } } for(r=node->childs;r;r=r->next){ print_report_details((seltree*)r->data); } } static void print_report_header() { char *time; int first = 1; error(0,_("AIDE " AIDEVERSION)); if(conf->action&(DO_COMPARE|DO_DIFF)) { error(0,_(" found %sdifferences between %s%s!!\n"), (nadd||nrem||nchg)?"":"NO ", conf->action&DO_COMPARE?_("database and filesystem"):_("the two databases"), (nadd||nrem||nchg)?"":_(". Looks okay")); if(conf->action&(DO_INIT)) { error(0,_("New AIDE database written to %s\n"),conf->db_out_url->value); } } else { error(0,_(" initialized AIDE database at %s\n"),conf->db_out_url->value); } if(conf->config_version) error(2,_("Config version used: %s\n"),conf->config_version); time = malloc(time_string_len * sizeof (char)); strftime(time, time_string_len, time_format, localtime(&(conf->start_time))); error(2,_("Start timestamp: %s\n"), time); free(time); time=NULL; if (conf->verbose_level != 5) { error (2,_("Verbose level: %d"), conf->verbose_level); first = 0; } if (conf->action&(DO_INIT|DO_COMPARE) && conf->root_prefix_length > 0) { if (first) { first=0; } else { error (2," | "); } error (2,_("Root prefix: %s"),conf->root_prefix); } if (ignored_attrs) { if (first) { first=0; } else { error (2," | "); } error (2,_("Ignored attributes: %llx"),ignored_attrs); } if (forced_attrs) { if (first) { first=0; } else { error (2," | "); } error (2,_("Forced attributes: %llx"),forced_attrs); } if (!first) { error (2,"\n"); } if(conf->action&(DO_COMPARE|DO_DIFF) && (nadd||nrem||nchg)) { error(0,_("\nSummary:\n Total number of entries:\t%li\n Added entries:\t\t%li\n" " Removed entries:\t\t%li\n Changed entries:\t\t%li"), ntotal, nadd, nrem, nchg); } else { error(0,_("\nNumber of entries:\t%li"), ntotal); } } static void print_report_databases() { if (conf->verbose_level>=2 && (conf->line_db_in || conf->line_db_out)) { error(2,(char*)report_top_format,_("The attributes of the (uncompressed) database(s)")); if (conf->line_db_in) { print_attributes_removed_node(conf->line_db_in); } if (conf->line_db_out) { print_attributes_removed_node(conf->line_db_out); } } } static void print_report_footer() { char *time = malloc(time_string_len * sizeof (char)); int run_time = (int) difftime(conf->end_time, conf->start_time); strftime(time, time_string_len, time_format, localtime(&(conf->end_time))); error(2,_("\n\nEnd timestamp: %s (run time: %dm %ds)\n"), time, run_time/60, run_time%60); free(time); time=NULL; } #ifdef WITH_AUDIT /* Something changed, send audit anomaly message */ void send_audit_report() { if(nadd!=0||nrem!=0||nchg!=0){ int fd=audit_open(); if (fd>=0){ char msg[64]; snprintf(msg, sizeof(msg), "added=%ld removed=%ld changed=%ld", nadd, nrem, nchg); if (audit_log_user_message(fd, AUDIT_ANOM_RBAC_INTEGRITY_FAIL, msg, NULL, NULL, NULL, 0)<=0) #ifdef HAVE_SYSLOG syslog(LOG_ERR, "Failed sending audit message:%s", msg); #else ; #endif close(fd); } } } #endif /* WITH_AUDIT */ int gen_report(seltree* node) { forced_attrs = get_report_attributes(); ignored_attrs = get_ignorelist(); terse_report(node); #ifdef WITH_AUDIT send_audit_report(); #endif print_report_header(); if(conf->action&(DO_COMPARE|DO_DIFF) || (conf->action&DO_INIT && conf->report_detailed_init) ) { if (conf->grouped) { if (nadd) { error(2,(char*)report_top_format,_("Added entries")); print_report_list(node, NODE_ADDED); } if (nrem) { error(2,(char*)report_top_format,_("Removed entries")); print_report_list(node, NODE_REMOVED); } if (nchg) { error(2,(char*)report_top_format,_("Changed entries")); print_report_list(node, NODE_CHANGED); } } else if (nadd || nrem || nchg) { if (nadd && nrem && nchg) { error(2,(char*)report_top_format,_("Added, removed and changed entries")); } else if (nadd && nrem) { error(2,(char*)report_top_format,_("Added and removed entries")); } else if (nadd && nchg) { error(2,(char*)report_top_format,_("Added and changed entries")); } else if (nrem && nchg) { error(2,(char*)report_top_format,_("Removed and changed entries")); } else if (nadd) { error(2,(char*)report_top_format,_("Added entries")); } else if (nrem) { error(2,(char*)report_top_format,_("Removed entries")); } else if (nchg) { error(2,(char*)report_top_format,_("Changed entries")); } print_report_list(node, NODE_ADDED|NODE_REMOVED|NODE_CHANGED); } if (nadd || nrem || nchg) { error(nchg?5:7,(char*)report_top_format,_("Detailed information about changes")); print_report_details(node); } } print_report_databases(); conf->end_time=time(&(conf->end_time)); print_report_footer(); return conf->action&(DO_COMPARE|DO_DIFF) ? (nadd!=0)*1+(nrem!=0)*2+(nchg!=0)*4 : 0; } const char* aide_key_9=CONFHMACKEY_09; const char* db_key_9=DBHMACKEY_09; // vi: ts=8 sw=8 aide-0.16~a2.git20130520/src/conf_lex.c000066400000000000000000007655671214657706600171620ustar00rootroot00000000000000#line 2 "conf_lex.c" #line 4 "conf_lex.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define yy_create_buffer conf_create_buffer #define yy_delete_buffer conf_delete_buffer #define yy_flex_debug conf_flex_debug #define yy_init_buffer conf_init_buffer #define yy_flush_buffer conf_flush_buffer #define yy_load_buffer_state conf_load_buffer_state #define yy_switch_to_buffer conf_switch_to_buffer #define yyin confin #define yyleng confleng #define yylex conflex #define yylineno conflineno #define yyout confout #define yyrestart confrestart #define yytext conftext #define yywrap confwrap #define yyalloc confalloc #define yyrealloc confrealloc #define yyfree conffree #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #endif /* ! C99 */ #endif /* ! FLEXINT_H */ #ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ /* C99 requires __STDC__ to be defined as 1. */ #if defined (__STDC__) #define YY_USE_CONST #endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE confrestart(confin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k. * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. * Ditto for the __ia64__ case accordingly. */ #define YY_BUF_SIZE 32768 #else #define YY_BUF_SIZE 16384 #endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif extern int confleng; extern FILE *confin, *confout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up conftext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up conftext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via confrestart()), so that the user can continue scanning by * just pointing confin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when conftext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int confleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow confwrap()'s to do buffer switches * instead of setting up a fresh confin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void confrestart (FILE *input_file ); void conf_switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE conf_create_buffer (FILE *file,int size ); void conf_delete_buffer (YY_BUFFER_STATE b ); void conf_flush_buffer (YY_BUFFER_STATE b ); void confpush_buffer_state (YY_BUFFER_STATE new_buffer ); void confpop_buffer_state (void ); static void confensure_buffer_stack (void ); static void conf_load_buffer_state (void ); static void conf_init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER conf_flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE conf_scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE conf_scan_string (yyconst char *yy_str ); YY_BUFFER_STATE conf_scan_bytes (yyconst char *bytes,int len ); void *confalloc (yy_size_t ); void *confrealloc (void *,yy_size_t ); void conffree (void * ); #define yy_new_buffer conf_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ confensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ conf_create_buffer(confin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ confensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ conf_create_buffer(confin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ typedef unsigned char YY_CHAR; FILE *confin = (FILE *) 0, *confout = (FILE *) 0; typedef int yy_state_type; extern int conflineno; int conflineno = 1; extern char *conftext; #define yytext_ptr conftext static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up conftext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ confleng = (size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 54 #define YY_END_OF_BUFFER 55 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static yyconst flex_int16_t yy_accept[2439] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 53, 31, 32, 1, 52, 53, 31, 53, 1, 6, 4, 53, 53, 6, 6, 6, 6, 6, 6, 6, 6, 31, 9, 8, 10, 11, 8, 8, 31, 6, 10, 11, 6, 8, 6, 6, 6, 6, 6, 6, 6, 6, 12, 6, 6, 6, 6, 6, 6, 6, 6, 6, 31, 14, 13, 13, 31, 13, 13, 6, 4, 13, 13, 6, 6, 6, 6, 6, 6, 6, 6, 22, 6, 6, 6, 6, 6, 6, 6, 6, 6, 30, 1, 30, 30, 30, 1, 6, 4, 30, 30, 6, 6, 6, 6, 6, 6, 6, 6, 31, 7, 31, 7, 51, 51, 51, 51, 51, 51, 51, 51, 6, 4, 51, 51, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 25, 25, 6, 25, 6, 6, 6, 6, 6, 6, 6, 6, 31, 1, 52, 0, 0, 31, 0, 6, 4, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 5, 1, 1, 6, 4, 4, 4, 3, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 31, 9, 8, 8, 8, 8, 31, 6, 6, 8, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 12, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 31, 14, 13, 13, 31, 13, 5, 13, 6, 4, 4, 4, 3, 13, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 22, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 30, 1, 30, 30, 30, 5, 1, 1, 6, 4, 4, 4, 3, 30, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 31, 7, 7, 31, 7, 7, 51, 51, 51, 50, 51, 51, 51, 5, 51, 6, 4, 4, 4, 3, 51, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 25, 25, 6, 25, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 1, 4, 4, 4, 4, 3, 3, 3, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 13, 4, 4, 4, 4, 3, 3, 3, 13, 13, 13, 13, 13, 13, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 30, 5, 5, 5, 1, 4, 4, 4, 4, 3, 3, 3, 30, 30, 30, 30, 30, 30, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 51, 51, 49, 5, 5, 5, 51, 4, 4, 4, 4, 3, 3, 3, 51, 51, 51, 51, 51, 51, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 1, 4, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 4, 3, 3, 3, 3, 13, 13, 13, 13, 13, 13, 13, 13, 13, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 1, 4, 3, 3, 3, 3, 30, 30, 30, 30, 30, 30, 30, 30, 30, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 51, 5, 5, 5, 5, 4, 3, 3, 3, 3, 51, 51, 51, 51, 51, 51, 51, 51, 51, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 1, 4, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 4, 3, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 1, 4, 3, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 4, 3, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 1, 2, 3, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 2, 3, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 2, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 1, 2, 3, 30, 30, 30, 19, 30, 30, 30, 30, 30, 30, 30, 30, 2, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 2, 3, 51, 51, 51, 19, 51, 51, 51, 51, 51, 51, 51, 51, 2, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 1, 1, 2, 2, 2, 2, 0, 0, 0, 0, 20, 18, 0, 0, 0, 0, 16, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 2, 2, 2, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 1, 1, 2, 2, 2, 2, 30, 30, 30, 30, 20, 18, 30, 30, 30, 30, 16, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 2, 2, 2, 51, 51, 51, 51, 20, 18, 51, 51, 51, 51, 16, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 0, 0, 15, 0, 23, 17, 0, 0, 2, 6, 6, 6, 0, 38, 6, 0, 47, 6, 6, 6, 6, 6, 0, 41, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 13, 13, 13, 13, 13, 13, 13, 13, 2, 6, 6, 6, 13, 6, 13, 6, 6, 6, 6, 6, 13, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 30, 30, 15, 30, 23, 17, 30, 30, 2, 6, 6, 6, 30, 6, 30, 6, 6, 6, 6, 6, 30, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 51, 51, 15, 51, 23, 17, 51, 51, 2, 6, 6, 6, 38, 6, 47, 6, 6, 6, 6, 6, 41, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 0, 0, 26, 0, 24, 29, 2, 6, 6, 0, 33, 6, 38, 6, 47, 6, 6, 6, 6, 6, 41, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 13, 13, 13, 13, 13, 13, 2, 6, 6, 13, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 30, 30, 26, 30, 24, 29, 2, 6, 6, 30, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 51, 51, 26, 51, 24, 29, 2, 6, 6, 33, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 1, 2, 2, 0, 21, 0, 2, 6, 6, 33, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 2, 13, 13, 13, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 1, 2, 2, 30, 21, 30, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 2, 51, 21, 51, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 1, 2, 2, 0, 0, 6, 6, 6, 6, 6, 0, 45, 6, 6, 0, 42, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 2, 13, 13, 6, 6, 6, 6, 6, 13, 6, 6, 13, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 1, 2, 2, 30, 30, 6, 6, 6, 6, 6, 30, 6, 6, 30, 6, 6, 6, 2, 2, 2, 51, 51, 6, 6, 6, 6, 6, 45, 6, 6, 42, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 0, 28, 6, 6, 6, 6, 6, 45, 6, 6, 42, 0, 46, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 13, 13, 6, 6, 6, 6, 6, 6, 6, 13, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 30, 28, 6, 6, 6, 6, 6, 6, 6, 30, 6, 6, 2, 2, 51, 28, 6, 6, 6, 6, 6, 6, 6, 46, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 6, 6, 6, 0, 35, 0, 34, 6, 6, 46, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 13, 6, 6, 6, 13, 13, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 30, 6, 6, 6, 30, 30, 6, 6, 6, 6, 51, 6, 6, 6, 35, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 27, 6, 6, 6, 35, 34, 0, 44, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 13, 6, 6, 6, 13, 6, 6, 6, 6, 6, 6, 6, 6, 6, 27, 6, 6, 6, 30, 6, 6, 6, 27, 6, 6, 6, 44, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 48, 0, 36, 44, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 13, 13, 6, 6, 6, 6, 6, 6, 6, 6, 30, 30, 6, 6, 6, 6, 48, 36, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 48, 36, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 39, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 13, 6, 6, 6, 6, 6, 6, 30, 6, 6, 6, 39, 6, 6, 6, 6, 6, 6, 6, 6, 6, 39, 0, 37, 6, 6, 6, 6, 6, 6, 6, 6, 6, 13, 6, 6, 6, 6, 30, 6, 6, 37, 6, 6, 6, 6, 6, 6, 37, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 43, 6, 6, 6, 6, 6, 13, 6, 6, 30, 6, 43, 6, 6, 0, 40, 43, 6, 13, 30, 40, 40, 0 } ; static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 5, 1, 6, 7, 8, 7, 7, 7, 7, 7, 9, 7, 10, 7, 11, 12, 13, 12, 12, 12, 12, 14, 12, 12, 12, 7, 7, 7, 15, 16, 7, 17, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 18, 7, 7, 19, 7, 20, 21, 22, 23, 24, 25, 26, 27, 28, 8, 29, 30, 31, 32, 33, 34, 8, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 7, 45, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 1, 1, 1, 1, 1, 8, 1, 1, 8, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 1, 1, 1, 1, 1, 8, 1, 1, 1 } ; static yyconst flex_int32_t yy_meta[46] = { 0, 1, 2, 3, 2, 4, 1, 4, 5, 4, 6, 4, 5, 5, 5, 4, 7, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4 } ; static yyconst flex_int16_t yy_base[2683] = { 0, 0, 45, 90, 0, 135, 180, 225, 270, 315, 360, 405, 450, 495, 540, 10, 17, 0, 0, 585, 630, 675, 720, 8878,11474, 18,11474, 0, 0, 8781, 765, 12, 8714, 810, 108, 13, 8671, 855, 4, 11, 76, 80, 5, 12, 18, 118,11474, 232,11474,11474, 237, 252, 900, 945, 8605, 8581, 0, 990, 8489, 8436, 8422, 80, 94, 8333, 8240, 8206, 0, 1035, 1080, 6, 217, 81, 235, 95, 236, 241, 325,11474, 0, 1121, 332, 336, 423, 1166, 429, 513, 519, 1211, 317, 321, 391, 322, 406, 327, 332, 0, 1256, 1301, 323, 397, 494, 415, 496, 414, 421, 0, 505, 1346, 685, 692, 693, 1391, 828, 696, 697, 1436, 500, 506, 796, 682, 800, 694, 813, 838, 839, 848, 865, 0, 1477, 1518, 412, 227, 507, 877, 1053, 1563, 1059, 1099, 1105, 1608, 791, 827, 864, 801, 815, 863, 836, 858, 867, 870, 873, 8171, 0, 1653, 1698, 1743, 1016, 1036, 1040, 1045, 1026, 1044, 1051, 1070, 0, 0, 8069, 8042, 0, 24, 1787, 1117, 521, 8022, 7929, 7897, 7839, 1069, 324, 7802, 7761, 7699, 1139, 7682, 7641, 1827, 1145, 1184, 1190, 1230, 1856, 1900, 1062, 675, 678, 1085, 1120, 1084, 98, 203, 473, 1237,11474, 1240, 0, 1263, 1268, 1945, 1989, 0, 2029, 7617, 7536, 7510, 1109, 1075, 7456, 7410, 7348, 2074, 0, 0, 7249, 7197, 7143, 7127, 7041, 1126, 7011, 6902, 6874, 6729, 0, 2119, 2164, 1097, 838, 1125, 1131, 1165, 1167, 1148, 653, 1058, 1201,11474, 0, 2205, 1221, 1287, 1320, 1326, 2250, 1364, 1370, 1409, 1415, 2295, 2339, 1205, 1208, 1176, 1240, 1256, 1262, 1266, 1134, 1163, 0, 2384, 2429, 1253, 1257, 1301, 1285, 1314, 1309, 1268, 1184, 1229, 0, 1331, 2474, 1356, 1382, 1455, 1401, 1427, 2519, 1461, 1495, 1501, 1538, 2563, 2607, 1337, 1348, 1347, 1384, 1400, 1390, 1310, 1279, 1290, 1462, 1446, 1466, 1496, 1472, 1513, 0, 2648, 2689, 6644, 1345, 1144, 1544, 1581, 1587, 2734, 1627, 1633, 1671, 1677, 2779, 2823, 1439, 1479, 6584, 1395, 1476, 6549, 1519, 1521, 1319, 1494, 1324, 1359, 1419, 6519, 0, 2868, 2913, 2958, 1478, 1522, 1527, 1547, 1562, 1564, 1460, 1496, 1536, 1503, 2987, 3030, 1570, 1590, 1573, 1608, 1652, 1610, 1591, 1560, 1581, 1716, 1722, 1762, 1588, 3070, 1768, 1799, 1845, 1851, 1881, 1918, 1624, 1625, 1676, 1659, 235, 3114, 3159, 3204, 1636, 1095, 1662, 1665, 1686, 1655, 1512, 1022, 1700, 3249, 1635, 1699, 1697, 1682, 1760, 1705, 1725, 1711, 1727, 3294, 1712, 1756, 1628, 1405, 1748, 1762, 1539, 1752, 1778, 1774, 3339, 3384, 1753, 1783, 1786, 1789, 1815, 1787, 1810, 1794, 1829, 1925, 2001, 2137, 2143, 3429, 2182, 2189, 2223, 2229, 2268, 2274, 2303, 3473, 3497, 3529, 1891, 3561, 3606, 3651, 1839, 1840, 1805, 1831, 1825, 1849, 1835, 1900, 1856, 3696, 3741, 1850, 1851, 1878, 1903, 1907, 1971, 1865, 1912, 1909, 2194, 2320, 2357, 2364, 2200, 3786, 2402, 2408, 2447, 2454, 2492, 2498, 1993, 2129, 2241, 2285, 2296, 3830, 3875, 3920, 1996, 1976, 1988, 2115, 2123, 1995, 2127, 2002, 2153, 3961, 4002, 6309, 2537, 2543, 2571, 2577, 4047, 2625, 2632, 2666, 2672, 2707, 2714, 2752, 4091, 4115, 4147, 2330, 4179, 4224, 4269, 2102, 2136, 2151, 2167, 2201, 2134, 2211, 2172, 1889, 2207, 2252, 6268, 4314, 4359, 2137, 2180, 2228, 2254, 2209, 2256, 2188, 2290, 2310, 2336, 4404, 4449, 2263, 2326, 2342, 2278, 2346, 2355, 2347, 2304, 2373, 4494, 2769, 2787, 2793, 4538, 4583, 4628, 2841, 2848, 2886, 2370, 2289, 2390, 1760, 2394, 2480, 2396, 2399, 4672, 4717, 4762, 2422, 2393, 2404, 2424, 2434, 2435, 2448, 2409, 2438, 4807, 2463, 1979, 2244, 1441, 2405, 2468, 2458, 2486, 2487, 2495, 4852, 2345, 2446, 2479, 2514, 2516, 2524, 2538, 2520, 2499, 2539, 4897, 4942, 2541, 2540, 2523, 2548, 2562, 2574, 2572, 2570, 2576, 4987, 2892, 2931, 2937, 5031, 5076, 2976, 2983, 3012, 3020, 3038, 3076, 3090, 2814, 5120, 2760, 3132, 5152, 5197, 5242, 2578, 2607, 2577, 2582, 2604, 2626, 2600, 2628, 2641, 5287, 5332, 2619, 2643, 2660, 2654, 2652, 2667, 2682, 2684, 2695, 5377, 3139, 3178, 3184, 5421, 5466, 5511, 3222, 3229, 3358, 2919, 2755, 2995, 2844, 2725, 3081, 2804, 2923, 5555, 5600, 5645, 2700, 2647, 2718, 2764, 2732, 2794, 2702, 2735, 2816, 5686, 5731, 3364, 3402, 3409, 5775, 5820, 3435, 3453, 3463, 3483, 3504, 3511, 3538, 3579, 5864, 3547, 3586, 5896, 5941, 5986, 2791, 2620, 2669, 2832, 2827, 2828, 2843, 2727, 2781, 2863, 6031, 6076, 2874, 2756, 2878, 2871, 2872, 2923, 2861, 2883, 2925, 2930, 6121, 6166, 2951, 2958, 2933, 2953, 2963, 2977, 2906, 2938, 3000, 6211, 6256, 6301, 6346, 2978, 2840, 3010, 3019, 3045, 3034, 1213, 3072, 2953, 3037, 6253, 6391, 6436, 2997, 2983, 3058, 3042, 3022, 3071, 3074, 2106, 3080, 6481, 2873, 3058, 3078, 3103, 3105, 3112, 3120, 3130, 3095, 3135, 6526, 3120, 3161, 3078, 3150, 6192, 3030, 3138, 3154, 3115, 3174, 6571, 6616, 3172, 3167, 3211, 3192, 3190, 3210, 3206, 3216, 3346, 6661, 6706, 6751, 3626, 3673, 3682, 3715, 6796, 3759, 3632, 6824, 3732, 3767, 3776, 3184, 3217, 3333, 3323, 3350, 3346, 3343, 3364, 3377, 3386, 3393, 3390, 3406, 3397, 3339, 3415, 3412, 3359, 3414, 3416, 3422, 3433, 6851, 6896, 6941, 6986, 3474, 3520, 3530, 3580, 3777, 3668, 3687, 3793, 3796, 3720, 3597, 3435, 3434, 3468, 3458, 3488, 3492, 3455, 3438, 3491, 3524, 3515, 7031, 7076, 7121, 3805, 3851, 3861, 3894, 7166, 3938, 3900, 7194, 3950, 3957, 3906, 3517, 3467, 3566, 3565, 3572, 3598, 3592, 3607, 3563, 3609, 3616, 3614, 3531, 3620, 3635, 3650, 3654, 3643, 3695, 3690, 3699, 3703, 3490, 3739, 3547, 3795, 3746, 3789, 3786, 3727, 3774, 3790, 3793, 3815, 7221, 6190, 3981, 7266, 1569, 3390, 2598, 6140, 3827, 3825, 3834, 3837, 3847, 2453, 3737, 3841, 6117, 6100, 3890, 3915, 3316, 3801, 3835, 3871, 3924, 3834, 3702, 3775, 3846, 3167, 3921, 3661, 3925, 3937, 3586, 3851, 3881, 3954, 3867, 3952, 3675, 3895, 3955, 3967, 3971, 3960, 3913, 3968, 3982, 3990, 3992, 3976, 4002, 3996, 4001, 4008, 4004, 4014, 4009, 4011, 4017, 4026, 7311, 4053, 7356, 4071, 4077, 4103, 4083, 4121, 4127, 4153, 4165, 4198, 4159, 4210, 4287, 4204, 4243, 4017, 4039, 4032, 4033, 4041, 4046, 4071, 4078, 5970, 4058, 4074, 4082, 4111, 4090, 4113, 4147, 4106, 4118, 4163, 5952, 4134, 4149, 7401, 4215, 4249, 7446, 4260, 4293, 4279, 4255, 4324, 4332, 4369, 4336, 4376, 4350, 4305, 4414, 4333, 4385, 4190, 4218, 4114, 4233, 4192, 4159, 4235, 4230, 5907, 4179, 4274, 7491, 4423, 7536, 4467, 4474, 4484, 4395, 4501, 4556, 4601, 4529, 4562, 4607, 4574, 4619, 4520, 4637, 4271, 4289, 4311, 4277, 4323, 4314, 4360, 4327, 5692, 4357, 4367, 4379, 4398, 4354, 4278, 4407, 4402, 4414, 4409, 5630, 4410, 4419, 4429, 4444, 4451, 4453, 4429, 4476, 4449, 4487, 4482, 5546, 4485, 4501, 4646, 5501, 5447, 4690, 4696, 4735, 4741, 4219, 4503, 4517, 2533, 5391, 5373, 3360, 4511, 4515, 4544, 5010, 4470, 4040, 4406, 4526, 4591, 4544, 4627, 4760, 4545, 4571, 4645, 4584, 4540, 4603, 4583, 4633, 4010, 4623, 4643, 4626, 4605, 4627, 4661, 4633, 4647, 4671, 4697, 4968, 4705, 4727, 4682, 4081, 4742, 4711, 4456, 4748, 4644, 4725, 4677, 4778, 4895, 4730, 4641, 4784, 4679, 4918, 4960, 4967, 4993, 5011, 5049, 5055, 5082, 5094, 5017, 5101, 5108, 5170, 5129, 5177, 5138, 5217, 4748, 4317, 4761, 4922, 4763, 4952, 4902, 4773, 4727, 4968, 4772, 4766, 4872, 4881, 4975, 4899, 4994, 5113, 4910, 4911, 5039, 4775, 5261, 5022, 5056, 5267, 5305, 5311, 5350, 5171, 5207, 5297, 5115, 5087, 5111, 5218, 5355, 5228, 5323, 5223, 5367, 4927, 4889, 4978, 5059, 4948, 5222, 5364, 4992, 4964, 5262, 4954, 5387, 5395, 5439, 5445, 5484, 5490, 5502, 5519, 5536, 5529, 5546, 5575, 5618, 5636, 5663, 5581, 5624, 4972, 4986, 5041, 5358, 5057, 5405, 5396, 5073, 5002, 5414, 5024, 5034, 5053, 5136, 5446, 5149, 5465, 5511, 5156, 5080, 5563, 5165, 5172, 5200, 5110, 5248, 5580, 5177, 5599, 5654, 5292, 5211, 5655, 5254, 5705, 5711, 5737, 5239, 7581, 5755, 5793, 5799, 5826, 5844, 5854, 5258, 5216, 4893, 5278, 4838, 4788, 4579, 5047, 7625, 2620, 5300, 5571, 5349, 5112, 3970, 5399, 5341, 5166, 5337, 5309, 5191, 5374, 5483, 5431, 5384, 5338, 5343, 5276, 5512, 5420, 5684, 5704, 5465, 5412, 5730, 5298, 5373, 5481, 5814, 5421, 5521, 5556, 5425, 5563, 5615, 4942, 2659, 5498, 5748, 5595, 5525, 5605, 5631, 5453, 5610, 5648, 5872, 5914, 5920, 7670, 5959, 5965, 6004, 6011, 6049, 6055, 7714, 5882, 6094, 6101, 6139, 6145, 6186, 6229, 7737, 4683, 5471, 5821, 6157, 5327, 6235, 5656, 5657, 5659, 5680, 5690, 6274, 5696, 4903, 5716, 6174, 5530, 5730, 5723, 5718, 5740, 5736, 5698, 6280, 6319, 6325, 5850, 7782, 6364, 6370, 6409, 6415, 6454, 6589, 5785, 5906, 5875, 5932, 5878, 5951, 6007, 6041, 7826, 5741, 5742, 6176, 5977, 5585, 6067, 5768, 5785, 5743, 5787, 5807, 6095, 5811, 6595, 6634, 6679, 7871, 6685, 6724, 6730, 6769, 6775, 6802, 7915, 6462, 6642, 6652, 6810, 6831, 6871, 6914, 7938, 5891, 5829, 6181, 6877, 5776, 6920, 5778, 5835, 5972, 5902, 5901, 6959, 5916, 5942, 5950, 6264, 5813, 5865, 5992, 5990, 5947, 5995, 6011, 6057, 6026, 6036, 6446, 5961, 5889, 6082, 6073, 6088, 6091, 6086, 7983, 6965, 7004, 7010, 8027, 8072, 8117, 7049, 7055, 7094, 3016, 6127, 4557, 5937, 4502, 4445, 8161, 6098, 6129, 6182, 6197, 6212, 6202, 6214, 6230, 6026, 6217, 6124, 5672, 6116, 6260, 6179, 6137, 6128, 6309, 5837, 6267, 6218, 6253, 6264, 6290, 6272, 6057, 6297, 6347, 6257, 6302, 6307, 6345, 6306, 6340, 6350, 6323, 6351, 6662, 6222, 6358, 6377, 6359, 6332, 6386, 6399, 8206, 7100, 7139, 7145, 8250, 8295, 7172, 7201, 7239, 7180, 7257, 7245, 7284, 7290, 7302, 8339, 6392, 6394, 7329, 6617, 6402, 6421, 6439, 6445, 4364, 6450, 6555, 6400, 6442, 6707, 6557, 6556, 6572, 6575, 4275, 6583, 6591, 8384, 7335, 7374, 7380, 8428, 8473, 8518, 7419, 7425, 7464, 6716, 6742, 6697, 6819, 6805, 6872, 8562, 6662, 6629, 6882, 6752, 6602, 6619, 6672, 6645, 4254, 6710, 6726, 8607, 7470, 7509, 7515, 8651, 8696, 7554, 7560, 7587, 7605, 7643, 7611, 7650, 7676, 7688, 8740, 6760, 6754, 7694, 6897, 6737, 6782, 6762, 6801, 4224, 6815, 6821, 6811, 6766, 6942, 6817, 6810, 6822, 6835, 4146, 6852, 6863, 6859, 6857, 6987, 6882, 6899, 6895, 6906, 4128, 6925, 6936, 8785, 8830, 8875, 8920, 6427, 4079, 6876, 4046, 6598, 6572, 6964, 6902, 6953, 6603, 6974, 6999, 6289, 7039, 6678, 6958, 6973, 5562, 6994, 7038, 6367, 6962, 6746, 7030, 6985, 7020, 7065, 7075, 7074, 7031, 7055, 6916, 7030, 7066, 7083, 7109, 7111, 7126, 7117, 7089, 7128, 7132, 7109, 6779, 7173, 7167, 6672, 7229, 7048, 7149, 7178, 8965, 9010, 9055, 7700, 7706, 7723, 7755, 7178, 7151, 7164, 7188, 7182, 7220, 7226, 7214, 7265, 7259, 6715, 7224, 7267, 7296, 7261, 7310, 7312, 7355, 7319, 7349, 7381, 7323, 6842, 7351, 9100, 9145, 9190, 9235, 7437, 7411, 7456, 7501, 7295, 7386, 7277, 7320, 7361, 7471, 7321, 7404, 7516, 7439, 6996, 7402, 9280, 9325, 9370, 7761, 7773, 7790, 7800, 7360, 7449, 7367, 7416, 7421, 7535, 7455, 7484, 7564, 7529, 7133, 7486, 7405, 7531, 7497, 7500, 7537, 7569, 7562, 7574, 7633, 7567, 7187, 7582, 7546, 7588, 7586, 7572, 7625, 7651, 7622, 7637, 7658, 7592, 7501, 7655, 9415, 3956, 7807, 9460, 7696, 7642, 7575, 7593, 7227, 6408, 7452, 7718, 7680, 7732, 7700, 7756, 7772, 7808, 5652, 5124, 7734, 7649, 7077, 7763, 7671, 7765, 7790, 7322, 7806, 7788, 7783, 7698, 7101, 7770, 7812, 7806, 7814, 6236, 7820, 7846, 7825, 7821, 7742, 7829, 7830, 7834, 7839, 7855, 7836, 7865, 6000, 6182, 9505, 7881, 9550, 7901, 7907, 3920, 3800, 7856, 7838, 7858, 7956, 7884, 3761, 7962, 7886, 6945, 7864, 3725, 3513, 7892, 7882, 7897, 7918, 3476, 7937, 7366, 7908, 9595, 7957, 7974, 9640, 7986, 7991, 3421, 3269, 7944, 7895, 7949, 7992, 7984, 3210, 8002, 7995, 7521, 7974, 9685, 8045, 9730, 8090, 8096, 3089, 3058, 7970, 7985, 7977, 8051, 8002, 2922, 8063, 8020, 7722, 7998, 2808, 2770, 8013, 8026, 8033, 8047, 2737, 8080, 7900, 8057, 2698, 2554, 8073, 8065, 8075, 8096, 2494, 8110, 7942, 8078, 8125, 8135, 8116, 2380, 7868, 8078, 8114, 8143, 8160, 8128, 8134, 7941, 8142, 8170, 8176, 8130, 8157, 7990, 8123, 8152, 7864, 8158, 5810, 8164, 8187, 8167, 8169, 7988, 2319, 8023, 8194, 8199, 6056, 7269, 8180, 8097, 8189, 8171, 8147, 8213, 8214, 8208, 8190, 8205, 8204, 8268, 8274, 8301, 8241, 8205, 8208, 8218, 8234, 8278, 8249, 8243, 8313, 8259, 7788, 8216, 8255, 8276, 8294, 8306, 8309, 8296, 8261, 8126, 8357, 8363, 8334, 8374, 8288, 8299, 8300, 8338, 8364, 8319, 8342, 8391, 8280, 8366, 8403, 8409, 8448, 8454, 8345, 8354, 8361, 8408, 8436, 8386, 8388, 8491, 8332, 8375, 8425, 8389, 8396, 8466, 8481, 8433, 8438, 8439, 8470, 8471, 8472, 8413, 8498, 8500, 8493, 8482, 8486, 8499, 8499, 8503, 8258, 8497, 8527, 8530, 8533, 8534, 8539, 8515, 8536, 8299, 8519, 2298, 8366, 8520, 8542, 8555, 3632, 8526, 8556, 8431, 8552, 8454, 8550, 8585, 8551, 8528, 8560, 8565, 8393, 8556, 8595, 8571, 8570, 8575, 8613, 8575, 8584, 8592, 8625, 8631, 8619, 8612, 8613, 8616, 8621, 8631, 8636, 8650, 8646, 8643, 8649, 8682, 8652, 8655, 8654, 8687, 8690, 8697, 8681, 8678, 8687, 8717, 8698, 8688, 8657, 8731, 8758, 8724, 8737, 8735, 8694, 8701, 8738, 8675, 8765, 8744, 8745, 8708, 8725, 8746, 8743, 8784, 8780, 8777, 8753, 2247, 8787, 8807, 8812, 8793, 8803, 8811, 8838, 8650, 2213, 8791, 8789, 2145, 8817, 8839, 8820, 2045, 8793, 8831, 8854, 8855, 8791, 8830, 8610, 8841, 8847, 8857, 8842, 2000, 8868, 8896, 8838, 8895, 8900, 8938, 8878, 8877, 1910, 8888, 8928, 8930, 8886, 8920, 1863, 8945, 8889, 8964, 8969, 8983, 8929, 8925, 1790, 8987, 8922, 8990, 9009, 9028, 8931, 8935, 1723, 8958, 9018, 9035, 8967, 8970, 1693, 8980, 9054, 9063, 8978, 9010, 1657, 8886, 9027, 9031, 9036, 9064, 9070, 9057, 9017, 8750, 9056, 9080, 9081, 9054, 8863, 8975, 9064, 9060, 9070, 9087, 9096, 9104, 9023, 9066, 9099, 9131, 9163, 9106, 9112, 9110, 9101, 9138, 9115, 9140, 9103, 9169, 9181, 9151, 9150, 9149, 9159, 9208, 9214, 9174, 9189, 9191, 9196, 9210, 9198, 9200, 9202, 9228, 9230, 9227, 9149, 9244, 9245, 9237, 9054, 9231, 9179, 9245, 9242, 1482, 1452, 9125, 9234, 9239, 9243, 9245, 9207, 9249, 9255, 1376, 9264, 9265, 9271, 1351, 9273, 9274, 9277, 1301, 9278, 9279, 9283, 1241, 9284, 9289, 9295, 1161, 9285, 9309, 9311, 1125, 9317, 9318, 9289, 9082, 9347, 9322, 9317, 9324, 9323, 9325, 9330, 9332, 9363, 9356, 9364, 9365, 9378, 9369, 9338, 9370, 9395, 9372, 9373, 9379, 9414, 9399, 9406, 9381, 9424, 9409, 9410, 9415, 9440, 9413, 9418, 9422, 9459, 9444, 9423, 9451, 9469, 9453, 9456, 9430, 9481, 9484, 9487, 9460, 961, 9504, 9463, 9470, 9496, 9513, 9500, 9499, 9527, 9504, 920, 9568, 9543, 9505, 870, 9558, 9509, 823, 9573, 9588, 9510, 740, 9613, 9594, 9513, 689, 9603, 9548, 507, 9620, 9554, 9296, 9604, 9619, 9616, 9549, 9516, 9622, 409, 9551, 9556, 9601, 9631, 9615, 9659, 9634, 9638, 9640, 9641, 9695, 9644, 9642, 9703, 9655, 9643, 9665, 9678, 9682, 9712, 9706, 9351, 9681, 9592, 9710, 9693, 9738, 9148, 9740, 9721, 9748, 9722, 9750, 9729, 9752, 9730, 9756, 9745, 9762, 9768, 9778, 9707, 9551, 9777, 9782, 9784, 9783, 9799, 9792, 9798, 9787, 9802, 9817, 9810, 9818, 9820, 9823, 9824, 9827, 9843, 9846, 9850, 9849,11474, 9867, 9874, 9881, 9888, 9895, 9902, 9909, 413, 9916, 9923, 9930, 9937, 9943, 9946, 353, 9953, 9957, 9961, 9968, 9975, 9982, 318, 9989, 9996,10003,10010,10017,10024,10031,10038,10042,10046, 10053,10060,10067,10070,10072,10078,10085,10092, 37,10099, 10106,10113,10120,10127,10134,10140,10143, 8,10150,10154, 10158,10165,10172,10179,10186,10193,10200, 3,10207,10214, 10221,10228,10235,10242,10249,10256,10263,10270,10277,10281, 10285,10292,10299,10306,10313,10320,10327,10330,10332,10338, 10345,10352,10359,10366,10373,10380,10387,10394,10401,10408, 10415,10422,10429,10436,10443,10450,10457,10464,10471,10478, 10485,10492,10499,10506,10513,10520,10527,10534,10541,10548, 10555,10559,10566,10573,10580,10587,10594,10601,10608,10615, 10622,10629,10636,10643,10650,10657,10664,10671,10678,10685, 10692,10699,10706,10713,10720,10727,10734,10741,10748,10755, 10762,10769,10776,10783,10790,10797,10804,10811,10818,10825, 10832,10836,10843,10850,10857,10864,10871,10878,10885,10892, 10899,10906,10913,10920,10927,10934,10941,10948,10955,10962, 10969,10976,10983,10990,10997,11004,11011,11018,11025,11032, 11039,11046,11053,11060,11067,11074,11081,11088,11095,11102, 11109,11116,11123,11130,11137,11144,11151,11158,11165,11172, 11179,11186,11193,11200,11207,11214,11221,11228,11235,11242, 11249,11256,11263,11270,11277,11284,11291,11298,11305,11312, 11319,11326,11333,11340,11347,11354,11361,11368,11375,11382, 11389,11396,11403,11410,11417,11424,11431,11438,11445,11452, 11459,11466 } ; static yyconst flex_int16_t yy_def[2683] = { 0, 2439, 2438, 2439, 2, 2438, 2438, 2440, 2438, 2441, 2438, 2442, 2438, 2443, 2438, 3, 2, 3, 2, 2438, 2438, 2444, 2438, 2438, 2438, 2438, 2438, 2445, 2446, 2447, 2438, 2447, 2448, 2449, 2450, 2447, 2447, 2449, 37, 37, 37, 37, 37, 37, 37, 2451, 2438, 2452, 2438, 2438, 2452, 2451, 2438, 2438, 2447, 2447, 53, 2438, 53, 53, 53, 53, 53, 53, 53, 53, 2453, 2454, 2454, 68, 68, 68, 68, 68, 68, 68, 2438, 2438, 2455, 2456, 30, 2457, 2457, 2458, 2459, 2457, 2457, 2458, 87, 87, 87, 87, 87, 87, 87, 2460, 2461, 2461, 97, 97, 97, 97, 97, 97, 97, 2462, 2463, 2464, 2465, 2465, 2466, 2467, 2468, 2465, 2465, 2467, 115, 115, 115, 115, 115, 115, 115, 2438, 2438, 30, 2447, 2469, 2470, 2470, 129, 129, 129, 2471, 2471, 2472, 2473, 2471, 2471, 2472, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2474, 2475, 2476, 2477, 2476, 155, 155, 155, 155, 155, 155, 155, 2438, 2478, 2479, 2447, 2447, 30, 2447, 30, 2480, 2447, 2447, 170, 170, 170, 170, 170, 170, 170, 170, 2481, 2482, 2482, 2483, 2480, 2480, 2484, 2485, 2447, 2483, 191, 191, 191, 191, 191, 191, 191, 191, 191, 2486, 2438, 2486, 203, 2487, 2487, 2438, 207, 208, 2438, 208, 208, 208, 208, 208, 208, 208, 208, 2438, 219, 210, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 2488, 2489, 2489, 234, 234, 234, 234, 234, 234, 234, 234, 234, 2438, 2438, 2490, 2491, 30, 2492, 2493, 2492, 2494, 2495, 2495, 2496, 2497, 2492, 2494, 258, 258, 258, 258, 258, 258, 258, 258, 258, 2498, 2499, 2499, 270, 270, 270, 270, 270, 270, 270, 270, 270, 2500, 2501, 2502, 2503, 2503, 2504, 2505, 2505, 2506, 2507, 2507, 2508, 2509, 2503, 2506, 294, 294, 294, 294, 294, 294, 294, 294, 294, 2438, 2438, 2438, 30, 2447, 2447, 2510, 2511, 2511, 312, 312, 312, 2512, 2513, 2512, 2514, 2515, 2515, 2516, 2517, 2512, 2514, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 2518, 2519, 2520, 2521, 2520, 343, 343, 343, 343, 343, 343, 343, 343, 343, 2447, 2447, 30, 355, 355, 355, 355, 355, 355, 355, 355, 355, 2522, 2522, 2523, 2524, 2525, 2525, 2525, 2526, 2527, 2527, 2528, 2447, 2447, 2447, 2447, 2447, 2529, 2530, 2530, 383, 383, 383, 383, 383, 383, 383, 383, 383, 2438, 393, 393, 393, 393, 393, 393, 393, 393, 393, 2438, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 2531, 2531, 415, 415, 415, 415, 415, 415, 415, 415, 415, 2532, 2532, 2533, 2534, 2535, 2535, 2535, 2536, 2537, 2537, 2538, 2534, 2534, 2534, 2534, 2534, 2539, 2540, 2540, 443, 443, 443, 443, 443, 443, 443, 443, 443, 2541, 2541, 454, 454, 454, 454, 454, 454, 454, 454, 454, 2542, 2543, 2543, 2544, 2545, 2546, 2546, 2546, 2547, 2548, 2548, 2549, 2542, 2542, 2542, 2542, 2542, 2550, 2551, 2551, 483, 483, 483, 483, 483, 483, 483, 483, 483, 2552, 2552, 494, 2553, 2553, 2554, 2555, 2556, 2556, 2556, 2557, 2558, 2558, 2559, 2555, 2555, 2555, 2555, 2555, 2560, 2561, 2561, 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, 2562, 2562, 528, 528, 528, 528, 528, 528, 528, 528, 528, 2563, 2564, 2564, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2565, 2565, 2565, 2566, 2567, 2568, 2569, 2569, 2569, 2570, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 2571, 2572, 2572, 570, 570, 570, 570, 570, 570, 570, 570, 570, 2438, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 2438, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 2573, 2573, 603, 603, 603, 603, 603, 603, 603, 603, 603, 2574, 2574, 2574, 2575, 2576, 2577, 2577, 2577, 2578, 2579, 2579, 2579, 2579, 2579, 2579, 2579, 2579, 2580, 2581, 2581, 632, 632, 632, 632, 632, 632, 632, 632, 632, 2582, 2582, 643, 643, 643, 643, 643, 643, 643, 643, 643, 2583, 2583, 2583, 2584, 2585, 2586, 2587, 2587, 2587, 2588, 2589, 2589, 2589, 2589, 2589, 2589, 2589, 2589, 2590, 2591, 2591, 673, 673, 673, 673, 673, 673, 673, 673, 673, 2592, 2593, 2593, 2593, 2594, 2595, 2596, 2596, 2596, 2597, 2598, 2598, 2598, 2598, 2598, 2598, 2598, 2598, 2599, 2600, 2600, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 2601, 2601, 715, 715, 715, 715, 715, 715, 715, 715, 715, 2563, 2602, 2602, 727, 727, 727, 727, 727, 727, 727, 727, 727, 2603, 2604, 2605, 2606, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 2607, 2608, 2608, 753, 753, 753, 753, 753, 753, 753, 753, 753, 2438, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 2438, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 2609, 2609, 786, 786, 786, 786, 786, 786, 786, 786, 786, 2610, 2611, 2612, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 2614, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 643, 643, 643, 643, 643, 643, 643, 643, 643, 643, 643, 2615, 2585, 2586, 2616, 2589, 2589, 2589, 2589, 2589, 2589, 2589, 2589, 2589, 2589, 2617, 673, 673, 673, 673, 673, 673, 673, 673, 673, 673, 673, 2618, 2595, 2619, 2598, 2598, 2598, 2598, 2598, 2598, 2598, 2598, 2598, 2598, 2620, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 715, 715, 715, 715, 715, 715, 715, 715, 715, 715, 715, 2563, 727, 727, 727, 727, 727, 727, 727, 727, 727, 727, 727, 2603, 2621, 2622, 2606, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 2607, 2607, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 2610, 2623, 2612, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 2614, 2614, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 643, 643, 643, 643, 643, 643, 643, 643, 643, 643, 643, 2615, 2624, 2625, 2616, 2589, 2589, 2589, 2589, 2589, 2589, 2589, 2589, 2589, 2589, 2589, 2589, 2617, 2617, 673, 673, 673, 673, 673, 673, 673, 673, 673, 673, 673, 2618, 2626, 2619, 2598, 2598, 2598, 2598, 2598, 2598, 2598, 2598, 2598, 2598, 2598, 2598, 2620, 2620, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 715, 715, 715, 715, 715, 715, 715, 715, 715, 715, 715, 2563, 727, 727, 727, 727, 727, 727, 727, 727, 727, 727, 727, 2627, 2621, 2621, 2622, 2622, 2628, 2629, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 2607, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 2630, 2623, 2623, 2631, 2632, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 2614, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 643, 643, 643, 643, 643, 643, 643, 643, 643, 643, 643, 2633, 2624, 2624, 2625, 2625, 2634, 2635, 2589, 2589, 2589, 2589, 2589, 2589, 2589, 2589, 2589, 2589, 2589, 2617, 673, 673, 673, 673, 673, 673, 673, 673, 673, 673, 673, 2636, 2626, 2626, 2637, 2638, 2598, 2598, 2598, 2598, 2598, 2598, 2598, 2598, 2598, 2598, 2598, 2620, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 715, 715, 715, 715, 715, 715, 715, 715, 715, 715, 715, 2563, 727, 727, 727, 727, 727, 727, 727, 727, 727, 727, 727, 2627, 2627, 2639, 2621, 2622, 2622, 2622, 2628, 2629, 2629, 2640, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 2641, 753, 753, 753, 2563, 2563, 753, 2563, 2563, 753, 753, 753, 753, 753, 2563, 2563, 753, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 2630, 2630, 2642, 2623, 2623, 2623, 2631, 2632, 2632, 2643, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 2644, 632, 632, 632, 2613, 632, 2613, 632, 632, 632, 632, 632, 2613, 632, 643, 643, 643, 643, 643, 643, 643, 643, 643, 643, 2633, 2633, 2645, 2624, 2625, 2625, 2625, 2634, 2635, 2635, 2646, 2589, 2589, 2589, 2589, 2589, 2589, 2589, 2589, 2647, 673, 673, 673, 2589, 673, 2589, 673, 673, 673, 673, 673, 2589, 673, 2636, 2636, 2648, 2626, 2626, 2626, 2637, 2638, 2638, 2649, 2598, 2598, 2598, 2598, 2598, 2598, 2598, 2598, 2650, 703, 703, 703, 2598, 703, 2598, 703, 703, 703, 703, 703, 2598, 703, 715, 715, 715, 715, 715, 715, 715, 715, 715, 715, 2563, 727, 727, 727, 727, 727, 727, 727, 727, 727, 727, 2627, 2627, 2627, 2639, 2651, 2652, 2629, 2629, 2629, 2640, 2563, 2563, 2563, 2563, 2563, 2563, 2641, 753, 753, 2563, 2563, 753, 2563, 753, 2563, 753, 753, 753, 753, 753, 2563, 753, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 2630, 2630, 2630, 2642, 2653, 2632, 2632, 2632, 2643, 2613, 2613, 2613, 2613, 2613, 2613, 2644, 632, 632, 2613, 632, 632, 632, 632, 632, 632, 632, 632, 643, 643, 643, 643, 643, 643, 643, 643, 643, 643, 2633, 2633, 2633, 2645, 2654, 2655, 2635, 2635, 2635, 2646, 2589, 2589, 2589, 2589, 2589, 2589, 2647, 673, 673, 2589, 673, 673, 673, 673, 673, 673, 673, 673, 2636, 2636, 2636, 2648, 2656, 2638, 2638, 2638, 2649, 2598, 2598, 2598, 2598, 2598, 2598, 2650, 703, 703, 2598, 703, 703, 703, 703, 703, 703, 703, 703, 715, 715, 715, 715, 715, 715, 715, 715, 715, 715, 727, 727, 727, 727, 727, 727, 727, 727, 727, 727, 2657, 2651, 2652, 2658, 2563, 2563, 2563, 2659, 753, 753, 2563, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 2660, 2653, 2661, 2613, 2613, 2613, 2662, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 643, 643, 643, 643, 643, 643, 643, 643, 643, 643, 643, 643, 2663, 2654, 2655, 2664, 2589, 2589, 2589, 2665, 673, 673, 673, 673, 673, 673, 673, 673, 673, 673, 673, 673, 2666, 2656, 2667, 2598, 2598, 2598, 2668, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 715, 715, 715, 715, 715, 715, 715, 715, 715, 715, 715, 715, 727, 727, 727, 727, 727, 727, 727, 727, 727, 727, 727, 727, 2657, 2669, 2670, 2658, 2563, 2563, 753, 753, 753, 753, 753, 2563, 2563, 753, 753, 2563, 2563, 753, 753, 753, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 2660, 2671, 2661, 2613, 2613, 632, 632, 632, 632, 632, 2613, 632, 632, 2613, 632, 632, 632, 643, 643, 643, 643, 643, 643, 643, 643, 643, 643, 2663, 2672, 2673, 2664, 2589, 2589, 673, 673, 673, 673, 673, 2589, 673, 673, 2589, 673, 673, 673, 2666, 2674, 2667, 2598, 2598, 703, 703, 703, 703, 703, 2598, 703, 703, 2598, 703, 703, 703, 715, 715, 715, 715, 715, 715, 715, 715, 715, 715, 727, 727, 727, 727, 727, 727, 727, 727, 727, 727, 2675, 2676, 2563, 2563, 753, 753, 753, 753, 753, 2563, 753, 753, 2563, 2563, 2563, 753, 753, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 774, 774, 774, 774, 774, 774, 774, 774, 774, 786, 786, 786, 786, 786, 786, 786, 786, 786, 2677, 2678, 2613, 2613, 632, 632, 632, 632, 632, 632, 632, 2613, 632, 632, 643, 643, 643, 643, 643, 643, 643, 643, 643, 2679, 2680, 2589, 2589, 673, 673, 673, 673, 673, 673, 673, 2589, 673, 673, 2681, 2682, 2598, 2598, 703, 703, 703, 703, 703, 703, 703, 2598, 703, 703, 715, 715, 715, 715, 715, 715, 715, 715, 715, 727, 727, 727, 727, 727, 727, 727, 727, 727, 2563, 753, 753, 753, 2563, 2563, 2563, 2563, 753, 753, 2563, 753, 753, 763, 763, 763, 763, 763, 763, 763, 763, 763, 774, 774, 774, 774, 774, 774, 774, 786, 786, 786, 786, 786, 786, 786, 2613, 632, 632, 632, 2613, 2613, 632, 632, 632, 632, 643, 643, 643, 643, 643, 643, 643, 2589, 673, 673, 673, 2589, 2589, 673, 673, 673, 673, 2598, 703, 703, 703, 2598, 2598, 703, 703, 703, 703, 715, 715, 715, 715, 715, 715, 715, 727, 727, 727, 727, 727, 727, 727, 2563, 753, 753, 753, 2563, 2563, 2563, 2563, 753, 753, 753, 763, 763, 763, 763, 763, 763, 763, 774, 774, 774, 774, 774, 774, 786, 786, 786, 786, 786, 786, 2613, 632, 632, 632, 2613, 632, 632, 632, 643, 643, 643, 643, 643, 643, 2589, 673, 673, 673, 2589, 673, 673, 673, 2598, 703, 703, 703, 2598, 703, 703, 703, 715, 715, 715, 715, 715, 715, 727, 727, 727, 727, 727, 727, 753, 2563, 2563, 2563, 2563, 2563, 753, 753, 753, 763, 763, 763, 763, 763, 763, 774, 774, 774, 774, 786, 786, 786, 786, 632, 2613, 2613, 632, 632, 632, 643, 643, 643, 643, 673, 2589, 2589, 673, 673, 673, 703, 2598, 2598, 703, 703, 703, 715, 715, 715, 715, 727, 727, 727, 727, 753, 2563, 2563, 753, 753, 753, 763, 763, 763, 763, 774, 774, 774, 774, 786, 786, 786, 786, 632, 632, 632, 632, 643, 643, 643, 643, 673, 673, 673, 673, 703, 703, 703, 703, 715, 715, 715, 715, 727, 727, 727, 727, 753, 753, 753, 753, 763, 763, 763, 763, 774, 774, 774, 774, 786, 786, 786, 786, 632, 632, 632, 632, 643, 643, 643, 643, 673, 673, 673, 673, 703, 703, 703, 703, 715, 715, 715, 715, 727, 727, 727, 727, 753, 753, 2563, 2563, 753, 763, 763, 763, 763, 774, 774, 774, 786, 786, 786, 632, 632, 2613, 632, 643, 643, 643, 673, 673, 2589, 673, 703, 703, 2598, 703, 715, 715, 715, 727, 727, 727, 753, 753, 2563, 2563, 2563, 763, 763, 763, 774, 774, 786, 786, 632, 632, 2613, 643, 643, 673, 673, 2589, 703, 703, 2598, 715, 715, 727, 727, 753, 753, 2563, 763, 763, 774, 774, 786, 786, 632, 632, 643, 643, 673, 673, 703, 703, 715, 715, 727, 727, 753, 2563, 2563, 763, 763, 774, 786, 632, 2613, 643, 673, 2589, 703, 2598, 715, 727, 2563, 2563, 2563, 763, 2613, 2589, 2598, 2563, 0, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438 } ; static yyconst flex_int16_t yy_nxt[11520] = { 0, 24, 25, 26, 25, 24, 27, 24, 268, 24, 24, 24, 123, 232, 123, 24, 24, 24, 24, 125, 163, 125, 163, 182, 189, 124, 185, 185, 233, 167, 167, 193, 126, 185, 185, 182, 199, 192, 200, 235, 185, 167, 165, 198, 24, 24, 29, 30, 26, 30, 31, 32, 29, 33, 29, 29, 34, 33, 33, 33, 35, 29, 36, 29, 33, 37, 33, 38, 39, 33, 33, 40, 33, 33, 33, 33, 33, 33, 33, 33, 41, 42, 33, 33, 43, 44, 33, 33, 33, 29, 29, 24, 25, 26, 25, 24, 27, 24, 185, 24, 24, 24, 185, 233, 196, 24, 24, 24, 24, 166, 166, 194, 166, 197, 166, 225, 237, 233, 227, 195, 201, 202, 201, 226, 238, 187, 188, 228, 185, 390, 204, 204, 204, 241, 24, 24, 24, 45, 46, 45, 24, 27, 24, 47, 48, 49, 24, 50, 50, 50, 24, 51, 24, 24, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 24, 24, 29, 52, 46, 52, 31, 32, 29, 53, 54, 55, 34, 56, 56, 56, 35, 57, 36, 29, 53, 58, 53, 59, 60, 53, 53, 61, 53, 53, 53, 53, 53, 53, 53, 53, 62, 63, 53, 53, 64, 65, 53, 53, 53, 29, 29, 24, 25, 26, 25, 24, 27, 24, 185, 24, 24, 24, 236, 391, 233, 24, 24, 24, 24, 206, 206, 206, 311, 203, 206, 206, 206, 167, 203, 2438, 2438, 2438, 233, 233, 239, 242, 243, 314, 233, 204, 204, 204, 567, 240, 24, 24, 29, 30, 26, 30, 31, 32, 29, 67, 29, 29, 34, 67, 67, 67, 35, 29, 36, 29, 67, 68, 67, 69, 70, 67, 67, 71, 67, 67, 67, 67, 67, 67, 67, 67, 72, 73, 67, 67, 74, 75, 67, 67, 67, 29, 29, 24, 76, 77, 76, 78, 27, 78, 268, 78, 78, 78, 244, 245, 244, 78, 78, 78, 78, 248, 245, 248, 166, 166, 252, 166, 260, 166, 252, 252, 269, 263, 250, 360, 252, 259, 266, 267, 251, 252, 264, 271, 361, 232, 78, 78, 29, 80, 77, 80, 81, 32, 82, 83, 82, 82, 84, 83, 83, 83, 85, 82, 86, 82, 83, 87, 83, 88, 89, 83, 83, 90, 83, 83, 83, 83, 83, 83, 83, 83, 91, 92, 83, 83, 93, 94, 83, 83, 83, 82, 82, 24, 25, 26, 25, 24, 27, 24, 252, 24, 24, 24, 272, 165, 269, 24, 24, 24, 24, 166, 166, 261, 166, 252, 166, 166, 166, 311, 166, 262, 166, 269, 269, 278, 275, 251, 279, 2398, 269, 265, 313, 254, 255, 276, 24, 24, 29, 30, 26, 30, 31, 32, 29, 96, 29, 29, 34, 96, 96, 96, 35, 29, 36, 29, 96, 97, 96, 98, 99, 96, 96, 100, 96, 96, 96, 96, 96, 96, 96, 96, 101, 102, 96, 96, 103, 104, 96, 96, 96, 29, 29, 105, 25, 26, 25, 105, 106, 105, 185, 105, 105, 105, 164, 392, 164, 105, 105, 105, 105, 166, 166, 269, 166, 269, 166, 166, 166, 288, 166, 256, 166, 296, 311, 288, 273, 251, 315, 189, 295, 277, 2392, 257, 274, 167, 105, 105, 108, 30, 26, 30, 109, 110, 108, 111, 108, 108, 112, 111, 111, 111, 113, 108, 114, 108, 111, 115, 111, 116, 117, 111, 111, 118, 111, 111, 111, 111, 111, 111, 111, 111, 119, 120, 111, 111, 121, 122, 111, 111, 111, 108, 108, 24, 25, 26, 25, 127, 27, 127, 128, 127, 127, 127, 128, 128, 128, 127, 127, 127, 127, 128, 128, 128, 128, 128, 128, 129, 128, 128, 128, 128, 128, 128, 130, 128, 128, 128, 128, 131, 128, 128, 128, 128, 132, 128, 127, 127, 29, 30, 26, 30, 133, 32, 134, 135, 134, 134, 136, 135, 135, 135, 137, 134, 138, 134, 135, 139, 135, 140, 141, 135, 142, 143, 135, 135, 135, 135, 135, 144, 135, 135, 145, 146, 147, 135, 148, 149, 135, 150, 135, 134, 134, 24, 25, 26, 25, 24, 27, 24, 233, 24, 152, 24, 166, 423, 166, 24, 24, 24, 24, 166, 183, 166, 183, 166, 166, 166, 166, 284, 285, 288, 185, 299, 292, 185, 284, 287, 385, 384, 284, 293, 300, 288, 2390, 302, 24, 24, 29, 30, 26, 30, 31, 32, 29, 153, 29, 154, 34, 153, 153, 153, 35, 29, 36, 29, 153, 155, 153, 156, 157, 153, 153, 158, 153, 153, 153, 153, 153, 153, 153, 153, 159, 160, 153, 153, 161, 162, 153, 153, 153, 29, 29, 166, 168, 2387, 168, 169, 166, 166, 170, 166, 166, 171, 170, 170, 170, 172, 166, 173, 166, 170, 174, 170, 175, 176, 170, 170, 177, 170, 170, 170, 170, 170, 170, 170, 170, 178, 179, 170, 170, 180, 181, 170, 170, 170, 166, 166, 166, 166, 319, 166, 166, 166, 166, 288, 166, 166, 166, 288, 319, 326, 166, 166, 167, 166, 283, 166, 297, 166, 303, 283, 288, 329, 319, 301, 298, 304, 306, 304, 306, 330, 290, 291, 327, 331, 319, 307, 2384, 307, 305, 166, 166, 166, 166, 319, 166, 166, 166, 166, 308, 166, 166, 166, 309, 233, 309, 166, 166, 167, 166, 334, 416, 189, 191, 166, 166, 319, 166, 167, 166, 328, 319, 319, 332, 317, 319, 337, 336, 319, 335, 318, 319, 333, 338, 2382, 166, 166, 166, 207, 202, 207, 169, 166, 166, 208, 166, 166, 171, 209, 209, 209, 172, 210, 173, 166, 208, 211, 208, 212, 213, 208, 208, 214, 208, 208, 208, 208, 208, 208, 208, 208, 215, 216, 208, 208, 217, 218, 208, 208, 208, 166, 166, 166, 166, 2379, 166, 166, 166, 166, 219, 166, 166, 166, 220, 220, 220, 166, 210, 167, 166, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 166, 166, 166, 166, 2372, 166, 166, 166, 166, 210, 166, 166, 166, 221, 221, 221, 166, 210, 167, 166, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 166, 166, 166, 166, 341, 166, 166, 166, 166, 578, 166, 166, 166, 185, 341, 344, 166, 166, 167, 166, 166, 166, 345, 166, 341, 166, 166, 166, 341, 166, 350, 166, 341, 341, 351, 348, 318, 352, 163, 341, 163, 346, 321, 322, 349, 166, 166, 166, 166, 347, 166, 166, 166, 166, 233, 166, 166, 166, 185, 424, 383, 166, 166, 167, 166, 398, 166, 166, 234, 166, 358, 166, 166, 166, 399, 166, 323, 166, 359, 386, 185, 185, 318, 389, 166, 166, 185, 166, 324, 166, 166, 166, 246, 233, 246, 415, 246, 246, 246, 572, 187, 188, 246, 246, 246, 246, 166, 166, 387, 166, 396, 166, 166, 166, 408, 166, 185, 166, 397, 2327, 388, 233, 366, 367, 417, 418, 409, 233, 187, 188, 252, 246, 246, 166, 166, 451, 166, 249, 166, 249, 311, 249, 249, 249, 233, 422, 495, 249, 249, 251, 249, 166, 166, 419, 166, 2323, 166, 186, 186, 252, 186, 233, 186, 233, 452, 420, 421, 369, 188, 244, 245, 244, 252, 371, 372, 445, 249, 249, 166, 166, 269, 166, 249, 166, 249, 462, 249, 249, 249, 248, 245, 248, 249, 249, 251, 249, 167, 166, 166, 258, 166, 252, 166, 443, 252, 201, 202, 201, 2438, 2438, 2438, 444, 917, 374, 375, 204, 204, 204, 204, 204, 204, 249, 249, 166, 166, 269, 166, 166, 166, 166, 463, 166, 166, 166, 446, 2319, 252, 166, 166, 167, 166, 206, 206, 206, 447, 203, 206, 206, 206, 269, 203, 454, 252, 269, 166, 166, 448, 166, 252, 166, 455, 449, 252, 450, 269, 461, 166, 166, 166, 166, 251, 166, 166, 166, 166, 288, 166, 166, 166, 457, 491, 269, 166, 166, 167, 166, 288, 166, 166, 270, 166, 492, 166, 166, 166, 2315, 166, 269, 166, 164, 456, 164, 458, 426, 427, 269, 288, 490, 460, 428, 269, 166, 166, 280, 459, 319, 522, 280, 280, 280, 319, 280, 280, 280, 166, 524, 166, 280, 280, 280, 280, 166, 166, 288, 166, 483, 166, 166, 166, 284, 166, 311, 166, 288, 288, 2311, 485, 254, 255, 494, 166, 484, 166, 429, 255, 319, 280, 280, 283, 166, 525, 166, 283, 283, 283, 464, 283, 283, 283, 183, 2307, 183, 283, 283, 284, 283, 186, 186, 486, 186, 288, 186, 166, 166, 287, 166, 288, 166, 487, 489, 219, 319, 431, 432, 517, 183, 288, 183, 434, 435, 488, 283, 283, 283, 166, 595, 166, 283, 283, 283, 468, 283, 283, 283, 306, 319, 306, 283, 283, 284, 283, 526, 283, 166, 294, 166, 208, 283, 283, 166, 304, 166, 304, 283, 306, 319, 306, 514, 466, 467, 309, 767, 309, 305, 290, 291, 283, 283, 310, 189, 310, 2298, 310, 310, 310, 167, 341, 535, 310, 310, 310, 310, 283, 166, 307, 166, 307, 283, 289, 186, 518, 186, 319, 289, 341, 319, 528, 308, 469, 291, 2297, 309, 515, 309, 471, 472, 353, 310, 310, 310, 319, 310, 341, 310, 310, 310, 167, 536, 523, 310, 310, 310, 310, 185, 312, 283, 166, 519, 166, 577, 283, 166, 166, 381, 166, 319, 166, 319, 341, 520, 521, 474, 475, 341, 219, 529, 530, 318, 310, 310, 166, 166, 341, 166, 316, 166, 316, 537, 316, 316, 316, 531, 598, 341, 316, 316, 318, 316, 166, 166, 532, 166, 167, 166, 166, 166, 170, 166, 341, 166, 341, 548, 533, 534, 497, 498, 170, 1094, 540, 170, 499, 368, 542, 316, 316, 166, 166, 170, 166, 316, 166, 316, 549, 316, 316, 316, 170, 170, 547, 316, 316, 318, 316, 541, 166, 166, 325, 166, 554, 166, 166, 166, 543, 166, 170, 166, 170, 167, 167, 546, 321, 322, 561, 219, 560, 562, 500, 322, 316, 316, 166, 166, 571, 166, 166, 166, 166, 185, 166, 342, 166, 208, 594, 581, 166, 166, 167, 166, 186, 186, 544, 186, 167, 186, 166, 166, 185, 166, 170, 166, 565, 2247, 545, 185, 502, 503, 185, 566, 576, 167, 505, 506, 573, 166, 166, 166, 166, 574, 166, 166, 166, 166, 563, 166, 564, 166, 584, 185, 208, 166, 166, 167, 166, 166, 166, 575, 166, 2243, 166, 166, 166, 185, 166, 208, 166, 208, 583, 219, 579, 366, 367, 208, 582, 592, 587, 550, 367, 208, 166, 166, 166, 166, 589, 166, 166, 166, 166, 2239, 166, 342, 166, 208, 588, 208, 166, 166, 167, 166, 590, 365, 365, 343, 365, 219, 365, 166, 166, 219, 166, 604, 166, 219, 593, 167, 233, 552, 553, 219, 585, 599, 596, 187, 188, 166, 166, 166, 208, 166, 166, 219, 586, 597, 744, 219, 166, 600, 166, 166, 166, 166, 167, 166, 601, 170, 233, 170, 170, 233, 233, 170, 233, 611, 369, 188, 2233, 233, 606, 605, 170, 170, 609, 607, 170, 170, 166, 166, 252, 166, 166, 166, 166, 233, 166, 166, 166, 635, 233, 610, 166, 166, 167, 166, 186, 186, 608, 186, 252, 186, 166, 166, 233, 166, 252, 166, 637, 633, 252, 612, 371, 372, 252, 252, 639, 636, 374, 375, 644, 166, 166, 353, 252, 269, 269, 376, 634, 377, 378, 252, 166, 166, 379, 166, 638, 166, 641, 645, 269, 2227, 166, 166, 380, 166, 650, 166, 556, 375, 381, 166, 166, 269, 166, 166, 166, 166, 251, 166, 166, 166, 646, 526, 319, 166, 166, 167, 166, 373, 373, 640, 373, 629, 373, 252, 166, 166, 269, 166, 382, 166, 269, 651, 269, 558, 559, 269, 2223, 647, 648, 652, 426, 427, 166, 166, 166, 207, 202, 207, 169, 166, 166, 208, 166, 166, 171, 209, 209, 209, 172, 210, 173, 166, 208, 211, 208, 212, 213, 208, 208, 214, 208, 208, 208, 208, 208, 208, 208, 208, 215, 216, 208, 208, 217, 218, 208, 208, 208, 166, 166, 166, 2438, 166, 166, 166, 269, 166, 208, 765, 166, 288, 166, 166, 166, 166, 167, 166, 649, 208, 284, 208, 208, 288, 675, 208, 674, 663, 613, 427, 288, 288, 676, 681, 208, 208, 2216, 288, 208, 208, 166, 166, 679, 166, 166, 166, 166, 210, 166, 166, 166, 221, 221, 221, 166, 210, 167, 166, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 166, 166, 166, 166, 2208, 166, 166, 166, 166, 219, 166, 166, 166, 220, 220, 220, 166, 210, 167, 166, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 166, 166, 166, 166, 704, 166, 166, 166, 166, 319, 166, 166, 166, 166, 185, 166, 166, 166, 167, 166, 365, 365, 288, 365, 933, 365, 166, 166, 284, 166, 288, 166, 664, 677, 288, 665, 615, 616, 678, 716, 680, 319, 428, 319, 341, 166, 166, 166, 166, 709, 166, 166, 166, 166, 705, 166, 166, 166, 319, 2205, 288, 166, 166, 167, 166, 166, 166, 682, 166, 441, 166, 706, 166, 166, 319, 166, 414, 166, 166, 319, 166, 254, 255, 707, 183, 711, 183, 341, 429, 255, 166, 166, 246, 464, 246, 341, 246, 246, 246, 468, 717, 722, 246, 246, 246, 246, 186, 186, 319, 186, 712, 186, 166, 166, 319, 166, 341, 166, 319, 708, 481, 2202, 431, 432, 720, 166, 657, 166, 434, 435, 710, 246, 246, 166, 166, 341, 166, 249, 166, 249, 284, 249, 249, 249, 718, 208, 167, 249, 249, 251, 249, 166, 166, 666, 166, 667, 166, 373, 373, 319, 373, 341, 373, 341, 766, 728, 713, 618, 435, 166, 170, 166, 719, 620, 621, 721, 249, 249, 166, 166, 166, 166, 166, 166, 284, 170, 166, 166, 167, 166, 742, 166, 668, 723, 428, 284, 731, 341, 436, 669, 437, 438, 251, 283, 166, 439, 166, 735, 283, 622, 670, 170, 2134, 166, 166, 440, 166, 341, 166, 466, 467, 441, 166, 166, 724, 166, 249, 166, 249, 318, 249, 249, 249, 170, 2059, 167, 249, 249, 251, 249, 283, 166, 725, 166, 700, 283, 729, 465, 365, 170, 365, 442, 465, 170, 170, 775, 653, 467, 730, 219, 734, 732, 170, 655, 656, 249, 249, 166, 166, 167, 166, 166, 166, 166, 733, 166, 166, 166, 741, 167, 170, 166, 166, 167, 166, 283, 166, 736, 166, 167, 283, 283, 166, 167, 166, 167, 283, 743, 167, 745, 749, 290, 291, 185, 750, 756, 208, 469, 291, 755, 166, 166, 166, 166, 185, 166, 166, 166, 166, 185, 166, 166, 166, 768, 761, 754, 166, 166, 167, 166, 289, 186, 185, 186, 185, 289, 759, 283, 166, 762, 166, 453, 283, 757, 185, 185, 471, 472, 185, 776, 760, 758, 167, 474, 475, 166, 166, 280, 185, 208, 219, 280, 280, 280, 208, 280, 280, 280, 1102, 208, 764, 280, 280, 280, 280, 283, 166, 770, 166, 167, 283, 473, 373, 769, 373, 746, 473, 208, 208, 747, 772, 659, 475, 219, 748, 777, 208, 661, 662, 771, 280, 280, 283, 166, 2033, 166, 283, 283, 283, 773, 283, 283, 283, 219, 783, 778, 283, 283, 284, 283, 166, 166, 782, 166, 789, 166, 166, 166, 219, 166, 219, 166, 167, 233, 219, 779, 497, 498, 219, 781, 784, 780, 684, 498, 787, 283, 283, 166, 1284, 166, 233, 233, 219, 219, 365, 365, 788, 365, 233, 365, 166, 166, 464, 166, 2028, 166, 476, 790, 477, 478, 686, 687, 233, 479, 793, 792, 499, 795, 814, 791, 233, 812, 233, 480, 233, 794, 233, 252, 252, 481, 283, 166, 252, 166, 283, 283, 283, 167, 283, 283, 283, 815, 818, 512, 283, 283, 284, 283, 166, 166, 252, 166, 1096, 166, 252, 166, 166, 252, 166, 482, 166, 816, 823, 813, 321, 322, 331, 817, 185, 269, 319, 500, 322, 283, 283, 310, 252, 310, 252, 310, 310, 310, 820, 819, 1482, 310, 310, 310, 310, 186, 186, 252, 186, 269, 186, 166, 166, 288, 166, 824, 166, 825, 269, 850, 269, 502, 503, 233, 828, 827, 269, 505, 506, 826, 310, 310, 310, 269, 310, 319, 310, 310, 310, 1517, 829, 875, 310, 310, 310, 310, 166, 166, 269, 166, 269, 166, 831, 373, 373, 830, 373, 493, 373, 849, 855, 269, 689, 506, 2027, 166, 288, 166, 288, 691, 692, 310, 310, 166, 166, 851, 166, 316, 166, 316, 284, 316, 316, 316, 288, 880, 840, 316, 316, 318, 316, 166, 166, 319, 166, 166, 166, 166, 288, 166, 166, 288, 166, 2024, 166, 853, 856, 318, 166, 166, 284, 166, 837, 166, 693, 251, 316, 316, 166, 166, 807, 166, 341, 166, 366, 367, 166, 166, 886, 166, 288, 166, 365, 365, 499, 365, 2019, 365, 507, 852, 508, 509, 550, 367, 166, 510, 166, 319, 552, 553, 874, 854, 881, 166, 166, 511, 166, 319, 166, 284, 288, 512, 166, 166, 844, 166, 316, 166, 316, 251, 316, 316, 316, 857, 2018, 803, 316, 316, 318, 316, 166, 166, 288, 166, 166, 166, 166, 166, 166, 876, 166, 513, 166, 319, 319, 167, 374, 375, 319, 284, 879, 878, 877, 556, 375, 316, 316, 166, 166, 319, 166, 166, 166, 166, 911, 166, 342, 166, 839, 891, 882, 166, 166, 167, 166, 373, 373, 341, 373, 319, 373, 166, 166, 885, 166, 887, 166, 341, 341, 936, 341, 558, 559, 208, 341, 889, 888, 426, 427, 341, 166, 166, 166, 166, 892, 166, 166, 166, 166, 166, 166, 166, 166, 166, 903, 166, 166, 166, 167, 166, 166, 166, 170, 166, 284, 166, 365, 365, 284, 365, 890, 365, 893, 836, 845, 167, 613, 427, 2014, 341, 899, 341, 615, 616, 894, 166, 166, 166, 166, 170, 166, 166, 166, 166, 170, 166, 342, 166, 167, 904, 897, 166, 166, 167, 166, 166, 166, 170, 166, 170, 166, 920, 166, 166, 170, 166, 527, 166, 900, 170, 898, 434, 435, 167, 902, 166, 901, 166, 618, 435, 166, 166, 353, 170, 910, 927, 538, 185, 377, 378, 284, 373, 373, 379, 373, 926, 373, 905, 838, 166, 166, 185, 166, 380, 166, 167, 170, 620, 621, 381, 166, 167, 166, 166, 167, 251, 912, 166, 166, 166, 166, 913, 166, 166, 799, 167, 185, 1643, 170, 167, 170, 170, 167, 251, 170, 800, 916, 930, 539, 921, 167, 219, 914, 170, 170, 952, 185, 170, 170, 166, 166, 915, 166, 929, 166, 166, 166, 937, 166, 928, 166, 166, 185, 166, 2009, 369, 188, 167, 208, 166, 166, 251, 166, 918, 166, 185, 284, 919, 185, 801, 949, 934, 841, 931, 185, 251, 842, 932, 208, 219, 938, 843, 555, 166, 166, 2008, 166, 166, 166, 166, 939, 166, 166, 166, 802, 208, 944, 166, 166, 167, 166, 166, 166, 208, 166, 208, 166, 942, 283, 166, 940, 166, 208, 283, 947, 941, 219, 251, 943, 955, 208, 219, 945, 808, 466, 467, 166, 166, 166, 166, 208, 166, 166, 166, 166, 208, 166, 166, 166, 219, 953, 950, 166, 166, 167, 166, 569, 283, 166, 948, 166, 219, 283, 465, 365, 219, 365, 954, 465, 960, 959, 233, 219, 653, 467, 956, 233, 208, 1117, 655, 656, 166, 166, 166, 166, 219, 166, 166, 166, 166, 252, 166, 166, 166, 233, 985, 233, 166, 166, 167, 166, 283, 166, 962, 166, 963, 283, 570, 283, 166, 233, 166, 961, 283, 233, 233, 2000, 474, 475, 965, 233, 986, 964, 252, 659, 475, 166, 166, 166, 166, 966, 166, 166, 166, 166, 208, 166, 166, 166, 209, 209, 209, 166, 210, 167, 166, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 580, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 166, 166, 166, 166, 1995, 166, 166, 166, 166, 219, 166, 166, 166, 220, 220, 220, 166, 210, 167, 166, 591, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 166, 166, 166, 166, 185, 166, 166, 166, 166, 988, 166, 166, 166, 252, 1108, 987, 166, 166, 167, 166, 602, 473, 373, 252, 373, 999, 473, 166, 166, 269, 166, 967, 166, 252, 233, 989, 252, 661, 662, 167, 252, 990, 991, 497, 498, 166, 166, 166, 166, 269, 166, 166, 166, 166, 252, 166, 166, 166, 1002, 1285, 992, 166, 166, 167, 166, 166, 166, 252, 166, 167, 166, 603, 365, 365, 993, 365, 252, 365, 995, 998, 269, 684, 498, 252, 994, 996, 1095, 269, 686, 687, 166, 166, 166, 166, 997, 166, 269, 166, 166, 166, 1000, 166, 269, 166, 269, 269, 269, 1001, 429, 255, 1003, 1994, 269, 1004, 505, 506, 166, 166, 1006, 166, 1005, 166, 1026, 269, 288, 288, 373, 373, 288, 373, 1025, 373, 689, 506, 1032, 617, 166, 166, 166, 166, 166, 166, 691, 692, 1028, 288, 166, 166, 288, 166, 1027, 166, 251, 284, 1031, 1054, 623, 319, 288, 624, 166, 166, 318, 166, 1011, 166, 1987, 166, 166, 167, 166, 861, 166, 1029, 166, 166, 251, 166, 288, 166, 1075, 288, 288, 318, 166, 862, 166, 1030, 1033, 625, 318, 626, 166, 166, 166, 166, 166, 166, 863, 284, 1035, 166, 166, 1982, 166, 288, 166, 319, 251, 284, 166, 166, 1053, 166, 288, 166, 627, 318, 1012, 1065, 1013, 341, 1034, 628, 166, 166, 318, 166, 249, 166, 249, 869, 249, 249, 249, 1077, 864, 170, 249, 249, 251, 249, 166, 166, 166, 166, 166, 166, 1055, 166, 166, 1056, 166, 319, 166, 319, 319, 1057, 318, 284, 1061, 922, 319, 922, 865, 318, 1014, 249, 249, 166, 166, 870, 166, 249, 166, 249, 1024, 249, 249, 249, 208, 1122, 319, 249, 249, 251, 249, 631, 319, 166, 166, 1059, 166, 1058, 166, 166, 166, 319, 166, 319, 166, 1063, 1066, 1060, 341, 251, 319, 1062, 2137, 1064, 341, 251, 249, 249, 166, 166, 971, 166, 249, 166, 249, 1067, 249, 249, 249, 341, 208, 978, 249, 249, 251, 249, 166, 341, 166, 1068, 166, 166, 632, 166, 341, 166, 1070, 1119, 341, 166, 166, 284, 166, 1069, 166, 166, 251, 166, 1017, 208, 1128, 249, 249, 166, 166, 251, 166, 166, 166, 166, 284, 166, 166, 166, 219, 972, 973, 166, 166, 167, 166, 642, 166, 166, 341, 166, 1018, 166, 166, 341, 166, 1072, 1074, 341, 185, 1071, 1114, 341, 251, 166, 166, 1073, 166, 284, 166, 974, 166, 166, 166, 166, 1022, 166, 166, 166, 166, 251, 166, 166, 166, 1981, 167, 170, 166, 166, 167, 166, 166, 166, 981, 166, 1082, 166, 643, 170, 166, 166, 1079, 166, 1076, 166, 170, 1103, 251, 922, 922, 166, 922, 166, 922, 977, 251, 166, 166, 283, 166, 1977, 166, 982, 283, 984, 284, 166, 1015, 166, 166, 1115, 166, 185, 170, 469, 291, 1016, 166, 166, 1083, 166, 284, 166, 1080, 284, 170, 1078, 1019, 170, 170, 1081, 1020, 170, 318, 170, 1109, 1084, 1021, 185, 1972, 1085, 658, 283, 166, 1039, 166, 283, 283, 283, 1086, 283, 283, 283, 167, 170, 167, 283, 283, 284, 283, 1097, 1098, 167, 166, 166, 167, 166, 1110, 166, 167, 1099, 185, 185, 166, 166, 167, 166, 1104, 166, 318, 1113, 1116, 1101, 185, 1100, 283, 283, 283, 166, 318, 166, 283, 283, 283, 208, 283, 283, 283, 1040, 1123, 1041, 283, 283, 284, 283, 672, 166, 166, 185, 166, 208, 166, 166, 166, 1126, 166, 1111, 166, 922, 922, 1106, 922, 318, 922, 208, 1129, 1124, 185, 318, 1042, 283, 283, 283, 166, 1052, 166, 283, 283, 283, 219, 283, 283, 283, 1134, 1046, 1107, 283, 283, 284, 283, 166, 166, 185, 166, 1112, 166, 673, 219, 1118, 1971, 1120, 185, 166, 166, 208, 166, 318, 166, 208, 166, 166, 1121, 166, 1045, 166, 283, 283, 310, 318, 310, 208, 310, 310, 310, 1089, 318, 1127, 310, 310, 310, 310, 1049, 1050, 922, 922, 208, 922, 208, 922, 219, 1125, 1131, 1130, 1132, 219, 1133, 1139, 185, 683, 1091, 1092, 219, 219, 233, 1135, 219, 310, 310, 310, 1488, 310, 1136, 310, 310, 310, 1137, 219, 1138, 310, 310, 310, 310, 1140, 233, 219, 1142, 219, 495, 233, 233, 1143, 233, 1310, 1141, 1145, 233, 233, 1167, 233, 1144, 1147, 233, 1148, 208, 233, 1146, 252, 310, 310, 166, 166, 1149, 166, 233, 166, 922, 922, 1170, 922, 1168, 922, 252, 252, 1171, 923, 500, 322, 185, 252, 1169, 252, 1152, 1153, 166, 166, 252, 166, 1290, 166, 166, 166, 1172, 166, 1176, 166, 166, 166, 252, 166, 251, 166, 1173, 688, 166, 166, 251, 166, 167, 166, 1177, 252, 251, 1178, 252, 1155, 166, 166, 252, 166, 318, 166, 269, 1156, 694, 1174, 219, 695, 166, 166, 269, 166, 251, 166, 166, 166, 1325, 166, 1180, 166, 166, 166, 1179, 166, 318, 166, 269, 1157, 1181, 1184, 251, 269, 1183, 269, 288, 1158, 251, 696, 269, 697, 166, 166, 1210, 166, 1159, 166, 166, 166, 1785, 166, 1187, 166, 166, 166, 269, 166, 318, 166, 166, 166, 1182, 166, 251, 166, 698, 1188, 1773, 269, 251, 269, 1160, 699, 166, 166, 251, 166, 316, 166, 316, 288, 316, 316, 316, 269, 1163, 1213, 316, 316, 318, 316, 1185, 166, 166, 1161, 166, 1217, 166, 922, 922, 288, 922, 1208, 922, 166, 166, 1212, 166, 251, 166, 1088, 288, 1088, 288, 984, 1162, 316, 316, 166, 166, 251, 166, 316, 166, 316, 1191, 316, 316, 316, 167, 1209, 1281, 316, 316, 318, 316, 702, 922, 922, 288, 922, 1164, 922, 1023, 922, 1761, 922, 1214, 1023, 1211, 166, 288, 166, 1166, 288, 166, 288, 166, 1215, 1193, 1194, 316, 316, 166, 166, 284, 166, 316, 166, 316, 284, 316, 316, 316, 166, 1742, 166, 316, 316, 318, 316, 166, 166, 1236, 166, 1196, 166, 703, 166, 284, 166, 1218, 319, 1239, 1250, 288, 1722, 251, 319, 341, 166, 1237, 166, 284, 1198, 1165, 316, 316, 166, 166, 319, 166, 166, 166, 166, 284, 166, 342, 166, 166, 1197, 166, 166, 166, 167, 166, 714, 166, 922, 166, 922, 166, 319, 166, 284, 319, 1205, 1240, 252, 1199, 1238, 1241, 284, 1024, 319, 166, 284, 166, 319, 1357, 1200, 166, 166, 166, 166, 1243, 166, 166, 166, 166, 284, 166, 342, 166, 166, 1202, 166, 166, 166, 167, 166, 166, 1242, 166, 1245, 341, 1204, 715, 319, 284, 922, 319, 922, 1249, 1246, 1710, 284, 1201, 319, 166, 166, 1247, 166, 1203, 166, 1207, 166, 166, 166, 166, 341, 166, 166, 166, 166, 318, 166, 166, 166, 166, 1248, 166, 166, 166, 167, 166, 726, 922, 922, 341, 922, 1251, 922, 341, 284, 185, 1253, 1256, 341, 1252, 341, 341, 1206, 1221, 1222, 341, 1257, 1254, 1291, 167, 341, 166, 166, 166, 166, 1262, 166, 166, 166, 166, 170, 166, 166, 166, 1258, 167, 1259, 166, 166, 167, 166, 166, 166, 1260, 166, 170, 166, 727, 166, 166, 170, 166, 170, 166, 170, 233, 1264, 318, 166, 166, 1105, 166, 1261, 166, 318, 1327, 166, 166, 166, 166, 1263, 166, 1224, 166, 318, 166, 166, 170, 166, 1265, 166, 1225, 1268, 170, 550, 367, 170, 1289, 170, 1226, 1266, 318, 167, 167, 922, 922, 1227, 922, 1269, 922, 1282, 167, 170, 166, 166, 167, 166, 167, 166, 1286, 1052, 737, 183, 183, 1283, 183, 183, 183, 183, 318, 183, 183, 183, 1292, 1287, 185, 183, 183, 184, 183, 166, 166, 1306, 166, 167, 166, 166, 166, 1230, 166, 1288, 166, 1301, 185, 185, 208, 318, 167, 166, 166, 1295, 166, 318, 166, 1228, 183, 183, 166, 166, 1231, 166, 186, 166, 186, 318, 186, 186, 186, 1293, 167, 185, 186, 186, 187, 188, 166, 166, 1305, 166, 1294, 166, 166, 166, 185, 166, 1233, 166, 1302, 208, 1479, 185, 318, 1308, 166, 166, 1307, 166, 318, 166, 1229, 186, 186, 166, 166, 1296, 166, 1314, 166, 208, 318, 208, 922, 922, 1232, 922, 1297, 922, 1234, 556, 375, 922, 922, 1303, 922, 1315, 922, 185, 1235, 208, 1309, 1311, 208, 208, 1304, 1313, 1312, 1271, 1272, 208, 219, 233, 1329, 1317, 233, 185, 740, 166, 166, 208, 166, 166, 166, 166, 219, 166, 166, 166, 1335, 1316, 1318, 166, 166, 167, 166, 922, 922, 208, 922, 1319, 922, 922, 922, 1336, 922, 1293, 922, 233, 219, 233, 1324, 1091, 1092, 1296, 1330, 252, 1294, 1274, 1092, 219, 166, 751, 166, 166, 1297, 166, 166, 166, 166, 1543, 166, 166, 166, 1293, 219, 1326, 166, 166, 167, 166, 1090, 1090, 219, 1090, 1294, 1090, 922, 922, 219, 922, 1303, 922, 1321, 752, 1322, 233, 1276, 1277, 1334, 252, 233, 1304, 1279, 1280, 219, 166, 166, 166, 166, 1323, 166, 166, 166, 166, 1366, 166, 166, 166, 233, 219, 252, 166, 166, 167, 166, 1298, 1296, 1299, 1356, 1358, 185, 1328, 1303, 252, 753, 252, 1368, 1297, 269, 1378, 1360, 1365, 1300, 1304, 252, 252, 1369, 269, 233, 167, 166, 166, 166, 166, 233, 166, 166, 166, 166, 208, 166, 166, 166, 209, 209, 209, 166, 210, 167, 166, 763, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 166, 166, 166, 166, 167, 166, 166, 166, 166, 219, 166, 166, 166, 220, 220, 220, 166, 210, 167, 166, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 774, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 166, 166, 166, 166, 269, 166, 166, 166, 166, 1371, 166, 166, 166, 269, 167, 1370, 166, 166, 167, 166, 1331, 288, 1332, 922, 922, 233, 922, 1362, 922, 1363, 1293, 269, 1400, 785, 252, 269, 1372, 1333, 1376, 1338, 1339, 1359, 269, 269, 1364, 166, 166, 166, 166, 1554, 166, 166, 166, 166, 252, 166, 166, 166, 1377, 288, 1296, 166, 166, 167, 166, 922, 922, 1399, 922, 1516, 922, 1361, 922, 922, 786, 922, 1303, 922, 1411, 219, 288, 1152, 1153, 1293, 252, 1403, 288, 1367, 1340, 1153, 166, 166, 166, 166, 1294, 166, 288, 166, 1090, 1090, 252, 1090, 1296, 1090, 319, 1320, 1401, 269, 613, 427, 288, 1409, 1431, 1297, 1342, 1343, 922, 922, 319, 922, 1408, 922, 166, 166, 288, 166, 269, 166, 1088, 1432, 1088, 167, 1345, 1346, 319, 796, 166, 166, 251, 166, 253, 166, 253, 1191, 253, 253, 253, 1303, 1443, 1441, 253, 253, 254, 255, 166, 166, 319, 166, 1304, 166, 166, 166, 1088, 166, 1088, 166, 341, 1293, 167, 1433, 251, 269, 1347, 319, 1444, 1480, 251, 1382, 1402, 253, 253, 166, 166, 1348, 166, 341, 166, 166, 166, 319, 166, 288, 166, 166, 1435, 166, 1445, 618, 435, 166, 166, 1440, 166, 251, 166, 319, 166, 166, 284, 166, 1349, 166, 341, 166, 166, 251, 166, 166, 166, 166, 1487, 166, 251, 166, 798, 166, 166, 1452, 166, 251, 166, 1350, 284, 167, 166, 166, 284, 166, 1373, 166, 1374, 251, 170, 166, 166, 269, 166, 804, 166, 1351, 251, 805, 1393, 1456, 185, 1375, 806, 166, 166, 251, 166, 249, 166, 249, 1446, 249, 249, 249, 341, 1353, 1938, 249, 249, 251, 249, 166, 166, 166, 166, 166, 166, 341, 166, 166, 1451, 166, 1447, 166, 341, 1453, 1490, 251, 284, 167, 1390, 1454, 185, 341, 251, 1352, 249, 809, 166, 166, 1354, 166, 249, 166, 249, 170, 249, 249, 249, 166, 1458, 166, 249, 249, 251, 249, 1493, 185, 922, 922, 166, 922, 166, 922, 284, 166, 1296, 166, 170, 810, 166, 1391, 166, 167, 1166, 284, 1455, 1404, 1477, 170, 284, 249, 249, 166, 166, 284, 166, 249, 166, 249, 288, 249, 249, 249, 1463, 1394, 1273, 249, 249, 251, 249, 1355, 1023, 922, 1396, 922, 1303, 1023, 1023, 922, 811, 922, 1457, 1023, 1464, 167, 170, 1410, 1380, 1381, 1475, 1476, 170, 1469, 1193, 1194, 249, 249, 166, 166, 288, 166, 166, 166, 166, 167, 166, 166, 166, 166, 1499, 166, 166, 166, 167, 166, 1023, 922, 208, 922, 1478, 1023, 1192, 1090, 284, 1090, 1462, 1192, 1506, 821, 170, 1392, 1383, 1194, 1483, 166, 185, 166, 1385, 1386, 208, 166, 166, 166, 166, 185, 166, 166, 166, 166, 284, 166, 166, 166, 1492, 1489, 1397, 166, 166, 167, 166, 1023, 922, 1293, 922, 252, 1023, 166, 167, 166, 822, 1491, 1293, 185, 1294, 1547, 167, 1388, 1389, 922, 208, 922, 284, 1434, 1497, 208, 166, 166, 283, 166, 1395, 166, 1498, 283, 1207, 1405, 319, 1406, 922, 922, 167, 922, 288, 922, 653, 467, 922, 922, 1494, 922, 185, 922, 1407, 1296, 1413, 1414, 219, 1496, 167, 1296, 185, 1398, 1221, 1222, 1297, 1507, 167, 1437, 1303, 1438, 1436, 832, 286, 183, 319, 183, 286, 286, 286, 1442, 286, 286, 286, 319, 1439, 1495, 286, 286, 287, 286, 922, 922, 319, 922, 208, 922, 1090, 1090, 167, 1090, 1293, 1090, 208, 1500, 219, 1505, 1415, 1222, 219, 1510, 1513, 1294, 1417, 1418, 1273, 286, 286, 283, 166, 1296, 166, 289, 283, 289, 341, 289, 289, 289, 1524, 233, 1297, 289, 289, 290, 291, 922, 922, 1303, 922, 1504, 922, 166, 166, 341, 166, 1544, 166, 208, 1304, 252, 167, 1420, 1421, 166, 166, 1508, 166, 318, 166, 1422, 289, 289, 283, 166, 219, 166, 1293, 283, 1089, 318, 166, 166, 1518, 166, 233, 166, 1423, 1294, 659, 475, 166, 166, 1448, 166, 1449, 166, 318, 166, 166, 341, 166, 1511, 166, 1424, 208, 1521, 318, 166, 166, 1450, 166, 233, 166, 318, 219, 835, 283, 166, 269, 166, 283, 283, 283, 318, 283, 283, 283, 1303, 1557, 1425, 283, 283, 284, 283, 1267, 1484, 166, 166, 1304, 166, 1512, 166, 166, 166, 1293, 166, 1485, 166, 1514, 219, 1486, 341, 318, 1808, 208, 1294, 219, 185, 318, 283, 846, 283, 166, 1296, 166, 283, 283, 283, 170, 283, 283, 283, 1426, 288, 1297, 283, 283, 284, 283, 166, 166, 233, 166, 1585, 166, 922, 922, 170, 922, 1522, 922, 233, 847, 1520, 1525, 318, 233, 166, 166, 1515, 166, 1235, 166, 1427, 283, 283, 283, 166, 219, 166, 283, 283, 283, 318, 283, 283, 283, 233, 1255, 1303, 283, 283, 284, 283, 166, 166, 1523, 166, 1430, 166, 1304, 1526, 1428, 848, 233, 1459, 1548, 1460, 185, 1937, 318, 1549, 170, 170, 252, 252, 1429, 252, 1296, 283, 283, 310, 1461, 310, 1550, 310, 310, 310, 185, 1297, 1657, 310, 310, 310, 310, 1551, 922, 922, 252, 922, 313, 922, 922, 922, 1552, 922, 208, 922, 252, 1553, 1244, 1563, 1271, 1272, 252, 1501, 269, 1502, 1465, 1272, 310, 310, 166, 166, 1303, 166, 208, 166, 1270, 1270, 1555, 1270, 1503, 1270, 269, 1304, 269, 1559, 684, 498, 1558, 269, 1484, 1560, 1467, 1468, 922, 922, 269, 922, 1562, 922, 208, 1485, 269, 1561, 1582, 1519, 269, 288, 288, 288, 1091, 1092, 233, 858, 166, 166, 1588, 166, 320, 166, 320, 1581, 320, 320, 320, 166, 1586, 166, 320, 320, 321, 322, 922, 922, 288, 922, 1613, 922, 1090, 1090, 284, 1090, 319, 1090, 319, 1574, 1575, 1587, 1274, 1092, 1589, 288, 1612, 288, 1276, 1277, 1484, 320, 320, 166, 166, 2054, 166, 1484, 166, 922, 922, 1485, 922, 1590, 922, 1509, 1591, 288, 1545, 689, 506, 288, 1546, 341, 208, 1279, 1280, 922, 922, 219, 922, 252, 922, 1622, 1088, 1609, 1088, 1278, 1278, 319, 1278, 1614, 1278, 1471, 1280, 319, 860, 166, 166, 1382, 166, 208, 166, 1473, 1474, 922, 922, 1663, 922, 166, 922, 166, 166, 318, 166, 166, 166, 1623, 166, 866, 166, 1338, 1339, 867, 284, 341, 1568, 284, 868, 166, 166, 251, 166, 316, 166, 316, 1538, 316, 316, 316, 166, 1633, 166, 316, 316, 318, 316, 922, 922, 170, 922, 319, 922, 1270, 1270, 284, 1270, 1617, 1270, 1616, 1576, 319, 319, 1527, 1339, 1608, 166, 1216, 166, 1529, 1530, 1618, 316, 871, 166, 166, 319, 166, 316, 166, 316, 284, 316, 316, 316, 166, 167, 166, 316, 316, 318, 316, 922, 922, 1645, 922, 1577, 922, 922, 922, 284, 922, 341, 922, 1626, 872, 1620, 341, 1152, 1153, 341, 166, 1186, 1487, 1340, 1153, 1619, 316, 316, 166, 166, 170, 166, 316, 166, 316, 284, 316, 316, 316, 1175, 1632, 319, 316, 316, 318, 316, 1090, 1090, 1615, 1090, 166, 1090, 166, 922, 922, 873, 922, 1624, 922, 341, 1627, 341, 1342, 1343, 341, 284, 1625, 233, 1965, 1345, 1346, 316, 316, 166, 166, 1628, 166, 166, 166, 166, 341, 166, 342, 166, 166, 1578, 166, 166, 166, 167, 166, 922, 922, 185, 922, 170, 922, 1278, 1278, 284, 1278, 1630, 1278, 1654, 883, 170, 1579, 1532, 1346, 1629, 166, 2061, 1489, 1534, 1535, 167, 166, 166, 166, 166, 1475, 166, 166, 166, 166, 284, 166, 342, 166, 1670, 219, 219, 166, 166, 167, 166, 166, 166, 166, 166, 1495, 166, 170, 166, 166, 884, 166, 1634, 166, 1635, 1638, 170, 251, 284, 1636, 170, 1637, 170, 1105, 251, 170, 166, 166, 166, 166, 185, 166, 166, 166, 166, 1647, 166, 166, 166, 1539, 923, 1658, 166, 166, 167, 166, 166, 166, 185, 166, 167, 166, 166, 166, 1644, 166, 185, 166, 1661, 895, 1656, 185, 251, 167, 166, 166, 208, 1487, 251, 166, 1648, 166, 166, 166, 166, 208, 166, 166, 166, 166, 251, 166, 166, 166, 1484, 1660, 1484, 166, 166, 167, 166, 1484, 1484, 166, 166, 1485, 166, 1583, 166, 1556, 896, 1584, 1610, 1485, 1659, 167, 1611, 1649, 269, 251, 288, 185, 1487, 1089, 233, 319, 166, 166, 166, 166, 167, 166, 365, 166, 365, 167, 365, 365, 365, 1540, 1966, 951, 365, 365, 366, 367, 166, 166, 1650, 166, 1489, 166, 166, 166, 185, 1489, 185, 166, 1665, 185, 1651, 1652, 251, 167, 233, 1954, 208, 1653, 251, 1541, 1655, 365, 365, 183, 183, 1687, 183, 183, 183, 183, 1495, 183, 183, 183, 1484, 219, 923, 183, 183, 184, 183, 166, 166, 167, 1495, 1485, 166, 1023, 922, 1621, 922, 208, 1023, 1664, 1666, 1667, 219, 251, 341, 319, 1675, 1669, 208, 1380, 1381, 208, 183, 907, 166, 166, 208, 166, 186, 166, 186, 1802, 186, 186, 186, 1484, 1668, 185, 186, 186, 187, 188, 1023, 922, 208, 922, 1485, 1023, 1379, 1270, 1662, 1270, 219, 1379, 1671, 311, 1679, 219, 1564, 1381, 1676, 219, 219, 208, 1566, 1567, 1677, 186, 908, 166, 166, 233, 166, 373, 166, 373, 1682, 373, 373, 373, 233, 1680, 1691, 373, 373, 374, 375, 1023, 922, 1672, 922, 1681, 1023, 1023, 922, 219, 922, 1678, 1023, 233, 219, 1673, 1674, 1193, 1194, 219, 233, 233, 1683, 1383, 1194, 1690, 373, 373, 166, 166, 1688, 166, 166, 166, 166, 208, 166, 166, 166, 233, 1813, 1692, 166, 166, 167, 166, 1192, 1090, 233, 1090, 1689, 1192, 1023, 922, 1693, 922, 252, 1023, 252, 1701, 924, 233, 1385, 1386, 269, 1702, 252, 1713, 1388, 1389, 185, 166, 166, 166, 166, 1706, 166, 166, 166, 166, 167, 166, 166, 166, 1929, 252, 1484, 166, 166, 167, 166, 1023, 922, 1707, 922, 1792, 1023, 1485, 925, 166, 166, 1631, 166, 252, 166, 1711, 269, 1570, 1389, 252, 170, 1709, 1708, 1714, 252, 318, 166, 166, 166, 166, 1603, 166, 166, 166, 166, 208, 166, 166, 166, 209, 209, 209, 166, 210, 167, 166, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 935, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 166, 166, 166, 166, 340, 166, 166, 166, 166, 219, 166, 166, 166, 220, 220, 220, 166, 210, 167, 166, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 946, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 166, 166, 166, 166, 1712, 166, 166, 166, 166, 319, 166, 166, 166, 252, 269, 269, 166, 166, 167, 166, 1387, 1278, 1719, 1278, 1718, 1387, 922, 922, 185, 922, 269, 922, 1723, 269, 957, 1721, 1572, 1573, 1795, 1720, 1724, 269, 1413, 1414, 516, 166, 166, 166, 166, 269, 166, 166, 166, 166, 185, 166, 166, 166, 1794, 185, 288, 166, 166, 167, 166, 922, 922, 1703, 922, 1738, 922, 1798, 958, 166, 166, 252, 166, 288, 166, 1704, 1705, 1592, 1414, 166, 166, 1739, 166, 288, 166, 318, 166, 166, 166, 166, 1734, 166, 425, 166, 425, 318, 425, 425, 425, 288, 311, 1741, 425, 425, 426, 427, 1270, 1270, 1684, 1270, 1604, 1270, 922, 922, 233, 922, 288, 922, 1836, 1733, 1685, 1686, 1594, 1595, 233, 166, 288, 166, 1221, 1222, 185, 425, 425, 166, 166, 1740, 166, 253, 166, 253, 284, 253, 253, 253, 166, 1805, 166, 253, 253, 254, 255, 922, 922, 1715, 922, 1743, 922, 1090, 1090, 284, 1090, 269, 1090, 1855, 288, 1716, 1717, 1415, 1222, 252, 166, 1744, 166, 1417, 1418, 1729, 253, 969, 166, 166, 288, 166, 433, 166, 433, 284, 433, 433, 433, 1730, 413, 319, 433, 433, 434, 435, 922, 922, 1735, 922, 1757, 922, 922, 922, 208, 922, 288, 922, 319, 1815, 1736, 1737, 1420, 1421, 319, 1753, 319, 1752, 1597, 1421, 341, 433, 433, 166, 166, 1759, 166, 1765, 166, 1278, 1278, 233, 1278, 166, 1278, 166, 319, 166, 166, 251, 166, 975, 166, 1834, 1758, 1599, 1600, 166, 284, 166, 976, 166, 166, 318, 166, 319, 166, 1760, 166, 166, 1762, 166, 284, 166, 341, 341, 1763, 251, 1764, 319, 1731, 341, 1770, 979, 318, 319, 341, 980, 283, 166, 1769, 166, 465, 283, 465, 1771, 465, 465, 465, 341, 1865, 1772, 465, 465, 466, 467, 269, 1774, 166, 166, 166, 166, 166, 166, 166, 166, 341, 1487, 1775, 166, 166, 170, 1649, 170, 318, 284, 1776, 341, 1777, 167, 318, 465, 465, 286, 183, 284, 183, 286, 286, 286, 1793, 286, 286, 286, 1605, 412, 170, 286, 286, 287, 286, 166, 166, 1754, 166, 1781, 166, 166, 166, 170, 1489, 319, 166, 170, 185, 1755, 1756, 318, 1783, 411, 170, 1782, 1784, 318, 1606, 1796, 286, 1008, 283, 166, 1786, 166, 289, 283, 289, 219, 289, 289, 289, 170, 1824, 1787, 289, 289, 290, 291, 166, 166, 1766, 1495, 170, 166, 922, 922, 1649, 922, 341, 922, 1979, 252, 1767, 1768, 318, 1797, 1799, 185, 1806, 167, 1271, 1272, 185, 289, 1009, 283, 166, 1800, 166, 473, 283, 473, 208, 473, 473, 473, 1814, 185, 185, 473, 473, 474, 475, 922, 922, 1778, 922, 1807, 922, 1270, 1270, 1817, 1270, 170, 1270, 208, 1883, 1779, 1780, 1465, 1272, 1801, 288, 185, 208, 1467, 1468, 1809, 473, 473, 166, 166, 1799, 166, 496, 166, 496, 1818, 496, 496, 496, 1803, 410, 1800, 496, 496, 497, 498, 922, 922, 208, 922, 1804, 922, 922, 922, 1810, 922, 1816, 922, 208, 219, 219, 185, 1279, 1280, 1822, 407, 1811, 1812, 1471, 1280, 233, 496, 496, 166, 166, 1823, 166, 320, 166, 320, 1819, 320, 320, 320, 219, 1837, 1825, 320, 320, 321, 322, 1278, 1278, 208, 1278, 219, 1278, 922, 922, 1826, 922, 1820, 922, 219, 219, 208, 1821, 1473, 1474, 1803, 1941, 233, 219, 1338, 1339, 1830, 320, 1037, 166, 166, 1804, 166, 504, 166, 504, 1949, 504, 504, 504, 1833, 219, 233, 504, 504, 505, 506, 922, 922, 219, 922, 219, 922, 1270, 1270, 1828, 1270, 219, 1270, 1827, 1829, 233, 1900, 1527, 1339, 233, 219, 406, 319, 1529, 1530, 1831, 504, 504, 166, 166, 1832, 166, 1838, 166, 922, 922, 233, 922, 1799, 922, 252, 405, 166, 166, 318, 166, 1043, 166, 1846, 1800, 1345, 1346, 1835, 252, 233, 1044, 166, 166, 251, 166, 233, 166, 1847, 922, 922, 233, 922, 252, 922, 1845, 1910, 252, 318, 1848, 1697, 1839, 341, 252, 1047, 1532, 1346, 1849, 1048, 166, 166, 1799, 166, 365, 166, 365, 404, 365, 365, 365, 1803, 1852, 1850, 365, 365, 366, 367, 1278, 1278, 252, 1278, 1804, 1278, 166, 166, 252, 166, 1851, 166, 252, 185, 252, 233, 1534, 1535, 166, 166, 1856, 166, 251, 166, 1928, 365, 1087, 166, 166, 1803, 166, 373, 166, 373, 251, 373, 373, 373, 1698, 403, 1853, 373, 373, 374, 375, 166, 166, 252, 166, 269, 166, 166, 166, 252, 166, 269, 166, 1857, 1859, 2062, 1854, 251, 219, 166, 166, 288, 166, 251, 166, 1699, 373, 1093, 166, 166, 1875, 166, 425, 166, 425, 251, 425, 425, 425, 288, 269, 1873, 425, 425, 426, 427, 166, 166, 1858, 1649, 1860, 166, 1023, 922, 269, 922, 269, 1023, 1945, 1862, 1876, 1879, 251, 269, 288, 288, 1861, 269, 1380, 1381, 208, 425, 1150, 166, 166, 1799, 166, 433, 166, 433, 1864, 433, 433, 433, 402, 1863, 1800, 433, 433, 434, 435, 1023, 922, 269, 922, 269, 1023, 1379, 1270, 269, 1270, 1803, 1379, 1866, 319, 288, 1890, 1564, 1381, 1988, 269, 319, 1804, 1566, 1567, 1877, 433, 1154, 283, 166, 1892, 166, 465, 283, 465, 269, 465, 465, 465, 166, 288, 166, 465, 465, 466, 467, 1023, 922, 1874, 922, 1880, 1023, 1023, 922, 284, 922, 288, 1023, 288, 341, 401, 1902, 1388, 1389, 1884, 166, 1893, 166, 1570, 1389, 319, 465, 1189, 283, 166, 319, 166, 473, 283, 473, 284, 473, 473, 473, 166, 1894, 166, 473, 473, 474, 475, 1387, 1278, 288, 1278, 1871, 1387, 922, 922, 284, 922, 1799, 922, 319, 185, 1896, 1882, 1572, 1573, 319, 1872, 1891, 1878, 1413, 1414, 1930, 473, 1195, 166, 166, 400, 166, 496, 166, 496, 288, 496, 496, 496, 922, 1897, 922, 496, 496, 497, 498, 922, 922, 319, 922, 319, 922, 1270, 1270, 1024, 1270, 1803, 1270, 1901, 1920, 1905, 341, 1592, 1414, 341, 170, 395, 1881, 1594, 1595, 1904, 496, 1219, 166, 166, 1799, 166, 504, 166, 504, 288, 504, 504, 504, 2002, 288, 1895, 504, 504, 505, 506, 922, 922, 319, 922, 341, 922, 922, 922, 319, 922, 341, 922, 1903, 1803, 394, 1899, 1420, 1421, 1799, 170, 1906, 1912, 1597, 1421, 1898, 504, 1223, 922, 922, 1800, 922, 1907, 922, 1278, 1278, 341, 1278, 319, 1278, 1908, 341, 1915, 341, 1274, 1092, 170, 185, 341, 1926, 1599, 1600, 166, 166, 1909, 166, 341, 166, 166, 166, 170, 166, 170, 166, 1911, 185, 170, 1927, 318, 1914, 1913, 1470, 922, 922, 318, 922, 922, 922, 922, 1919, 922, 922, 922, 1803, 1748, 393, 922, 922, 923, 922, 166, 166, 1917, 166, 1804, 166, 170, 166, 166, 170, 166, 1799, 166, 1918, 368, 167, 318, 341, 1803, 1916, 1749, 170, 1800, 318, 1925, 922, 922, 922, 922, 1804, 922, 1750, 922, 166, 166, 170, 166, 208, 166, 170, 1931, 1940, 170, 1340, 1153, 166, 166, 1921, 166, 318, 166, 166, 166, 167, 1649, 184, 166, 166, 166, 208, 166, 318, 166, 166, 166, 1943, 166, 318, 166, 167, 1531, 166, 166, 251, 166, 364, 166, 1924, 1799, 251, 166, 166, 185, 166, 1933, 166, 208, 251, 1843, 1800, 1948, 167, 1536, 1537, 922, 922, 251, 922, 983, 922, 983, 1932, 983, 983, 983, 2016, 319, 1844, 983, 983, 984, 983, 922, 922, 185, 922, 1803, 922, 166, 166, 1939, 166, 208, 166, 233, 1799, 1958, 1804, 984, 167, 166, 166, 1934, 166, 318, 166, 1800, 983, 983, 1023, 922, 363, 922, 1942, 1023, 167, 318, 166, 166, 1888, 166, 208, 166, 208, 1950, 1383, 1194, 922, 922, 219, 922, 1947, 922, 318, 922, 922, 1803, 922, 1935, 922, 1944, 208, 252, 1052, 1889, 2081, 208, 1804, 208, 1936, 1091, 1092, 1569, 1023, 922, 1946, 922, 1023, 1023, 1023, 185, 1023, 1023, 1023, 208, 219, 362, 1023, 1023, 1024, 1023, 219, 1952, 219, 1955, 1951, 1935, 1953, 1956, 219, 219, 233, 233, 1959, 219, 357, 233, 1936, 233, 1957, 1964, 233, 252, 1960, 1963, 1935, 1023, 1023, 922, 922, 1961, 922, 1962, 922, 1974, 219, 1936, 233, 922, 922, 252, 922, 252, 922, 1415, 1222, 1935, 233, 252, 1973, 185, 1975, 208, 1976, 1152, 1153, 2037, 1978, 166, 166, 2052, 166, 1980, 166, 166, 166, 269, 166, 252, 166, 252, 1596, 166, 166, 251, 166, 269, 166, 1984, 288, 251, 269, 1969, 2025, 341, 1983, 356, 1986, 318, 1970, 1985, 1997, 269, 1601, 1602, 922, 922, 1935, 922, 1051, 922, 1051, 269, 1051, 1051, 1051, 1989, 355, 1936, 1051, 1051, 1052, 1051, 166, 166, 1088, 1931, 1088, 166, 166, 166, 269, 1934, 185, 166, 2034, 170, 2045, 288, 251, 1191, 1023, 922, 288, 922, 251, 1023, 1996, 1051, 1051, 922, 922, 1998, 922, 166, 922, 166, 1193, 1194, 166, 166, 166, 1931, 1999, 319, 1935, 1465, 1272, 288, 284, 166, 319, 1934, 2010, 284, 284, 2001, 1992, 288, 319, 2012, 2013, 2003, 1993, 2049, 284, 2058, 219, 208, 288, 1935, 2011, 319, 1639, 1088, 1088, 319, 1088, 1088, 1088, 1088, 2015, 1088, 1088, 1088, 354, 2017, 341, 1088, 1088, 1089, 1088, 922, 922, 319, 922, 2020, 922, 166, 166, 341, 1931, 219, 166, 2060, 353, 2023, 341, 1221, 1222, 166, 166, 2021, 1934, 318, 166, 2022, 1088, 1088, 922, 922, 341, 922, 1090, 922, 1090, 318, 1090, 1090, 1090, 1935, 341, 167, 1090, 1090, 1091, 1092, 166, 166, 170, 166, 1936, 166, 166, 166, 2026, 166, 170, 166, 170, 185, 2030, 170, 318, 341, 2032, 2029, 2038, 2031, 318, 1935, 2006, 1090, 1090, 922, 922, 2035, 922, 2007, 922, 170, 1936, 922, 922, 2064, 922, 219, 922, 1931, 167, 1471, 1280, 922, 922, 170, 922, 185, 922, 1271, 1272, 2036, 167, 1934, 2040, 2044, 2039, 2047, 2050, 1279, 1280, 269, 208, 185, 2088, 2041, 167, 185, 1642, 922, 922, 2042, 922, 922, 922, 922, 185, 922, 922, 922, 233, 1935, 2043, 922, 922, 923, 922, 2046, 340, 2067, 185, 208, 1936, 185, 167, 2048, 2051, 208, 1935, 2055, 167, 2056, 2053, 208, 233, 2040, 208, 2063, 208, 1936, 2042, 2066, 922, 1646, 922, 922, 2041, 922, 2057, 922, 219, 2043, 233, 233, 2040, 2042, 208, 2069, 2065, 2068, 1527, 1339, 2070, 231, 219, 2041, 2043, 233, 233, 219, 252, 233, 2071, 252, 2073, 2040, 233, 233, 2074, 166, 166, 269, 166, 252, 166, 2082, 2076, 1694, 922, 922, 2075, 922, 1151, 922, 1151, 251, 1151, 1151, 1151, 252, 2078, 230, 1151, 1151, 1152, 1153, 922, 922, 252, 922, 2079, 922, 922, 922, 252, 922, 2080, 922, 2087, 2042, 269, 185, 1338, 1339, 252, 2083, 269, 2125, 1345, 1346, 2077, 1151, 1151, 922, 922, 2040, 922, 2097, 922, 166, 166, 269, 166, 252, 166, 288, 2041, 2042, 2084, 1532, 1346, 166, 166, 288, 2046, 251, 166, 2090, 2043, 269, 2085, 269, 185, 2086, 288, 288, 2072, 251, 2132, 2091, 2095, 269, 2092, 166, 269, 166, 1696, 922, 922, 2040, 922, 983, 922, 983, 288, 983, 983, 983, 284, 2107, 2093, 983, 983, 984, 983, 1023, 922, 319, 922, 2089, 1023, 1023, 922, 288, 922, 2042, 1023, 288, 229, 2096, 319, 1380, 1381, 166, 2100, 166, 2094, 1388, 1389, 319, 983, 1700, 1023, 922, 2101, 922, 319, 1023, 284, 288, 166, 288, 2046, 2102, 2098, 208, 2135, 2105, 1564, 1381, 319, 922, 922, 2108, 922, 284, 922, 922, 922, 2040, 922, 319, 922, 319, 341, 2106, 233, 1413, 1414, 2110, 2103, 341, 2148, 1420, 1421, 1725, 1190, 1088, 2111, 1088, 1190, 1190, 1190, 319, 1190, 1190, 1190, 2042, 170, 224, 1190, 1190, 1191, 1190, 2112, 2118, 166, 166, 2104, 166, 341, 166, 166, 166, 2109, 166, 2114, 166, 341, 2140, 208, 319, 318, 341, 341, 2113, 223, 2040, 318, 1190, 1190, 1023, 922, 2099, 922, 1192, 1023, 1192, 2041, 1192, 1192, 1192, 2042, 2142, 219, 1192, 1192, 1193, 1194, 166, 166, 341, 2046, 2043, 166, 341, 170, 170, 2115, 2040, 2116, 2042, 2117, 2121, 2119, 318, 341, 170, 222, 2120, 2041, 170, 2043, 167, 1192, 1192, 1023, 922, 170, 922, 185, 1023, 2123, 170, 170, 170, 185, 2122, 2040, 2124, 2126, 2127, 1570, 1389, 2042, 2128, 2131, 2046, 185, 2041, 2129, 167, 185, 2040, 167, 2043, 2133, 167, 167, 208, 167, 2130, 2136, 2138, 2041, 208, 2042, 2145, 219, 1728, 1023, 922, 185, 922, 1023, 1023, 1023, 2043, 1023, 1023, 1023, 208, 2144, 2139, 1023, 1023, 1024, 1023, 2141, 233, 219, 219, 219, 2143, 208, 208, 2129, 2146, 233, 2149, 219, 2147, 2150, 233, 233, 167, 2129, 2130, 233, 2151, 252, 2154, 2152, 1023, 1732, 922, 922, 2130, 922, 252, 922, 166, 166, 2155, 166, 219, 166, 252, 233, 167, 2129, 1592, 1414, 166, 166, 2156, 2127, 251, 166, 166, 166, 2157, 2128, 2158, 166, 2213, 2153, 252, 252, 251, 219, 252, 2159, 2160, 252, 251, 269, 2161, 1745, 922, 922, 2129, 922, 1220, 922, 1220, 269, 1220, 1220, 1220, 2162, 269, 2130, 1220, 1220, 1221, 1222, 2164, 269, 2163, 2201, 269, 2165, 185, 269, 269, 2166, 288, 2168, 288, 288, 166, 319, 166, 2169, 190, 166, 2170, 2127, 166, 2178, 2128, 1220, 1220, 922, 922, 284, 922, 2129, 922, 341, 284, 2172, 288, 284, 2167, 288, 2173, 2185, 2171, 1597, 1421, 288, 319, 2174, 166, 166, 2177, 166, 319, 166, 2182, 288, 319, 2176, 2129, 341, 2183, 184, 166, 166, 318, 2127, 341, 166, 2188, 2179, 1747, 922, 922, 2175, 922, 1051, 922, 1051, 318, 1051, 1051, 1051, 319, 170, 2189, 1051, 1051, 1052, 1051, 166, 166, 2180, 2128, 319, 166, 319, 341, 2181, 2186, 2129, 2184, 170, 341, 341, 170, 318, 185, 2187, 2190, 2191, 2130, 170, 2253, 2194, 1051, 1751, 922, 922, 2129, 922, 1270, 922, 1270, 341, 1270, 1270, 1270, 2127, 167, 2130, 1270, 1270, 1271, 1272, 2192, 170, 2195, 2128, 170, 2193, 167, 2196, 170, 185, 2211, 2129, 2198, 185, 2204, 2203, 167, 208, 2197, 2209, 219, 208, 2130, 2199, 167, 1270, 1270, 1088, 1088, 185, 1088, 1088, 1088, 1088, 185, 1088, 1088, 1088, 2200, 2129, 2207, 1088, 1088, 1089, 1088, 208, 2210, 2196, 208, 2206, 2130, 167, 2212, 2218, 2196, 2198, 2214, 2198, 2197, 219, 219, 2215, 252, 233, 233, 2197, 2199, 208, 2199, 233, 1088, 1789, 922, 922, 2438, 922, 1090, 922, 1090, 233, 1090, 1090, 1090, 219, 219, 2256, 1090, 1090, 1091, 1092, 233, 208, 2217, 166, 166, 2196, 166, 2221, 166, 2222, 2198, 252, 252, 2224, 2228, 2225, 2219, 2248, 185, 251, 269, 2220, 269, 288, 2438, 1090, 1790, 922, 922, 252, 922, 1278, 922, 1278, 252, 1278, 1278, 1278, 2196, 2438, 2198, 1278, 1278, 1279, 1280, 166, 166, 2234, 2200, 2197, 166, 2199, 2226, 166, 269, 166, 319, 2232, 2231, 288, 2237, 251, 269, 288, 269, 319, 2438, 2238, 284, 319, 1278, 1278, 922, 922, 2196, 922, 1337, 922, 1337, 2198, 1337, 1337, 1337, 2240, 2438, 2229, 1337, 1337, 1338, 1339, 2230, 166, 341, 2200, 166, 166, 2241, 166, 288, 166, 2196, 341, 2242, 288, 341, 2244, 284, 2245, 2438, 2257, 318, 2235, 170, 208, 170, 1337, 1337, 922, 922, 2198, 922, 1151, 922, 1151, 319, 1151, 1151, 1151, 2196, 2438, 2236, 1151, 1151, 1152, 1153, 166, 166, 2196, 2200, 2197, 166, 2249, 2246, 319, 170, 2198, 2198, 2252, 2197, 185, 167, 318, 341, 2264, 167, 233, 2199, 2199, 2438, 167, 1151, 1841, 922, 922, 2196, 922, 1344, 922, 1344, 341, 1344, 1344, 1344, 2198, 2250, 2197, 1344, 1344, 1345, 1346, 2200, 2254, 2251, 2255, 2199, 2259, 185, 167, 170, 185, 2196, 2198, 208, 167, 208, 2258, 2292, 170, 233, 219, 2260, 2197, 2199, 219, 2265, 1344, 1344, 1023, 922, 219, 922, 1379, 1023, 1379, 185, 1379, 1379, 1379, 208, 208, 2331, 1379, 1379, 1380, 1381, 2261, 219, 2262, 233, 2263, 2266, 2267, 2270, 252, 2274, 269, 233, 288, 166, 166, 252, 2249, 2268, 166, 252, 2272, 252, 2438, 2269, 269, 1379, 1379, 1190, 1088, 251, 1088, 1190, 1190, 1190, 2299, 1190, 1190, 1190, 2271, 219, 2438, 1190, 1190, 1191, 1190, 166, 166, 269, 2250, 269, 166, 2275, 166, 2273, 2249, 2276, 185, 252, 288, 288, 288, 251, 2277, 2290, 166, 2278, 2250, 284, 319, 2421, 1190, 1868, 1023, 922, 2279, 922, 1192, 1023, 1192, 284, 1192, 1192, 1192, 319, 2438, 2294, 1192, 1192, 1193, 1194, 166, 166, 208, 2249, 2280, 166, 166, 166, 319, 2250, 319, 166, 2282, 2284, 2281, 341, 318, 341, 2286, 341, 2283, 170, 318, 2285, 233, 1192, 1869, 1023, 922, 341, 922, 1387, 1023, 1387, 2304, 1387, 1387, 1387, 2287, 2249, 2250, 1387, 1387, 1388, 1389, 2288, 170, 170, 185, 170, 2289, 2293, 167, 167, 185, 2295, 2291, 2296, 219, 2301, 233, 2300, 233, 219, 2303, 208, 233, 2302, 208, 2305, 1387, 1387, 922, 922, 252, 922, 1412, 922, 1412, 2306, 1412, 1412, 1412, 252, 252, 2309, 1412, 1412, 1413, 1414, 269, 2308, 269, 269, 2313, 2310, 288, 288, 288, 2317, 2312, 2314, 319, 319, 341, 2316, 185, 2318, 319, 2321, 2330, 2320, 2324, 185, 341, 1412, 1412, 922, 922, 2322, 922, 1220, 922, 1220, 2394, 1220, 1220, 1220, 341, 2325, 170, 1220, 1220, 1221, 1222, 2326, 170, 170, 2329, 185, 208, 2335, 2332, 2336, 2328, 2338, 208, 208, 208, 2334, 2337, 2339, 2438, 2333, 219, 2340, 219, 252, 2332, 2345, 1220, 1886, 922, 922, 185, 922, 1419, 922, 1419, 2333, 1419, 1419, 1419, 2332, 208, 2417, 1419, 1419, 1420, 1421, 219, 233, 233, 2341, 2333, 2342, 233, 219, 2343, 252, 2332, 252, 269, 2346, 2349, 233, 2344, 2438, 269, 2348, 288, 2347, 2350, 2438, 2353, 1419, 1419, 922, 922, 2332, 922, 1270, 922, 1270, 252, 1270, 1270, 1270, 269, 2332, 2333, 1270, 1270, 1271, 1272, 288, 2351, 2352, 288, 319, 2354, 2356, 319, 269, 319, 2332, 2355, 341, 2357, 2360, 2359, 341, 170, 288, 2363, 2361, 2358, 185, 2438, 2367, 1270, 1922, 922, 922, 2332, 922, 1278, 922, 1278, 319, 1278, 1278, 1278, 341, 2332, 2333, 1278, 1278, 1279, 1280, 170, 2362, 170, 185, 2364, 2333, 2332, 2366, 341, 2368, 2365, 2371, 2369, 208, 2438, 2438, 208, 2333, 170, 167, 2373, 2374, 167, 2370, 219, 1278, 1923, 922, 922, 2332, 922, 1337, 922, 1337, 185, 1337, 1337, 1337, 2369, 2438, 2333, 1337, 1337, 1338, 1339, 2375, 233, 233, 2377, 2370, 219, 2376, 2369, 252, 269, 2378, 2381, 208, 288, 319, 2383, 2386, 341, 2370, 2389, 2397, 2438, 219, 2369, 208, 1337, 1967, 922, 922, 233, 922, 1344, 922, 1344, 2380, 1344, 1344, 1344, 2369, 2438, 2438, 1344, 1344, 1345, 1346, 166, 166, 252, 2368, 2370, 166, 166, 170, 2368, 2391, 2396, 185, 208, 233, 208, 219, 251, 269, 2393, 2399, 2400, 284, 2433, 2369, 2438, 1344, 1968, 1023, 922, 2369, 922, 1379, 1023, 1379, 2385, 1379, 1379, 1379, 2369, 2368, 2388, 1379, 1379, 1380, 1381, 166, 166, 288, 2368, 2370, 166, 2395, 167, 319, 2369, 2369, 219, 2369, 233, 2438, 2438, 318, 341, 2419, 167, 2370, 2370, 167, 2370, 2401, 1379, 1990, 1023, 922, 252, 922, 1387, 1023, 1387, 170, 1387, 1387, 1387, 2403, 2438, 208, 1387, 1387, 1388, 1389, 252, 166, 166, 269, 2395, 2402, 166, 269, 2404, 288, 288, 319, 341, 319, 2406, 2438, 2405, 251, 2408, 2407, 2409, 2411, 2438, 2438, 341, 1387, 1991, 922, 922, 2410, 922, 1412, 922, 1412, 170, 1412, 1412, 1412, 166, 2412, 2395, 1412, 1412, 1413, 1414, 166, 166, 170, 2395, 185, 166, 2395, 2432, 284, 208, 2415, 2413, 2415, 2438, 2418, 233, 318, 2438, 2414, 167, 167, 2416, 2438, 2416, 2438, 1412, 2004, 922, 922, 2420, 922, 1419, 922, 1419, 185, 1419, 1419, 1419, 2415, 219, 2415, 1419, 1419, 1420, 1421, 269, 288, 2438, 2415, 2416, 2415, 2422, 2415, 319, 341, 2438, 2415, 2423, 2424, 2416, 233, 2425, 2415, 2427, 252, 2426, 2428, 2416, 2430, 170, 1419, 2005, 269, 2416, 288, 2438, 319, 2415, 2415, 2431, 341, 2429, 2430, 2430, 2430, 166, 170, 2432, 2416, 2416, 185, 167, 2430, 2431, 2434, 2431, 166, 166, 2430, 2432, 284, 166, 2430, 2431, 2438, 208, 233, 252, 2438, 2435, 2430, 219, 251, 2436, 166, 166, 269, 2432, 2430, 166, 2430, 2431, 288, 2437, 2432, 2438, 319, 2430, 2438, 2431, 318, 2431, 2438, 167, 341, 2438, 167, 167, 2431, 2438, 166, 166, 170, 2437, 166, 166, 2437, 166, 166, 2437, 2437, 2438, 166, 2438, 2438, 208, 251, 2438, 2438, 284, 2438, 2438, 167, 318, 28, 28, 28, 28, 28, 28, 28, 66, 66, 66, 66, 66, 66, 66, 79, 79, 79, 79, 79, 79, 79, 95, 95, 95, 95, 95, 95, 95, 107, 107, 107, 107, 107, 107, 107, 151, 151, 151, 151, 151, 151, 151, 164, 164, 2438, 164, 164, 164, 164, 166, 166, 2438, 166, 166, 166, 166, 183, 183, 2438, 183, 183, 183, 183, 185, 185, 2438, 185, 185, 185, 185, 186, 186, 2438, 186, 186, 186, 186, 203, 203, 2438, 203, 2438, 203, 205, 2438, 205, 233, 233, 2438, 233, 233, 233, 233, 246, 246, 246, 246, 247, 247, 247, 247, 249, 249, 2438, 249, 249, 249, 249, 252, 252, 2438, 252, 252, 252, 252, 253, 253, 2438, 253, 253, 253, 253, 269, 269, 2438, 269, 269, 269, 269, 280, 2438, 2438, 280, 280, 280, 280, 281, 281, 2438, 281, 281, 281, 281, 282, 2438, 2438, 282, 282, 282, 282, 283, 283, 2438, 283, 283, 283, 283, 286, 286, 2438, 286, 286, 286, 286, 288, 288, 2438, 288, 288, 288, 288, 289, 289, 2438, 289, 289, 289, 289, 310, 310, 310, 310, 311, 311, 311, 311, 316, 316, 2438, 316, 316, 316, 316, 319, 319, 2438, 319, 319, 319, 319, 320, 320, 2438, 320, 320, 320, 320, 339, 339, 340, 340, 341, 341, 2438, 341, 341, 341, 341, 342, 342, 2438, 342, 342, 342, 342, 164, 164, 2438, 164, 164, 164, 164, 186, 186, 2438, 186, 186, 186, 186, 365, 365, 2438, 365, 365, 365, 365, 183, 183, 2438, 183, 183, 183, 183, 185, 185, 2438, 185, 185, 185, 185, 370, 370, 2438, 370, 370, 370, 370, 373, 373, 2438, 373, 373, 373, 373, 203, 203, 2438, 203, 2438, 203, 205, 2438, 205, 233, 233, 2438, 233, 233, 233, 233, 246, 246, 246, 246, 247, 247, 247, 247, 249, 249, 2438, 249, 249, 249, 249, 425, 425, 2438, 425, 425, 425, 425, 252, 252, 2438, 252, 252, 252, 252, 253, 253, 2438, 253, 253, 253, 253, 430, 430, 2438, 430, 430, 430, 430, 433, 433, 2438, 433, 433, 433, 433, 269, 269, 2438, 269, 269, 269, 269, 280, 2438, 2438, 280, 280, 280, 280, 281, 281, 2438, 281, 281, 281, 281, 282, 2438, 2438, 282, 282, 282, 282, 283, 283, 2438, 283, 283, 283, 283, 465, 465, 2438, 465, 465, 465, 465, 286, 286, 2438, 286, 286, 286, 286, 288, 288, 2438, 288, 288, 288, 288, 289, 289, 2438, 289, 289, 289, 289, 470, 470, 2438, 470, 470, 470, 470, 473, 473, 2438, 473, 473, 473, 473, 310, 310, 310, 310, 311, 311, 311, 311, 316, 316, 2438, 316, 316, 316, 316, 496, 496, 2438, 496, 496, 496, 496, 319, 319, 2438, 319, 319, 319, 319, 320, 320, 2438, 320, 320, 320, 320, 501, 501, 2438, 501, 501, 501, 501, 504, 504, 2438, 504, 504, 504, 504, 339, 339, 340, 340, 341, 341, 2438, 341, 341, 341, 341, 342, 342, 2438, 342, 342, 342, 342, 365, 365, 2438, 365, 365, 365, 365, 551, 551, 2438, 551, 551, 551, 551, 183, 183, 2438, 183, 183, 183, 183, 186, 186, 2438, 186, 186, 186, 186, 370, 370, 2438, 370, 370, 370, 370, 373, 373, 2438, 373, 373, 373, 373, 557, 557, 2438, 557, 557, 557, 557, 568, 568, 2438, 568, 568, 568, 568, 185, 185, 2438, 185, 185, 185, 185, 233, 233, 2438, 233, 233, 233, 233, 425, 425, 2438, 425, 425, 425, 425, 614, 614, 2438, 614, 614, 614, 614, 249, 249, 2438, 249, 249, 249, 249, 253, 253, 2438, 253, 253, 253, 253, 430, 430, 2438, 430, 430, 430, 430, 433, 433, 2438, 433, 433, 433, 433, 619, 619, 2438, 619, 619, 619, 619, 630, 630, 2438, 630, 630, 630, 630, 252, 252, 2438, 252, 252, 252, 252, 269, 269, 2438, 269, 269, 269, 269, 283, 283, 2438, 283, 283, 283, 283, 465, 465, 2438, 465, 465, 465, 465, 654, 654, 2438, 654, 654, 654, 654, 286, 286, 2438, 286, 286, 286, 286, 289, 289, 2438, 289, 289, 289, 289, 470, 470, 2438, 470, 470, 470, 470, 473, 473, 2438, 473, 473, 473, 473, 660, 660, 2438, 660, 660, 660, 660, 671, 671, 2438, 671, 671, 671, 671, 288, 288, 2438, 288, 288, 288, 288, 311, 311, 311, 311, 496, 496, 2438, 496, 496, 496, 496, 685, 685, 2438, 685, 685, 685, 685, 316, 316, 2438, 316, 316, 316, 316, 320, 320, 2438, 320, 320, 320, 320, 501, 501, 2438, 501, 501, 501, 501, 504, 504, 2438, 504, 504, 504, 504, 690, 690, 2438, 690, 690, 690, 690, 701, 701, 2438, 701, 701, 701, 701, 319, 319, 2438, 319, 319, 319, 319, 341, 341, 2438, 341, 341, 341, 341, 166, 166, 2438, 166, 166, 166, 166, 170, 170, 2438, 170, 170, 170, 170, 365, 365, 2438, 365, 365, 365, 365, 551, 551, 2438, 551, 551, 551, 551, 738, 738, 2438, 738, 738, 738, 738, 739, 739, 2438, 739, 739, 739, 739, 373, 373, 2438, 373, 373, 373, 373, 557, 557, 2438, 557, 557, 557, 557, 568, 568, 2438, 568, 568, 568, 568, 185, 185, 2438, 185, 185, 185, 185, 233, 233, 2438, 233, 233, 233, 233, 425, 425, 2438, 425, 425, 425, 425, 614, 614, 2438, 614, 614, 614, 614, 797, 797, 2438, 797, 797, 797, 797, 433, 433, 2438, 433, 433, 433, 433, 619, 619, 2438, 619, 619, 619, 619, 249, 249, 2438, 249, 249, 249, 249, 630, 630, 2438, 630, 630, 630, 630, 252, 252, 2438, 252, 252, 252, 252, 269, 269, 2438, 269, 269, 269, 269, 465, 465, 2438, 465, 465, 465, 465, 654, 654, 2438, 654, 654, 654, 654, 833, 833, 2438, 833, 833, 833, 833, 834, 834, 2438, 834, 834, 834, 834, 473, 473, 2438, 473, 473, 473, 473, 660, 660, 2438, 660, 660, 660, 660, 283, 283, 2438, 283, 283, 283, 283, 671, 671, 2438, 671, 671, 671, 671, 288, 288, 2438, 288, 288, 288, 288, 311, 311, 311, 311, 496, 496, 2438, 496, 496, 496, 496, 685, 685, 2438, 685, 685, 685, 685, 859, 859, 2438, 859, 859, 859, 859, 504, 504, 2438, 504, 504, 504, 504, 690, 690, 2438, 690, 690, 690, 690, 316, 316, 2438, 316, 316, 316, 316, 701, 701, 2438, 701, 701, 701, 701, 319, 319, 2438, 319, 319, 319, 319, 341, 341, 2438, 341, 341, 341, 341, 170, 170, 2438, 170, 170, 170, 170, 906, 906, 2438, 906, 906, 906, 906, 738, 738, 2438, 738, 738, 738, 738, 739, 739, 2438, 739, 739, 739, 739, 909, 909, 2438, 909, 909, 909, 909, 922, 922, 2438, 922, 922, 922, 922, 185, 185, 2438, 185, 185, 185, 185, 233, 233, 2438, 233, 233, 233, 233, 968, 968, 2438, 968, 968, 968, 968, 797, 797, 2438, 797, 797, 797, 797, 970, 970, 2438, 970, 970, 970, 970, 249, 249, 2438, 249, 249, 249, 249, 983, 983, 2438, 983, 983, 983, 983, 1007, 1007, 2438, 1007, 1007, 1007, 1007, 1010, 1010, 2438, 1010, 1010, 1010, 1010, 1023, 1023, 2438, 1023, 1023, 1023, 1023, 1036, 1036, 2438, 1036, 1036, 1036, 1036, 1038, 1038, 2438, 1038, 1038, 1038, 1038, 1051, 1051, 2438, 1051, 1051, 1051, 1051, 1088, 1088, 2438, 1088, 1088, 1088, 1088, 1090, 1090, 2438, 1090, 1090, 1090, 1090, 1151, 1151, 2438, 1151, 1151, 1151, 1151, 1190, 1190, 2438, 1190, 1190, 1190, 1190, 1192, 1192, 2438, 1192, 1192, 1192, 1192, 1220, 1220, 2438, 1220, 1220, 1220, 1220, 1270, 1270, 2438, 1270, 1270, 1270, 1270, 1275, 1275, 2438, 1275, 1275, 1275, 1275, 1278, 1278, 2438, 1278, 1278, 1278, 1278, 1337, 1337, 2438, 1337, 1337, 1337, 1337, 1341, 1341, 2438, 1341, 1341, 1341, 1341, 1344, 1344, 2438, 1344, 1344, 1344, 1344, 1379, 1379, 2438, 1379, 1379, 1379, 1379, 1384, 1384, 2438, 1384, 1384, 1384, 1384, 1387, 1387, 2438, 1387, 1387, 1387, 1387, 1412, 1412, 2438, 1412, 1412, 1412, 1412, 1416, 1416, 2438, 1416, 1416, 1416, 1416, 1419, 1419, 2438, 1419, 1419, 1419, 1419, 1466, 1466, 2438, 1466, 1466, 1466, 1466, 1472, 1472, 2438, 1472, 1472, 1472, 1472, 1481, 1481, 2438, 1481, 1481, 1481, 1481, 1528, 1528, 2438, 1528, 1528, 1528, 1528, 1533, 1533, 2438, 1533, 1533, 1533, 1533, 1542, 1542, 2438, 1542, 1542, 1542, 1542, 1565, 1565, 2438, 1565, 1565, 1565, 1565, 1571, 1571, 2438, 1571, 1571, 1571, 1571, 1580, 1580, 2438, 1580, 1580, 1580, 1580, 1593, 1593, 2438, 1593, 1593, 1593, 1593, 1598, 1598, 2438, 1598, 1598, 1598, 1598, 1607, 1607, 2438, 1607, 1607, 1607, 1607, 1640, 1640, 2438, 1640, 1640, 1640, 1640, 1641, 1641, 2438, 1641, 1641, 1641, 1641, 1695, 1695, 2438, 1695, 1695, 1695, 1695, 1726, 1726, 2438, 1726, 1726, 1726, 1726, 1727, 1727, 2438, 1727, 1727, 1727, 1727, 1746, 1746, 2438, 1746, 1746, 1746, 1746, 1788, 1788, 2438, 1788, 1788, 1788, 1788, 1791, 1791, 2438, 1791, 1791, 1791, 1791, 922, 922, 2438, 922, 922, 922, 922, 1840, 1840, 2438, 1840, 1840, 1840, 1840, 1842, 1842, 2438, 1842, 1842, 1842, 1842, 983, 983, 2438, 983, 983, 983, 983, 1867, 1867, 2438, 1867, 1867, 1867, 1867, 1870, 1870, 2438, 1870, 1870, 1870, 1870, 1023, 1023, 2438, 1023, 1023, 1023, 1023, 1885, 1885, 2438, 1885, 1885, 1885, 1885, 1887, 1887, 2438, 1887, 1887, 1887, 1887, 1051, 1051, 2438, 1051, 1051, 1051, 1051, 1088, 1088, 2438, 1088, 1088, 1088, 1088, 1090, 1090, 2438, 1090, 1090, 1090, 1090, 1151, 1151, 2438, 1151, 1151, 1151, 1151, 1190, 1190, 2438, 1190, 1190, 1190, 1190, 1192, 1192, 2438, 1192, 1192, 1192, 1192, 1220, 1220, 2438, 1220, 1220, 1220, 1220, 1270, 1270, 2438, 1270, 1270, 1270, 1270, 1278, 1278, 2438, 1278, 1278, 1278, 1278, 1337, 1337, 2438, 1337, 1337, 1337, 1337, 1344, 1344, 2438, 1344, 1344, 1344, 1344, 1379, 1379, 2438, 1379, 1379, 1379, 1379, 1387, 1387, 2438, 1387, 1387, 1387, 1387, 1412, 1412, 2438, 1412, 1412, 1412, 1412, 1419, 1419, 2438, 1419, 1419, 1419, 1419, 23, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438 } ; static yyconst flex_int16_t yy_chk[11520] = { 0, 1, 1, 1, 1, 1, 1, 1, 2498, 1, 1, 1, 15, 2488, 15, 1, 1, 1, 1, 16, 25, 16, 25, 31, 35, 15, 38, 42, 69, 31, 35, 39, 16, 39, 43, 169, 43, 38, 44, 69, 44, 169, 2479, 42, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 40, 3, 3, 3, 41, 71, 41, 3, 3, 3, 3, 34, 34, 40, 34, 41, 34, 61, 71, 73, 62, 40, 45, 45, 45, 61, 71, 34, 34, 62, 198, 198, 45, 45, 45, 73, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 199, 7, 7, 7, 70, 199, 70, 7, 7, 7, 7, 47, 47, 47, 131, 47, 50, 50, 50, 380, 50, 51, 51, 51, 72, 74, 72, 74, 75, 131, 75, 51, 51, 51, 380, 72, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 2460, 9, 9, 9, 76, 76, 76, 9, 9, 9, 9, 80, 80, 80, 81, 81, 88, 81, 89, 81, 89, 91, 98, 91, 81, 178, 93, 88, 93, 94, 81, 94, 91, 98, 178, 2453, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 90, 11, 11, 11, 99, 2446, 99, 11, 11, 11, 11, 82, 82, 90, 82, 92, 82, 84, 84, 130, 84, 90, 84, 103, 101, 103, 101, 82, 104, 2374, 104, 92, 130, 84, 84, 101, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 200, 13, 13, 13, 106, 200, 106, 13, 13, 13, 13, 85, 85, 100, 85, 102, 85, 86, 86, 116, 86, 85, 86, 117, 132, 117, 100, 85, 132, 172, 116, 102, 2364, 86, 100, 172, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 242, 21, 21, 21, 108, 242, 108, 21, 21, 21, 21, 109, 110, 109, 110, 113, 114, 113, 114, 108, 109, 119, 193, 119, 113, 194, 109, 110, 194, 193, 113, 114, 119, 121, 2361, 121, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 30, 30, 2357, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 33, 33, 140, 33, 33, 33, 33, 118, 33, 33, 33, 120, 143, 140, 33, 33, 33, 33, 112, 112, 118, 112, 122, 112, 122, 143, 144, 120, 118, 123, 124, 123, 124, 143, 112, 112, 141, 144, 141, 125, 2353, 125, 123, 33, 33, 37, 37, 146, 37, 37, 37, 37, 125, 37, 37, 37, 126, 236, 126, 37, 37, 37, 37, 146, 236, 126, 37, 133, 133, 147, 133, 126, 133, 142, 145, 142, 145, 133, 148, 149, 148, 149, 147, 133, 150, 145, 150, 2350, 37, 37, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 53, 53, 2346, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 57, 57, 2336, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 67, 67, 156, 67, 67, 67, 67, 391, 67, 67, 67, 391, 160, 156, 67, 67, 67, 67, 134, 134, 157, 134, 157, 134, 136, 136, 158, 136, 160, 136, 161, 159, 161, 159, 134, 162, 163, 162, 163, 158, 136, 136, 159, 67, 67, 68, 68, 158, 68, 68, 68, 68, 243, 68, 68, 68, 192, 243, 192, 68, 68, 68, 68, 215, 137, 137, 68, 137, 177, 137, 138, 138, 215, 138, 137, 138, 177, 195, 197, 195, 137, 197, 171, 171, 385, 171, 138, 171, 68, 68, 79, 235, 79, 235, 79, 79, 79, 385, 171, 171, 79, 79, 79, 79, 182, 182, 196, 182, 214, 182, 186, 186, 227, 186, 196, 186, 214, 2287, 196, 237, 182, 182, 237, 238, 227, 238, 186, 186, 266, 79, 79, 83, 83, 266, 83, 83, 83, 83, 315, 83, 83, 83, 241, 241, 315, 83, 83, 83, 83, 187, 187, 239, 187, 2283, 187, 188, 188, 267, 188, 239, 188, 240, 267, 239, 240, 187, 187, 244, 244, 244, 261, 188, 188, 261, 83, 83, 87, 87, 278, 87, 87, 87, 87, 278, 87, 87, 87, 248, 248, 248, 87, 87, 87, 87, 747, 189, 189, 87, 189, 259, 189, 259, 260, 201, 201, 201, 203, 203, 203, 260, 747, 189, 189, 201, 201, 201, 203, 203, 203, 87, 87, 96, 96, 279, 96, 96, 96, 96, 279, 96, 96, 96, 262, 2279, 262, 96, 96, 96, 96, 205, 205, 205, 263, 205, 206, 206, 206, 271, 206, 271, 263, 272, 249, 249, 263, 249, 264, 249, 272, 264, 265, 265, 277, 277, 96, 96, 97, 97, 249, 97, 97, 97, 97, 302, 97, 97, 97, 274, 302, 274, 97, 97, 97, 97, 303, 250, 250, 97, 250, 303, 250, 251, 251, 2275, 251, 273, 251, 281, 273, 281, 275, 250, 250, 276, 301, 301, 276, 251, 275, 97, 97, 107, 275, 334, 334, 107, 107, 107, 336, 107, 107, 107, 283, 336, 283, 107, 107, 107, 107, 253, 253, 295, 253, 295, 253, 254, 254, 283, 254, 314, 254, 297, 296, 2271, 297, 253, 253, 314, 284, 296, 284, 254, 254, 337, 107, 107, 111, 111, 337, 111, 111, 111, 111, 284, 111, 111, 111, 286, 2267, 286, 111, 111, 111, 111, 255, 255, 298, 255, 298, 255, 256, 256, 286, 256, 300, 256, 299, 300, 407, 329, 255, 255, 329, 287, 299, 287, 256, 256, 299, 111, 111, 115, 115, 407, 115, 115, 115, 115, 287, 115, 115, 115, 305, 338, 305, 115, 115, 115, 115, 338, 285, 285, 115, 285, 584, 285, 289, 289, 304, 289, 304, 289, 306, 326, 306, 326, 285, 285, 308, 584, 308, 304, 289, 289, 115, 115, 128, 308, 128, 2258, 128, 128, 128, 308, 350, 350, 128, 128, 128, 128, 290, 290, 307, 290, 307, 290, 291, 291, 330, 291, 330, 291, 344, 327, 344, 307, 290, 290, 2257, 309, 327, 309, 291, 291, 353, 128, 128, 129, 335, 129, 351, 129, 129, 129, 309, 351, 335, 129, 129, 129, 129, 390, 129, 292, 292, 332, 292, 390, 292, 316, 316, 353, 316, 332, 316, 333, 345, 332, 333, 292, 292, 346, 410, 345, 346, 316, 129, 129, 135, 135, 352, 135, 135, 135, 135, 352, 135, 135, 135, 347, 410, 347, 135, 135, 135, 135, 317, 317, 348, 317, 910, 317, 318, 318, 363, 318, 348, 318, 349, 363, 348, 349, 317, 317, 356, 910, 356, 358, 318, 368, 358, 135, 135, 139, 139, 364, 139, 139, 139, 139, 364, 139, 139, 139, 357, 362, 362, 139, 139, 139, 139, 357, 320, 320, 139, 320, 368, 320, 321, 321, 359, 321, 359, 321, 361, 376, 377, 361, 320, 320, 377, 406, 376, 377, 321, 321, 139, 139, 153, 153, 384, 153, 153, 153, 153, 384, 153, 153, 153, 394, 406, 394, 153, 153, 153, 153, 322, 322, 360, 322, 379, 322, 323, 323, 389, 323, 360, 323, 379, 2194, 360, 386, 322, 322, 387, 379, 389, 378, 323, 323, 386, 153, 153, 154, 154, 387, 154, 154, 154, 154, 378, 154, 378, 154, 397, 388, 397, 154, 154, 154, 154, 365, 365, 388, 365, 2188, 365, 366, 366, 392, 366, 396, 366, 395, 396, 404, 392, 365, 365, 399, 395, 404, 399, 366, 366, 401, 154, 154, 155, 155, 401, 155, 155, 155, 155, 2182, 155, 155, 155, 400, 400, 402, 155, 155, 155, 155, 402, 367, 367, 155, 367, 408, 367, 370, 370, 411, 370, 416, 370, 405, 405, 563, 416, 367, 367, 409, 398, 411, 408, 370, 370, 155, 155, 170, 398, 170, 170, 413, 398, 409, 563, 412, 170, 412, 371, 371, 170, 371, 170, 371, 413, 170, 417, 170, 170, 418, 421, 170, 419, 423, 371, 371, 2174, 423, 418, 417, 170, 170, 421, 419, 170, 170, 185, 185, 446, 185, 185, 185, 185, 422, 185, 185, 185, 446, 420, 422, 185, 185, 185, 185, 372, 372, 420, 372, 448, 372, 373, 373, 424, 373, 447, 373, 448, 444, 450, 424, 372, 372, 444, 445, 450, 447, 373, 373, 455, 185, 185, 190, 449, 455, 456, 190, 445, 190, 190, 452, 374, 374, 190, 374, 449, 374, 452, 456, 461, 2166, 440, 440, 190, 440, 461, 440, 374, 374, 190, 191, 191, 457, 191, 191, 191, 191, 440, 191, 191, 191, 457, 523, 523, 191, 191, 191, 191, 375, 375, 451, 375, 440, 375, 451, 425, 425, 458, 425, 191, 425, 459, 462, 463, 375, 375, 462, 2160, 458, 459, 463, 425, 425, 191, 191, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 208, 208, 208, 208, 476, 460, 476, 582, 582, 208, 485, 426, 426, 208, 426, 208, 426, 460, 208, 476, 208, 208, 486, 485, 208, 484, 476, 426, 426, 489, 484, 486, 491, 208, 208, 2151, 491, 208, 208, 210, 210, 489, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 219, 219, 2139, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 233, 233, 515, 233, 233, 233, 233, 515, 233, 233, 233, 477, 761, 477, 233, 233, 233, 233, 427, 427, 487, 427, 761, 427, 428, 428, 477, 428, 488, 428, 477, 487, 490, 477, 427, 427, 488, 529, 490, 520, 428, 516, 529, 233, 233, 234, 234, 520, 234, 234, 234, 234, 516, 234, 234, 234, 517, 2135, 492, 234, 234, 234, 234, 430, 430, 492, 430, 428, 430, 517, 431, 431, 518, 431, 234, 431, 464, 522, 464, 430, 430, 518, 468, 522, 468, 530, 431, 431, 234, 234, 247, 464, 247, 535, 247, 247, 247, 468, 530, 535, 247, 247, 247, 247, 432, 432, 519, 432, 524, 432, 433, 433, 524, 433, 533, 433, 521, 519, 464, 2132, 432, 432, 533, 478, 468, 478, 433, 433, 521, 247, 247, 252, 252, 531, 252, 252, 252, 252, 478, 252, 252, 252, 531, 583, 2123, 252, 252, 252, 252, 434, 434, 478, 434, 478, 434, 435, 435, 525, 435, 532, 435, 534, 583, 541, 525, 434, 434, 479, 541, 479, 532, 435, 435, 534, 252, 252, 257, 257, 480, 257, 480, 257, 479, 544, 436, 436, 561, 436, 561, 436, 479, 536, 257, 480, 544, 536, 257, 479, 257, 257, 436, 465, 465, 257, 465, 548, 465, 436, 480, 548, 2049, 511, 511, 257, 511, 537, 511, 465, 465, 257, 258, 258, 537, 258, 258, 258, 258, 511, 258, 258, 258, 542, 1950, 538, 258, 258, 258, 258, 466, 466, 538, 466, 511, 466, 542, 467, 467, 543, 467, 258, 467, 545, 547, 592, 466, 466, 543, 592, 547, 545, 546, 467, 467, 258, 258, 269, 269, 560, 269, 269, 269, 269, 546, 269, 269, 269, 560, 1925, 549, 269, 269, 269, 269, 470, 470, 549, 470, 562, 470, 471, 471, 564, 471, 566, 471, 562, 567, 564, 566, 470, 470, 572, 567, 573, 585, 471, 471, 572, 269, 269, 270, 270, 573, 270, 270, 270, 270, 578, 270, 270, 270, 585, 578, 571, 270, 270, 270, 270, 472, 472, 571, 472, 574, 472, 576, 473, 473, 579, 473, 270, 473, 574, 575, 576, 472, 472, 579, 593, 577, 575, 919, 473, 473, 270, 270, 282, 577, 587, 593, 282, 282, 282, 581, 282, 282, 282, 919, 586, 581, 282, 282, 282, 282, 474, 474, 587, 474, 565, 474, 475, 475, 586, 475, 565, 475, 588, 589, 565, 589, 474, 474, 594, 565, 594, 590, 475, 475, 588, 282, 282, 288, 288, 1918, 288, 288, 288, 288, 590, 288, 288, 288, 600, 600, 595, 288, 288, 288, 288, 496, 496, 599, 496, 606, 496, 497, 497, 595, 497, 596, 497, 1097, 606, 599, 596, 496, 496, 597, 598, 601, 597, 497, 497, 604, 288, 288, 293, 1097, 293, 605, 604, 598, 601, 498, 498, 605, 498, 607, 498, 499, 499, 293, 499, 1913, 499, 293, 607, 293, 293, 498, 498, 608, 293, 610, 609, 499, 612, 635, 608, 611, 633, 610, 293, 609, 611, 612, 635, 633, 293, 294, 294, 636, 294, 294, 294, 294, 912, 294, 294, 294, 636, 639, 499, 294, 294, 294, 294, 501, 501, 639, 501, 912, 501, 637, 502, 502, 634, 502, 294, 502, 637, 644, 634, 501, 501, 705, 638, 1290, 644, 705, 502, 502, 294, 294, 311, 638, 311, 640, 311, 311, 311, 641, 640, 1290, 311, 311, 311, 311, 503, 503, 641, 503, 645, 503, 504, 504, 675, 504, 645, 504, 646, 648, 675, 647, 503, 503, 1327, 649, 648, 646, 504, 504, 647, 311, 311, 312, 649, 312, 706, 312, 312, 312, 1327, 650, 706, 312, 312, 312, 312, 505, 505, 650, 505, 651, 505, 652, 506, 506, 651, 506, 312, 506, 674, 680, 652, 505, 505, 1912, 667, 674, 667, 680, 506, 506, 312, 312, 319, 319, 676, 319, 319, 319, 319, 667, 319, 319, 319, 676, 711, 667, 319, 319, 319, 319, 507, 507, 711, 507, 664, 507, 664, 678, 628, 628, 681, 628, 1908, 628, 678, 681, 507, 551, 551, 664, 551, 664, 551, 507, 628, 319, 319, 324, 324, 628, 324, 717, 324, 551, 551, 552, 552, 717, 552, 677, 552, 553, 553, 324, 553, 1903, 553, 324, 677, 324, 324, 552, 552, 669, 324, 669, 712, 553, 553, 704, 679, 712, 626, 626, 324, 626, 704, 626, 669, 679, 324, 325, 325, 669, 325, 325, 325, 325, 626, 325, 325, 325, 682, 1902, 626, 325, 325, 325, 325, 557, 557, 682, 557, 666, 557, 666, 558, 558, 707, 558, 325, 558, 708, 709, 742, 557, 557, 707, 666, 710, 709, 708, 558, 558, 325, 325, 341, 341, 710, 341, 341, 341, 341, 742, 341, 341, 341, 666, 722, 713, 341, 341, 341, 341, 559, 559, 722, 559, 713, 559, 614, 614, 716, 614, 718, 614, 719, 720, 764, 716, 559, 559, 764, 718, 720, 719, 614, 614, 723, 341, 341, 342, 342, 723, 342, 342, 342, 342, 663, 342, 663, 342, 670, 734, 670, 342, 342, 342, 342, 615, 615, 734, 615, 663, 615, 616, 616, 670, 616, 721, 616, 724, 663, 670, 725, 615, 615, 1897, 721, 730, 724, 616, 616, 725, 342, 342, 343, 343, 730, 343, 343, 343, 343, 735, 343, 343, 343, 749, 735, 728, 343, 343, 343, 343, 619, 619, 728, 619, 731, 619, 749, 620, 620, 729, 620, 343, 620, 731, 732, 729, 619, 619, 741, 733, 665, 732, 665, 620, 620, 343, 343, 354, 733, 741, 755, 354, 755, 354, 354, 665, 621, 621, 354, 621, 754, 621, 736, 665, 622, 622, 754, 622, 354, 622, 743, 736, 621, 621, 354, 355, 1475, 355, 355, 744, 622, 743, 623, 623, 355, 623, 744, 623, 355, 622, 355, 758, 1475, 355, 746, 355, 355, 750, 623, 355, 623, 746, 758, 355, 750, 745, 780, 745, 355, 355, 780, 757, 355, 355, 369, 369, 745, 369, 757, 369, 624, 624, 765, 624, 756, 624, 668, 756, 668, 1891, 369, 369, 748, 765, 625, 625, 624, 625, 748, 625, 759, 668, 748, 760, 624, 777, 762, 668, 759, 762, 625, 668, 760, 766, 777, 766, 668, 369, 381, 381, 1890, 381, 381, 381, 381, 767, 381, 381, 381, 625, 772, 772, 381, 381, 381, 381, 629, 629, 767, 629, 768, 629, 770, 654, 654, 768, 654, 769, 654, 775, 769, 783, 629, 771, 783, 770, 775, 773, 629, 654, 654, 381, 381, 382, 382, 771, 382, 382, 382, 382, 773, 382, 382, 382, 781, 781, 778, 382, 382, 382, 382, 382, 655, 655, 776, 655, 778, 655, 656, 656, 782, 656, 782, 656, 788, 787, 788, 776, 655, 655, 784, 787, 935, 935, 656, 656, 382, 382, 383, 383, 784, 383, 383, 383, 383, 810, 383, 383, 383, 791, 810, 790, 383, 383, 383, 383, 660, 660, 790, 660, 791, 660, 383, 661, 661, 793, 661, 789, 661, 792, 789, 1880, 660, 660, 793, 794, 811, 792, 811, 661, 661, 383, 383, 393, 393, 794, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 403, 403, 1874, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 414, 414, 926, 414, 414, 414, 414, 813, 414, 414, 414, 813, 926, 812, 414, 414, 414, 414, 414, 662, 662, 812, 662, 824, 662, 685, 685, 824, 685, 795, 685, 816, 795, 814, 815, 662, 662, 1100, 814, 815, 816, 685, 685, 414, 414, 415, 415, 827, 415, 415, 415, 415, 817, 415, 415, 415, 827, 1100, 817, 415, 415, 415, 415, 686, 686, 818, 686, 911, 686, 415, 687, 687, 818, 687, 819, 687, 820, 823, 821, 686, 686, 820, 819, 821, 911, 823, 687, 687, 415, 415, 429, 429, 822, 429, 822, 429, 690, 690, 825, 690, 826, 690, 828, 825, 829, 826, 429, 429, 828, 1873, 830, 829, 690, 690, 691, 691, 831, 691, 830, 691, 848, 831, 848, 847, 692, 692, 854, 692, 847, 692, 691, 691, 854, 429, 437, 437, 836, 437, 836, 437, 692, 692, 850, 853, 693, 693, 850, 693, 849, 693, 437, 836, 853, 873, 437, 873, 849, 437, 438, 438, 693, 438, 836, 438, 1863, 694, 694, 894, 694, 693, 694, 851, 695, 695, 438, 695, 851, 695, 894, 855, 852, 694, 837, 694, 837, 852, 855, 438, 695, 438, 439, 439, 838, 439, 838, 439, 695, 837, 857, 696, 696, 1858, 696, 857, 696, 872, 439, 838, 699, 699, 872, 699, 856, 699, 439, 696, 837, 884, 838, 884, 856, 439, 441, 441, 699, 441, 441, 441, 441, 699, 441, 441, 441, 896, 696, 896, 441, 441, 441, 441, 697, 697, 839, 697, 839, 697, 874, 700, 700, 875, 700, 880, 700, 875, 874, 876, 697, 839, 880, 846, 876, 846, 697, 700, 839, 441, 441, 442, 442, 700, 442, 442, 442, 442, 846, 442, 442, 442, 940, 940, 878, 442, 442, 442, 442, 442, 877, 799, 799, 878, 799, 877, 799, 805, 805, 879, 805, 881, 805, 882, 885, 879, 883, 799, 882, 881, 2054, 883, 885, 805, 442, 442, 443, 443, 799, 443, 443, 443, 443, 886, 443, 443, 443, 886, 2054, 805, 443, 443, 443, 443, 841, 889, 841, 887, 800, 800, 443, 800, 887, 800, 889, 937, 888, 801, 801, 841, 801, 888, 801, 842, 800, 842, 841, 937, 946, 443, 443, 453, 453, 801, 453, 453, 453, 453, 842, 453, 453, 453, 946, 800, 801, 453, 453, 453, 453, 453, 802, 802, 891, 802, 842, 802, 845, 890, 845, 891, 893, 892, 932, 890, 932, 893, 802, 807, 807, 892, 807, 845, 807, 802, 453, 453, 454, 454, 845, 454, 454, 454, 454, 807, 454, 454, 454, 1857, 920, 901, 454, 454, 454, 454, 804, 804, 807, 804, 901, 804, 454, 895, 808, 808, 898, 808, 895, 808, 898, 920, 804, 809, 809, 840, 809, 840, 809, 804, 808, 454, 454, 469, 469, 1852, 469, 808, 469, 809, 840, 843, 840, 843, 844, 933, 844, 933, 902, 469, 469, 840, 861, 861, 902, 861, 843, 861, 899, 844, 900, 897, 843, 899, 903, 900, 843, 904, 861, 897, 927, 903, 844, 927, 1846, 904, 469, 481, 481, 861, 481, 481, 481, 481, 905, 481, 481, 481, 915, 905, 914, 481, 481, 481, 481, 914, 915, 916, 862, 862, 917, 862, 928, 862, 921, 916, 931, 928, 863, 863, 918, 863, 921, 863, 862, 931, 934, 918, 934, 917, 481, 481, 482, 482, 863, 482, 482, 482, 482, 941, 482, 482, 482, 862, 941, 863, 482, 482, 482, 482, 482, 864, 864, 929, 864, 944, 864, 867, 867, 944, 867, 929, 867, 871, 871, 924, 871, 864, 871, 942, 947, 942, 924, 867, 864, 482, 482, 483, 483, 871, 483, 483, 483, 483, 947, 483, 483, 483, 952, 867, 925, 483, 483, 483, 483, 866, 866, 925, 866, 930, 866, 483, 952, 936, 1845, 938, 930, 869, 869, 936, 869, 866, 869, 938, 870, 870, 939, 870, 866, 870, 483, 483, 493, 869, 493, 939, 493, 493, 493, 1789, 870, 945, 493, 493, 493, 493, 869, 870, 908, 908, 945, 908, 943, 908, 948, 943, 949, 948, 950, 951, 951, 957, 1295, 493, 908, 908, 949, 953, 957, 953, 950, 493, 493, 494, 1295, 494, 954, 494, 494, 494, 955, 954, 956, 494, 494, 494, 494, 958, 959, 955, 960, 956, 494, 960, 958, 961, 962, 1121, 959, 963, 961, 964, 985, 965, 962, 965, 963, 966, 1121, 966, 964, 985, 494, 494, 500, 500, 967, 500, 967, 500, 969, 969, 988, 969, 986, 969, 987, 988, 989, 1646, 500, 500, 1106, 986, 987, 989, 969, 969, 971, 971, 990, 971, 1106, 971, 972, 972, 990, 972, 994, 972, 974, 974, 994, 974, 971, 974, 991, 500, 508, 508, 972, 508, 1644, 508, 995, 991, 974, 996, 995, 971, 973, 973, 992, 973, 508, 973, 996, 972, 508, 992, 1136, 508, 509, 509, 998, 509, 973, 509, 975, 975, 1136, 975, 998, 975, 976, 976, 997, 976, 509, 976, 1001, 973, 999, 1002, 975, 997, 1001, 999, 1027, 975, 976, 509, 1002, 509, 510, 510, 1027, 510, 976, 510, 977, 977, 1636, 977, 1005, 977, 980, 980, 1005, 980, 510, 980, 978, 978, 1000, 978, 977, 978, 510, 1006, 1626, 1000, 980, 1006, 977, 510, 512, 512, 978, 512, 512, 512, 512, 1030, 512, 512, 512, 1003, 980, 1030, 512, 512, 512, 512, 1003, 979, 979, 978, 979, 1034, 979, 983, 983, 1034, 983, 1025, 983, 981, 981, 1029, 981, 979, 981, 1008, 1025, 1008, 1029, 983, 979, 512, 512, 513, 513, 981, 513, 513, 513, 513, 1008, 513, 513, 513, 1094, 1026, 1094, 513, 513, 513, 513, 513, 984, 984, 1026, 984, 981, 984, 1009, 1009, 1616, 1009, 1031, 1009, 1028, 1014, 1032, 1014, 984, 1028, 1011, 1031, 1011, 1032, 1009, 1009, 513, 513, 514, 514, 1014, 514, 514, 514, 514, 1011, 514, 514, 514, 1013, 1589, 1013, 514, 514, 514, 514, 982, 982, 1053, 982, 1011, 982, 514, 1012, 1013, 1012, 1035, 1053, 1056, 1067, 1035, 1561, 982, 1056, 1067, 1021, 1054, 1021, 1012, 1013, 982, 514, 514, 527, 527, 1054, 527, 527, 527, 527, 1021, 527, 527, 527, 1015, 1012, 1015, 527, 527, 527, 527, 527, 1016, 1023, 1016, 1023, 1018, 1055, 1018, 1015, 1058, 1021, 1057, 1168, 1015, 1055, 1058, 1016, 1023, 1057, 1020, 1018, 1020, 1060, 1168, 1016, 527, 527, 528, 528, 1060, 528, 528, 528, 528, 1020, 528, 528, 528, 1017, 1018, 1017, 528, 528, 528, 528, 1019, 1059, 1019, 1062, 1066, 1020, 528, 1062, 1017, 1024, 1059, 1024, 1066, 1063, 1551, 1019, 1017, 1063, 1042, 1042, 1064, 1042, 1019, 1042, 1024, 528, 528, 539, 539, 1064, 539, 539, 539, 539, 1042, 539, 539, 539, 1022, 1065, 1022, 539, 539, 539, 539, 539, 1037, 1037, 1065, 1037, 1068, 1037, 1069, 1022, 1107, 1070, 1073, 1068, 1069, 1071, 1073, 1022, 1037, 1037, 1070, 1074, 1071, 1107, 1075, 1074, 539, 539, 540, 540, 1079, 540, 540, 540, 540, 1079, 540, 540, 540, 1075, 1480, 1076, 540, 540, 540, 540, 1039, 1039, 1077, 1039, 1076, 1039, 540, 1040, 1040, 1081, 1040, 1077, 1040, 1078, 1139, 1081, 1039, 1041, 1041, 1105, 1041, 1078, 1041, 1040, 1139, 540, 540, 550, 550, 1080, 550, 1039, 550, 1041, 1043, 1043, 1080, 1043, 1082, 1043, 1040, 1085, 1083, 550, 550, 1085, 1105, 1082, 1041, 1083, 1043, 1479, 1095, 1051, 1051, 1043, 1051, 1086, 1051, 1095, 1101, 1086, 1046, 1046, 1102, 1046, 1096, 1046, 1101, 1051, 550, 554, 554, 1096, 554, 554, 554, 554, 1046, 554, 554, 554, 1108, 1102, 1108, 554, 554, 554, 554, 1044, 1044, 1117, 1044, 1103, 1044, 1047, 1047, 1046, 1047, 1103, 1047, 1113, 1110, 1113, 1117, 1044, 1477, 1049, 1049, 1110, 1049, 1047, 1049, 1044, 554, 554, 555, 555, 1047, 555, 555, 555, 555, 1049, 555, 555, 555, 1109, 1287, 1114, 555, 555, 555, 555, 1045, 1045, 1116, 1045, 1109, 1045, 1048, 1048, 1116, 1048, 1049, 1048, 1114, 1119, 1287, 1109, 1045, 1119, 1050, 1050, 1118, 1050, 1048, 1050, 1045, 555, 555, 556, 556, 1111, 556, 1125, 556, 1118, 1050, 1125, 1052, 1052, 1048, 1052, 1111, 1052, 1050, 556, 556, 1087, 1087, 1115, 1087, 1126, 1087, 1111, 1052, 1122, 1120, 1122, 1124, 1126, 1115, 1124, 1123, 1087, 1087, 1120, 1128, 1147, 1141, 1128, 1141, 1115, 556, 568, 568, 1123, 568, 568, 568, 568, 1129, 568, 568, 568, 1147, 1127, 1129, 568, 568, 568, 568, 1090, 1090, 1127, 1090, 1130, 1090, 1091, 1091, 1149, 1091, 1131, 1091, 1143, 1130, 1149, 1135, 1090, 1090, 1133, 1143, 1356, 1131, 1091, 1091, 1135, 568, 568, 569, 569, 1133, 569, 569, 569, 569, 1356, 569, 569, 569, 1142, 1131, 1138, 569, 569, 569, 569, 1092, 1092, 1133, 1092, 1142, 1092, 1093, 1093, 1138, 1093, 1137, 1093, 1134, 569, 1134, 1142, 1092, 1092, 1146, 1175, 1146, 1137, 1093, 1093, 1134, 569, 569, 570, 570, 1134, 570, 570, 570, 570, 1175, 570, 570, 570, 1140, 1137, 1167, 570, 570, 570, 570, 1112, 1144, 1112, 1167, 1169, 1112, 1140, 1148, 1169, 570, 1171, 1177, 1144, 1178, 1188, 1171, 1174, 1112, 1148, 1177, 1174, 1178, 1188, 1144, 1286, 570, 570, 580, 580, 1148, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, 591, 591, 1285, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, 602, 602, 1179, 602, 602, 602, 602, 1180, 602, 602, 602, 1180, 1283, 1179, 602, 602, 602, 602, 1145, 1209, 1145, 1150, 1150, 1145, 1150, 1173, 1150, 1173, 1170, 1182, 1209, 602, 1173, 1369, 1182, 1145, 1185, 1150, 1150, 1170, 1185, 1186, 1173, 602, 602, 603, 603, 1369, 603, 603, 603, 603, 1170, 603, 603, 603, 1186, 1208, 1172, 603, 603, 603, 603, 1151, 1151, 1208, 1151, 1326, 1151, 1172, 1152, 1152, 603, 1152, 1176, 1152, 1218, 1326, 1212, 1151, 1151, 1181, 1172, 1212, 1218, 1176, 1152, 1152, 603, 603, 613, 613, 1181, 613, 1216, 613, 1153, 1153, 1176, 1153, 1183, 1153, 1236, 1132, 1210, 1181, 613, 613, 1210, 1216, 1236, 1183, 1153, 1153, 1154, 1154, 1237, 1154, 1215, 1154, 1159, 1159, 1215, 1159, 1183, 1159, 1190, 1237, 1190, 1104, 1154, 1154, 1244, 613, 617, 617, 1159, 617, 617, 617, 617, 1190, 617, 617, 617, 1187, 1246, 1244, 617, 617, 617, 617, 1155, 1155, 1246, 1155, 1187, 1155, 1156, 1156, 1191, 1156, 1191, 1156, 1247, 1211, 1288, 1238, 1155, 1187, 1155, 1238, 1247, 1288, 1156, 1191, 1211, 617, 617, 618, 618, 1156, 618, 1248, 618, 1157, 1157, 1240, 1157, 1211, 1157, 1200, 1240, 1200, 1248, 618, 618, 1158, 1158, 1243, 1158, 1157, 1158, 1243, 1160, 1160, 1200, 1160, 1157, 1160, 1255, 1161, 1161, 1158, 1161, 1201, 1161, 1201, 1294, 1199, 1160, 1199, 618, 627, 627, 1255, 627, 1161, 627, 1158, 1201, 1294, 1163, 1163, 1199, 1163, 1184, 1163, 1184, 627, 1260, 1165, 1165, 1184, 1165, 627, 1165, 1161, 1163, 627, 1199, 1260, 1807, 1184, 627, 630, 630, 1165, 630, 630, 630, 630, 1249, 630, 630, 630, 1249, 1163, 1807, 630, 630, 630, 630, 1162, 1162, 1196, 1162, 1196, 1162, 1251, 1164, 1164, 1254, 1164, 1251, 1164, 1254, 1257, 1298, 1162, 1196, 1258, 1196, 1258, 1298, 1257, 1164, 1162, 630, 630, 631, 631, 1164, 631, 631, 631, 631, 1263, 631, 631, 631, 1197, 1263, 1197, 631, 631, 631, 631, 1301, 1301, 1166, 1166, 1202, 1166, 1202, 1166, 1197, 1206, 1213, 1206, 1259, 631, 1204, 1197, 1204, 1282, 1166, 1202, 1259, 1213, 1282, 1267, 1206, 631, 631, 632, 632, 1204, 632, 632, 632, 632, 1213, 632, 632, 632, 1267, 1202, 1273, 632, 632, 632, 632, 1166, 1189, 1189, 1204, 1189, 1217, 1189, 1192, 1192, 632, 1192, 1261, 1192, 1269, 1281, 1261, 1217, 1189, 1189, 1281, 1281, 1269, 1273, 1192, 1192, 632, 632, 642, 642, 1217, 642, 642, 642, 642, 1284, 642, 642, 642, 1198, 1308, 1198, 642, 642, 642, 642, 1193, 1193, 1308, 1193, 1284, 1193, 1194, 1194, 1198, 1194, 1266, 1194, 1316, 642, 1266, 1198, 1193, 1193, 1291, 1205, 1291, 1205, 1194, 1194, 1316, 642, 642, 643, 643, 1300, 643, 643, 643, 643, 1205, 643, 643, 643, 1300, 1297, 1205, 643, 643, 643, 643, 1195, 1195, 1293, 1195, 1360, 1195, 1203, 1297, 1203, 643, 1299, 1239, 1299, 1293, 1360, 1293, 1195, 1195, 1207, 1306, 1207, 1203, 1239, 1306, 1307, 643, 643, 653, 653, 1203, 653, 1307, 653, 1207, 1214, 1239, 1214, 1219, 1219, 1099, 1219, 1214, 1219, 653, 653, 1220, 1220, 1302, 1220, 1302, 1220, 1214, 1296, 1219, 1219, 1317, 1305, 1098, 1241, 1305, 1207, 1220, 1220, 1296, 1317, 1296, 1242, 1245, 1242, 1241, 653, 657, 657, 1242, 657, 657, 657, 657, 1245, 657, 657, 657, 1241, 1242, 1304, 657, 657, 657, 657, 1221, 1221, 1245, 1221, 1314, 1221, 1222, 1222, 1304, 1222, 1250, 1222, 1310, 1310, 1320, 1314, 1221, 1221, 1323, 1320, 1323, 1250, 1222, 1222, 1089, 657, 657, 658, 658, 1252, 658, 658, 658, 658, 1250, 658, 658, 658, 1334, 1334, 1252, 658, 658, 658, 658, 1223, 1223, 1303, 1223, 1313, 1223, 1224, 1224, 1252, 1224, 1357, 1224, 1313, 1303, 1357, 1303, 1223, 1223, 1225, 1225, 1318, 1225, 1224, 1225, 1224, 658, 658, 659, 659, 1318, 659, 1309, 659, 1088, 1225, 1226, 1226, 1328, 1226, 1328, 1226, 1225, 1309, 659, 659, 1228, 1228, 1253, 1228, 1253, 1228, 1226, 1227, 1227, 1253, 1227, 1321, 1227, 1226, 1309, 1331, 1228, 1229, 1229, 1253, 1229, 1331, 1229, 1227, 1321, 659, 671, 671, 1372, 671, 671, 671, 671, 1229, 671, 671, 671, 1256, 1372, 1227, 671, 671, 671, 671, 1084, 1292, 1230, 1230, 1256, 1230, 1322, 1230, 1234, 1234, 1262, 1234, 1292, 1234, 1324, 1322, 1292, 1256, 1230, 1660, 1660, 1262, 1324, 1292, 1234, 671, 671, 672, 672, 1264, 672, 672, 672, 672, 1262, 672, 672, 672, 1230, 1403, 1264, 672, 672, 672, 672, 1231, 1231, 1330, 1231, 1403, 1231, 1235, 1235, 1264, 1235, 1332, 1235, 1332, 672, 1330, 1335, 1231, 1335, 1232, 1232, 1325, 1232, 1235, 1232, 1231, 672, 672, 673, 673, 1325, 673, 673, 673, 673, 1232, 673, 673, 673, 1333, 1072, 1268, 673, 673, 673, 673, 1233, 1233, 1333, 1233, 1235, 1233, 1268, 1336, 1232, 673, 1336, 1265, 1362, 1265, 1806, 1806, 1233, 1363, 1265, 1268, 1362, 1363, 1233, 1364, 1311, 673, 673, 683, 1265, 683, 1364, 683, 683, 683, 1493, 1311, 1493, 683, 683, 683, 683, 1365, 1270, 1270, 1365, 1270, 683, 1270, 1271, 1271, 1366, 1271, 1311, 1271, 1366, 1368, 1061, 1378, 1270, 1270, 1368, 1312, 1378, 1312, 1271, 1271, 683, 683, 684, 684, 1315, 684, 1312, 684, 1272, 1272, 1370, 1272, 1312, 1272, 1370, 1315, 1375, 1374, 684, 684, 1373, 1374, 1329, 1375, 1272, 1272, 1275, 1275, 1373, 1275, 1377, 1275, 1315, 1329, 1377, 1376, 1400, 1329, 1376, 1399, 1400, 1407, 1275, 1275, 1329, 684, 688, 688, 1407, 688, 688, 688, 688, 1399, 688, 688, 688, 1390, 1405, 1390, 688, 688, 688, 688, 1276, 1276, 1405, 1276, 1437, 1276, 1277, 1277, 1390, 1277, 1435, 1277, 1437, 1390, 1390, 1406, 1276, 1276, 1408, 1406, 1435, 1408, 1277, 1277, 1319, 688, 688, 689, 689, 1944, 689, 1358, 689, 1278, 1278, 1319, 1278, 1409, 1278, 1319, 1411, 1409, 1358, 689, 689, 1411, 1358, 1447, 1944, 1278, 1278, 1279, 1279, 1319, 1279, 1358, 1279, 1447, 1382, 1432, 1382, 1280, 1280, 1432, 1280, 1438, 1280, 1279, 1279, 1438, 689, 698, 698, 1382, 698, 1500, 698, 1280, 1280, 1337, 1337, 1500, 1337, 1392, 1337, 1392, 1394, 698, 1394, 1348, 1348, 1448, 1348, 698, 1348, 1337, 1337, 698, 1392, 1448, 1382, 1394, 698, 701, 701, 1348, 701, 701, 701, 701, 1348, 701, 701, 701, 1391, 1459, 1391, 701, 701, 701, 701, 1338, 1338, 1459, 1338, 1431, 1338, 1339, 1339, 1391, 1339, 1441, 1339, 1440, 1391, 1441, 1440, 1338, 1338, 1431, 1393, 1033, 1393, 1339, 1339, 1443, 701, 701, 702, 702, 1443, 702, 702, 702, 702, 1393, 702, 702, 702, 1395, 1478, 1395, 702, 702, 702, 702, 1341, 1341, 1478, 1341, 1393, 1341, 1342, 1342, 1395, 1342, 1444, 1342, 1451, 702, 1445, 1451, 1341, 1341, 1445, 1402, 1004, 1402, 1342, 1342, 1444, 702, 702, 703, 703, 1458, 703, 703, 703, 703, 1402, 703, 703, 703, 993, 1458, 1439, 703, 703, 703, 703, 1343, 1343, 1439, 1343, 1396, 1343, 1396, 1344, 1344, 703, 1344, 1449, 1344, 1450, 1452, 1449, 1343, 1343, 1452, 1396, 1450, 1838, 1838, 1344, 1344, 703, 703, 714, 714, 1453, 714, 714, 714, 714, 1453, 714, 714, 714, 1397, 1396, 1397, 714, 714, 714, 714, 1345, 1345, 1490, 1345, 1455, 1345, 1346, 1346, 1397, 1346, 1456, 1346, 1490, 714, 1456, 1397, 1345, 1345, 1455, 1404, 1954, 1404, 1346, 1346, 1454, 714, 714, 715, 715, 1454, 715, 715, 715, 715, 1404, 715, 715, 715, 1507, 1954, 1507, 715, 715, 715, 715, 1349, 1349, 1410, 1349, 1410, 1349, 1461, 1350, 1350, 715, 1350, 1460, 1350, 1461, 1464, 1460, 1349, 1410, 1462, 1464, 1463, 1462, 923, 1350, 1463, 715, 715, 726, 726, 1482, 726, 726, 726, 726, 1482, 726, 726, 726, 1350, 922, 1494, 726, 726, 726, 726, 1351, 1351, 1494, 1351, 1476, 1351, 1352, 1352, 1476, 1352, 1492, 1352, 1498, 726, 1492, 1483, 1351, 913, 1359, 1359, 1498, 1359, 1352, 1359, 1483, 726, 726, 727, 727, 1497, 727, 727, 727, 727, 1359, 727, 727, 727, 1371, 1497, 1401, 727, 727, 727, 727, 1433, 1484, 1353, 1353, 1371, 1353, 1401, 1353, 1371, 727, 1401, 1433, 1484, 1496, 1484, 1433, 1485, 1371, 1353, 1401, 1496, 1487, 907, 1839, 1433, 727, 727, 737, 737, 1485, 737, 737, 737, 737, 1487, 737, 737, 737, 1353, 1839, 779, 737, 737, 737, 737, 1354, 1354, 1486, 1354, 1489, 1354, 1361, 1361, 1486, 1361, 1488, 1361, 1502, 1491, 1486, 1486, 1354, 1489, 1520, 1825, 1502, 1488, 1361, 1354, 1491, 737, 737, 738, 738, 1520, 738, 738, 738, 738, 1495, 738, 738, 738, 1446, 1825, 751, 738, 738, 738, 738, 1367, 1367, 1495, 1367, 1446, 1367, 1379, 1379, 1446, 1379, 1503, 1379, 1501, 1503, 1504, 1510, 1367, 1446, 526, 1510, 1506, 1504, 1379, 1379, 1501, 738, 738, 739, 739, 1506, 739, 739, 739, 739, 1655, 739, 739, 739, 1499, 1505, 1655, 739, 739, 739, 739, 1380, 1380, 1505, 1380, 1499, 1380, 1381, 1381, 1499, 1381, 1508, 1381, 1508, 495, 1514, 1511, 1380, 1380, 1511, 1514, 1512, 1499, 1381, 1381, 1512, 739, 739, 740, 740, 1517, 740, 740, 740, 740, 1517, 740, 740, 740, 1524, 1515, 1524, 740, 740, 740, 740, 1384, 1384, 1509, 1384, 1516, 1384, 1385, 1385, 1515, 1385, 1513, 1385, 1518, 1513, 1509, 1509, 1384, 1384, 1516, 1521, 1523, 1518, 1385, 1385, 1523, 740, 740, 752, 752, 1521, 752, 752, 752, 752, 1663, 752, 752, 752, 1522, 1663, 1525, 752, 752, 752, 752, 1386, 1386, 1525, 1386, 1522, 1386, 1387, 1387, 1526, 1387, 1543, 1387, 1544, 1543, 752, 1526, 1386, 1386, 1554, 1544, 1547, 1554, 1387, 1387, 1797, 752, 752, 753, 753, 1547, 753, 753, 753, 753, 1643, 753, 753, 753, 1797, 1548, 1457, 753, 753, 753, 753, 1388, 1388, 1548, 1388, 1643, 1388, 1457, 753, 1423, 1423, 1457, 1423, 1549, 1423, 1552, 1555, 1388, 1388, 1550, 1457, 1550, 1549, 1555, 1552, 1423, 753, 753, 763, 763, 1423, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 774, 774, 339, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 785, 785, 1553, 785, 785, 785, 785, 331, 785, 785, 785, 1553, 1558, 1557, 785, 785, 785, 785, 1389, 1389, 1558, 1389, 1557, 1389, 1412, 1412, 1648, 1412, 1559, 1412, 1562, 1560, 785, 1560, 1389, 1389, 1648, 1559, 1563, 1562, 1412, 1412, 328, 785, 785, 786, 786, 1563, 786, 786, 786, 786, 1647, 786, 786, 786, 1647, 1652, 1585, 786, 786, 786, 786, 1413, 1413, 1546, 1413, 1585, 1413, 1652, 786, 1424, 1424, 1546, 1424, 1586, 1424, 1546, 1546, 1413, 1413, 1425, 1425, 1586, 1425, 1582, 1425, 1424, 786, 786, 796, 796, 1582, 796, 796, 796, 796, 1425, 796, 796, 796, 1588, 313, 1588, 796, 796, 796, 796, 1414, 1414, 1519, 1414, 1425, 1414, 1416, 1416, 1519, 1416, 1581, 1416, 1689, 1581, 1519, 1519, 1414, 1414, 1689, 1576, 1587, 1576, 1416, 1416, 1657, 796, 796, 797, 797, 1587, 797, 797, 797, 797, 1576, 797, 797, 797, 1574, 1657, 1574, 797, 797, 797, 797, 1417, 1417, 1556, 1417, 1590, 1417, 1418, 1418, 1574, 1418, 1556, 1418, 1711, 1590, 1556, 1556, 1417, 1417, 1711, 1575, 1591, 1575, 1418, 1418, 1574, 797, 797, 798, 798, 1591, 798, 798, 798, 798, 1575, 798, 798, 798, 1575, 231, 1612, 798, 798, 798, 798, 1419, 1419, 1584, 1419, 1612, 1419, 1420, 1420, 1665, 1420, 1584, 1420, 1609, 1665, 1584, 1584, 1419, 1419, 1608, 1609, 1614, 1608, 1420, 1420, 1620, 798, 798, 803, 803, 1614, 803, 1620, 803, 1421, 1421, 1686, 1421, 1578, 1421, 1578, 1613, 1426, 1426, 803, 1426, 803, 1426, 1686, 1613, 1421, 1421, 1577, 1578, 1577, 803, 806, 806, 1426, 806, 1615, 806, 1615, 1427, 1427, 1617, 1427, 1577, 1427, 1623, 1619, 1618, 806, 1619, 1617, 1577, 1622, 1623, 806, 1427, 1618, 1624, 806, 832, 832, 1622, 832, 832, 832, 832, 1624, 832, 832, 832, 1625, 1723, 1625, 832, 832, 832, 832, 1723, 1627, 1428, 1428, 1579, 1428, 1579, 1428, 1434, 1434, 1627, 1434, 1628, 1434, 1583, 1630, 1583, 1629, 1428, 1579, 1629, 1628, 1630, 1645, 1434, 832, 832, 833, 833, 1583, 833, 833, 833, 833, 1645, 833, 833, 833, 1428, 230, 1632, 833, 833, 833, 833, 1429, 1429, 1611, 1429, 1632, 1429, 1436, 1436, 1634, 1436, 1611, 1436, 1633, 1650, 1611, 1611, 1429, 1634, 229, 1635, 1633, 1635, 1436, 1429, 1650, 833, 833, 834, 834, 1637, 834, 834, 834, 834, 1674, 834, 834, 834, 1637, 1674, 1638, 834, 834, 834, 834, 1442, 1442, 1621, 1442, 1638, 1442, 1466, 1466, 1649, 1466, 1621, 1466, 1855, 1855, 1621, 1621, 1442, 1651, 1653, 1651, 1658, 1649, 1466, 1466, 1658, 834, 834, 835, 835, 1653, 835, 835, 835, 835, 1664, 835, 835, 835, 1664, 1659, 1653, 835, 835, 835, 835, 1467, 1467, 1631, 1467, 1659, 1467, 1468, 1468, 1667, 1468, 1631, 1468, 1667, 1743, 1631, 1631, 1467, 1467, 1654, 1743, 1654, 1661, 1468, 1468, 1661, 835, 835, 858, 858, 1675, 858, 858, 858, 858, 1668, 858, 858, 858, 1656, 228, 1675, 858, 858, 858, 858, 1472, 1472, 1668, 1472, 1656, 1472, 1473, 1473, 1662, 1473, 1666, 1473, 1666, 1675, 1672, 1656, 1472, 1472, 1672, 226, 1662, 1662, 1473, 1473, 1691, 858, 858, 859, 859, 1673, 859, 859, 859, 859, 1669, 859, 859, 859, 1673, 1691, 1676, 859, 859, 859, 859, 1474, 1474, 1669, 1474, 1676, 1474, 1528, 1528, 1677, 1528, 1670, 1528, 1671, 1670, 1810, 1671, 1474, 1474, 1678, 1810, 1682, 1677, 1528, 1528, 1682, 859, 859, 860, 860, 1678, 860, 860, 860, 860, 1820, 860, 860, 860, 1685, 1820, 1685, 860, 860, 860, 860, 1529, 1529, 1678, 1529, 1679, 1529, 1530, 1530, 1680, 1530, 1681, 1530, 1679, 1681, 1683, 1762, 1529, 1529, 1684, 1680, 225, 1762, 1530, 1530, 1683, 860, 860, 865, 865, 1684, 865, 1692, 865, 1533, 1533, 1692, 1533, 1687, 1533, 1702, 224, 1536, 1536, 865, 1536, 865, 1536, 1702, 1687, 1533, 1533, 1688, 1703, 1688, 865, 868, 868, 1536, 868, 1687, 868, 1703, 1534, 1534, 1693, 1534, 1701, 1534, 1701, 1774, 1705, 868, 1704, 1536, 1693, 1774, 1704, 868, 1534, 1534, 1705, 868, 906, 906, 1706, 906, 906, 906, 906, 223, 906, 906, 906, 1690, 1708, 1706, 906, 906, 906, 906, 1535, 1535, 1708, 1535, 1690, 1535, 1538, 1538, 1706, 1538, 1707, 1538, 1712, 1796, 1707, 1690, 1535, 1535, 1537, 1537, 1712, 1537, 1538, 1537, 1796, 906, 906, 909, 909, 1709, 909, 909, 909, 909, 1537, 909, 909, 909, 1537, 222, 1709, 909, 909, 909, 909, 1539, 1539, 1710, 1539, 1715, 1539, 1540, 1540, 1709, 1540, 1713, 1540, 1713, 1715, 1955, 1710, 1539, 1955, 1541, 1541, 1735, 1541, 1540, 1541, 1539, 909, 909, 968, 968, 1735, 968, 968, 968, 968, 1541, 968, 968, 968, 1733, 1714, 1733, 968, 968, 968, 968, 1545, 1545, 1714, 1545, 1716, 1545, 1565, 1565, 1716, 1565, 1717, 1565, 1815, 1719, 1736, 1739, 1545, 1719, 1736, 1739, 1717, 1722, 1565, 1565, 1815, 968, 968, 970, 970, 1718, 970, 970, 970, 970, 1722, 970, 970, 970, 218, 1720, 1718, 970, 970, 970, 970, 1566, 1566, 1720, 1566, 1724, 1566, 1567, 1567, 1718, 1567, 1721, 1567, 1724, 1752, 1737, 1752, 1566, 1566, 1865, 1865, 1754, 1721, 1567, 1567, 1737, 970, 970, 1007, 1007, 1754, 1007, 1007, 1007, 1007, 1721, 1007, 1007, 1007, 1730, 1734, 1730, 1007, 1007, 1007, 1007, 1571, 1571, 1734, 1571, 1740, 1571, 1572, 1572, 1730, 1572, 1744, 1572, 1740, 1764, 217, 1764, 1571, 1571, 1744, 1729, 1755, 1729, 1572, 1572, 1755, 1007, 1007, 1010, 1010, 1756, 1010, 1010, 1010, 1010, 1729, 1010, 1010, 1010, 1731, 1756, 1731, 1010, 1010, 1010, 1010, 1573, 1573, 1742, 1573, 1729, 1573, 1593, 1593, 1731, 1593, 1738, 1593, 1753, 1798, 1758, 1742, 1573, 1573, 1758, 1731, 1753, 1738, 1593, 1593, 1798, 1010, 1010, 1036, 1036, 216, 1036, 1036, 1036, 1036, 1738, 1036, 1036, 1036, 1732, 1759, 1732, 1036, 1036, 1036, 1036, 1594, 1594, 1759, 1594, 1763, 1594, 1595, 1595, 1732, 1595, 1741, 1595, 1763, 1786, 1767, 1766, 1594, 1594, 1767, 1786, 213, 1741, 1595, 1595, 1766, 1036, 1036, 1038, 1038, 1757, 1038, 1038, 1038, 1038, 1741, 1038, 1038, 1038, 1883, 1883, 1757, 1038, 1038, 1038, 1038, 1598, 1598, 1761, 1598, 1765, 1598, 1599, 1599, 1757, 1599, 1768, 1599, 1765, 1760, 212, 1761, 1598, 1598, 1769, 1776, 1768, 1776, 1599, 1599, 1760, 1038, 1038, 1274, 1274, 1769, 1274, 1770, 1274, 1600, 1600, 1770, 1600, 1760, 1600, 1771, 1773, 1779, 1769, 1274, 1274, 1779, 1794, 1771, 1794, 1600, 1600, 1601, 1601, 1773, 1601, 1775, 1601, 1603, 1603, 1778, 1603, 1777, 1603, 1775, 1795, 1785, 1795, 1601, 1778, 1777, 1274, 1289, 1289, 1603, 1289, 1289, 1289, 1289, 1785, 1289, 1289, 1289, 1772, 1601, 211, 1289, 1289, 1289, 1289, 1602, 1602, 1782, 1602, 1772, 1602, 1782, 1604, 1604, 1780, 1604, 1781, 1604, 1783, 184, 1793, 1602, 1772, 1784, 1780, 1602, 1783, 1781, 1604, 1793, 1289, 1289, 1340, 1340, 1784, 1340, 1604, 1340, 1605, 1605, 1781, 1605, 1809, 1605, 1787, 1800, 1809, 1784, 1340, 1340, 1606, 1606, 1787, 1606, 1605, 1606, 1610, 1610, 1800, 1610, 183, 1610, 1697, 1697, 1812, 1697, 1606, 1697, 1698, 1698, 1812, 1698, 1610, 1698, 1792, 1340, 1347, 1347, 1697, 1347, 181, 1347, 1792, 1799, 1698, 1699, 1699, 1802, 1699, 1802, 1699, 1819, 1347, 1697, 1799, 1819, 1799, 1347, 1347, 1355, 1355, 1699, 1355, 1355, 1355, 1355, 1801, 1355, 1355, 1355, 1900, 1900, 1699, 1355, 1355, 1355, 1355, 1700, 1700, 1801, 1700, 1803, 1700, 1748, 1748, 1808, 1748, 1808, 1748, 1830, 1813, 1830, 1803, 1700, 1803, 1749, 1749, 1804, 1749, 1748, 1749, 1813, 1355, 1355, 1383, 1383, 180, 1383, 1811, 1383, 1804, 1749, 1750, 1750, 1748, 1750, 1811, 1750, 1813, 1821, 1383, 1383, 1751, 1751, 1821, 1751, 1818, 1751, 1750, 1790, 1790, 1816, 1790, 1805, 1790, 1814, 1818, 1980, 1751, 1750, 1980, 1817, 1816, 1814, 1805, 1790, 1790, 1383, 1398, 1398, 1817, 1398, 1398, 1398, 1398, 1805, 1398, 1398, 1398, 1816, 1823, 179, 1398, 1398, 1398, 1398, 1822, 1823, 1824, 1826, 1822, 1827, 1824, 1828, 1826, 1829, 1831, 1832, 1831, 1828, 176, 1833, 1827, 1836, 1829, 1836, 1834, 1848, 1832, 1835, 1837, 1398, 1398, 1415, 1415, 1833, 1415, 1834, 1415, 1848, 1827, 1837, 1835, 1841, 1841, 1847, 1841, 1849, 1841, 1415, 1415, 1854, 1837, 1856, 1847, 1926, 1849, 1942, 1851, 1841, 1841, 1926, 1854, 1843, 1843, 1942, 1843, 1856, 1843, 1844, 1844, 1860, 1844, 1851, 1844, 1854, 1415, 1422, 1422, 1843, 1422, 1859, 1422, 1860, 1876, 1844, 1861, 1843, 1910, 1910, 1859, 175, 1862, 1422, 1844, 1861, 1876, 1866, 1422, 1422, 1430, 1430, 1864, 1430, 1430, 1430, 1430, 1862, 1430, 1430, 1430, 1866, 174, 1864, 1430, 1430, 1430, 1430, 1850, 1850, 1868, 1850, 1868, 1850, 1853, 1853, 1864, 1853, 1933, 1853, 1920, 1920, 1933, 1875, 1850, 1868, 1869, 1869, 1877, 1869, 1853, 1869, 1875, 1430, 1430, 1465, 1465, 1877, 1465, 1871, 1465, 1871, 1869, 1869, 1872, 1878, 1872, 1878, 1879, 1892, 1882, 1465, 1465, 1884, 1871, 1881, 1894, 1881, 1892, 1872, 1878, 1882, 1871, 1879, 1893, 1894, 1896, 1884, 1872, 1939, 1881, 1949, 1949, 1939, 1882, 1899, 1893, 1901, 1465, 1469, 1469, 1896, 1469, 1469, 1469, 1469, 1899, 1469, 1469, 1469, 173, 1901, 1904, 1469, 1469, 1469, 1469, 1886, 1886, 1899, 1886, 1904, 1886, 1895, 1895, 1905, 1895, 1951, 1895, 1951, 167, 1907, 1906, 1886, 1886, 1898, 1898, 1905, 1898, 1895, 1898, 1906, 1469, 1469, 1470, 1470, 1907, 1470, 1470, 1470, 1470, 1898, 1470, 1470, 1470, 1909, 1911, 166, 1470, 1470, 1470, 1470, 1888, 1888, 1915, 1888, 1909, 1888, 1889, 1889, 1911, 1889, 1914, 1889, 1916, 1927, 1915, 1921, 1888, 1909, 1917, 1914, 1927, 1916, 1889, 1919, 1888, 1470, 1470, 1471, 1471, 1921, 1471, 1889, 1471, 1917, 1919, 1922, 1922, 1957, 1922, 1957, 1922, 1931, 1924, 1471, 1471, 1923, 1923, 1919, 1923, 1928, 1923, 1922, 1922, 1924, 1931, 1934, 1929, 1932, 1928, 1937, 1940, 1923, 1923, 1989, 1940, 1937, 1989, 1929, 1934, 1932, 1471, 1481, 1481, 1930, 1481, 1481, 1481, 1481, 1929, 1481, 1481, 1481, 1960, 1935, 1930, 1481, 1481, 1481, 1481, 1936, 151, 1960, 1938, 1941, 1935, 1930, 1935, 1938, 1941, 1943, 1946, 1945, 1936, 1947, 1943, 1945, 1959, 1952, 1947, 1956, 1948, 1946, 1953, 1959, 1481, 1481, 1527, 1527, 1952, 1527, 1948, 1527, 1956, 1953, 1958, 1964, 1961, 1962, 1946, 1964, 1958, 1963, 1527, 1527, 1965, 65, 1952, 1961, 1962, 1966, 1965, 1953, 1971, 1963, 1966, 1972, 1971, 1974, 1961, 1962, 1972, 1970, 1970, 1981, 1970, 1973, 1970, 1981, 1974, 1527, 1531, 1531, 1973, 1531, 1531, 1531, 1531, 1970, 1531, 1531, 1531, 1974, 1976, 64, 1531, 1531, 1531, 1531, 1967, 1967, 1977, 1967, 1977, 1967, 1968, 1968, 1976, 1968, 1979, 1968, 1988, 1975, 1982, 2038, 1967, 1967, 1979, 1982, 1988, 2038, 1968, 1968, 1975, 1531, 1531, 1532, 1532, 1984, 1532, 2002, 1532, 1969, 1969, 1983, 1969, 1975, 1969, 2002, 1984, 1985, 1983, 1532, 1532, 1978, 1978, 1994, 1978, 1969, 1978, 1994, 1985, 1984, 1986, 1987, 2047, 1987, 1995, 1996, 1969, 1978, 2047, 1995, 1999, 1985, 1996, 1992, 1986, 1992, 1532, 1542, 1542, 1997, 1542, 1542, 1542, 1542, 1999, 1542, 1542, 1542, 1992, 2016, 1997, 1542, 1542, 1542, 1542, 1990, 1990, 2016, 1990, 1992, 1990, 1991, 1991, 1997, 1991, 1998, 1991, 2000, 63, 2000, 2008, 1990, 1990, 1993, 2008, 1993, 1998, 1991, 1991, 2009, 1542, 1542, 1564, 1564, 2009, 1564, 2010, 1564, 1993, 1998, 2001, 2003, 2001, 2010, 2003, 2050, 2050, 2013, 1564, 1564, 2017, 2004, 2004, 2017, 2004, 2001, 2004, 2005, 2005, 2011, 2005, 2013, 2005, 2014, 2019, 2014, 2066, 2004, 2004, 2019, 2011, 2020, 2066, 2005, 2005, 1564, 1568, 1568, 2020, 1568, 1568, 1568, 1568, 2011, 1568, 1568, 1568, 2012, 2029, 60, 1568, 1568, 1568, 1568, 2023, 2029, 2006, 2006, 2012, 2006, 2018, 2006, 2007, 2007, 2018, 2007, 2025, 2007, 2023, 2057, 2057, 2012, 2006, 2024, 2025, 2024, 59, 2021, 2007, 1568, 1568, 1569, 1569, 2006, 1569, 1569, 1569, 1569, 2021, 1569, 1569, 1569, 2022, 2059, 2059, 1569, 1569, 1569, 1569, 2015, 2015, 2021, 2015, 2022, 2015, 2026, 2027, 2028, 2026, 2030, 2027, 2031, 2028, 2034, 2032, 2015, 2022, 2033, 58, 2033, 2030, 2034, 2031, 2036, 1569, 1569, 1570, 1570, 2032, 1570, 2039, 1570, 2036, 2030, 2035, 2031, 2037, 2035, 2040, 2037, 2039, 2041, 1570, 1570, 2042, 2043, 2045, 2046, 2045, 2040, 2044, 2040, 2048, 2052, 2041, 2042, 2048, 2042, 2043, 2051, 2046, 2044, 2051, 2055, 2052, 2055, 2053, 2063, 2063, 1570, 1580, 1580, 2044, 1580, 1580, 1580, 1580, 2053, 1580, 1580, 1580, 2052, 2062, 2056, 1580, 1580, 1580, 1580, 2058, 2067, 2060, 2062, 2058, 2060, 2053, 2056, 2061, 2064, 2065, 2067, 2064, 2065, 2069, 2070, 2069, 55, 2068, 2061, 2071, 2070, 2073, 2073, 2071, 1580, 1580, 1592, 1592, 2068, 1592, 2074, 1592, 2072, 2072, 2074, 2072, 2061, 2072, 2075, 2068, 54, 2078, 1592, 1592, 2076, 2076, 2075, 2076, 2072, 2076, 2077, 2077, 2078, 2077, 2079, 2077, 2146, 2072, 2079, 2080, 2076, 2146, 2081, 2080, 2081, 2078, 2077, 2082, 2082, 1592, 1596, 1596, 2085, 1596, 1596, 1596, 1596, 2083, 1596, 1596, 1596, 2083, 2084, 2085, 1596, 1596, 1596, 1596, 2086, 2087, 2084, 2131, 2086, 2087, 2131, 2088, 2085, 2088, 2090, 2090, 2092, 2091, 2089, 2102, 2089, 2091, 36, 2093, 2092, 2093, 2094, 2102, 2094, 1596, 1596, 1597, 1597, 2089, 1597, 2095, 1597, 2111, 2093, 2096, 2097, 2094, 2089, 2096, 2097, 2111, 2095, 1597, 1597, 2098, 2101, 2098, 2099, 2099, 2101, 2099, 2108, 2099, 2108, 2095, 2100, 2100, 2105, 2109, 2109, 32, 2103, 2103, 2099, 2103, 2115, 2103, 2115, 2105, 1597, 1607, 1607, 2099, 1607, 1607, 1607, 1607, 2103, 1607, 1607, 1607, 2105, 2116, 2116, 1607, 1607, 1607, 1607, 2104, 2104, 2106, 2104, 2107, 2104, 2106, 2110, 2107, 2113, 2112, 2110, 2118, 2113, 2114, 2117, 2104, 2203, 2114, 2117, 2118, 2112, 2122, 2203, 2122, 1607, 1607, 1639, 1639, 2119, 1639, 1639, 1639, 1639, 2112, 1639, 1639, 1639, 2127, 29, 2119, 1639, 1639, 1639, 1639, 2120, 2121, 2124, 2128, 2120, 2121, 2127, 2125, 2119, 2124, 2144, 2129, 2126, 2133, 2134, 2133, 2128, 2134, 2125, 2140, 2144, 2140, 2129, 2126, 2129, 1639, 1639, 1640, 1640, 2125, 1640, 1640, 1640, 1640, 2126, 1640, 1640, 1640, 2130, 2137, 2138, 1640, 1640, 1640, 1640, 2136, 2141, 2148, 2138, 2136, 2137, 2130, 2145, 2154, 2142, 2143, 2147, 2149, 2148, 2145, 2141, 2150, 2154, 2147, 2150, 2142, 2143, 2137, 2149, 2148, 1640, 1640, 1641, 1641, 23, 1641, 1641, 1641, 1641, 2149, 1641, 1641, 1641, 2142, 2143, 2208, 1641, 1641, 1641, 1641, 2152, 2208, 2152, 2153, 2153, 2155, 2153, 2158, 2153, 2159, 2156, 2159, 2158, 2161, 2168, 2164, 2155, 2195, 2195, 2153, 2164, 2156, 2161, 2168, 0, 1641, 1641, 1642, 1642, 2155, 1642, 1642, 1642, 1642, 2156, 1642, 1642, 1642, 2162, 0, 2163, 1642, 1642, 1642, 1642, 2157, 2157, 2176, 2157, 2162, 2157, 2163, 2165, 2167, 2165, 2167, 2176, 2173, 2172, 2173, 2180, 2157, 2162, 2172, 2163, 2180, 0, 2181, 2167, 2181, 1642, 1642, 1694, 1694, 2169, 1694, 1694, 1694, 1694, 2170, 1694, 1694, 1694, 2183, 0, 2169, 1694, 1694, 1694, 1694, 2170, 2171, 2183, 2171, 2175, 2175, 2186, 2175, 2169, 2175, 2177, 2186, 2187, 2170, 2187, 2189, 2171, 2192, 0, 2209, 2175, 2177, 2192, 2209, 2189, 1694, 1694, 1695, 1695, 2178, 1695, 1695, 1695, 1695, 2177, 1695, 1695, 1695, 2184, 0, 2178, 1695, 1695, 1695, 1695, 2179, 2179, 2196, 2179, 2184, 2179, 2197, 2193, 2178, 2193, 2185, 2198, 2202, 2196, 2202, 2196, 2179, 2184, 2216, 2197, 2216, 2185, 2198, 0, 2198, 1695, 1695, 1696, 1696, 2190, 1696, 1696, 1696, 1696, 2185, 1696, 1696, 1696, 2191, 2199, 2190, 1696, 1696, 1696, 1696, 2200, 2204, 2201, 2207, 2191, 2211, 2252, 2199, 2190, 2201, 2205, 2206, 2207, 2200, 2204, 2210, 2252, 2191, 2217, 2211, 2212, 2205, 2206, 2210, 2217, 1696, 1696, 1725, 1725, 2212, 1725, 1725, 1725, 1725, 2291, 1725, 1725, 1725, 2205, 2206, 2291, 1725, 1725, 1725, 1725, 2213, 2213, 2214, 2214, 2215, 2218, 2221, 2224, 2218, 2228, 2224, 2215, 2228, 2219, 2219, 2221, 2219, 2222, 2219, 2223, 2226, 2222, 0, 2223, 2226, 1725, 1725, 1726, 1726, 2219, 1726, 1726, 1726, 1726, 2259, 1726, 1726, 1726, 2225, 2259, 0, 1726, 1726, 1726, 1726, 2220, 2220, 2225, 2220, 2227, 2220, 2231, 2229, 2227, 2229, 2232, 2248, 2402, 2233, 2232, 2231, 2220, 2233, 2248, 2230, 2234, 2230, 2229, 2234, 2402, 1726, 1726, 1727, 1727, 2237, 1727, 1727, 1727, 1727, 2230, 1727, 1727, 1727, 2237, 0, 2254, 1727, 1727, 1727, 1727, 2235, 2235, 2254, 2235, 2238, 2235, 2236, 2236, 2238, 2236, 2239, 2236, 2240, 2242, 2239, 2240, 2235, 2242, 2244, 2243, 2241, 2244, 2236, 2243, 2264, 1727, 1727, 1728, 1728, 2241, 1728, 1728, 1728, 1728, 2264, 1728, 1728, 1728, 2245, 2249, 2250, 1728, 1728, 1728, 1728, 2246, 2247, 2245, 2253, 2246, 2247, 2253, 2249, 2250, 2251, 2255, 2251, 2256, 2260, 2261, 2262, 2260, 2263, 2261, 2263, 2256, 2265, 2262, 2255, 2265, 1728, 1728, 1745, 1745, 2266, 1745, 1745, 1745, 1745, 2266, 1745, 1745, 1745, 2268, 2269, 2269, 1745, 1745, 1745, 1745, 2270, 2268, 2272, 2273, 2273, 2270, 2274, 2276, 2277, 2277, 2272, 2274, 2278, 2280, 2284, 2276, 2290, 2278, 2281, 2281, 2290, 2280, 2284, 2367, 2282, 1745, 1745, 1746, 1746, 2282, 1746, 1746, 1746, 1746, 2367, 1746, 1746, 1746, 2285, 2285, 2286, 1746, 1746, 1746, 1746, 2286, 2288, 2289, 2289, 2293, 2294, 2294, 2292, 2295, 2288, 2297, 2296, 2295, 2297, 2293, 2296, 2298, 0, 2292, 2298, 2299, 2299, 2306, 2300, 2306, 1746, 1746, 1747, 1747, 2292, 1747, 1747, 1747, 1747, 2300, 1747, 1747, 1747, 2304, 2396, 2396, 1747, 1747, 1747, 1747, 2301, 2302, 2303, 2301, 2304, 2302, 2305, 2300, 2303, 2307, 2308, 2309, 2310, 2307, 2310, 2304, 2305, 0, 2311, 2309, 2315, 2308, 2311, 0, 2315, 1747, 1747, 1788, 1788, 2312, 1788, 1788, 1788, 1788, 2308, 1788, 1788, 1788, 2313, 2316, 2312, 1788, 1788, 1788, 1788, 2314, 2313, 2314, 2317, 2318, 2316, 2318, 2321, 2312, 2319, 2320, 2317, 2322, 2319, 2322, 2321, 2323, 2326, 2316, 2326, 2323, 2320, 2331, 0, 2331, 1788, 1788, 1791, 1791, 2324, 1791, 1791, 1791, 1791, 2320, 1791, 1791, 1791, 2325, 2328, 2324, 1791, 1791, 1791, 1791, 2327, 2325, 2329, 2330, 2327, 2328, 2332, 2330, 2324, 2333, 2329, 2335, 2334, 2335, 0, 0, 2338, 2332, 2328, 2332, 2338, 2339, 2333, 2334, 2339, 1791, 1791, 1840, 1840, 2337, 1840, 1840, 1840, 1840, 2334, 1840, 1840, 1840, 2341, 0, 2337, 1840, 1840, 1840, 1840, 2340, 2343, 2342, 2343, 2341, 2340, 2342, 2344, 2345, 2349, 2345, 2349, 2337, 2352, 2356, 2352, 2356, 2360, 2344, 2360, 2372, 0, 2341, 2348, 2372, 1840, 1840, 1842, 1842, 2344, 1842, 1842, 1842, 1842, 2348, 1842, 1842, 1842, 2351, 0, 0, 1842, 1842, 1842, 1842, 2347, 2347, 2348, 2347, 2351, 2347, 2354, 2363, 2354, 2363, 2371, 2366, 2371, 2376, 2417, 2375, 2347, 2351, 2366, 2375, 2376, 2354, 2417, 2355, 0, 1842, 1842, 1867, 1867, 2359, 1867, 1867, 1867, 1867, 2355, 1867, 1867, 1867, 2362, 2368, 2359, 1867, 1867, 1867, 1867, 2358, 2358, 2355, 2358, 2362, 2358, 2370, 2368, 2359, 2369, 2365, 2398, 2373, 2377, 0, 0, 2358, 2362, 2398, 2370, 2369, 2365, 2369, 2373, 2377, 1867, 1867, 1870, 1870, 2379, 1870, 1870, 1870, 1870, 2365, 1870, 1870, 1870, 2379, 0, 2373, 1870, 1870, 1870, 1870, 2378, 2380, 2380, 2381, 2380, 2378, 2380, 2382, 2381, 2383, 2384, 2387, 2390, 2386, 2383, 0, 2382, 2380, 2386, 2384, 2387, 2390, 0, 0, 2389, 1870, 1870, 1885, 1885, 2389, 1885, 1885, 1885, 1885, 2391, 1885, 1885, 1885, 2385, 2391, 2385, 1885, 1885, 1885, 1885, 2388, 2388, 2392, 2388, 2393, 2388, 2395, 2416, 2385, 2397, 2399, 2392, 2394, 0, 2397, 2400, 2388, 0, 2393, 2395, 2416, 2399, 0, 2394, 0, 1885, 1885, 1887, 1887, 2400, 1887, 1887, 1887, 1887, 2394, 1887, 1887, 1887, 2401, 2399, 2403, 1887, 1887, 1887, 1887, 2404, 2406, 0, 2405, 2401, 2407, 2403, 2409, 2408, 2410, 0, 2411, 2404, 2406, 2405, 2401, 2407, 2413, 2409, 2403, 2408, 2410, 2411, 2414, 2412, 1887, 1887, 2405, 2413, 2407, 0, 2409, 2418, 2415, 2414, 2411, 2412, 2419, 2421, 2420, 2425, 2413, 2425, 2418, 2415, 2414, 2415, 2423, 2419, 2421, 2420, 2422, 2422, 2424, 2422, 2425, 2422, 2426, 2423, 0, 2418, 2420, 2421, 0, 2424, 2428, 2419, 2422, 2426, 2427, 2427, 2423, 2427, 2429, 2427, 2430, 2428, 2424, 2431, 2432, 0, 2426, 2433, 0, 2429, 2427, 2430, 0, 2430, 2428, 0, 2431, 2432, 2433, 0, 2434, 2434, 2429, 2434, 2435, 2434, 2435, 2436, 2436, 2437, 2436, 0, 2436, 0, 0, 2433, 2434, 0, 0, 2435, 0, 0, 2437, 2436, 2439, 2439, 2439, 2439, 2439, 2439, 2439, 2440, 2440, 2440, 2440, 2440, 2440, 2440, 2441, 2441, 2441, 2441, 2441, 2441, 2441, 2442, 2442, 2442, 2442, 2442, 2442, 2442, 2443, 2443, 2443, 2443, 2443, 2443, 2443, 2444, 2444, 2444, 2444, 2444, 2444, 2444, 2445, 2445, 0, 2445, 2445, 2445, 2445, 2447, 2447, 0, 2447, 2447, 2447, 2447, 2448, 2448, 0, 2448, 2448, 2448, 2448, 2449, 2449, 0, 2449, 2449, 2449, 2449, 2450, 2450, 0, 2450, 2450, 2450, 2450, 2451, 2451, 0, 2451, 0, 2451, 2452, 0, 2452, 2454, 2454, 0, 2454, 2454, 2454, 2454, 2455, 2455, 2455, 2455, 2456, 2456, 2456, 2456, 2457, 2457, 0, 2457, 2457, 2457, 2457, 2458, 2458, 0, 2458, 2458, 2458, 2458, 2459, 2459, 0, 2459, 2459, 2459, 2459, 2461, 2461, 0, 2461, 2461, 2461, 2461, 2462, 0, 0, 2462, 2462, 2462, 2462, 2463, 2463, 0, 2463, 2463, 2463, 2463, 2464, 0, 0, 2464, 2464, 2464, 2464, 2465, 2465, 0, 2465, 2465, 2465, 2465, 2466, 2466, 0, 2466, 2466, 2466, 2466, 2467, 2467, 0, 2467, 2467, 2467, 2467, 2468, 2468, 0, 2468, 2468, 2468, 2468, 2469, 2469, 2469, 2469, 2470, 2470, 2470, 2470, 2471, 2471, 0, 2471, 2471, 2471, 2471, 2472, 2472, 0, 2472, 2472, 2472, 2472, 2473, 2473, 0, 2473, 2473, 2473, 2473, 2474, 2474, 2475, 2475, 2476, 2476, 0, 2476, 2476, 2476, 2476, 2477, 2477, 0, 2477, 2477, 2477, 2477, 2478, 2478, 0, 2478, 2478, 2478, 2478, 2480, 2480, 0, 2480, 2480, 2480, 2480, 2481, 2481, 0, 2481, 2481, 2481, 2481, 2482, 2482, 0, 2482, 2482, 2482, 2482, 2483, 2483, 0, 2483, 2483, 2483, 2483, 2484, 2484, 0, 2484, 2484, 2484, 2484, 2485, 2485, 0, 2485, 2485, 2485, 2485, 2486, 2486, 0, 2486, 0, 2486, 2487, 0, 2487, 2489, 2489, 0, 2489, 2489, 2489, 2489, 2490, 2490, 2490, 2490, 2491, 2491, 2491, 2491, 2492, 2492, 0, 2492, 2492, 2492, 2492, 2493, 2493, 0, 2493, 2493, 2493, 2493, 2494, 2494, 0, 2494, 2494, 2494, 2494, 2495, 2495, 0, 2495, 2495, 2495, 2495, 2496, 2496, 0, 2496, 2496, 2496, 2496, 2497, 2497, 0, 2497, 2497, 2497, 2497, 2499, 2499, 0, 2499, 2499, 2499, 2499, 2500, 0, 0, 2500, 2500, 2500, 2500, 2501, 2501, 0, 2501, 2501, 2501, 2501, 2502, 0, 0, 2502, 2502, 2502, 2502, 2503, 2503, 0, 2503, 2503, 2503, 2503, 2504, 2504, 0, 2504, 2504, 2504, 2504, 2505, 2505, 0, 2505, 2505, 2505, 2505, 2506, 2506, 0, 2506, 2506, 2506, 2506, 2507, 2507, 0, 2507, 2507, 2507, 2507, 2508, 2508, 0, 2508, 2508, 2508, 2508, 2509, 2509, 0, 2509, 2509, 2509, 2509, 2510, 2510, 2510, 2510, 2511, 2511, 2511, 2511, 2512, 2512, 0, 2512, 2512, 2512, 2512, 2513, 2513, 0, 2513, 2513, 2513, 2513, 2514, 2514, 0, 2514, 2514, 2514, 2514, 2515, 2515, 0, 2515, 2515, 2515, 2515, 2516, 2516, 0, 2516, 2516, 2516, 2516, 2517, 2517, 0, 2517, 2517, 2517, 2517, 2518, 2518, 2519, 2519, 2520, 2520, 0, 2520, 2520, 2520, 2520, 2521, 2521, 0, 2521, 2521, 2521, 2521, 2522, 2522, 0, 2522, 2522, 2522, 2522, 2523, 2523, 0, 2523, 2523, 2523, 2523, 2524, 2524, 0, 2524, 2524, 2524, 2524, 2525, 2525, 0, 2525, 2525, 2525, 2525, 2526, 2526, 0, 2526, 2526, 2526, 2526, 2527, 2527, 0, 2527, 2527, 2527, 2527, 2528, 2528, 0, 2528, 2528, 2528, 2528, 2529, 2529, 0, 2529, 2529, 2529, 2529, 2530, 2530, 0, 2530, 2530, 2530, 2530, 2531, 2531, 0, 2531, 2531, 2531, 2531, 2532, 2532, 0, 2532, 2532, 2532, 2532, 2533, 2533, 0, 2533, 2533, 2533, 2533, 2534, 2534, 0, 2534, 2534, 2534, 2534, 2535, 2535, 0, 2535, 2535, 2535, 2535, 2536, 2536, 0, 2536, 2536, 2536, 2536, 2537, 2537, 0, 2537, 2537, 2537, 2537, 2538, 2538, 0, 2538, 2538, 2538, 2538, 2539, 2539, 0, 2539, 2539, 2539, 2539, 2540, 2540, 0, 2540, 2540, 2540, 2540, 2541, 2541, 0, 2541, 2541, 2541, 2541, 2542, 2542, 0, 2542, 2542, 2542, 2542, 2543, 2543, 0, 2543, 2543, 2543, 2543, 2544, 2544, 0, 2544, 2544, 2544, 2544, 2545, 2545, 0, 2545, 2545, 2545, 2545, 2546, 2546, 0, 2546, 2546, 2546, 2546, 2547, 2547, 0, 2547, 2547, 2547, 2547, 2548, 2548, 0, 2548, 2548, 2548, 2548, 2549, 2549, 0, 2549, 2549, 2549, 2549, 2550, 2550, 0, 2550, 2550, 2550, 2550, 2551, 2551, 0, 2551, 2551, 2551, 2551, 2552, 2552, 2552, 2552, 2553, 2553, 0, 2553, 2553, 2553, 2553, 2554, 2554, 0, 2554, 2554, 2554, 2554, 2555, 2555, 0, 2555, 2555, 2555, 2555, 2556, 2556, 0, 2556, 2556, 2556, 2556, 2557, 2557, 0, 2557, 2557, 2557, 2557, 2558, 2558, 0, 2558, 2558, 2558, 2558, 2559, 2559, 0, 2559, 2559, 2559, 2559, 2560, 2560, 0, 2560, 2560, 2560, 2560, 2561, 2561, 0, 2561, 2561, 2561, 2561, 2562, 2562, 0, 2562, 2562, 2562, 2562, 2563, 2563, 0, 2563, 2563, 2563, 2563, 2564, 2564, 0, 2564, 2564, 2564, 2564, 2565, 2565, 0, 2565, 2565, 2565, 2565, 2566, 2566, 0, 2566, 2566, 2566, 2566, 2567, 2567, 0, 2567, 2567, 2567, 2567, 2568, 2568, 0, 2568, 2568, 2568, 2568, 2569, 2569, 0, 2569, 2569, 2569, 2569, 2570, 2570, 0, 2570, 2570, 2570, 2570, 2571, 2571, 0, 2571, 2571, 2571, 2571, 2572, 2572, 0, 2572, 2572, 2572, 2572, 2573, 2573, 0, 2573, 2573, 2573, 2573, 2574, 2574, 0, 2574, 2574, 2574, 2574, 2575, 2575, 0, 2575, 2575, 2575, 2575, 2576, 2576, 0, 2576, 2576, 2576, 2576, 2577, 2577, 0, 2577, 2577, 2577, 2577, 2578, 2578, 0, 2578, 2578, 2578, 2578, 2579, 2579, 0, 2579, 2579, 2579, 2579, 2580, 2580, 0, 2580, 2580, 2580, 2580, 2581, 2581, 0, 2581, 2581, 2581, 2581, 2582, 2582, 0, 2582, 2582, 2582, 2582, 2583, 2583, 0, 2583, 2583, 2583, 2583, 2584, 2584, 0, 2584, 2584, 2584, 2584, 2585, 2585, 0, 2585, 2585, 2585, 2585, 2586, 2586, 0, 2586, 2586, 2586, 2586, 2587, 2587, 0, 2587, 2587, 2587, 2587, 2588, 2588, 0, 2588, 2588, 2588, 2588, 2589, 2589, 0, 2589, 2589, 2589, 2589, 2590, 2590, 0, 2590, 2590, 2590, 2590, 2591, 2591, 0, 2591, 2591, 2591, 2591, 2592, 2592, 2592, 2592, 2593, 2593, 0, 2593, 2593, 2593, 2593, 2594, 2594, 0, 2594, 2594, 2594, 2594, 2595, 2595, 0, 2595, 2595, 2595, 2595, 2596, 2596, 0, 2596, 2596, 2596, 2596, 2597, 2597, 0, 2597, 2597, 2597, 2597, 2598, 2598, 0, 2598, 2598, 2598, 2598, 2599, 2599, 0, 2599, 2599, 2599, 2599, 2600, 2600, 0, 2600, 2600, 2600, 2600, 2601, 2601, 0, 2601, 2601, 2601, 2601, 2602, 2602, 0, 2602, 2602, 2602, 2602, 2603, 2603, 0, 2603, 2603, 2603, 2603, 2604, 2604, 0, 2604, 2604, 2604, 2604, 2605, 2605, 0, 2605, 2605, 2605, 2605, 2606, 2606, 0, 2606, 2606, 2606, 2606, 2607, 2607, 0, 2607, 2607, 2607, 2607, 2608, 2608, 0, 2608, 2608, 2608, 2608, 2609, 2609, 0, 2609, 2609, 2609, 2609, 2610, 2610, 0, 2610, 2610, 2610, 2610, 2611, 2611, 0, 2611, 2611, 2611, 2611, 2612, 2612, 0, 2612, 2612, 2612, 2612, 2613, 2613, 0, 2613, 2613, 2613, 2613, 2614, 2614, 0, 2614, 2614, 2614, 2614, 2615, 2615, 0, 2615, 2615, 2615, 2615, 2616, 2616, 0, 2616, 2616, 2616, 2616, 2617, 2617, 0, 2617, 2617, 2617, 2617, 2618, 2618, 0, 2618, 2618, 2618, 2618, 2619, 2619, 0, 2619, 2619, 2619, 2619, 2620, 2620, 0, 2620, 2620, 2620, 2620, 2621, 2621, 0, 2621, 2621, 2621, 2621, 2622, 2622, 0, 2622, 2622, 2622, 2622, 2623, 2623, 0, 2623, 2623, 2623, 2623, 2624, 2624, 0, 2624, 2624, 2624, 2624, 2625, 2625, 0, 2625, 2625, 2625, 2625, 2626, 2626, 0, 2626, 2626, 2626, 2626, 2627, 2627, 0, 2627, 2627, 2627, 2627, 2628, 2628, 0, 2628, 2628, 2628, 2628, 2629, 2629, 0, 2629, 2629, 2629, 2629, 2630, 2630, 0, 2630, 2630, 2630, 2630, 2631, 2631, 0, 2631, 2631, 2631, 2631, 2632, 2632, 0, 2632, 2632, 2632, 2632, 2633, 2633, 0, 2633, 2633, 2633, 2633, 2634, 2634, 0, 2634, 2634, 2634, 2634, 2635, 2635, 0, 2635, 2635, 2635, 2635, 2636, 2636, 0, 2636, 2636, 2636, 2636, 2637, 2637, 0, 2637, 2637, 2637, 2637, 2638, 2638, 0, 2638, 2638, 2638, 2638, 2639, 2639, 0, 2639, 2639, 2639, 2639, 2640, 2640, 0, 2640, 2640, 2640, 2640, 2641, 2641, 0, 2641, 2641, 2641, 2641, 2642, 2642, 0, 2642, 2642, 2642, 2642, 2643, 2643, 0, 2643, 2643, 2643, 2643, 2644, 2644, 0, 2644, 2644, 2644, 2644, 2645, 2645, 0, 2645, 2645, 2645, 2645, 2646, 2646, 0, 2646, 2646, 2646, 2646, 2647, 2647, 0, 2647, 2647, 2647, 2647, 2648, 2648, 0, 2648, 2648, 2648, 2648, 2649, 2649, 0, 2649, 2649, 2649, 2649, 2650, 2650, 0, 2650, 2650, 2650, 2650, 2651, 2651, 0, 2651, 2651, 2651, 2651, 2652, 2652, 0, 2652, 2652, 2652, 2652, 2653, 2653, 0, 2653, 2653, 2653, 2653, 2654, 2654, 0, 2654, 2654, 2654, 2654, 2655, 2655, 0, 2655, 2655, 2655, 2655, 2656, 2656, 0, 2656, 2656, 2656, 2656, 2657, 2657, 0, 2657, 2657, 2657, 2657, 2658, 2658, 0, 2658, 2658, 2658, 2658, 2659, 2659, 0, 2659, 2659, 2659, 2659, 2660, 2660, 0, 2660, 2660, 2660, 2660, 2661, 2661, 0, 2661, 2661, 2661, 2661, 2662, 2662, 0, 2662, 2662, 2662, 2662, 2663, 2663, 0, 2663, 2663, 2663, 2663, 2664, 2664, 0, 2664, 2664, 2664, 2664, 2665, 2665, 0, 2665, 2665, 2665, 2665, 2666, 2666, 0, 2666, 2666, 2666, 2666, 2667, 2667, 0, 2667, 2667, 2667, 2667, 2668, 2668, 0, 2668, 2668, 2668, 2668, 2669, 2669, 0, 2669, 2669, 2669, 2669, 2670, 2670, 0, 2670, 2670, 2670, 2670, 2671, 2671, 0, 2671, 2671, 2671, 2671, 2672, 2672, 0, 2672, 2672, 2672, 2672, 2673, 2673, 0, 2673, 2673, 2673, 2673, 2674, 2674, 0, 2674, 2674, 2674, 2674, 2675, 2675, 0, 2675, 2675, 2675, 2675, 2676, 2676, 0, 2676, 2676, 2676, 2676, 2677, 2677, 0, 2677, 2677, 2677, 2677, 2678, 2678, 0, 2678, 2678, 2678, 2678, 2679, 2679, 0, 2679, 2679, 2679, 2679, 2680, 2680, 0, 2680, 2680, 2680, 2680, 2681, 2681, 0, 2681, 2681, 2681, 2681, 2682, 2682, 0, 2682, 2682, 2682, 2682, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int conf_flex_debug; int conf_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *conftext; #line 1 "conf_lex.l" #line 14 "conf_lex.l" #define YYDEBUG 1 /* * Copyright (C) 1999-2002,2004-2006,2010-2013 Rami Lehti, Pablo * Virolainen, Richard van den Berg, Hannes von Haugwitz * $Header$ * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "aide.h" #include #include "conf_yacc.h" #include "list.h" #include "symboltable.h" #include "commandconf.h" void includehandler(void) ; void conf_put_token(const char*); int firstnotempty(char* s); typedef struct conf_buffer_type { char* buff; char* pos; } conf_buffer_type; list* l_symt=NULL; list* conf_buffer=NULL; int condition=0; int varbol=0; long conf_lineno=1; int newlinelastinconfig=0; #define MAX_INCLUDE_DEPTH 10 YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; int include_stack_ptr = 0; #define YY_INPUT(buf,result,max_size) \ if( ((result=conf_input_wrapper(buf,max_size,confin)) == 0) \ && ferror(confin) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); int var_in_conflval=0; #line 3929 "conf_lex.c" #define INITIAL 0 #define A 1 #define EXPR 2 #define DEFSTMT 3 #define DEFSTMT2 4 #define IFDEFSTMT 5 #define INCLUDE 6 #define EXPREQUHUNT 7 #define VARSUB 8 #define CONFVALHUNT 9 #define IFHOSTSTMT 10 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif static int yy_init_globals (void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int conflex_destroy (void ); int confget_debug (void ); void confset_debug (int debug_flag ); YY_EXTRA_TYPE confget_extra (void ); void confset_extra (YY_EXTRA_TYPE user_defined ); FILE *confget_in (void ); void confset_in (FILE * in_str ); FILE *confget_out (void ); void confset_out (FILE * out_str ); int confget_leng (void ); char *confget_text (void ); int confget_lineno (void ); void confset_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int confwrap (void ); #else extern int confwrap (void ); #endif #endif static void yyunput (int c,char *buf_ptr ); #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void ); #else static int input (void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k */ #define YY_READ_BUF_SIZE 16384 #else #define YY_READ_BUF_SIZE 8192 #endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO do { if (fwrite( conftext, confleng, 1, confout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ size_t n; \ for ( n = 0; n < max_size && \ (c = getc( confin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( confin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, confin))==0 && ferror(confin)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(confin); \ } \ }\ \ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int conflex (void); #define YY_DECL int conflex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after conftext and confleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ if ( confleng > 0 ) \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ (conftext[confleng - 1] == '\n'); \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; #line 76 "conf_lex.l" #line 4132 "conf_lex.c" if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! confin ) confin = stdin; if ( ! confout ) confout = stdout; if ( ! YY_CURRENT_BUFFER ) { confensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = conf_create_buffer(confin,YY_BUF_SIZE ); } conf_load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of conftext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 2439 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 11474 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = (yy_hold_char); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: YY_RULE_SETUP #line 78 "conf_lex.l" { } YY_BREAK case 2: YY_RULE_SETUP #line 82 "conf_lex.l" { putbackvariable(conftext); error(230,"%li:Variable substitution\n",conf_lineno+1); } YY_BREAK case 3: YY_RULE_SETUP #line 92 "conf_lex.l" { conflval.s=strdup(conftext+1+firstnotempty(conftext)); BEGIN(EXPR); return (TEQURXRULE); } YY_BREAK case 4: YY_RULE_SETUP #line 98 "conf_lex.l" { conflval.s=strdup(conftext+firstnotempty(conftext)); error(230,"%li:Selrule\n",conf_lineno); BEGIN(EXPR); return (TSELRXRULE ); } YY_BREAK case 5: YY_RULE_SETUP #line 105 "conf_lex.l" { conflval.s=strdup(conftext+1+firstnotempty(conftext)); error(230,"%li:Negrule\n",conf_lineno); return (TNEGRXRULE ); } YY_BREAK case 6: YY_RULE_SETUP #line 111 "conf_lex.l" { conflval.s=strdup(conftext+firstnotempty(conftext)); error(230,"%li:Equrule\n",conf_lineno); BEGIN(EXPREQUHUNT); return (TSTRING); } YY_BREAK case 7: YY_RULE_SETUP #line 118 "conf_lex.l" { BEGIN(EXPR); return('='); } YY_BREAK case 8: YY_RULE_SETUP #line 124 "conf_lex.l" { conflval.s=strdup(conftext+firstnotempty(conftext)); return (TSTRING); } YY_BREAK case 9: /* rule 9 can match eol */ YY_RULE_SETUP #line 129 "conf_lex.l" { conf_lineno++; return (TNEWLINE); BEGIN 0; } YY_BREAK case 10: YY_RULE_SETUP #line 135 "conf_lex.l" { return ('+'); } YY_BREAK case 11: YY_RULE_SETUP #line 139 "conf_lex.l" { return ('-'); } YY_BREAK case 12: YY_RULE_SETUP #line 143 "conf_lex.l" { error(230," %s",conftext); conflval.s=strdup(conftext); BEGIN (DEFSTMT2); return (TSTRING); } YY_BREAK case 13: YY_RULE_SETUP #line 150 "conf_lex.l" { error(230," %s",conftext); conflval.s=strdup(conftext); return (TSTRING); } YY_BREAK case 14: /* rule 14 can match eol */ YY_RULE_SETUP #line 156 "conf_lex.l" { error(230,"\n"); conf_lineno++; BEGIN 0; return (TNEWLINE); } YY_BREAK case 15: YY_RULE_SETUP #line 163 "conf_lex.l" { error(230,"%li:@@define",conf_lineno); BEGIN DEFSTMT; return (TDEFINE); } YY_BREAK case 16: YY_RULE_SETUP #line 169 "conf_lex.l" { error(230,"%li:@@undef",conf_lineno); BEGIN IFDEFSTMT; return (TUNDEF); } YY_BREAK case 17: YY_RULE_SETUP #line 176 "conf_lex.l" { error(230,"%li:@@ifndef",conf_lineno); BEGIN IFDEFSTMT; return (TIFNDEF); } YY_BREAK case 18: YY_RULE_SETUP #line 182 "conf_lex.l" { error(230,"%li:@@ifdef",conf_lineno); BEGIN IFDEFSTMT; return (TIFDEF); } YY_BREAK case 19: YY_RULE_SETUP #line 188 "conf_lex.l" { error(230,"%li:@@else\n",conf_lineno); BEGIN 0; return (TELSE); } YY_BREAK case 20: YY_RULE_SETUP #line 194 "conf_lex.l" { error(230,"%li:@@endif\n",conf_lineno); BEGIN 0; return (TENDIF); } YY_BREAK case 21: YY_RULE_SETUP #line 200 "conf_lex.l" { error(230,"%li:@@begin_db",conf_lineno); BEGIN 0; return (TBEGIN_DB); } YY_BREAK case 22: YY_RULE_SETUP #line 206 "conf_lex.l" { error(230," %s\n",conftext); conflval.s=strdup(conftext); BEGIN 0; return (TSTRING); } YY_BREAK case 23: YY_RULE_SETUP #line 213 "conf_lex.l" { error(230,"%li:@@ifhost",conf_lineno); BEGIN IFHOSTSTMT; return (TIFHOST); } YY_BREAK case 24: YY_RULE_SETUP #line 219 "conf_lex.l" { error(230,"%li:@@ifnhost",conf_lineno); BEGIN IFHOSTSTMT; return (TIFNHOST); } YY_BREAK case 25: YY_RULE_SETUP #line 225 "conf_lex.l" { error(230," %s\n",conftext); conflval.s=strdup(conftext); BEGIN 0; return (TSTRING); } YY_BREAK case 26: YY_RULE_SETUP #line 232 "conf_lex.l" { conf_put_token("\n@@db_spec"); error(230,"%li:@@db_spec",conf_lineno); return (TDBSPEC); } YY_BREAK case 27: YY_RULE_SETUP #line 238 "conf_lex.l" { error(230,"%li:@@begin_config",conf_lineno); BEGIN CONFVALHUNT; return (TBEGIN_CONFIG); } YY_BREAK case 28: YY_RULE_SETUP #line 244 "conf_lex.l" { return (TEND_CONFIG); } YY_BREAK case 29: YY_RULE_SETUP #line 248 "conf_lex.l" { BEGIN INCLUDE; } YY_BREAK case 30: YY_RULE_SETUP #line 252 "conf_lex.l" { includehandler(); BEGIN 0; error(230,"%li:@@include\n",conf_lineno); return (TNEWLINE); } YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(A): case YY_STATE_EOF(EXPR): case YY_STATE_EOF(DEFSTMT): case YY_STATE_EOF(DEFSTMT2): case YY_STATE_EOF(IFDEFSTMT): case YY_STATE_EOF(INCLUDE): case YY_STATE_EOF(EXPREQUHUNT): case YY_STATE_EOF(VARSUB): case YY_STATE_EOF(CONFVALHUNT): case YY_STATE_EOF(IFHOSTSTMT): #line 259 "conf_lex.l" { if (yy_hold_char=='\n'){ newlinelastinconfig=1; }else { newlinelastinconfig=0; } if ( --include_stack_ptr < 0 ) { yyterminate(); } else { if (confin != stdin ) { fclose(confin); } conf_delete_buffer( YY_CURRENT_BUFFER ); conf_switch_to_buffer( include_stack[include_stack_ptr] ); } } YY_BREAK case 31: YY_RULE_SETUP #line 284 "conf_lex.l" {} YY_BREAK case 32: /* rule 32 can match eol */ YY_RULE_SETUP #line 286 "conf_lex.l" { conf_lineno++; BEGIN 0; return (TNEWLINE); } YY_BREAK case 33: YY_RULE_SETUP #line 292 "conf_lex.l" { error(230,"%li:database =\n",conf_lineno); BEGIN CONFVALHUNT; return (TDATABASE); } YY_BREAK case 34: YY_RULE_SETUP #line 298 "conf_lex.l" { error(230,"%li:database_out =\n",conf_lineno); BEGIN CONFVALHUNT; return (TDATABASE_OUT); } YY_BREAK case 35: YY_RULE_SETUP #line 304 "conf_lex.l" { error(230,"%li:database_new =\n",conf_lineno); BEGIN CONFVALHUNT; return (TDATABASE_NEW); } YY_BREAK case 36: YY_RULE_SETUP #line 310 "conf_lex.l" { error(230,"%li:database_attrs =\n",conf_lineno); BEGIN EXPR; return (TDATABASE_ATTRS); } YY_BREAK case 37: YY_RULE_SETUP #line 316 "conf_lex.l" { error(230,"%li:warn_dead_symlinks =\n",conf_lineno); BEGIN CONFVALHUNT; return (TWARNDEADSYMLINKS); } YY_BREAK case 38: YY_RULE_SETUP #line 322 "conf_lex.l" { error(230,"%li:grouped =\n",conf_lineno); BEGIN CONFVALHUNT; return (TGROUPED); } YY_BREAK case 39: YY_RULE_SETUP #line 328 "conf_lex.l" { error(230,"%li:summarize_changes =\n",conf_lineno); BEGIN CONFVALHUNT; return (TSUMMARIZECHANGES); } YY_BREAK case 40: YY_RULE_SETUP #line 334 "conf_lex.l" { error(230,"%li:acl_no_symlink_follow =\n",conf_lineno); BEGIN CONFVALHUNT; return (TACLNOSYMLINKFOLLOW); } YY_BREAK case 41: YY_RULE_SETUP #line 341 "conf_lex.l" { error(230,"%li:verbose =\n",conf_lineno); return (TVERBOSE); } YY_BREAK case 42: YY_RULE_SETUP #line 346 "conf_lex.l" { error(230,"%li:report_url =\n",conf_lineno); BEGIN CONFVALHUNT; return (TREPORT_URL); } YY_BREAK case 43: YY_RULE_SETUP #line 352 "conf_lex.l" { error(230,"%li:report_detailed_init =\n",conf_lineno); BEGIN CONFVALHUNT; return (TREPORTDETAILEDINIT); } YY_BREAK case 44: YY_RULE_SETUP #line 358 "conf_lex.l" { error(230,"%li:report_base16 =\n",conf_lineno); BEGIN CONFVALHUNT; return (TREPORTBASE16); } YY_BREAK case 45: YY_RULE_SETUP #line 364 "conf_lex.l" { error(230,"%li:gzip_dbout =\n",conf_lineno); BEGIN CONFVALHUNT; return (TGZIPDBOUT); } YY_BREAK case 46: YY_RULE_SETUP #line 370 "conf_lex.l" { error(230,"%li:root_prefix =\n",conf_lineno); BEGIN CONFVALHUNT; return (TROOT_PREFIX); } YY_BREAK case 47: YY_RULE_SETUP #line 376 "conf_lex.l" { error(230,"%li:recstop =\n",conf_lineno); BEGIN CONFVALHUNT; return (TRECSTOP); } YY_BREAK case 48: YY_RULE_SETUP #line 382 "conf_lex.l" { error(230,"%li:config_version =\n",conf_lineno); BEGIN CONFVALHUNT; return (TCONFIG_VERSION); } YY_BREAK case 49: YY_RULE_SETUP #line 388 "conf_lex.l" { BEGIN 0; return (TTRUE); } YY_BREAK case 50: YY_RULE_SETUP #line 393 "conf_lex.l" { BEGIN 0; return (TFALSE); } YY_BREAK case 51: YY_RULE_SETUP #line 398 "conf_lex.l" { conflval.s=strdup(conftext); BEGIN 0; return (TSTRING); } YY_BREAK case 52: YY_RULE_SETUP #line 405 "conf_lex.l" { conflval.s=strdup(conftext); return (TSTRING); } YY_BREAK case 53: YY_RULE_SETUP #line 411 "conf_lex.l" { return(conftext[0]); } YY_BREAK case 54: YY_RULE_SETUP #line 414 "conf_lex.l" ECHO; YY_BREAK #line 4721 "conf_lex.c" case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed confin at a new source and called * conflex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = confin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = (yy_c_buf_p); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( confwrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * conftext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of conflex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ confrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), (size_t) num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; confrestart(confin ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) confrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 2439 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { register int yy_is_jam; register char *yy_cp = (yy_c_buf_p); register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 2439 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 2438); return yy_is_jam ? 0 : yy_current_state; } static void yyunput (int c, register char * yy_bp ) { register char *yy_cp; yy_cp = (yy_c_buf_p); /* undo effects of setting up conftext */ *yy_cp = (yy_hold_char); if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register int number_to_move = (yy_n_chars) + 2; register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; register char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; (yytext_ptr) = yy_bp; (yy_hold_char) = *yy_cp; (yy_c_buf_p) = yy_cp; } #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) #else static int input (void) #endif { int c; *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ *(yy_c_buf_p) = '\0'; else { /* need more input */ int offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ confrestart(confin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( confwrap( ) ) return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ *(yy_c_buf_p) = '\0'; /* preserve conftext */ (yy_hold_char) = *++(yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ void confrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ confensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = conf_create_buffer(confin,YY_BUF_SIZE ); } conf_init_buffer(YY_CURRENT_BUFFER,input_file ); conf_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void conf_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * confpop_buffer_state(); * confpush_buffer_state(new_buffer); */ confensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; conf_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (confwrap()) processing, but the only time this flag * is looked at is after confwrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void conf_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; confin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ YY_BUFFER_STATE conf_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) confalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in conf_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) confalloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in conf_create_buffer()" ); b->yy_is_our_buffer = 1; conf_init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with conf_create_buffer() * */ void conf_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) conffree((void *) b->yy_ch_buf ); conffree((void *) b ); } #ifndef __cplusplus extern int isatty (int ); #endif /* __cplusplus */ /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a confrestart() or at EOF. */ static void conf_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; conf_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then conf_init_buffer was _probably_ * called from confrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ void conf_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) conf_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ void confpush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; confensure_buffer_stack(); /* This block is copied from conf_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from conf_switch_to_buffer. */ conf_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ void confpop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; conf_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { conf_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void confensure_buffer_stack (void) { int num_to_alloc; if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; (yy_buffer_stack) = (struct yy_buffer_state**)confalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in confensure_buffer_stack()" ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; } if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)confrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in confensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE conf_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) confalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in conf_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; conf_switch_to_buffer(b ); return b; } /** Setup the input buffer state to scan a string. The next call to conflex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * conf_scan_bytes() instead. */ YY_BUFFER_STATE conf_scan_string (yyconst char * yystr ) { return conf_scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to conflex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE conf_scan_bytes (yyconst char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) confalloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in conf_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = conf_scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in conf_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif static void yy_fatal_error (yyconst char* msg ) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up conftext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ conftext[confleng] = (yy_hold_char); \ (yy_c_buf_p) = conftext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ confleng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int confget_lineno (void) { return conflineno; } /** Get the input stream. * */ FILE *confget_in (void) { return confin; } /** Get the output stream. * */ FILE *confget_out (void) { return confout; } /** Get the length of the current token. * */ int confget_leng (void) { return confleng; } /** Get the current token. * */ char *confget_text (void) { return conftext; } /** Set the current line number. * @param line_number * */ void confset_lineno (int line_number ) { conflineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param in_str A readable stream. * * @see conf_switch_to_buffer */ void confset_in (FILE * in_str ) { confin = in_str ; } void confset_out (FILE * out_str ) { confout = out_str ; } int confget_debug (void) { return conf_flex_debug; } void confset_debug (int bdebug ) { conf_flex_debug = bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from conflex_destroy(), so don't allocate here. */ (yy_buffer_stack) = 0; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; (yy_c_buf_p) = (char *) 0; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT confin = stdin; confout = stdout; #else confin = (FILE *) 0; confout = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * conflex_init() */ return 0; } /* conflex_destroy is for both reentrant and non-reentrant scanners. */ int conflex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ conf_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; confpop_buffer_state(); } /* Destroy the stack itself. */ conffree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * conflex() is called, initialization will occur. */ yy_init_globals( ); return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *confalloc (yy_size_t size ) { return (void *) malloc( size ); } void *confrealloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } void conffree (void * ptr ) { free( (char *) ptr ); /* see confrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 414 "conf_lex.l" int confwrap(void){ return 1; } void conf_put_token(const char* s){ int i=0; for(i=strlen(s)-1;i>=0;i--){ unput(s[i]); if(s[i]=='\n'){ conf_lineno--; } } } int firstnotempty(char* s){ int i=0; if (s==NULL) { return i; } while( s[i]==' ' || s[i]=='\t') { i++; } return i; } const char* aide_key_4=CONFHMACKEY_04; const char* db_key_4=DBHMACKEY_04; void includehandler(void) { /* got the include file name */ if ( include_stack_ptr >= MAX_INCLUDE_DEPTH ) { error( 0, "Config includes nested too deeply\n" ); exit( 1 ); } if (strcmp(conftext,"-")==0) { confin = stdin; } else { confin = fopen( conftext, "r" ); } if ( ! confin ) { error(0,"Cannot open config file %s\n",conftext); exit(IO_ERROR); } else { include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER; conf_switch_to_buffer(conf_create_buffer( confin, YY_BUF_SIZE ) ); } } aide-0.16~a2.git20130520/src/conf_lex.l000066400000000000000000000211521214657706600171420ustar00rootroot00000000000000SC [\\'"netbgr\ @#] C [a-zA-Z0-9öäüßåÖÄÜÅ_\\=$%£@&/!\^\~;:.,\?\{\}\(\)\[\]\<\>\-\+\*\|\'\`] E [\ ]*"="[\ ]* L [a-zA-ZöäüßåÖÄÜÅ0-9_%] D [0-9] PC \\[^\n] EX [" "\t]* %{ #define YYDEBUG 1 /* * Copyright (C) 1999-2002,2004-2006,2010-2013 Rami Lehti, Pablo * Virolainen, Richard van den Berg, Hannes von Haugwitz * $Header$ * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "aide.h" #include #include "conf_yacc.h" #include "list.h" #include "symboltable.h" #include "commandconf.h" void includehandler(void) ; void conf_put_token(const char*); int firstnotempty(char* s); typedef struct conf_buffer_type { char* buff; char* pos; } conf_buffer_type; list* l_symt=NULL; list* conf_buffer=NULL; int condition=0; int varbol=0; long conf_lineno=1; int newlinelastinconfig=0; #define MAX_INCLUDE_DEPTH 10 YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; int include_stack_ptr = 0; #define YY_INPUT(buf,result,max_size) \ if( ((result=conf_input_wrapper(buf,max_size,yyin)) == 0) \ && ferror(yyin) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); int var_in_conflval=0; %} %Start A EXPR DEFSTMT DEFSTMT2 IFDEFSTMT INCLUDE EXPREQUHUNT VARSUB CONFVALHUNT IFHOSTSTMT %% "#"[^\n]* { } ^[^\n]*"\@\@\{"({L}+)"}"[^\n]* { putbackvariable(conftext); error(230,"%li:Variable substitution\n",conf_lineno+1); } ^[\ \t]*"=/"({C}|{PC})* { conflval.s=strdup(conftext+1+firstnotempty(conftext)); BEGIN(EXPR); return (TEQURXRULE); } ^[\ \t]*"/"({C}|{PC})* { conflval.s=strdup(conftext+firstnotempty(conftext)); error(230,"%li:Selrule\n",conf_lineno); BEGIN(EXPR); return (TSELRXRULE ); } ^[\ \t]*"!/"({C}|{PC})* { conflval.s=strdup(conftext+1+firstnotempty(conftext)); error(230,"%li:Negrule\n",conf_lineno); return (TNEGRXRULE ); } ^[\ \t]*({L})+ { conflval.s=strdup(conftext+firstnotempty(conftext)); error(230,"%li:Equrule\n",conf_lineno); BEGIN(EXPREQUHUNT); return (TSTRING); } [\ \t]*"="[\ \t]* { BEGIN(EXPR); return('='); } [\ \t]*({L}|{D}|">")+ { conflval.s=strdup(conftext+firstnotempty(conftext)); return (TSTRING); } [\ \t]*\n { conf_lineno++; return (TNEWLINE); BEGIN 0; } \+ { return ('+'); } \- { return ('-'); } ({L})+ { error(230," %s",conftext); conflval.s=strdup(conftext); BEGIN (DEFSTMT2); return (TSTRING); } ({C})+ { error(230," %s",conftext); conflval.s=strdup(conftext); return (TSTRING); } [\ \t]*"\n" { error(230,"\n"); conf_lineno++; BEGIN 0; return (TNEWLINE); } ^[\ \t]*"\@\@define" { error(230,"%li:@@define",conf_lineno); BEGIN DEFSTMT; return (TDEFINE); } ^[\ \t]*"\@\@undef" { error(230,"%li:@@undef",conf_lineno); BEGIN IFDEFSTMT; return (TUNDEF); } ^[\ \t]*"\@\@ifndef" { error(230,"%li:@@ifndef",conf_lineno); BEGIN IFDEFSTMT; return (TIFNDEF); } ^[\ \t]*"\@\@ifdef" { error(230,"%li:@@ifdef",conf_lineno); BEGIN IFDEFSTMT; return (TIFDEF); } ^[\ \t]*"\@\@else" { error(230,"%li:@@else\n",conf_lineno); BEGIN 0; return (TELSE); } ^[\ \t]*"\@\@endif" { error(230,"%li:@@endif\n",conf_lineno); BEGIN 0; return (TENDIF); } ^"\@\@begin_db" { error(230,"%li:@@begin_db",conf_lineno); BEGIN 0; return (TBEGIN_DB); } ({L})+ { error(230," %s\n",conftext); conflval.s=strdup(conftext); BEGIN 0; return (TSTRING); } ^[\ \t]*"\@\@ifhost" { error(230,"%li:@@ifhost",conf_lineno); BEGIN IFHOSTSTMT; return (TIFHOST); } ^[\ \t]*"\@\@ifnhost" { error(230,"%li:@@ifnhost",conf_lineno); BEGIN IFHOSTSTMT; return (TIFNHOST); } ({L}|"-")+ { error(230," %s\n",conftext); conflval.s=strdup(conftext); BEGIN 0; return (TSTRING); } ^[\ \t]*"\@\@db_spec" { conf_put_token("\n@@db_spec"); error(230,"%li:@@db_spec",conf_lineno); return (TDBSPEC); } ^[\ \t]*"\@\@begin_config" { error(230,"%li:@@begin_config",conf_lineno); BEGIN CONFVALHUNT; return (TBEGIN_CONFIG); } ^[\ \t]*"\@\@end_config" { return (TEND_CONFIG); } ^[\ \t]*"\@\@include" { BEGIN INCLUDE; } [^ \t\n]+ { includehandler(); BEGIN 0; error(230,"%li:@@include\n",conf_lineno); return (TNEWLINE); } <> { if (yy_hold_char=='\n'){ newlinelastinconfig=1; }else { newlinelastinconfig=0; } if ( --include_stack_ptr < 0 ) { yyterminate(); } else { if (confin != stdin ) { fclose(confin); } conf_delete_buffer( YY_CURRENT_BUFFER ); conf_switch_to_buffer( include_stack[include_stack_ptr] ); } } [\t\ ]+ {} "\n" { conf_lineno++; BEGIN 0; return (TNEWLINE); } ^[\t\ ]*"database"{E} { error(230,"%li:database =\n",conf_lineno); BEGIN CONFVALHUNT; return (TDATABASE); } ^[\t\ ]*"database_out"{E} { error(230,"%li:database_out =\n",conf_lineno); BEGIN CONFVALHUNT; return (TDATABASE_OUT); } ^[\t\ ]*"database_new"{E} { error(230,"%li:database_new =\n",conf_lineno); BEGIN CONFVALHUNT; return (TDATABASE_NEW); } ^[\t\ ]*"database_attrs"{E} { error(230,"%li:database_attrs =\n",conf_lineno); BEGIN EXPR; return (TDATABASE_ATTRS); } ^[\t\ ]*"warn_dead_symlinks"{E} { error(230,"%li:warn_dead_symlinks =\n",conf_lineno); BEGIN CONFVALHUNT; return (TWARNDEADSYMLINKS); } ^[\t\ ]*"grouped"{E} { error(230,"%li:grouped =\n",conf_lineno); BEGIN CONFVALHUNT; return (TGROUPED); } ^[\t\ ]*"summarize_changes"{E} { error(230,"%li:summarize_changes =\n",conf_lineno); BEGIN CONFVALHUNT; return (TSUMMARIZECHANGES); } ^[\t\ ]*"acl_no_symlink_follow"{E} { error(230,"%li:acl_no_symlink_follow =\n",conf_lineno); BEGIN CONFVALHUNT; return (TACLNOSYMLINKFOLLOW); } ^[\t\ ]*"verbose"{E} { error(230,"%li:verbose =\n",conf_lineno); return (TVERBOSE); } ^[\t\ ]*"report_url"{E} { error(230,"%li:report_url =\n",conf_lineno); BEGIN CONFVALHUNT; return (TREPORT_URL); } ^[\t\ ]*"report_detailed_init"{E} { error(230,"%li:report_detailed_init =\n",conf_lineno); BEGIN CONFVALHUNT; return (TREPORTDETAILEDINIT); } ^[\t\ ]*"report_base16"{E} { error(230,"%li:report_base16 =\n",conf_lineno); BEGIN CONFVALHUNT; return (TREPORTBASE16); } ^[\t\ ]*"gzip_dbout"{E} { error(230,"%li:gzip_dbout =\n",conf_lineno); BEGIN CONFVALHUNT; return (TGZIPDBOUT); } ^[\t\ ]*"root_prefix"{E} { error(230,"%li:root_prefix =\n",conf_lineno); BEGIN CONFVALHUNT; return (TROOT_PREFIX); } ^[\t\ ]*"recstop"{E} { error(230,"%li:recstop =\n",conf_lineno); BEGIN CONFVALHUNT; return (TRECSTOP); } ^[\ \t]*"config_version"{E} { error(230,"%li:config_version =\n",conf_lineno); BEGIN CONFVALHUNT; return (TCONFIG_VERSION); } ("yes"|"true") { BEGIN 0; return (TTRUE); } ("no"|"false") { BEGIN 0; return (TFALSE); } ({C})+ { conflval.s=strdup(conftext); BEGIN 0; return (TSTRING); } ({L})+ { conflval.s=strdup(conftext); return (TSTRING); } [^\n] { return(conftext[0]); } %% int confwrap(void){ return 1; } void conf_put_token(const char* s){ int i=0; for(i=strlen(s)-1;i>=0;i--){ unput(s[i]); if(s[i]=='\n'){ conf_lineno--; } } } int firstnotempty(char* s){ int i=0; if (s==NULL) { return i; } while( s[i]==' ' || s[i]=='\t') { i++; } return i; } const char* aide_key_4=CONFHMACKEY_04; const char* db_key_4=DBHMACKEY_04; void includehandler(void) { /* got the include file name */ if ( include_stack_ptr >= MAX_INCLUDE_DEPTH ) { error( 0, "Config includes nested too deeply\n" ); exit( 1 ); } if (strcmp(conftext,"-")==0) { confin = stdin; } else { confin = fopen( conftext, "r" ); } if ( ! confin ) { error(0,"Cannot open config file %s\n",conftext); exit(IO_ERROR); } else { include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER; conf_switch_to_buffer(conf_create_buffer( confin, YY_BUF_SIZE ) ); } } aide-0.16~a2.git20130520/src/conf_yacc.c000066400000000000000000002222341214657706600172640ustar00rootroot00000000000000/* A Bison parser, made by GNU Bison 2.7.12-4996. */ /* Bison implementation for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.7.12-4996" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Push parsers. */ #define YYPUSH 0 /* Pull parsers. */ #define YYPULL 1 /* Substitute the variable and function names. */ #define yyparse confparse #define yylex conflex #define yyerror conferror #define yylval conflval #define yychar confchar #define yydebug confdebug #define yynerrs confnerrs /* Copy the first part of user declarations. */ /* Line 371 of yacc.c */ #line 1 "conf_yacc.y" /* * Copyright (C) 1999-2006,2010-2013 Rami Lehti, Pablo Virolainen, * Richard van den Berg, Hannes von Haugwitz * $Header$ * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "aide.h" #include #include #include #include #include #include "list.h" #include "gen_list.h" #include "db.h" #include "db_config.h" #include "symboltable.h" #include "util.h" #include "commandconf.h" DB_ATTR_TYPE retval=0; extern int conflex(); void conferror(const char*); extern char *conftext; extern long conf_lineno; /* Line 371 of yacc.c */ #line 120 "conf_yacc.c" # ifndef YY_NULL # if defined __cplusplus && 201103L <= __cplusplus # define YY_NULL nullptr # else # define YY_NULL 0 # endif # endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* In a future release of Bison, this section will be replaced by #include "conf_yacc.h". */ #ifndef YY_CONF_CONF_YACC_H_INCLUDED # define YY_CONF_CONF_YACC_H_INCLUDED /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif #if YYDEBUG extern int confdebug; #endif /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { TDEFINE = 258, TUNDEF = 259, TIFDEF = 260, TIFNDEF = 261, TIFNHOST = 262, TIFHOST = 263, TELSE = 264, TENDIF = 265, TINCLUDE = 266, TBEGIN_CONFIG = 267, TEND_CONFIG = 268, TBEGIN_DB = 269, TEND_DB = 270, TEND_DBNOMD = 271, TID = 272, TSTRING = 273, TACLNOSYMLINKFOLLOW = 274, TWARNDEADSYMLINKS = 275, TGROUPED = 276, TSUMMARIZECHANGES = 277, TNEWLINE = 278, TVERBOSE = 279, TREPORTDETAILEDINIT = 280, TREPORTBASE16 = 281, TCONFIG_FILE = 282, TDATABASE = 283, TDATABASE_OUT = 284, TDATABASE_NEW = 285, TDATABASE_ATTRS = 286, TREPORT_URL = 287, TGZIPDBOUT = 288, TROOT_PREFIX = 289, TUMASK = 290, TTRUE = 291, TFALSE = 292, TRECSTOP = 293, TCONFIG_VERSION = 294, TSELRXRULE = 295, TEQURXRULE = 296, TNEGRXRULE = 297, TRIGHTS = 298, TUSER = 299, TGROUP = 300, TINODE = 301, TLINKCOUNT = 302, TFTYPE = 303, TSIZE = 304, TGROWINGSIZE = 305, TATIME = 306, TCTIME = 307, TMTIME = 308, TACL = 309, TXATTRS = 310, TSELINUX = 311, TE2FSATTRS = 312, TTIGER = 313, TSHA1 = 314, TRMD160 = 315, TMD2 = 316, TMD4 = 317, TMD5 = 318, TSHA256 = 319, TSHA512 = 320, TWHIRLPOOL = 321, TL = 322, TR = 323, TGZIPHEADER = 324, TDBSPEC = 325, TUNKNOWN = 326, TNAME = 327, TERROR = 328, TEOF = 329 }; #endif /* Tokens. */ #define TDEFINE 258 #define TUNDEF 259 #define TIFDEF 260 #define TIFNDEF 261 #define TIFNHOST 262 #define TIFHOST 263 #define TELSE 264 #define TENDIF 265 #define TINCLUDE 266 #define TBEGIN_CONFIG 267 #define TEND_CONFIG 268 #define TBEGIN_DB 269 #define TEND_DB 270 #define TEND_DBNOMD 271 #define TID 272 #define TSTRING 273 #define TACLNOSYMLINKFOLLOW 274 #define TWARNDEADSYMLINKS 275 #define TGROUPED 276 #define TSUMMARIZECHANGES 277 #define TNEWLINE 278 #define TVERBOSE 279 #define TREPORTDETAILEDINIT 280 #define TREPORTBASE16 281 #define TCONFIG_FILE 282 #define TDATABASE 283 #define TDATABASE_OUT 284 #define TDATABASE_NEW 285 #define TDATABASE_ATTRS 286 #define TREPORT_URL 287 #define TGZIPDBOUT 288 #define TROOT_PREFIX 289 #define TUMASK 290 #define TTRUE 291 #define TFALSE 292 #define TRECSTOP 293 #define TCONFIG_VERSION 294 #define TSELRXRULE 295 #define TEQURXRULE 296 #define TNEGRXRULE 297 #define TRIGHTS 298 #define TUSER 299 #define TGROUP 300 #define TINODE 301 #define TLINKCOUNT 302 #define TFTYPE 303 #define TSIZE 304 #define TGROWINGSIZE 305 #define TATIME 306 #define TCTIME 307 #define TMTIME 308 #define TACL 309 #define TXATTRS 310 #define TSELINUX 311 #define TE2FSATTRS 312 #define TTIGER 313 #define TSHA1 314 #define TRMD160 315 #define TMD2 316 #define TMD4 317 #define TMD5 318 #define TSHA256 319 #define TSHA512 320 #define TWHIRLPOOL 321 #define TL 322 #define TR 323 #define TGZIPHEADER 324 #define TDBSPEC 325 #define TUNKNOWN 326 #define TNAME 327 #define TERROR 328 #define TEOF 329 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { /* Line 387 of yacc.c */ #line 45 "conf_yacc.y" char* s; DB_ATTR_TYPE i; /* Line 387 of yacc.c */ #line 317 "conf_yacc.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif extern YYSTYPE conflval; #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int confparse (void *YYPARSE_PARAM); #else int confparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int confparse (void); #else int confparse (); #endif #endif /* ! YYPARSE_PARAM */ #endif /* !YY_CONF_CONF_YACC_H_INCLUDED */ /* Copy the second part of user declarations. */ /* Line 390 of yacc.c */ #line 345 "conf_yacc.c" #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #elif (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ # define YY_(Msgid) Msgid # endif #endif #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ # if (! defined __GNUC__ || __GNUC__ < 2 \ || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) # define __attribute__(Spec) /* empty */ # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(E) ((void) (E)) #else # define YYUSE(E) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(N) (N) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID (int yyi) #else static int YYID (yyi) int yyi; #endif { return yyi; } #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED /* Copy COUNT objects from SRC to DST. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ while (YYID (0)) # endif # endif #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 308 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 78 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 41 /* YYNRULES -- Number of rules. */ #define YYNRULES 111 /* YYNRULES -- Number of states. */ #define YYNSTATES 153 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 329 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 76, 2, 77, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 19, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const yytype_uint16 yyprhs[] = { 0, 0, 3, 6, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 79, 83, 86, 90, 92, 94, 98, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 162, 165, 166, 171, 172, 177, 178, 183, 184, 189, 192, 197, 201, 204, 207, 210, 213, 216, 219, 222, 224, 227, 230, 233, 236, 239, 242, 245, 248, 251, 254, 257, 260, 263, 266, 269, 272 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { 79, 0, -1, 79, 80, -1, -1, 81, -1, 82, -1, 83, -1, 89, -1, 90, -1, 91, -1, 93, -1, 95, -1, 97, -1, 100, -1, 101, -1, 102, -1, 103, -1, 106, -1, 104, -1, 111, -1, 118, -1, 105, -1, 116, -1, 114, -1, 112, -1, 117, -1, 110, -1, 113, -1, 115, -1, 109, -1, 107, -1, 108, -1, 75, -1, 24, -1, 71, -1, 14, -1, 15, -1, 1, -1, 41, 85, 84, -1, 42, 85, 84, -1, 43, 84, -1, 43, 85, 84, -1, 24, -1, 75, -1, 85, 76, 85, -1, 85, 77, 85, -1, 86, -1, 88, -1, 87, -1, 18, -1, 44, -1, 45, -1, 46, -1, 47, -1, 48, -1, 49, -1, 50, -1, 51, -1, 52, -1, 53, -1, 54, -1, 68, -1, 69, -1, 55, -1, 56, -1, 57, -1, 58, -1, 59, -1, 60, -1, 61, -1, 64, -1, 65, -1, 66, -1, 67, -1, 3, 18, 18, -1, 4, 18, -1, -1, 5, 18, 92, 99, -1, -1, 6, 18, 94, 99, -1, -1, 8, 18, 96, 99, -1, -1, 7, 18, 98, 99, -1, 79, 10, -1, 79, 9, 79, 10, -1, 18, 19, 85, -1, 29, 18, -1, 30, 18, -1, 31, 18, -1, 25, 18, -1, 33, 18, -1, 32, 85, -1, 12, 18, -1, 13, -1, 20, 37, -1, 20, 38, -1, 21, 37, -1, 21, 38, -1, 26, 37, -1, 26, 38, -1, 27, 37, -1, 27, 38, -1, 22, 37, -1, 35, 18, -1, 22, 38, -1, 23, 37, -1, 23, 38, -1, 34, 37, -1, 34, 38, -1, 39, 18, -1, 40, 18, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 152, 152, 152, 154, 154, 154, 154, 154, 155, 155, 155, 155, 156, 156, 156, 156, 156, 156, 156, 156, 157, 157, 157, 157, 157, 157, 157, 158, 158, 158, 158, 159, 163, 164, 168, 172, 175, 180, 183, 186, 188, 191, 192, 197, 198, 199, 201, 202, 203, 213, 213, 214, 214, 215, 215, 215, 216, 216, 217, 217, 217, 218, 218, 218, 219, 219, 221, 221, 221, 222, 222, 222, 223, 225, 227, 229, 229, 236, 236, 243, 243, 250, 250, 257, 258, 260, 262, 264, 266, 268, 270, 272, 281, 288, 292, 300, 308, 312, 316, 320, 324, 328, 332, 336, 338, 342, 346, 350, 357, 363, 368 }; #endif #if YYDEBUG || YYERROR_VERBOSE || 0 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "TDEFINE", "TUNDEF", "TIFDEF", "TIFNDEF", "TIFNHOST", "TIFHOST", "TELSE", "TENDIF", "TINCLUDE", "TBEGIN_CONFIG", "TEND_CONFIG", "TBEGIN_DB", "TEND_DB", "TEND_DBNOMD", "TID", "TSTRING", "'='", "TACLNOSYMLINKFOLLOW", "TWARNDEADSYMLINKS", "TGROUPED", "TSUMMARIZECHANGES", "TNEWLINE", "TVERBOSE", "TREPORTDETAILEDINIT", "TREPORTBASE16", "TCONFIG_FILE", "TDATABASE", "TDATABASE_OUT", "TDATABASE_NEW", "TDATABASE_ATTRS", "TREPORT_URL", "TGZIPDBOUT", "TROOT_PREFIX", "TUMASK", "TTRUE", "TFALSE", "TRECSTOP", "TCONFIG_VERSION", "TSELRXRULE", "TEQURXRULE", "TNEGRXRULE", "TRIGHTS", "TUSER", "TGROUP", "TINODE", "TLINKCOUNT", "TFTYPE", "TSIZE", "TGROWINGSIZE", "TATIME", "TCTIME", "TMTIME", "TACL", "TXATTRS", "TSELINUX", "TE2FSATTRS", "TTIGER", "TSHA1", "TRMD160", "TMD2", "TMD4", "TMD5", "TSHA256", "TSHA512", "TWHIRLPOOL", "TL", "TR", "TGZIPHEADER", "TDBSPEC", "TUNKNOWN", "TNAME", "TERROR", "TEOF", "'+'", "'-'", "$accept", "lines", "line", "rule", "equrule", "negrule", "newlineoreof", "expr", "primary", "other", "hash", "definestmt", "undefstmt", "ifdefstmt", "$@1", "ifndefstmt", "$@2", "ifhoststmt", "$@3", "ifnhoststmt", "$@4", "ifstmtlist", "groupdef", "db_in", "db_out", "db_new", "verbose", "report", "db_attrs", "beginconfigstmt", "endconfigstmt", "acl_no_symlink_follow", "warn_dead_symlinks", "report_detailed_init", "report_base16", "grouped", "root_prefix", "summarize_changes", "gzipdbout", "recursion_stopper", "config_version", YY_NULL }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 61, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 43, 45 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 78, 79, 79, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 81, 82, 83, 83, 84, 84, 85, 85, 85, 86, 86, 86, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 88, 88, 88, 88, 88, 88, 88, 89, 90, 92, 91, 94, 93, 96, 95, 98, 97, 99, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 109, 110, 110, 111, 111, 112, 112, 113, 114, 113, 115, 115, 116, 116, 117, 118 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 2, 3, 1, 1, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 2, 0, 4, 0, 4, 0, 4, 0, 4, 2, 4, 3, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }; /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. Performed when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { 3, 0, 1, 37, 0, 0, 0, 0, 0, 0, 0, 94, 35, 36, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 32, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 21, 17, 30, 31, 29, 26, 19, 24, 27, 23, 28, 22, 25, 20, 0, 75, 76, 78, 82, 80, 93, 0, 95, 96, 97, 98, 103, 105, 106, 107, 90, 99, 100, 101, 102, 87, 88, 89, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 61, 62, 92, 46, 48, 47, 91, 108, 109, 104, 110, 111, 0, 0, 42, 43, 40, 0, 74, 3, 3, 3, 3, 86, 0, 0, 38, 39, 41, 0, 77, 79, 83, 81, 44, 45, 3, 84, 0, 85 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 142, 37, 38, 39, 40, 129, 115, 116, 117, 118, 41, 42, 43, 132, 44, 133, 45, 135, 46, 134, 143, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -121 static const yytype_int16 yypact[] = { -121, 4, -121, -121, 5, 14, 34, 38, 50, 51, 52, -121, -121, -121, 53, -17, 3, 13, 17, -121, 55, 23, 25, 56, 58, 59, 239, 60, 27, 62, 63, 64, 239, 239, 195, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, 65, -121, -121, -121, -121, -121, -121, 239, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -10, -121, -121, -121, -121, -121, -121, -121, -121, -121, -18, -18, -121, -121, -121, -18, -121, -121, -121, -121, -121, -10, 239, 239, -121, -121, -121, 90, -121, -121, -121, -121, -121, -121, -121, -121, 163, -121 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -121, 0, -121, -121, -121, -121, -77, -31, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -120, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { 1, 125, 126, 130, 2, 3, 127, 4, 5, 6, 7, 8, 9, 144, 145, 146, 10, 11, 12, 13, 74, 75, 14, 66, 15, 16, 17, 18, 19, 20, 21, 22, 67, 23, 24, 25, 26, 27, 28, 29, 76, 77, 136, 30, 31, 32, 33, 34, 139, 140, 78, 79, 68, 141, 80, 81, 69, 128, 137, 138, 83, 84, 85, 86, 120, 121, 137, 138, 70, 71, 72, 0, 73, 82, 87, 35, 88, 89, 119, 36, 122, 123, 124, 131, 0, 0, 0, 0, 0, 0, 0, 3, 0, 4, 5, 6, 7, 8, 9, 149, 150, 0, 10, 11, 12, 13, 147, 148, 14, 0, 15, 16, 17, 18, 19, 20, 21, 22, 0, 23, 24, 25, 26, 27, 28, 29, 0, 0, 0, 30, 31, 32, 33, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 151, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 35, 0, 0, 3, 36, 4, 5, 6, 7, 8, 9, 0, 152, 0, 10, 11, 12, 13, 0, 0, 14, 0, 15, 16, 17, 18, 19, 20, 21, 22, 0, 23, 24, 25, 26, 27, 28, 29, 0, 0, 0, 30, 31, 32, 33, 34, 0, 0, 0, 0, 0, 0, 90, 0, 0, 0, 0, 0, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 36, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 90, 0, 109, 110, 111, 112, 113, 114, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 0, 0, 109, 110, 111, 112, 113, 114 }; #define yypact_value_is_default(Yystate) \ (!!((Yystate) == (-121))) #define yytable_value_is_error(Yytable_value) \ YYID (0) static const yytype_int16 yycheck[] = { 0, 32, 33, 34, 0, 1, 24, 3, 4, 5, 6, 7, 8, 133, 134, 135, 12, 13, 14, 15, 37, 38, 18, 18, 20, 21, 22, 23, 24, 25, 26, 27, 18, 29, 30, 31, 32, 33, 34, 35, 37, 38, 73, 39, 40, 41, 42, 43, 125, 126, 37, 38, 18, 130, 37, 38, 18, 75, 76, 77, 37, 38, 37, 38, 37, 38, 76, 77, 18, 18, 18, -1, 19, 18, 18, 71, 18, 18, 18, 75, 18, 18, 18, 18, -1, -1, -1, -1, -1, -1, -1, 1, -1, 3, 4, 5, 6, 7, 8, 9, 10, -1, 12, 13, 14, 15, 137, 138, 18, -1, 20, 21, 22, 23, 24, 25, 26, 27, -1, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, 39, 40, 41, 42, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 149, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, -1, -1, 1, 75, 3, 4, 5, 6, 7, 8, -1, 10, -1, 12, 13, 14, 15, -1, -1, 18, -1, 20, 21, 22, 23, 24, 25, 26, 27, -1, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, 39, 40, 41, 42, 43, -1, -1, -1, -1, -1, -1, 18, -1, -1, -1, -1, -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, -1, -1, -1, 75, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 18, -1, 64, 65, 66, 67, 68, 69, -1, -1, -1, -1, -1, 75, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, 64, 65, 66, 67, 68, 69 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 79, 0, 1, 3, 4, 5, 6, 7, 8, 12, 13, 14, 15, 18, 20, 21, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 39, 40, 41, 42, 43, 71, 75, 80, 81, 82, 83, 89, 90, 91, 93, 95, 97, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 18, 18, 18, 18, 18, 18, 18, 19, 37, 38, 37, 38, 37, 38, 37, 38, 18, 37, 38, 37, 38, 18, 18, 18, 18, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 65, 66, 67, 68, 69, 85, 86, 87, 88, 18, 37, 38, 18, 18, 18, 85, 85, 24, 75, 84, 85, 18, 92, 94, 98, 96, 85, 76, 77, 84, 84, 84, 79, 99, 99, 99, 99, 85, 85, 9, 10, 79, 10 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. However, YYFAIL appears to be in use. Nevertheless, it is formally deprecated in Bison 2.4.2's NEWS entry, where a plan to phase it out is discussed. */ #define YYFAIL goto yyerrlab #if defined YYFAIL /* This is here to suppress warnings from the GCC cpp's -Wunused-macros. Normally we don't worry about that warning, but some users do, and we want to make it easy for users to remove YYFAIL uses, which will produce warnings from Bison 2.5. */ #endif #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY) \ { \ yychar = (Token); \ yylval = (Value); \ YYPOPSTACK (yylen); \ yystate = *yyssp; \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) /* Error token number */ #define YYTERROR 1 #define YYERRCODE 256 /* This macro is provided for backward compatibility. */ #ifndef YY_LOCATION_PRINT # define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (YYLEX_PARAM) #else # define YYLEX yylex () #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { FILE *yyo = yyoutput; YYUSE (yyo); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # else YYUSE (yyoutput); # endif YYUSE (yytype); } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void yy_stack_print (yybottom, yytop) yytype_int16 *yybottom; yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) { int yybot = *yybottom; YYFPRINTF (stderr, " %d", yybot); } YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void yy_reduce_print (yyvsp, yyrule) YYSTYPE *yyvsp; int yyrule; #endif { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); YYFPRINTF (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, Rule); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) #else static YYSIZE_T yystrlen (yystr) const char *yystr; #endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) #else static char * yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; #endif { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message about the unexpected token YYTOKEN for the state stack whose top is YYSSP. Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is not large enough to hold the message. In that case, also set *YYMSG_ALLOC to the required number of bytes. Return 2 if the required number of bytes is too large to store. */ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULL; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per "expected"). */ int yycount = 0; /* There are many possibilities here to consider: - Assume YYFAIL is not used. It's too flawed to consider. See for details. YYERROR is fine as it does not invoke this function. - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected tokens because there are none. - The only way there can be no lookahead present (in yychar) is if this state is a consistent state with a default action. Thus, detecting the absence of a lookahead is sufficient to determine that there is no unexpected or expected token to report. In that case, just report a simple "syntax error". - Don't assume there isn't a lookahead just because this state is a consistent state with a default action. There might have been a previous inconsistent state, consistent state with a non-default action, or user semantic action that manipulated yychar. - Of course, the expected token list depends on states to have correct lookahead information, and it depends on the parser not to perform extra reductions after fetching a lookahead from the scanner and before detecting a syntax error. Thus, state merging (from LALR or IELR) and default reductions corrupt the expected token list. However, the list is correct for canonical LR with one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ if (yytoken != YYEMPTY) { int yyn = yypact[*yyssp]; yyarg[yycount++] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. In other words, skip the first -YYN actions for this state because they are default actions. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yyx; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR && !yytable_value_is_error (yytable[yyx + yyn])) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; break; } yyarg[yycount++] = yytname[yyx]; { YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } } } } switch (yycount) { # define YYCASE_(N, S) \ case N: \ yyformat = S; \ break YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); # undef YYCASE_ } { YYSIZE_T yysize1 = yysize + yystrlen (yyformat); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } if (*yymsg_alloc < yysize) { *yymsg_alloc = 2 * yysize; if (! (yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; return 1; } /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ { char *yyp = *yymsg; int yyi = 0; while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyformat += 2; } else { yyp++; yyformat++; } } return 0; } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void yydestruct (yymsg, yytype, yyvaluep) const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); YYUSE (yytype); } /* The lookahead symbol. */ int yychar; #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif #ifndef YY_INITIAL_VALUE # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif /* The semantic value of the lookahead symbol. */ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); /* Number of syntax errors so far. */ int yynerrs; /*----------. | yyparse. | `----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () #endif #endif { int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: `yyss': related to states. `yyvs': related to semantic values. Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; YYSIZE_T yystacksize; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; yyssp = yyss = yyssa; yyvsp = yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yytable_value_is_error (yyn)) goto yyerrlab; yyn = -yyn; goto yyreduce; } /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token. */ yychar = YYEMPTY; yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 32: /* Line 1787 of yacc.c */ #line 159 "conf_yacc.y" { newlinelastinconfig=1; YYACCEPT; } break; case 34: /* Line 1787 of yacc.c */ #line 164 "conf_yacc.y" { error(220,"Got @@dbspec.Stopping\n"); YYACCEPT; } break; case 35: /* Line 1787 of yacc.c */ #line 168 "conf_yacc.y" { error(220,"Got @@begin_db. Stopping\n"); YYACCEPT; } break; case 36: /* Line 1787 of yacc.c */ #line 172 "conf_yacc.y" { conferror("Error while reading configuration"); } break; case 37: /* Line 1787 of yacc.c */ #line 175 "conf_yacc.y" { conferror("Error while reading configuration"); YYABORT; } break; case 38: /* Line 1787 of yacc.c */ #line 181 "conf_yacc.y" { decode_string((yyvsp[(1) - (3)].s)); conf->selrxlst=append_rxlist((yyvsp[(1) - (3)].s),(yyvsp[(2) - (3)].i),conf->selrxlst); } break; case 39: /* Line 1787 of yacc.c */ #line 184 "conf_yacc.y" { decode_string((yyvsp[(1) - (3)].s)); conf->equrxlst=append_rxlist((yyvsp[(1) - (3)].s),(yyvsp[(2) - (3)].i),conf->equrxlst); } break; case 40: /* Line 1787 of yacc.c */ #line 187 "conf_yacc.y" { decode_string((yyvsp[(1) - (2)].s)); conf->negrxlst=append_rxlist((yyvsp[(1) - (2)].s),0,conf->negrxlst); } break; case 41: /* Line 1787 of yacc.c */ #line 189 "conf_yacc.y" { decode_string((yyvsp[(1) - (3)].s)); conf->negrxlst=append_rxlist((yyvsp[(1) - (3)].s),0,conf->negrxlst); } break; case 43: /* Line 1787 of yacc.c */ #line 192 "conf_yacc.y" { newlinelastinconfig=0; YYACCEPT; } break; case 44: /* Line 1787 of yacc.c */ #line 197 "conf_yacc.y" { (yyval.i) =(yyvsp[(1) - (3)].i) | (yyvsp[(3) - (3)].i) ; } break; case 45: /* Line 1787 of yacc.c */ #line 198 "conf_yacc.y" { (yyval.i) =(yyvsp[(1) - (3)].i) & (~(yyvsp[(3) - (3)].i) ); } break; case 46: /* Line 1787 of yacc.c */ #line 199 "conf_yacc.y" { (yyval.i) =(yyvsp[(1) - (1)].i) ;} break; case 47: /* Line 1787 of yacc.c */ #line 201 "conf_yacc.y" { (yyval.i) =(yyvsp[(1) - (1)].i) ; } break; case 48: /* Line 1787 of yacc.c */ #line 202 "conf_yacc.y" { (yyval.i) =(yyvsp[(1) - (1)].i) ; } break; case 49: /* Line 1787 of yacc.c */ #line 203 "conf_yacc.y" { if((retval=get_groupval((yyvsp[(1) - (1)].s))) != DB_ATTR_UNDEF) { (yyval.i)=retval; } else { conf_lineno++; // Hack conferror("Error in expression"); YYABORT; } } break; case 50: /* Line 1787 of yacc.c */ #line 213 "conf_yacc.y" { (yyval.i) =(yyvsp[(1) - (1)].i) ;} break; case 51: /* Line 1787 of yacc.c */ #line 213 "conf_yacc.y" {(yyval.i) =(yyvsp[(1) - (1)].i) ;} break; case 52: /* Line 1787 of yacc.c */ #line 214 "conf_yacc.y" {(yyval.i) =(yyvsp[(1) - (1)].i) ;} break; case 53: /* Line 1787 of yacc.c */ #line 214 "conf_yacc.y" {(yyval.i) =(yyvsp[(1) - (1)].i) ;} break; case 54: /* Line 1787 of yacc.c */ #line 215 "conf_yacc.y" {(yyval.i) =(yyvsp[(1) - (1)].i) ;} break; case 55: /* Line 1787 of yacc.c */ #line 215 "conf_yacc.y" {(yyval.i) =(yyvsp[(1) - (1)].i) ;} break; case 56: /* Line 1787 of yacc.c */ #line 215 "conf_yacc.y" {(yyval.i) =(yyvsp[(1) - (1)].i) ;} break; case 57: /* Line 1787 of yacc.c */ #line 216 "conf_yacc.y" {(yyval.i) =(yyvsp[(1) - (1)].i) ;} break; case 58: /* Line 1787 of yacc.c */ #line 216 "conf_yacc.y" {(yyval.i) =(yyvsp[(1) - (1)].i) ;} break; case 59: /* Line 1787 of yacc.c */ #line 217 "conf_yacc.y" {(yyval.i) =(yyvsp[(1) - (1)].i) ;} break; case 60: /* Line 1787 of yacc.c */ #line 217 "conf_yacc.y" {(yyval.i) =(yyvsp[(1) - (1)].i) ;} break; case 61: /* Line 1787 of yacc.c */ #line 217 "conf_yacc.y" {(yyval.i) = (yyvsp[(1) - (1)].i);} break; case 62: /* Line 1787 of yacc.c */ #line 218 "conf_yacc.y" {(yyval.i) = (yyvsp[(1) - (1)].i);} break; case 63: /* Line 1787 of yacc.c */ #line 218 "conf_yacc.y" {(yyval.i) =(yyvsp[(1) - (1)].i) ;} break; case 64: /* Line 1787 of yacc.c */ #line 218 "conf_yacc.y" {(yyval.i) =(yyvsp[(1) - (1)].i) ;} break; case 65: /* Line 1787 of yacc.c */ #line 219 "conf_yacc.y" {(yyval.i) =(yyvsp[(1) - (1)].i) ;} break; case 66: /* Line 1787 of yacc.c */ #line 219 "conf_yacc.y" {(yyval.i) =(yyvsp[(1) - (1)].i) ;} break; case 67: /* Line 1787 of yacc.c */ #line 221 "conf_yacc.y" { (yyval.i) =(yyvsp[(1) - (1)].i) ;} break; case 68: /* Line 1787 of yacc.c */ #line 221 "conf_yacc.y" { (yyval.i) =(yyvsp[(1) - (1)].i) ;} break; case 69: /* Line 1787 of yacc.c */ #line 221 "conf_yacc.y" { (yyval.i) =(yyvsp[(1) - (1)].i) ;} break; case 70: /* Line 1787 of yacc.c */ #line 222 "conf_yacc.y" {(yyval.i) =(yyvsp[(1) - (1)].i) ;} break; case 71: /* Line 1787 of yacc.c */ #line 222 "conf_yacc.y" { (yyval.i) =(yyvsp[(1) - (1)].i) ;} break; case 72: /* Line 1787 of yacc.c */ #line 222 "conf_yacc.y" { (yyval.i) =(yyvsp[(1) - (1)].i) ;} break; case 73: /* Line 1787 of yacc.c */ #line 223 "conf_yacc.y" { (yyval.i) =(yyvsp[(1) - (1)].i) ;} break; case 74: /* Line 1787 of yacc.c */ #line 225 "conf_yacc.y" { do_define((yyvsp[(2) - (3)].s),(yyvsp[(3) - (3)].s)); } break; case 75: /* Line 1787 of yacc.c */ #line 227 "conf_yacc.y" { do_undefine((yyvsp[(2) - (2)].s)); } break; case 76: /* Line 1787 of yacc.c */ #line 229 "conf_yacc.y" { if(do_ifxdef(1,(yyvsp[(2) - (2)].s))==-1){ error(0,"ifdef error\n"); YYABORT; }; } break; case 78: /* Line 1787 of yacc.c */ #line 236 "conf_yacc.y" { if(do_ifxdef(0,(yyvsp[(2) - (2)].s))==-1){ error(0,"ifndef error\n"); YYABORT; }; } break; case 79: /* Line 1787 of yacc.c */ #line 241 "conf_yacc.y" { error(220,"Ifndef statement ended\n");} break; case 80: /* Line 1787 of yacc.c */ #line 243 "conf_yacc.y" { if(do_ifxhost(1,(yyvsp[(2) - (2)].s))==-1){ error(0,"ifhost error\n"); YYABORT; }; } break; case 82: /* Line 1787 of yacc.c */ #line 250 "conf_yacc.y" { if(do_ifxhost(0,(yyvsp[(2) - (2)].s))==-1){ error(0,"ifnhost error\n"); YYABORT; }; } break; case 84: /* Line 1787 of yacc.c */ #line 257 "conf_yacc.y" { error(220,"Endif stmt matched\n");} break; case 85: /* Line 1787 of yacc.c */ #line 258 "conf_yacc.y" {error(220,"Endifelse stmt matched\n");} break; case 86: /* Line 1787 of yacc.c */ #line 260 "conf_yacc.y" { do_groupdef((yyvsp[(1) - (3)].s),(yyvsp[(3) - (3)].i)); } break; case 87: /* Line 1787 of yacc.c */ #line 262 "conf_yacc.y" { do_dbdef(DB_OLD,(yyvsp[(2) - (2)].s)); } break; case 88: /* Line 1787 of yacc.c */ #line 264 "conf_yacc.y" { do_dbdef(DB_WRITE,(yyvsp[(2) - (2)].s)); } break; case 89: /* Line 1787 of yacc.c */ #line 266 "conf_yacc.y" { do_dbdef(DB_NEW,(yyvsp[(2) - (2)].s)); } break; case 90: /* Line 1787 of yacc.c */ #line 268 "conf_yacc.y" { do_verbdef((yyvsp[(2) - (2)].s)); } break; case 91: /* Line 1787 of yacc.c */ #line 270 "conf_yacc.y" { do_repurldef((yyvsp[(2) - (2)].s)); } break; case 92: /* Line 1787 of yacc.c */ #line 272 "conf_yacc.y" { DB_ATTR_TYPE attr; if((attr = (yyvsp[(2) - (2)].i)&(~DB_HASHES))){ error(0, "%li: invalid attribute(s) in database_attrs: %llx\n", conf_lineno-1, attr); YYABORT; } conf->db_attrs=(yyvsp[(2) - (2)].i); } break; case 93: /* Line 1787 of yacc.c */ #line 281 "conf_yacc.y" { #ifdef WITH_MHASH conf->do_configmd=1; conf->old_confmdstr=strdup((yyvsp[(2) - (2)].s)); #endif } break; case 94: /* Line 1787 of yacc.c */ #line 288 "conf_yacc.y" { YYACCEPT; } break; case 95: /* Line 1787 of yacc.c */ #line 292 "conf_yacc.y" { #ifdef WITH_ACL conf->no_acl_on_symlinks=1; #else error(0,"ACL-support not compiled in.\n"); #endif } break; case 96: /* Line 1787 of yacc.c */ #line 300 "conf_yacc.y" { #ifdef WITH_ACL conf->no_acl_on_symlinks=0; #else error(0,"ACL-support not compiled in.\n"); #endif } break; case 97: /* Line 1787 of yacc.c */ #line 308 "conf_yacc.y" { conf->warn_dead_symlinks=1; } break; case 98: /* Line 1787 of yacc.c */ #line 312 "conf_yacc.y" { conf->warn_dead_symlinks=0; } break; case 99: /* Line 1787 of yacc.c */ #line 316 "conf_yacc.y" { conf->report_detailed_init=1; } break; case 100: /* Line 1787 of yacc.c */ #line 320 "conf_yacc.y" { conf->report_detailed_init=0; } break; case 101: /* Line 1787 of yacc.c */ #line 324 "conf_yacc.y" { conf->report_base16=1; } break; case 102: /* Line 1787 of yacc.c */ #line 328 "conf_yacc.y" { conf->report_base16=0; } break; case 103: /* Line 1787 of yacc.c */ #line 332 "conf_yacc.y" { conf->grouped=1; } break; case 104: /* Line 1787 of yacc.c */ #line 336 "conf_yacc.y" { do_rootprefix((yyvsp[(2) - (2)].s)); } break; case 105: /* Line 1787 of yacc.c */ #line 338 "conf_yacc.y" { conf->grouped=0; } break; case 106: /* Line 1787 of yacc.c */ #line 342 "conf_yacc.y" { conf->summarize_changes=1; } break; case 107: /* Line 1787 of yacc.c */ #line 346 "conf_yacc.y" { conf->summarize_changes=0; } break; case 108: /* Line 1787 of yacc.c */ #line 350 "conf_yacc.y" { #ifdef WITH_ZLIB conf->gzip_dbout=1; #else error(0,"Gzip-support not compiled in.\n"); #endif } break; case 109: /* Line 1787 of yacc.c */ #line 357 "conf_yacc.y" { #ifdef WITH_ZLIB conf->gzip_dbout=0; #endif } break; case 110: /* Line 1787 of yacc.c */ #line 363 "conf_yacc.y" { /* FIXME implement me */ } break; case 111: /* Line 1787 of yacc.c */ #line 368 "conf_yacc.y" { conf->config_version=strdup((yyvsp[(2) - (2)].s)); } break; /* Line 1787 of yacc.c */ #line 2294 "conf_yacc.c" default: break; } /* User semantic actions sometimes alter yychar, and that requires that yytoken be updated with the new translation. We take the approach of translating immediately before every use of yytoken. One alternative is translating here after every semantic action, but that translation would be missed if the semantic action invokes YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an incorrect destructor might then be invoked immediately. In the case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ yyssp, yytoken) { char const *yymsgp = YY_("syntax error"); int yysyntax_error_status; yysyntax_error_status = YYSYNTAX_ERROR; if (yysyntax_error_status == 0) yymsgp = yymsg; else if (yysyntax_error_status == 1) { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); if (!yymsg) { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; yysyntax_error_status = 2; } else { yysyntax_error_status = YYSYNTAX_ERROR; yymsgp = yymsg; } } yyerror (yymsgp); if (yysyntax_error_status == 2) goto yyexhaustedlab; } # undef YYSYNTAX_ERROR #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEMPTY) { /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = YYTRANSLATE (yychar); yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); } /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif /* Make sure YYID is used. */ return YYID (yyresult); } /* Line 2050 of yacc.c */ #line 372 "conf_yacc.y" void conferror(const char *msg){ error(0,"%li:%s:%s\n",conf_lineno-1,msg,conftext); } const char* aide_key_1=CONFHMACKEY_01; const char* db_key_1=DBHMACKEY_01; aide-0.16~a2.git20130520/src/conf_yacc.h000066400000000000000000000131201214657706600172610ustar00rootroot00000000000000/* A Bison parser, made by GNU Bison 2.7.12-4996. */ /* Bison interface for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ #ifndef YY_CONF_CONF_YACC_H_INCLUDED # define YY_CONF_CONF_YACC_H_INCLUDED /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif #if YYDEBUG extern int confdebug; #endif /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { TDEFINE = 258, TUNDEF = 259, TIFDEF = 260, TIFNDEF = 261, TIFNHOST = 262, TIFHOST = 263, TELSE = 264, TENDIF = 265, TINCLUDE = 266, TBEGIN_CONFIG = 267, TEND_CONFIG = 268, TBEGIN_DB = 269, TEND_DB = 270, TEND_DBNOMD = 271, TID = 272, TSTRING = 273, TACLNOSYMLINKFOLLOW = 274, TWARNDEADSYMLINKS = 275, TGROUPED = 276, TSUMMARIZECHANGES = 277, TNEWLINE = 278, TVERBOSE = 279, TREPORTDETAILEDINIT = 280, TREPORTBASE16 = 281, TCONFIG_FILE = 282, TDATABASE = 283, TDATABASE_OUT = 284, TDATABASE_NEW = 285, TDATABASE_ATTRS = 286, TREPORT_URL = 287, TGZIPDBOUT = 288, TROOT_PREFIX = 289, TUMASK = 290, TTRUE = 291, TFALSE = 292, TRECSTOP = 293, TCONFIG_VERSION = 294, TSELRXRULE = 295, TEQURXRULE = 296, TNEGRXRULE = 297, TRIGHTS = 298, TUSER = 299, TGROUP = 300, TINODE = 301, TLINKCOUNT = 302, TFTYPE = 303, TSIZE = 304, TGROWINGSIZE = 305, TATIME = 306, TCTIME = 307, TMTIME = 308, TACL = 309, TXATTRS = 310, TSELINUX = 311, TE2FSATTRS = 312, TTIGER = 313, TSHA1 = 314, TRMD160 = 315, TMD2 = 316, TMD4 = 317, TMD5 = 318, TSHA256 = 319, TSHA512 = 320, TWHIRLPOOL = 321, TL = 322, TR = 323, TGZIPHEADER = 324, TDBSPEC = 325, TUNKNOWN = 326, TNAME = 327, TERROR = 328, TEOF = 329 }; #endif /* Tokens. */ #define TDEFINE 258 #define TUNDEF 259 #define TIFDEF 260 #define TIFNDEF 261 #define TIFNHOST 262 #define TIFHOST 263 #define TELSE 264 #define TENDIF 265 #define TINCLUDE 266 #define TBEGIN_CONFIG 267 #define TEND_CONFIG 268 #define TBEGIN_DB 269 #define TEND_DB 270 #define TEND_DBNOMD 271 #define TID 272 #define TSTRING 273 #define TACLNOSYMLINKFOLLOW 274 #define TWARNDEADSYMLINKS 275 #define TGROUPED 276 #define TSUMMARIZECHANGES 277 #define TNEWLINE 278 #define TVERBOSE 279 #define TREPORTDETAILEDINIT 280 #define TREPORTBASE16 281 #define TCONFIG_FILE 282 #define TDATABASE 283 #define TDATABASE_OUT 284 #define TDATABASE_NEW 285 #define TDATABASE_ATTRS 286 #define TREPORT_URL 287 #define TGZIPDBOUT 288 #define TROOT_PREFIX 289 #define TUMASK 290 #define TTRUE 291 #define TFALSE 292 #define TRECSTOP 293 #define TCONFIG_VERSION 294 #define TSELRXRULE 295 #define TEQURXRULE 296 #define TNEGRXRULE 297 #define TRIGHTS 298 #define TUSER 299 #define TGROUP 300 #define TINODE 301 #define TLINKCOUNT 302 #define TFTYPE 303 #define TSIZE 304 #define TGROWINGSIZE 305 #define TATIME 306 #define TCTIME 307 #define TMTIME 308 #define TACL 309 #define TXATTRS 310 #define TSELINUX 311 #define TE2FSATTRS 312 #define TTIGER 313 #define TSHA1 314 #define TRMD160 315 #define TMD2 316 #define TMD4 317 #define TMD5 318 #define TSHA256 319 #define TSHA512 320 #define TWHIRLPOOL 321 #define TL 322 #define TR 323 #define TGZIPHEADER 324 #define TDBSPEC 325 #define TUNKNOWN 326 #define TNAME 327 #define TERROR 328 #define TEOF 329 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { /* Line 2053 of yacc.c */ #line 45 "conf_yacc.y" char* s; DB_ATTR_TYPE i; /* Line 2053 of yacc.c */ #line 211 "conf_yacc.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif extern YYSTYPE conflval; #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int confparse (void *YYPARSE_PARAM); #else int confparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int confparse (void); #else int confparse (); #endif #endif /* ! YYPARSE_PARAM */ #endif /* !YY_CONF_CONF_YACC_H_INCLUDED */ aide-0.16~a2.git20130520/src/conf_yacc.y000066400000000000000000000202511214657706600173050ustar00rootroot00000000000000%{ /* * Copyright (C) 1999-2006,2010-2013 Rami Lehti, Pablo Virolainen, * Richard van den Berg, Hannes von Haugwitz * $Header$ * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "aide.h" #include #include #include #include #include #include "list.h" #include "gen_list.h" #include "db.h" #include "db_config.h" #include "symboltable.h" #include "util.h" #include "commandconf.h" DB_ATTR_TYPE retval=0; extern int conflex(); void conferror(const char*); extern char *conftext; extern long conf_lineno; %} %union { char* s; DB_ATTR_TYPE i; } %start lines %token TDEFINE %token TUNDEF %token TIFDEF %token TIFNDEF %token TIFNHOST %token TIFHOST %token TELSE %token TENDIF %token TINCLUDE %token TBEGIN_CONFIG %token TEND_CONFIG %token TBEGIN_DB %token TEND_DB %token TEND_DBNOMD %token TID %token TSTRING %token '=' %token TACLNOSYMLINKFOLLOW %token TWARNDEADSYMLINKS %token TGROUPED %token TSUMMARIZECHANGES %token TNEWLINE %token TVERBOSE %token TREPORTDETAILEDINIT %token TREPORTBASE16 %token TCONFIG_FILE %token TDATABASE %token TDATABASE_OUT %token TDATABASE_NEW %token TDATABASE_ATTRS %token TREPORT_URL %token TGZIPDBOUT %token TROOT_PREFIX %token TUMASK %token TTRUE %token TFALSE %token TRECSTOP %token TCONFIG_VERSION /* File rule */ %token TSELRXRULE %token TEQURXRULE %token TNEGRXRULE /* expr alkiot */ %token TRIGHTS %token TUSER %token TGROUP %token TINODE %token TLINKCOUNT %token TFTYPE %token TSIZE %token TGROWINGSIZE %token TATIME %token TCTIME %token TMTIME %token TACL %token TXATTRS %token TSELINUX %token TE2FSATTRS /* hash funktions */ %token TTIGER %token TSHA1 %token TRMD160 %token TMD2 %token TMD4 %token TMD5 %token TSHA256 %token TSHA512 %token TWHIRLPOOL /* predefs */ %token TL %token TR /* For db_lex */ %token TGZIPHEADER %token TDBSPEC %token TUNKNOWN %token TNAME %token TERROR %token TEOF %type expr %type hash %type primary other %left '+' '-' %% lines : lines line | ; line : rule | equrule | negrule | definestmt | undefstmt | ifdefstmt | ifndefstmt | ifhoststmt | ifnhoststmt | groupdef | db_in | db_out | db_new | db_attrs | verbose | report_detailed_init | config_version | report | gzipdbout | root_prefix | report_base16 | recursion_stopper | warn_dead_symlinks | grouped | summarize_changes | acl_no_symlink_follow | beginconfigstmt | endconfigstmt | TEOF { newlinelastinconfig=1; YYACCEPT; } | TNEWLINE | TDBSPEC { error(220,"Got @@dbspec.Stopping\n"); YYACCEPT; } | TBEGIN_DB { error(220,"Got @@begin_db. Stopping\n"); YYACCEPT; } | TEND_DB { conferror("Error while reading configuration"); } | error { conferror("Error while reading configuration"); YYABORT; } ; rule : TSELRXRULE expr newlineoreof { decode_string($1); conf->selrxlst=append_rxlist($1,$2,conf->selrxlst); } ; equrule : TEQURXRULE expr newlineoreof { decode_string($1); conf->equrxlst=append_rxlist($1,$2,conf->equrxlst); } ; negrule : TNEGRXRULE newlineoreof { decode_string($1); conf->negrxlst=append_rxlist($1,0,conf->negrxlst); } | TNEGRXRULE expr newlineoreof { decode_string($1); conf->negrxlst=append_rxlist($1,0,conf->negrxlst); }; newlineoreof : TNEWLINE | TEOF { newlinelastinconfig=0; YYACCEPT; } ; expr : expr '+' expr { $$ =$1 | $3 ; } | expr '-' expr { $$ =$1 & (~$3 ); } | primary { $$ =$1 ;} ; primary : hash { $$ =$1 ; } | other { $$ =$1 ; } | TSTRING { if((retval=get_groupval($1)) != DB_ATTR_UNDEF) { $$=retval; } else { conf_lineno++; // Hack conferror("Error in expression"); YYABORT; } } ; other : TRIGHTS { $$ =$1 ;} | TUSER {$$ =$1 ;} | TGROUP {$$ =$1 ;} | TINODE {$$ =$1 ;} | TLINKCOUNT {$$ =$1 ;} | TFTYPE {$$ =$1 ;} | TSIZE {$$ =$1 ;} | TGROWINGSIZE {$$ =$1 ;} | TATIME {$$ =$1 ;} | TCTIME {$$ =$1 ;} | TMTIME {$$ =$1 ;} | TL {$$ = $1;} | TR {$$ = $1;} | TACL {$$ =$1 ;} | TXATTRS {$$ =$1 ;} | TSELINUX {$$ =$1 ;} | TE2FSATTRS {$$ =$1 ;}; hash : TTIGER { $$ =$1 ;} | TSHA1 { $$ =$1 ;} | TRMD160 { $$ =$1 ;} | TMD5 {$$ =$1 ;} | TSHA256 { $$ =$1 ;} | TSHA512 { $$ =$1 ;} | TWHIRLPOOL { $$ =$1 ;}; definestmt : TDEFINE TSTRING TSTRING { do_define($2,$3); }; undefstmt : TUNDEF TSTRING { do_undefine($2); } ; ifdefstmt : TIFDEF TSTRING { if(do_ifxdef(1,$2)==-1){ error(0,"ifdef error\n"); YYABORT; }; } ifstmtlist ; ifndefstmt : TIFNDEF TSTRING { if(do_ifxdef(0,$2)==-1){ error(0,"ifndef error\n"); YYABORT; }; } ifstmtlist { error(220,"Ifndef statement ended\n");} ; ifhoststmt : TIFHOST TSTRING { if(do_ifxhost(1,$2)==-1){ error(0,"ifhost error\n"); YYABORT; }; } ifstmtlist ; ifnhoststmt : TIFNHOST TSTRING { if(do_ifxhost(0,$2)==-1){ error(0,"ifnhost error\n"); YYABORT; }; } ifstmtlist ; ifstmtlist : lines TENDIF { error(220,"Endif stmt matched\n");} | lines TELSE lines TENDIF {error(220,"Endifelse stmt matched\n");} ; groupdef : TSTRING '=' expr { do_groupdef($1,$3); } ; db_in : TDATABASE TSTRING { do_dbdef(DB_OLD,$2); }; db_out : TDATABASE_OUT TSTRING { do_dbdef(DB_WRITE,$2); }; db_new : TDATABASE_NEW TSTRING { do_dbdef(DB_NEW,$2); }; verbose : TVERBOSE TSTRING { do_verbdef($2); }; report : TREPORT_URL TSTRING { do_repurldef($2); } ; db_attrs : TDATABASE_ATTRS expr { DB_ATTR_TYPE attr; if((attr = $2&(~DB_HASHES))){ error(0, "%li: invalid attribute(s) in database_attrs: %llx\n", conf_lineno-1, attr); YYABORT; } conf->db_attrs=$2; } ; beginconfigstmt : TBEGIN_CONFIG TSTRING { #ifdef WITH_MHASH conf->do_configmd=1; conf->old_confmdstr=strdup($2); #endif } ; endconfigstmt : TEND_CONFIG { YYACCEPT; } ; acl_no_symlink_follow : TACLNOSYMLINKFOLLOW TTRUE { #ifdef WITH_ACL conf->no_acl_on_symlinks=1; #else error(0,"ACL-support not compiled in.\n"); #endif } ; acl_no_symlink_follow : TACLNOSYMLINKFOLLOW TFALSE { #ifdef WITH_ACL conf->no_acl_on_symlinks=0; #else error(0,"ACL-support not compiled in.\n"); #endif } ; warn_dead_symlinks : TWARNDEADSYMLINKS TTRUE { conf->warn_dead_symlinks=1; } ; warn_dead_symlinks : TWARNDEADSYMLINKS TFALSE { conf->warn_dead_symlinks=0; } ; report_detailed_init : TREPORTDETAILEDINIT TTRUE { conf->report_detailed_init=1; } ; report_detailed_init : TREPORTDETAILEDINIT TFALSE { conf->report_detailed_init=0; } ; report_base16 : TREPORTBASE16 TTRUE { conf->report_base16=1; } ; report_base16 : TREPORTBASE16 TFALSE { conf->report_base16=0; } ; grouped : TGROUPED TTRUE { conf->grouped=1; } ; root_prefix : TROOT_PREFIX TSTRING { do_rootprefix($2); }; grouped : TGROUPED TFALSE { conf->grouped=0; } ; summarize_changes : TSUMMARIZECHANGES TTRUE { conf->summarize_changes=1; } ; summarize_changes : TSUMMARIZECHANGES TFALSE { conf->summarize_changes=0; } ; gzipdbout : TGZIPDBOUT TTRUE { #ifdef WITH_ZLIB conf->gzip_dbout=1; #else error(0,"Gzip-support not compiled in.\n"); #endif } | TGZIPDBOUT TFALSE { #ifdef WITH_ZLIB conf->gzip_dbout=0; #endif } ; recursion_stopper : TRECSTOP TSTRING { /* FIXME implement me */ } ; config_version : TCONFIG_VERSION TSTRING { conf->config_version=strdup($2); } ; %% void conferror(const char *msg){ error(0,"%li:%s:%s\n",conf_lineno-1,msg,conftext); } const char* aide_key_1=CONFHMACKEY_01; const char* db_key_1=DBHMACKEY_01; aide-0.16~a2.git20130520/src/db.c000066400000000000000000000467451214657706600157400ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2006,2010,2011,2013 Rami Lehti, Pablo Virolainen, * Richard van den Berg, Hannes von Haugwitz * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "aide.h" #include #include #include #include "db.h" #include "db_file.h" #include "db_disk.h" #include "md.h" #ifdef WITH_PSQL #include "db_sql.h" #endif #include "db_config.h" #include "report.h" #include "be.h" #ifdef WITH_MHASH #include #endif #include "base64.h" #include "util.h" /*for locale support*/ #include "locale-aide.h" /*for locale support*/ db_line* db_char2line(char** ss,int db); long readint(char* s,char* err); AIDE_OFF_TYPE readlong(char* s,char* err); long readoct(char* s,char* err); time_t base64totime_t(char*); const char* db_names[db_unknown+1] = { "name", "lname", "perm", "uid", "gid", "size", "atime", "ctime", "mtime", "inode", "bcount", "lcount", "md5", "sha1", "rmd160", "tiger", "crc32", "haval", "gost", "crc32b", "attr", "acl", "bsize", "rdev", "dev", "checkmask", "allownewfiles", "allowrmfiles", "sha256", "sha512", "whirlpool", "selinux", "xattrs", "e2fsattrs", "unknown"} ; const int db_value[db_unknown+1] = { db_filename, /* "name", */ db_linkname, /* "lname", */ db_perm, /* "perm", */ db_uid, /* "uid", */ db_gid, /* "gid", */ db_size, /* "size", */ db_atime, /* "atime", */ db_ctime, /* "ctime", */ db_mtime, /* "mtime", */ db_inode, /* "inode", */ db_bcount, /* "bcount", */ db_lnkcount, /* "lcount", */ db_md5, /* "md5", */ db_sha1, /* "sha1", */ db_rmd160, /* "rmd160", */ db_tiger, /* "tiger", */ db_crc32, /* "crc32", */ db_haval, /* "haval", */ db_gost, /* "gost", */ db_crc32b, /* "crc32b", */ db_attr, /* attributes */ db_acl, /* "acl" */ db_bsize, /* "bsize" */ db_rdev, /* "rdev" */ db_dev, /* "dev" */ db_checkmask, /* "checkmask" */ db_allownewfile, /* "allownewfile" */ db_allowrmfile, /* "allowrmfile" */ db_sha256, /* "sha256", */ db_sha512, /* "sha512", */ db_whirlpool, /* "whirlpool", */ db_selinux, /* "selinux", */ db_xattrs, /* "xattrs", */ db_e2fsattrs, /* "e2fsattrs", */ db_unknown }; /* "unknown" */ const char* db_namealias[db_alias_size] = { "count" } ; const int db_aliasvalue[db_alias_size] = { db_lnkcount } ; /* "count", */ static struct md_container *init_db_attrs(URL_TYPE type) { struct md_container *mdc = NULL; if (conf->db_attrs) { switch (type) { case url_stdout: case url_stderr: case url_fd: case url_file: #ifdef WITH_CURL case url_http: case url_https: case url_ftp: #endif /* WITH CURL */ mdc = malloc(sizeof(struct md_container)); /* freed in close_db_attrs */ mdc->todo_attr = conf->db_attrs; init_md(mdc); break; #ifdef WITH_PSQL case url_sql: break; #endif /* WITH_PSQL */ default : error(200,_("init_db_attrs(): Unknown url type.\n")); } } return mdc; } static db_line *close_db_attrs (struct md_container *mdc, char *url_value) { db_line *line = NULL; if (mdc != NULL) { close_md(mdc); line = malloc(sizeof(struct db_line)); line->filename = url_value; line->perm = 0; line->attr = conf->db_attrs; md2line(mdc, line); free(mdc); } return line; } int db_init(int db) { void* rv=NULL; error(200,"db_init %i\n",db); switch(db) { case DB_DISK: { /* Should we actually do something here? */ return db_disk_init(); } case DB_OLD: { conf->mdc_in = init_db_attrs((conf->db_in_url)->type); rv=be_init(1,conf->db_in_url,0); if(rv==NULL) { error(200,_("db_in is null\n")); return RETFAIL; } conf->db_in=rv; error(200,_("db_in is nonnull\n")); return RETOK; } case DB_WRITE: { #ifdef WITH_ZLIB conf->mdc_out = init_db_attrs((conf->db_out_url)->type); if(conf->gzip_dbout){ rv=be_init(0,conf->db_out_url,conf->gzip_dbout); conf->db_gzout=rv; } else{ #endif rv=be_init(0,conf->db_out_url,0); conf->db_out=rv; #ifdef WITH_ZLIB } #endif if(rv==NULL){ error(200,_("db_out is null\n")); return RETFAIL; } error(200,_("db_out is nonnull %s\n"),conf->db_out_url->value); return RETOK; } case DB_NEW: { conf->mdc_out = init_db_attrs((conf->db_new_url)->type); rv=be_init(1,conf->db_new_url,0); if(rv==NULL) { error(200,_("db_new is null\n")); return RETFAIL; } conf->db_new=rv; error(200,_("db_new is nonnull\n")); return RETOK; } } return RETFAIL; } db_line* db_readline(int db){ db_line* s=NULL; int i=0; url_t* db_url=NULL; FILE** db_filep=NULL; int* db_osize=0; DB_FIELD** db_order=NULL; switch (db) { case DB_DISK: { /* Nothing else to be done? */ s=db_readline_disk(); return s; } case DB_OLD: { db_url=conf->db_in_url; db_filep=&(conf->db_in); db_osize=&(conf->db_in_size); db_order=&(conf->db_in_order); break; } case DB_NEW: { db_url=conf->db_new_url; db_filep=&(conf->db_new); db_osize=&(conf->db_new_size); db_order=&(conf->db_new_order); break; } } switch (db_url->type) { #ifdef WITH_CURL case url_http: case url_https: case url_ftp: #endif /* WITH CURL */ case url_stdin: case url_fd: case url_file: { /* Should set errno */ /* Please FIXME */ if ((*db_filep)!=NULL) { char** ss=db_readline_file(db); if (ss!=NULL){ s=db_char2line(ss,db); for(i=0;i<*db_osize;i++){ if((*db_order)[i]!=db_unknown && ss[(*db_order)[i]]!=NULL){ free(ss[(*db_order)[i]]); ss[(*db_order)[i]]=NULL; } } free(ss); } } break; } #ifdef WITH_PSQL case url_sql: { error(255,"db_sql readline..."); s=db_readline_sql(db, conf); break; } #endif default : { error(0,_("db_readline():Url-type backend not implemented\n")); return NULL; } } return s; } byte* base64tobyte(char* src,int len,size_t *ret_len) { if(strcmp(src,"0")!=0){ return decode_base64(src,len,ret_len); } return NULL; } static char *db_readchar(char *s) { if (s == NULL) return (NULL); if (s[0] == '0') { if (s[1] == '\0') return (NULL); if (s[1] == '-') return (strdup("")); if (s[1] == '0') { memmove(s, s+1, strlen(s+1)+1); // Hope this removes core // dumping in some environments. Has something to do with // memory (de)allocation. } } decode_string(s); return strdup(s); } #define WARN_ONCE(x) case db_ ## x : { \ static int warn_once_ ## x = 0; \ if (! warn_once_ ## x ) \ error(0,_("Hash %s uses MHASH, which is not enabled.\n"), \ #x ); \ warn_once_ ## x = 1; \ } break db_line* db_char2line(char** ss,int db){ int i; db_line* line=(db_line*)malloc(sizeof(db_line)*1); int* db_osize=0; DB_FIELD** db_order=NULL; switch (db) { case DB_OLD: { db_osize=&(conf->db_in_size); db_order=&(conf->db_in_order); break; } case DB_NEW: { db_osize=&(conf->db_new_size); db_order=&(conf->db_new_order); break; } } line->md5=NULL; line->sha1=NULL; line->rmd160=NULL; line->tiger=NULL; line->crc32=NULL; /* MHASH stuff.. */ line->crc32b=NULL; line->haval=NULL; line->gost=NULL; line->whirlpool=NULL; line->sha256=NULL; line->sha512=NULL; line->perm=0; line->uid=0; line->gid=0; line->atime=0; line->ctime=0; line->mtime=0; line->inode=0; line->nlink=0; line->bcount=0; line->size=0; line->filename=NULL; line->fullpath=NULL; line->linkname=NULL; line->acl=NULL; line->xattrs=NULL; line->e2fsattrs=0; line->cntx=NULL; line->attr=conf->attr; /* attributes from @@dbspec */ for(i=0;i<*db_osize;i++){ switch ((*db_order)[i]) { case db_filename : { if(ss[(*db_order)[i]]!=NULL){ decode_string(ss[(*db_order)[i]]); line->fullpath=strdup(ss[(*db_order)[i]]); line->filename=line->fullpath; } else { error(0,"db_char2line():Error while reading database\n"); exit(EXIT_FAILURE); } break; } case db_linkname : { line->linkname = db_readchar(ss[(*db_order)[i]]); break; } case db_mtime : { line->mtime=base64totime_t(ss[(*db_order)[i]]); break; } case db_bcount : { line->bcount=readint(ss[(*db_order)[i]],"bcount"); break; } case db_atime : { line->atime=base64totime_t(ss[(*db_order)[i]]); break; } case db_ctime : { line->ctime=base64totime_t(ss[(*db_order)[i]]); break; } case db_inode : { line->inode=readint(ss[(*db_order)[i]],"inode"); break; } case db_uid : { line->uid=readint(ss[(*db_order)[i]],"uid"); break; } case db_gid : { line->gid=readint(ss[(*db_order)[i]],"gid"); break; } case db_size : { line->size=readlong(ss[(*db_order)[i]],"size"); break; } case db_md5 : { line->md5=base64tobyte(ss[(*db_order)[i]], strlen(ss[(*db_order)[i]]), NULL); break; } case db_sha1 : { line->sha1=base64tobyte(ss[(*db_order)[i]], strlen(ss[(*db_order)[i]]), NULL); break; } case db_rmd160 : { line->rmd160=base64tobyte(ss[(*db_order)[i]], strlen(ss[(*db_order)[i]]), NULL); break; } case db_tiger : { line->tiger=base64tobyte(ss[(*db_order)[i]], strlen(ss[(*db_order)[i]]), NULL); break; } case db_crc32 : { line->crc32=base64tobyte(ss[(*db_order)[i]], strlen(ss[(*db_order)[i]]), NULL); break; } case db_haval : { line->haval=base64tobyte(ss[(*db_order)[i]], strlen(ss[(*db_order)[i]]), NULL); break; } #ifdef WITH_MHASH case db_gost : { line->gost=base64tobyte(ss[(*db_order)[i]], strlen(ss[(*db_order)[i]]), NULL); break; } case db_crc32b : { line->crc32b=base64tobyte(ss[(*db_order)[i]], strlen(ss[(*db_order)[i]]), NULL); break; } case db_whirlpool : { line->whirlpool=base64tobyte(ss[(*db_order)[i]], strlen(ss[(*db_order)[i]]), NULL); break; } #else WARN_ONCE(gost); WARN_ONCE(crc32b); WARN_ONCE(whirlpool); #endif case db_sha256 : { line->sha256=base64tobyte(ss[(*db_order)[i]], strlen(ss[(*db_order)[i]]), NULL); break; } case db_sha512 : { line->sha512=base64tobyte(ss[(*db_order)[i]], strlen(ss[(*db_order)[i]]), NULL); break; } #ifdef WITH_SUN_ACL case db_acl : { char* endp,*pos; int entries,lc; line->acl=NULL; entries=strtol(ss[(*db_order)[i]],&endp,10); if (endp==ss[(*db_order)[i]]) { /* Something went wrong */ break; } pos=endp+1; /* Warning! if acl in database is corrupted then this will break down. */ line->acl=malloc(sizeof(acl_type)); line->acl->entries=entries; line->acl->acl=malloc(sizeof(aclent_t)*entries); for (lc=0;lcacl->acl[lc].a_type=strtol(pos,&endp,10); pos=endp+1; line->acl->acl[lc].a_id=strtol(pos,&endp,10); pos=endp+1; line->acl->acl[lc].a_perm=strtol(pos,&endp,10); pos=endp+1; } break; } #endif #ifdef WITH_POSIX_ACL case db_acl : { char *tval = NULL; tval = strtok(ss[(*db_order)[i]], ","); line->acl = NULL; if (tval[0] == '0') line->acl = NULL; else if (!strcmp(tval, "POSIX")) { line->acl = malloc(sizeof(acl_type)); line->acl->acl_a = NULL; line->acl->acl_d = NULL; tval = strtok(NULL, ","); line->acl->acl_a = (char *)base64tobyte(tval, strlen(tval), NULL); tval = strtok(NULL, ","); line->acl->acl_d = (char *)base64tobyte(tval, strlen(tval), NULL); } /* else, it's broken... */ break; } #endif case db_xattrs : { size_t num = 0; char *tval = NULL; tval = strtok(ss[(*db_order)[i]], ","); num = readlong(tval, "xattrs"); if (num) { line->xattrs = malloc(sizeof(xattrs_type)); line->xattrs->ents = calloc(sizeof(xattr_node), num); line->xattrs->sz = num; line->xattrs->num = num; num = 0; while (num < line->xattrs->num) { byte *val = NULL; size_t vsz = 0; tval = strtok(NULL, ","); line->xattrs->ents[num].key = db_readchar(strdup(tval)); tval = strtok(NULL, ","); val = base64tobyte(tval, strlen(tval), &vsz); line->xattrs->ents[num].val = val; line->xattrs->ents[num].vsz = vsz; ++num; } } break; } case db_selinux : { byte *val = NULL; val = base64tobyte(ss[(*db_order)[i]], strlen(ss[(*db_order)[i]]),NULL); line->cntx = (char *)val; break; } case db_perm : { line->perm=readoct(ss[(*db_order)[i]],"permissions"); break; } case db_lnkcount : { line->nlink=readint(ss[(*db_order)[i]],"nlink"); break; } case db_attr : { line->attr=readlong(ss[(*db_order)[i]],"attr"); break; } case db_e2fsattrs : { line->e2fsattrs=readlong(ss[(*db_order)[i]],"e2fsattrs"); break; } case db_unknown : { /* Unknown fields are ignored. */ break; } default : { error(0,_("Not implemented in db_char2line %i \n"),(*db_order)[i]); return NULL; } } } return line; } time_t base64totime_t(char* s){ byte* b=decode_base64(s,strlen(s),NULL); char* endp; if (b==NULL||strcmp(s,"0")==0) { /* Should we print error here? */ free(b); return 0; } else { time_t t = strtol((char *)b,&endp,10); if (endp[0]!='\0') { error(0,"Error converting base64\n"); free(b); return 0; } free(b); return t; } } long readint(char* s,char* err){ long i; char* e; i=strtol(s,&e,10); if (e[0]!='\0') { error(0,_("Could not read %s from database"),err); } return i; } AIDE_OFF_TYPE readlong(char* s,char* err){ AIDE_OFF_TYPE i; char* e; i=AIDE_STRTOLL_FUNC(s,&e,10); if (e[0]!='\0') { error(0,_("Could not read %s from database"),err); } return i; } long readoct(char* s,char* err){ long i; char* e; i=strtol(s,&e,8); if (e[0]!='\0') { error(0,_("Could not read %s from database. String %s \n"),err,s); } return i; } int db_writespec(db_config* dbconf) { switch (dbconf->db_out_url->type) { case url_stdout: case url_stderr: case url_fd: case url_file: { if( #ifdef WITH_ZLIB (dbconf->gzip_dbout && dbconf->db_gzout) || #endif (dbconf->db_out!=NULL)){ if(db_writespec_file(dbconf)==RETOK){ return RETOK; } } break; } #ifdef WITH_CURL case url_http: case url_https: case url_ftp: { break; } #endif /* WITH CURL */ #ifdef WITH_PSQL case url_sql: { if(dbconf->db_out!=NULL){ if(db_writespec_sql(dbconf)==RETOK){ return RETOK; } } break; } #endif default:{ error(0,_("Unknown output in db out.\n")); return RETFAIL; } } return RETFAIL; } int db_writeline(db_line* line,db_config* dbconf){ if (line==NULL||dbconf==NULL) return RETOK; switch (dbconf->db_out_url->type) { #ifdef WITH_CURL case url_http: case url_https: case url_ftp: #endif /* WITH CURL */ case url_stdout: case url_stderr: case url_fd: case url_file: { if ( #ifdef WITH_ZLIB (dbconf->gzip_dbout && dbconf->db_gzout) || #endif (dbconf->db_out!=NULL)) { if (db_writeline_file(line,dbconf,dbconf->db_out_url)==RETOK) { return RETOK; } } return RETFAIL; break; } #ifdef WITH_PSQL case url_sql: { if (dbconf->db_out!=NULL) { if (db_writeline_sql(line,dbconf)==RETOK) { return RETOK; } } return RETFAIL; break; } #endif default : { error(0,_("Unknown output in db out.\n")); return RETFAIL; } } return RETFAIL; } void db_close() { switch (conf->db_out_url->type) { case url_stdout: case url_stderr: case url_fd: case url_file: { if ( #ifdef WITH_ZLIB (conf->gzip_dbout && conf->db_gzout) || #endif (conf->db_out!=NULL)) { db_close_file(conf); } break; } #ifdef WITH_CURL case url_http: case url_https: case url_ftp: { if (conf->db_out!=NULL) { url_fclose(conf->db_out); } break; } #endif /* WITH CURL */ #ifdef WITH_PSQL case url_sql: { if (conf->db_out!=NULL) { db_close_sql(conf->db_out); } break; } #endif default : { error(0,_("db_close():Unknown output in db out.\n")); } } conf->line_db_in = close_db_attrs(conf->mdc_in, (conf->db_in_url)->value); conf->line_db_out = close_db_attrs(conf->mdc_out, (conf->action&DO_DIFF ? conf->db_new_url : conf->db_out_url)->value); } void free_db_line(db_line* dl) { if (dl==NULL) { return; } #define checked_free(x) do { free(x); x=NULL; } while (0) checked_free(dl->md5); checked_free(dl->sha1); checked_free(dl->rmd160); checked_free(dl->tiger); dl->filename=NULL; checked_free(dl->fullpath); checked_free(dl->linkname); #ifdef WITH_MHASH checked_free(dl->crc32); checked_free(dl->crc32b); checked_free(dl->gost); checked_free(dl->haval); #endif checked_free(dl->sha256); checked_free(dl->sha512); checked_free(dl->whirlpool); if (dl->acl) { #ifdef WITH_ACL free(dl->acl->acl_a); free(dl->acl->acl_d); #endif } checked_free(dl->acl); if (dl->xattrs) free(dl->xattrs->ents); checked_free(dl->xattrs); checked_free(dl->cntx); } const char* aide_key_5=CONFHMACKEY_05; const char* db_key_5=DBHMACKEY_05; aide-0.16~a2.git20130520/src/db_disk.c000066400000000000000000000250501214657706600167340ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * vi: ts=2 sw=2 * * Copyright (C) 1999-2006,2010,2011 Rami Lehti, Pablo Virolainen, * Richard van den Berg, Mike Markley, Hannes von Haugwitz * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "aide.h" #ifndef _POSIX_C_SOURCE # define _POSIX_C_SOURCE 199506L #endif #include #include #include #include #include #include #include #include #include #include "seltree.h" #include "gen_list.h" #include "types.h" #include "base64.h" #include "db_disk.h" #include "conf_yacc.h" #include "util.h" #include "db_sql.h" /* typedefs */ #include "commandconf.h" /*for locale support*/ #include "locale-aide.h" /*for locale support*/ #ifdef WITH_MHASH #include #endif #ifdef WITH_ZLIB #include #endif static DIR *dirh = NULL; static struct AIDE_DIRENT_TYPE *entp = NULL; static struct AIDE_DIRENT_TYPE **resp = NULL; static struct seltree *r = NULL; #if defined HAVE_READDIR && !defined HAVE_READDIR_R static long td = -1; #endif static int rdres = 0; static int root_handled = 0; static DIR *open_dir(char* path) { if (dirh != NULL) { if (closedir(dirh) != 0) { /* Closedir did not success? */ } } return opendir(path); } static void next_in_dir (void) { #ifdef HAVE_READDIR_R if (dirh != NULL) rdres = AIDE_READDIR_R_FUNC (dirh, entp, resp); #else #ifdef HAVE_READDIR if (dirh != NULL) { entp = AIDE_READDIR_FUNC (dirh); if(entp!=NULL) td = telldir(dirh); else td=-1; } #endif #endif } static int in_this (void) { #ifdef HAVE_READDIR_R return (dirh != NULL && rdres == 0 && (*resp) != NULL); #else #ifdef HAVE_READDIR return (dirh != NULL && entp != NULL && td >= 0); #endif #endif } static char *name_construct (const char *s) { char *ret; int len2 = strlen (r->path); int len = len2 + strlen (s) + 2 + conf->root_prefix_length; if (r->path[len2 - 1] != '/') { len++; } ret = (char *) malloc (len); ret[0] = (char) 0; strncpy(ret, conf->root_prefix, conf->root_prefix_length+1); strncat (ret, r->path, len2); if (r->path[len2 - 1] != '/') { strncat (ret, "/", 1); } strcat (ret, s); return ret; } void add_child (db_line * fil) { int i; struct seltree *new_r; error (255, "Adding child %s\n", fil->filename); new_r = get_seltree_node (r, fil->filename); if (new_r != NULL) { if (S_ISDIR (fil->perm_o)) { ; } else { new_r->checked |= NODE_CHECKED; new_r->checked |= NODE_TRAVERSE; } return; } new_r = malloc (sizeof (seltree)); new_r->attr = 0; i = strlen (fil->filename); new_r->path = malloc (i + 1); strncpy(new_r->path, fil->filename, i+1); new_r->childs = NULL; new_r->sel_rx_lst = NULL; new_r->neg_rx_lst = NULL; new_r->equ_rx_lst = NULL; new_r->parent = r; new_r->checked = 0; new_r->new_data = NULL; new_r->old_data = NULL; if (S_ISDIR (fil->perm_o)) { ; } else { new_r->checked |= NODE_CHECKED; new_r->checked |= NODE_TRAVERSE; } r->childs = list_sorted_insert (r->childs, new_r, compare_node_by_path); } /* It might be a good idea to make this non recursive. Now implemented with goto-statement. Yeah, it's ugly and easy. */ db_line *db_readline_disk () { db_line *fil = NULL; DB_ATTR_TYPE attr; char *fullname; int add = 0; /* root needs special handling */ if (!root_handled) { root_handled = 1; fullname=malloc((conf->root_prefix_length+2)*sizeof(char)); strncpy(fullname, conf->root_prefix, conf->root_prefix_length+1); strncat (fullname, "/", 1); add = check_rxtree (&fullname[conf->root_prefix_length], conf->tree, &attr); error (240, "%s match=%d, tree=%p, attr=%llu\n", &fullname[conf->root_prefix_length], add, conf->tree, attr); if (add) { fil = get_file_attrs (fullname, attr); error (240, "%s attr=%llu\n", &fullname[conf->root_prefix_length], attr); if (fil != NULL) { error (240, "%s attr=%llu\n", fil->filename, fil->attr); } if (fil == NULL) { /* Something went wrong during read process -> Let's try next one. */ free_db_line (fil); /* Filename is freeed? */ free (fil); fil = NULL; } return fil; } else { free (fullname); } } recursion: next_in_dir (); if (in_this ()) { /* Let's check if we have '.' or '..' entry. If have, just skipit. If don't do the 'normal' thing. */ if (strcmp (entp->d_name, ".") == 0 || strcmp (entp->d_name, "..") == 0) { goto recursion; // return db_readline_disk(db); } /* Now we know that we actually can do something. */ fullname = name_construct (entp->d_name); /* Now we have a filename, which we must remember to free if it is not used. Next thing is to see if we want to do something with it. If not call, db_readline_disk again... */ add = check_rxtree (&fullname[conf->root_prefix_length], conf->tree, &attr); error (240, "%s match=%d, tree=%p, attr=%llu\n", &fullname[conf->root_prefix_length], add, conf->tree, attr); if (add) { fil = get_file_attrs (fullname, attr); error (240, "%s attr=%llu\n", &fullname[conf->root_prefix_length], attr); if (fil != NULL) { error (240, "%s attr=%llu\n", fil->filename, fil->attr); } /* Hack. */ if (fil == NULL) { /* Something went wrong during read process -> Let's try next one. */ free_db_line (fil); /* Filename is freeed? */ fil = NULL; goto recursion; // return db_readline_disk(db); } if (add == 1) { /* add_children -> if dir, then add to children list. */ /* If ee are adding a file that is not a dir */ /* add_child can make the determination and mark the tree accordingly */ add_child (fil); } else if (add == 2) { /* Don't add to children list. */ /* Should we do something? */ } } else { /* Make us traverse the tree:) */ /* We have no use for fullname. */ free (fullname); goto recursion; } /* Make sure that next time we enter we have something. */ } else { if (r == NULL) { return NULL; } error (255, "r->childs %p, r->parent %p, r->checked %i\n", r->childs, r->parent, r->checked); if ((0 == (r->checked & NODE_CHECKED)) && r->childs != NULL) { seltree *rr; list *l; l = r->childs->header->head; while (l != NULL && (((seltree *) (l->data))->checked & NODE_TRAVERSE) != 0) { l = l->next; } if (l != NULL) { if (l == l->header->tail) { r->checked |= NODE_CHECKED; } rr = (seltree *) l->data; error (255, "rr->checked %i\n", rr->checked); rr->checked |= NODE_TRAVERSE; r = rr; error (255, "r->childs %p, r->parent %p,r->checked %i\n", r->childs, r->parent, r->checked); fullname=malloc((conf->root_prefix_length+strlen(r->path)+1)*sizeof(char)); strncpy(fullname, conf->root_prefix, conf->root_prefix_length+1); strncat(fullname, r->path, strlen(r->path)); dirh=open_dir(fullname); if (! dirh) { /* open_dir failed so we need to know why and print an errormessage if needed. errno should still be the one from opendir() since it's global */ if (errno == ENOENT && r->old_data != NULL && r->sel_rx_lst == NULL && r->neg_rx_lst == NULL && r->equ_rx_lst == NULL) { /* The path did not exist and there is old data for this node and there are no regexps for this node There is no new data for this node otherwise it would not come to this part of the code. So we don't print any error message. */ } else if (errno == ENOENT && ((r->sel_rx_lst != NULL || r->neg_rx_lst != NULL || r->equ_rx_lst != NULL) || r->childs != NULL)) { /* The dir did not exist and there are regexps referring to this node or there are children to this node. The only way a nonexistent dirnode can have children is by having rules referring to them. */ error (10, "There are rules referring to non-existent directory %s\n", fullname); } else if (errno != ENOTDIR) { /* We print the message unless it is "Not a directory". */ char *er = strerror (errno); if (er != NULL) { error (3, "open_dir(): %s: %s\n", er, fullname); } else { error (3, "open_dir(): %i: %s\n", errno, fullname); } } r->checked |= NODE_TRAVERSE | NODE_CHECKED; r = r->parent; error (255, "dropping back to parent\n"); } free(fullname); } else { r->checked |= NODE_TRAVERSE | NODE_CHECKED; r = r->parent; /* We have gone out of the tree. This happens in some instances */ if (r == NULL) { return NULL; } error (255, "dropping back to parent\n"); } goto recursion; } if (r->parent != NULL) { /* Go back in time:) */ r->checked |= NODE_CHECKED; r = r->parent; goto recursion; } /* The end has been reached. Nothing to do. */ } return fil; } int db_disk_init () { r = conf->tree; # ifdef HAVE_READDIR_R resp = (struct AIDE_DIRENT_TYPE **) malloc (sizeof (struct AIDE_DIRENT_TYPE) + _POSIX_PATH_MAX); entp = (struct AIDE_DIRENT_TYPE *) malloc (sizeof (struct AIDE_DIRENT_TYPE) + _POSIX_PATH_MAX); # else # ifdef HAVE_READDIR /* Should we do something here? */ # else # error AIDE needs readdir or readdir_r # endif # endif char* fullname=malloc((conf->root_prefix_length+2)*sizeof(char)); strncpy(fullname, conf->root_prefix, conf->root_prefix_length+1); strncat (fullname, "/", 1); dirh=open_dir(fullname); free(fullname); return RETOK; } /* We don't support writing to the pseudo-database disk, since we are'n a backup/restore software. Hence the functions db_writespec_disk, db_writeline_disk and db_close_disk aren't declared. */ const char *aide_key_6 = CONFHMACKEY_06; const char *db_key_6 = DBHMACKEY_06; aide-0.16~a2.git20130520/src/db_file.c000066400000000000000000000532731214657706600167310ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2007,2010-2013 Rami Lehti, Pablo Virolainen, Mike * Markley, Richard van den Berg, Hannes von Haugwitz * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "aide.h" #include #include #include #include #include #include #include #include "types.h" #include "base64.h" #include "db_file.h" #include "conf_yacc.h" #include "util.h" #include "db_sql.h" /* typedefs */ #include "commandconf.h" /*for locale support*/ #include "locale-aide.h" /*for locale support*/ #ifdef WITH_MHASH #include #endif #ifdef WITH_ZLIB #include #endif #define BUFSIZE 16384 #include "md.h" #ifdef WITH_ZLIB #define ZBUFSIZE 16384 static int dofprintf( const char* s,...) #ifdef __GNUC__ __attribute__ ((format (printf, 1, 2))); #else ; #endif /* FIXME get rid of this */ void handle_gzipped_input(int out,gzFile* gzp){ int nread=0; int err=0; int* buf=malloc(ZBUFSIZE); buf[0]='\0'; error(200,"handle_gzipped_input(),%d\n",out); while(!gzeof(*gzp)){ if((nread=gzread(*gzp,buf,ZBUFSIZE))<0){ error(0,_("gzread() failed: gzerr=%s!\n"),gzerror(*gzp,&err)); exit(1); } else { int tmp = 0; /* gzread returns 0 even if uncompressed bytes were read */ if(nread==0){ tmp = strlen((char*)buf); } else { tmp = nread; } if (write(out, buf,nread) != tmp) { error(0,_("write() failed: %s\n"), strerror(errno)); exit(1); } error(240,"nread=%d,strlen(buf)=%lu,errno=%s,gzerr=%s\n", nread,(unsigned long)strlen((char*)buf),strerror(errno), gzerror(*gzp,&err)); buf[0]='\0'; } } close(out); error(240,"handle_gzipped_input() exiting\n"); exit(0); /* NOT REACHED */ return; } #endif int dofflush(void) { int retval; #ifdef WITH_ZLIB if(conf->gzip_dbout){ /* Should not flush using gzip, it degrades compression */ retval=Z_OK; }else { #endif retval=fflush(conf->db_out); #ifdef WITH_ZLIB } #endif return retval; } int dofprintf( const char* s,...) { char buf[3]; int retval; char* temp=NULL; va_list ap; va_start(ap,s); retval=vsnprintf(buf,3,s,ap); va_end(ap); temp=(char*)malloc(retval+2); if(temp==NULL){ error(0,"Unable to alloc %i bytes\n",retval+2); return -1; } va_start(ap,s); retval=vsnprintf(temp,retval+1,s,ap); va_end(ap); if (conf->mdc_out) { update_md(conf->mdc_out,temp ,retval); } #ifdef WITH_MHASH if(conf->do_dbnewmd) mhash(conf->dbnewmd,(void*)temp,retval); #endif #ifdef WITH_ZLIB if(conf->gzip_dbout){ retval=gzwrite(conf->db_gzout,temp,retval); }else{ #endif /* writing is ok with fwrite with curl.. */ retval=fwrite(temp,1,retval,conf->db_out); #ifdef WITH_ZLIB } #endif free(temp); return retval; } int db_file_read_spec(int db){ int i=0; int* db_osize=0; DB_FIELD** db_order=NULL; switch (db) { case DB_OLD: { db_osize=&(conf->db_in_size); db_order=&(conf->db_in_order); db_lineno=&db_in_lineno; break; } case DB_NEW: { db_osize=&(conf->db_new_size); db_order=&(conf->db_new_order); db_lineno=&db_new_lineno; break; } } *db_order=(DB_FIELD*) malloc(1*sizeof(DB_FIELD)); while ((i=db_scan())!=TNEWLINE){ switch (i) { case TID : { int l; /* Yes... we do not check if realloc returns nonnull */ *db_order=(DB_FIELD*) realloc((void*)*db_order, ((*db_osize)+1)*sizeof(DB_FIELD)); if(*db_order==NULL){ return RETFAIL; } (*db_order)[*db_osize]=db_unknown; for (l=0;lattr=-1; for (i=0;i<*db_osize;i++) { if ((*db_order)[i]==db_attr) { conf->attr=1; } } if (conf->attr==DB_ATTR_UNDEF) { conf->attr=0; error(0,"Database does not have attr field.\nComparation may be incorrect\nGenerating attr-field from dbspec\nIt might be a good Idea to regenerate databases. Sorry.\n"); for(i=0;idb_in_size;i++) { conf->attr|=1<<(*db_order)[i]; } } return RETOK; } char** db_readline_file(int db){ char** s=NULL; int i=0; int r; int a=0; int token=0; int gotbegin_db=0; int gotend_db=0; int* domd=NULL; #ifdef WITH_MHASH MHASH* md=NULL; #endif char** oldmdstr=NULL; int* db_osize=0; DB_FIELD** db_order=NULL; FILE** db_filep=NULL; url_t* db_url=NULL; switch (db) { case DB_OLD: { #ifdef WITH_MHASH md=&(conf->dboldmd); #endif domd=&(conf->do_dboldmd); oldmdstr=&(conf->old_dboldmdstr); db_osize=&(conf->db_in_size); db_order=&(conf->db_in_order); db_filep=&(conf->db_in); db_url=conf->db_in_url; db_lineno=&db_in_lineno; break; } case DB_NEW: { #ifdef WITH_MHASH md=&(conf->dbnewmd); #endif domd=&(conf->do_dbnewmd); oldmdstr=&(conf->old_dbnewmdstr); db_osize=&(conf->db_new_size); db_order=&(conf->db_new_order); db_filep=&(conf->db_new); db_url=conf->db_new_url; db_lineno=&db_new_lineno; break; } } if (*db_osize==0) { db_buff(db,*db_filep); token=db_scan(); while((token!=TDBSPEC && token!=TEOF)){ switch(token){ case TUNKNOWN: { continue; } case TBEGIN_DB: { token=db_scan(); gotbegin_db=1; continue; } case TNEWLINE: { if(gotbegin_db){ *domd=1; token=db_scan(); continue; }else { token=TEOF; break; } } case TGZIPHEADER: { error(0,"Gzipheader found inside uncompressed db!\n"); return NULL; } default: { /* If it is anything else we quit */ /* Missing dbspec */ token=TEOF; break; } } } if(FORCEDBMD&&!gotbegin_db){ error(0,"Database %i does not have checksum!\n",db); return NULL; } if (token!=TDBSPEC) { /* * error.. must be a @@dbspec line */ switch (db_url->type) { case url_file : { error(0,"File database must have one db_spec specification\n"); break; } case url_stdin : { error(0,"Pipe database must have one db_spec specification\n"); break; } case url_fd: { error(0,"FD database must have one db_spec specification\n"); break; } #ifdef WITH_CURL case url_http: case url_https: case url_ftp: { error(0,"CURL database must have one db_spec specification %i\n",token); break; } #endif default : { error(0,"db_readline_file():Unknown or unsupported db in type.\n"); break; } } return s; } /* * Here we read da spec */ if (db_file_read_spec(db)!=0) { /* somethin went wrong */ return s; } }else { /* We need to switch the buffer cleanly*/ db_buff(db,NULL); } s=(char**)malloc(sizeof(char*)*db_unknown); /* We NEED this to avoid Bus errors on Suns */ for(i=0;idbhmactype)); mhash_deinit(*md,(void*)dig); digstr=encode_base64(dig,mhash_get_block_size(conf->dbhmactype)); if(strncmp(digstr,*oldmdstr,strlen(digstr))!=0){ error(0,_("Db checksum mismatch for db:%i\n"),db); abort(); } } else { error(0,"@@end_db found without @@begin_db in db:%i\n",db); abort(); } #endif } token=db_scan(); if(token!=TNEWLINE){ error(0,_("Corrupt db. Checksum garbled\n")); abort(); } break; } case TEND_DBNOMD : { gotend_db=1; if(FORCEDBMD){ error(0,"Database %i does not have checksum!\n",db); abort(); } break; } case TEOF : { if(gotend_db){ return NULL; } /* This can be the first token on a line */ if(i>0){ error(0,"Not enough parameters in db:%li\n",*db_lineno); }; for(a=0;ado_dbnewmd=1; if( (dbconf->dbnewmd= mhash_hmac_init(dbconf->dbhmactype, key, keylen, mhash_get_hash_pblock(dbconf->dbhmactype)))== MHASH_FAILED){ error(0, "mhash_hmac_init() failed for db write. Aborting\n"); abort(); } } #endif retval=dofprintf( "# This file was generated by Aide, version %s\n" "# Time of generation was %.4u-%.2u-%.2u %.2u:%.2u:%.2u\n", AIDEVERSION, st->tm_year+1900, st->tm_mon+1, st->tm_mday, st->tm_hour, st->tm_min, st->tm_sec ); if(retval==0){ return RETFAIL; } if(dbconf->config_version){ retval=dofprintf( "# The config version used to generate this file was:\n" "# %s\n", dbconf->config_version); if(retval==0){ return RETFAIL; } } retval=dofprintf("@@db_spec "); if(retval==0){ return RETFAIL; } for(i=0;idb_out_size;i++){ for(j=0;jdb_out_order[i]){ retval=dofprintf("%s ",db_names[j]); if(retval==0){ return RETFAIL; } break; } } } retval=dofprintf("\n"); if(retval==0){ return RETFAIL; } return RETOK; } #ifdef WITH_ACL int db_writeacl(acl_type* acl,FILE* file,int a) { #ifdef WITH_SUN_ACL int i; if(a) { dofprintf(" "); } if (acl==NULL) { dofprintf("0"); } else { dofprintf("%i",acl->entries); for (i=0;ientries;i++) { dofprintf(",%i,%i,%i", acl->acl[i].a_type, acl->acl[i].a_id, acl->acl[i].a_perm); } } #endif #ifdef WITH_POSIX_ACL if(a) { dofprintf(" "); } if (acl==NULL) { dofprintf("0"); } else { dofprintf("POSIX"); /* This is _very_ incompatible */ dofprintf(","); if (acl->acl_a) db_write_byte_base64((byte*)acl->acl_a, 0, file,0,1,1); else dofprintf("0"); dofprintf(","); if (acl->acl_d) db_write_byte_base64((byte*)acl->acl_d, 0, file,0,1,1); else dofprintf("0"); } #endif #ifndef WITH_ACL if(a) { /* compat. */ dofprintf(" "); } dofprintf("0"); #endif return RETOK; } #endif int db_writeline_file(db_line* line,db_config* dbconf, url_t* url){ int i; (void)url; for(i=0;idb_out_size;i++){ switch (dbconf->db_out_order[i]) { case db_filename : { db_writechar(line->filename,dbconf->db_out,i); break; } case db_linkname : { db_writechar(line->linkname,dbconf->db_out,i); break; } case db_bcount : { db_writeint(line->bcount,dbconf->db_out,i); break; } case db_mtime : { db_write_time_base64(line->mtime,dbconf->db_out,i); break; } case db_atime : { db_write_time_base64(line->atime,dbconf->db_out,i); break; } case db_ctime : { db_write_time_base64(line->ctime,dbconf->db_out,i); break; } case db_inode : { db_writeint(line->inode,dbconf->db_out,i); break; } case db_lnkcount : { db_writeint(line->nlink,dbconf->db_out,i); break; } case db_uid : { db_writeint(line->uid,dbconf->db_out,i); break; } case db_gid : { db_writeint(line->gid,dbconf->db_out,i); break; } case db_size : { db_writelong(line->size,dbconf->db_out,i); break; } case db_md5 : { db_write_byte_base64(line->md5, HASH_MD5_LEN, dbconf->db_out,i, DB_MD5,line->attr); break; } case db_sha1 : { db_write_byte_base64(line->sha1, HASH_SHA1_LEN, dbconf->db_out,i, DB_SHA1,line->attr); break; } case db_rmd160 : { db_write_byte_base64(line->rmd160, HASH_RMD160_LEN, dbconf->db_out,i, DB_RMD160,line->attr); break; } case db_tiger : { db_write_byte_base64(line->tiger, HASH_TIGER_LEN, dbconf->db_out,i, DB_TIGER,line->attr); break; } case db_perm : { db_writeoct(line->perm,dbconf->db_out,i); break; } case db_crc32 : { db_write_byte_base64(line->crc32, HASH_CRC32_LEN, dbconf->db_out,i, DB_CRC32,line->attr); break; } case db_crc32b : { db_write_byte_base64(line->crc32b, HASH_CRC32B_LEN, dbconf->db_out,i, DB_CRC32B,line->attr); break; } case db_haval : { db_write_byte_base64(line->haval, HASH_HAVAL256_LEN, dbconf->db_out,i, DB_HAVAL,line->attr); break; } case db_gost : { db_write_byte_base64(line->gost , HASH_GOST_LEN, dbconf->db_out,i, DB_GOST,line->attr); break; } case db_sha256 : { db_write_byte_base64(line->sha256, HASH_SHA256_LEN, dbconf->db_out,i, DB_SHA256,line->attr); break; } case db_sha512 : { db_write_byte_base64(line->sha512, HASH_SHA512_LEN, dbconf->db_out,i, DB_SHA512,line->attr); break; } case db_whirlpool : { db_write_byte_base64(line->whirlpool, HASH_WHIRLPOOL_LEN, dbconf->db_out,i, DB_WHIRLPOOL,line->attr); break; } case db_attr : { db_writelong(line->attr, dbconf->db_out,i); break; } #ifdef WITH_ACL case db_acl : { db_writeacl(line->acl,dbconf->db_out,i); break; } #endif case db_xattrs : { xattr_node *xattr = NULL; size_t num = 0; if (!line->xattrs) { db_writelong(0, dbconf->db_out, i); break; } db_writelong(line->xattrs->num, dbconf->db_out, i); xattr = line->xattrs->ents; while (num < line->xattrs->num) { dofprintf(","); db_writechar(xattr->key, dbconf->db_out, 0); dofprintf(","); db_write_byte_base64(xattr->val, xattr->vsz, dbconf->db_out, 0, 1, 1); ++xattr; ++num; } break; } case db_selinux : { db_write_byte_base64((byte*)line->cntx, 0, dbconf->db_out, i, 1, 1); break; } #ifdef WITH_E2FSATTRS case db_e2fsattrs : { db_writelong(line->e2fsattrs,dbconf->db_out,i); break; } #endif case db_checkmask : { db_writeoct(line->attr,dbconf->db_out,i); break; } default : { error(0,"Not implemented in db_writeline_file %i\n", dbconf->db_out_order[i]); return RETFAIL; } } } dofprintf("\n"); /* Can't use fflush because of zlib.*/ dofflush(); return RETOK; } int db_close_file(db_config* dbconf){ #ifdef WITH_MHASH byte* dig=NULL; char* digstr=NULL; if(dbconf->db_out #ifdef WITH_ZLIB || dbconf->db_gzout #endif ){ /* Let's write @@end_db */ if (dbconf->dbnewmd!=NULL) { mhash(dbconf->dbnewmd, NULL ,0); dig=(byte*)malloc(sizeof(byte)*mhash_get_block_size(dbconf->dbhmactype)); mhash_deinit(dbconf->dbnewmd,(void*)dig); digstr=encode_base64(dig,mhash_get_block_size(dbconf->dbhmactype)); dbconf->do_dbnewmd=0; dofprintf("@@end_db %s\n",digstr); free(dig); free(digstr); } else { dofprintf("@@end_db\n"); } } #endif #ifndef WITH_ZLIB if(fclose(dbconf->db_out)){ error(0,"Unable to close database:%s\n",strerror(errno)); return RETFAIL; } #else if(dbconf->gzip_dbout){ if(gzclose(dbconf->db_gzout)){ error(0,"Unable to close gzdatabase:%s\n",strerror(errno)); return RETFAIL; } }else { if(fclose(dbconf->db_out)){ error(0,"Unable to close database:%s\n",strerror(errno)); return RETFAIL; } } #endif return RETOK; } // vi: ts=8 sw=8 aide-0.16~a2.git20130520/src/db_lex.c000066400000000000000000001401541214657706600165750ustar00rootroot00000000000000#line 2 "db_lex.c" #line 4 "db_lex.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define yy_create_buffer db_create_buffer #define yy_delete_buffer db_delete_buffer #define yy_flex_debug db_flex_debug #define yy_init_buffer db_init_buffer #define yy_flush_buffer db_flush_buffer #define yy_load_buffer_state db_load_buffer_state #define yy_switch_to_buffer db_switch_to_buffer #define yyin dbin #define yyleng dbleng #define yylex dblex #define yylineno dblineno #define yyout dbout #define yyrestart dbrestart #define yytext dbtext #define yywrap dbwrap #define yyalloc dballoc #define yyrealloc dbrealloc #define yyfree dbfree #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #endif /* ! C99 */ #endif /* ! FLEXINT_H */ #ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ /* C99 requires __STDC__ to be defined as 1. */ #if defined (__STDC__) #define YY_USE_CONST #endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE dbrestart(dbin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k. * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. * Ditto for the __ia64__ case accordingly. */ #define YY_BUF_SIZE 32768 #else #define YY_BUF_SIZE 16384 #endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif extern int dbleng; extern FILE *dbin, *dbout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up dbtext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up dbtext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via dbrestart()), so that the user can continue scanning by * just pointing dbin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when dbtext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int dbleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow dbwrap()'s to do buffer switches * instead of setting up a fresh dbin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void dbrestart (FILE *input_file ); void db_switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE db_create_buffer (FILE *file,int size ); void db_delete_buffer (YY_BUFFER_STATE b ); void db_flush_buffer (YY_BUFFER_STATE b ); void dbpush_buffer_state (YY_BUFFER_STATE new_buffer ); void dbpop_buffer_state (void ); static void dbensure_buffer_stack (void ); static void db_load_buffer_state (void ); static void db_init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER db_flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE db_scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE db_scan_string (yyconst char *yy_str ); YY_BUFFER_STATE db_scan_bytes (yyconst char *bytes,int len ); void *dballoc (yy_size_t ); void *dbrealloc (void *,yy_size_t ); void dbfree (void * ); #define yy_new_buffer db_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ dbensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ db_create_buffer(dbin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ dbensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ db_create_buffer(dbin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ typedef unsigned char YY_CHAR; FILE *dbin = (FILE *) 0, *dbout = (FILE *) 0; typedef int yy_state_type; extern int dblineno; int dblineno = 1; extern char *dbtext; #define yytext_ptr dbtext static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up dbtext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ dbleng = (size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 13 #define YY_END_OF_BUFFER 14 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static yyconst flex_int16_t yy_accept[46] = { 0, 0, 0, 0, 0, 14, 12, 10, 11, 9, 12, 12, 12, 12, 5, 9, 0, 8, 0, 1, 0, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 2, 7, 4, 3, 0 } ; static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 5, 6, 2, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 1, 6, 1, 6, 1, 6, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 1, 1, 1, 1, 10, 1, 8, 11, 12, 13, 14, 8, 15, 8, 16, 8, 8, 8, 8, 17, 8, 18, 8, 8, 19, 8, 8, 8, 8, 8, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 20, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 21, 21, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 21, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 21, 21, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 21, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst flex_int32_t yy_meta[22] = { 0, 1, 1, 1, 1, 1, 2, 1, 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 4 } ; static yyconst flex_int16_t yy_base[50] = { 0, 0, 18, 27, 45, 85, 86, 86, 86, 0, 81, 74, 62, 72, 0, 0, 77, 86, 66, 86, 12, 0, 0, 67, 63, 59, 65, 59, 60, 53, 55, 60, 51, 51, 54, 52, 55, 42, 40, 38, 45, 0, 13, 86, 0, 86, 53, 56, 59, 60 } ; static yyconst flex_int16_t yy_def[50] = { 0, 45, 1, 45, 3, 45, 45, 45, 45, 46, 47, 45, 45, 45, 48, 46, 47, 45, 49, 45, 49, 48, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 45, 49, 0, 45, 45, 45, 45 } ; static yyconst flex_int16_t yy_nxt[108] = { 0, 6, 7, 8, 6, 7, 9, 10, 9, 11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 6, 6, 12, 24, 44, 23, 25, 13, 6, 7, 8, 6, 7, 14, 10, 14, 11, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 6, 6, 12, 43, 42, 41, 40, 13, 15, 15, 16, 16, 16, 16, 21, 21, 22, 22, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 23, 17, 20, 19, 18, 17, 45, 5, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45 } ; static yyconst flex_int16_t yy_chk[108] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 20, 42, 20, 20, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 40, 39, 38, 37, 4, 46, 46, 47, 47, 47, 47, 48, 48, 49, 49, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 18, 16, 13, 12, 11, 10, 5, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int db_flex_debug; int db_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *dbtext; #line 1 "db_lex.l" #line 5 "db_lex.l" /* C [a-zA-Z0-9öäåÖÄÅ\\\*=$%£&/!\^\~;:.,\?\{\}\(\)\[\]\<\>\-\+\*\|\'\`] */ /* "\ "\\*=$%£&/!\^~;:.,?\{\}\(\)\[\]\<\>-+*\|\'\`] typedef union { char* s; } YYSTYPE; extern YYSTYPE yylval; "/"({C}|{PC})+ { return (TNAME); } */ /* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2002,2005,2010,2013 Rami Lehti,Pablo Virolainen, * Richard van den Berg, Hannes von Haugwitz * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define YY_DECL int db_scan(void) #define YYDEBUG 1 #include "aide.h" #include "conf_yacc.h" #include #include "report.h" #include "commandconf.h" /* We need to define these here since we cannot include db.h*/ #define DB_OLD (1<<0) #define DB_WRITE (1<<1) #define DB_NEW (1<<2) #define NODE_ADDED (1<<4) #define NODE_REMOVED (1<<5) #define NODE_CHANGED (1<<6) long db_in_lineno=1; long db_new_lineno=1; long* db_lineno=&db_in_lineno; YY_BUFFER_STATE db_stack[2]; int db_at_hand=0; #define YY_INPUT(buf,result,max_size) \ if( ((result=db_input_wrapper(buf,max_size,db_at_hand)) == 0) \ && ferror(dbin) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); #line 589 "db_lex.c" #define INITIAL 0 #define MDVALHUNT 1 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif static int yy_init_globals (void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int dblex_destroy (void ); int dbget_debug (void ); void dbset_debug (int debug_flag ); YY_EXTRA_TYPE dbget_extra (void ); void dbset_extra (YY_EXTRA_TYPE user_defined ); FILE *dbget_in (void ); void dbset_in (FILE * in_str ); FILE *dbget_out (void ); void dbset_out (FILE * out_str ); int dbget_leng (void ); char *dbget_text (void ); int dbget_lineno (void ); void dbset_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int dbwrap (void ); #else extern int dbwrap (void ); #endif #endif #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void ); #else static int input (void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k */ #define YY_READ_BUF_SIZE 16384 #else #define YY_READ_BUF_SIZE 8192 #endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO do { if (fwrite( dbtext, dbleng, 1, dbout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ size_t n; \ for ( n = 0; n < max_size && \ (c = getc( dbin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( dbin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, dbin))==0 && ferror(dbin)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(dbin); \ } \ }\ \ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int dblex (void); #define YY_DECL int dblex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after dbtext and dbleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ if ( dbleng > 0 ) \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ (dbtext[dbleng - 1] == '\n'); \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; #line 84 "db_lex.l" #line 781 "db_lex.c" if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! dbin ) dbin = stdin; if ( ! dbout ) dbout = stdout; if ( ! YY_CURRENT_BUFFER ) { dbensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = db_create_buffer(dbin,YY_BUF_SIZE ); } db_load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of dbtext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 46 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 86 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = (yy_hold_char); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: YY_RULE_SETUP #line 86 "db_lex.l" { return (TGZIPHEADER); } YY_BREAK case 2: YY_RULE_SETUP #line 90 "db_lex.l" { return (TDBSPEC); } YY_BREAK case 3: YY_RULE_SETUP #line 94 "db_lex.l" { return (TBEGIN_DB); } YY_BREAK case 4: YY_RULE_SETUP #line 98 "db_lex.l" { BEGIN MDVALHUNT; return (TEND_DB); } YY_BREAK case 5: YY_RULE_SETUP #line 103 "db_lex.l" { BEGIN 0; return (TSTRING); } YY_BREAK case 6: YY_RULE_SETUP #line 108 "db_lex.l" { return (TEND_DBNOMD); } YY_BREAK case 7: YY_RULE_SETUP #line 112 "db_lex.l" { return (TUNKNOWN); } YY_BREAK case 8: /* rule 8 can match eol */ YY_RULE_SETUP #line 116 "db_lex.l" { (*db_lineno)++; } YY_BREAK case 9: YY_RULE_SETUP #line 120 "db_lex.l" { error(230," %s \n",dbtext); return (TID); } YY_BREAK case 10: YY_RULE_SETUP #line 127 "db_lex.l" {} YY_BREAK case 11: /* rule 11 can match eol */ YY_RULE_SETUP #line 129 "db_lex.l" { (*db_lineno)++; return (TNEWLINE); } YY_BREAK case 12: YY_RULE_SETUP #line 134 "db_lex.l" { return (TERROR); } YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(MDVALHUNT): #line 138 "db_lex.l" { return (TEOF); } YY_BREAK case 13: YY_RULE_SETUP #line 143 "db_lex.l" ECHO; YY_BREAK #line 967 "db_lex.c" case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed dbin at a new source and called * dblex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = dbin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = (yy_c_buf_p); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( dbwrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * dbtext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of dblex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ dbrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), (size_t) num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; dbrestart(dbin ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) dbrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 46 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { register int yy_is_jam; register char *yy_cp = (yy_c_buf_p); register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 46 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 45); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) #else static int input (void) #endif { int c; *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ *(yy_c_buf_p) = '\0'; else { /* need more input */ int offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ dbrestart(dbin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( dbwrap( ) ) return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ *(yy_c_buf_p) = '\0'; /* preserve dbtext */ (yy_hold_char) = *++(yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ void dbrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ dbensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = db_create_buffer(dbin,YY_BUF_SIZE ); } db_init_buffer(YY_CURRENT_BUFFER,input_file ); db_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void db_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * dbpop_buffer_state(); * dbpush_buffer_state(new_buffer); */ dbensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; db_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (dbwrap()) processing, but the only time this flag * is looked at is after dbwrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void db_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; dbin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ YY_BUFFER_STATE db_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) dballoc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in db_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) dballoc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in db_create_buffer()" ); b->yy_is_our_buffer = 1; db_init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with db_create_buffer() * */ void db_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) dbfree((void *) b->yy_ch_buf ); dbfree((void *) b ); } #ifndef __cplusplus extern int isatty (int ); #endif /* __cplusplus */ /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a dbrestart() or at EOF. */ static void db_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; db_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then db_init_buffer was _probably_ * called from dbrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ void db_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) db_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ void dbpush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; dbensure_buffer_stack(); /* This block is copied from db_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from db_switch_to_buffer. */ db_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ void dbpop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; db_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { db_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void dbensure_buffer_stack (void) { int num_to_alloc; if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; (yy_buffer_stack) = (struct yy_buffer_state**)dballoc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in dbensure_buffer_stack()" ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; } if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)dbrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in dbensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE db_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) dballoc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in db_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; db_switch_to_buffer(b ); return b; } /** Setup the input buffer state to scan a string. The next call to dblex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * db_scan_bytes() instead. */ YY_BUFFER_STATE db_scan_string (yyconst char * yystr ) { return db_scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to dblex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE db_scan_bytes (yyconst char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) dballoc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in db_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = db_scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in db_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif static void yy_fatal_error (yyconst char* msg ) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up dbtext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ dbtext[dbleng] = (yy_hold_char); \ (yy_c_buf_p) = dbtext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ dbleng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int dbget_lineno (void) { return dblineno; } /** Get the input stream. * */ FILE *dbget_in (void) { return dbin; } /** Get the output stream. * */ FILE *dbget_out (void) { return dbout; } /** Get the length of the current token. * */ int dbget_leng (void) { return dbleng; } /** Get the current token. * */ char *dbget_text (void) { return dbtext; } /** Set the current line number. * @param line_number * */ void dbset_lineno (int line_number ) { dblineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param in_str A readable stream. * * @see db_switch_to_buffer */ void dbset_in (FILE * in_str ) { dbin = in_str ; } void dbset_out (FILE * out_str ) { dbout = out_str ; } int dbget_debug (void) { return db_flex_debug; } void dbset_debug (int bdebug ) { db_flex_debug = bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from dblex_destroy(), so don't allocate here. */ (yy_buffer_stack) = 0; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; (yy_c_buf_p) = (char *) 0; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT dbin = stdin; dbout = stdout; #else dbin = (FILE *) 0; dbout = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * dblex_init() */ return 0; } /* dblex_destroy is for both reentrant and non-reentrant scanners. */ int dblex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ db_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; dbpop_buffer_state(); } /* Destroy the stack itself. */ dbfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * dblex() is called, initialization will occur. */ yy_init_globals( ); return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *dballoc (yy_size_t size ) { return (void *) malloc( size ); } void *dbrealloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } void dbfree (void * ptr ) { free( (char *) ptr ); /* see dbrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 143 "db_lex.l" int dbwrap(){ return 1; } void db_buff(int db, FILE* f) { int stack_pointer=0; switch(db) { case DB_OLD: { stack_pointer=0; db_at_hand=DB_OLD; break; } case DB_NEW: { stack_pointer=1; db_at_hand=DB_NEW; break; } } if(f!=NULL){ db_stack[stack_pointer]=db_create_buffer(f,YY_BUF_SIZE ); } db_switch_to_buffer(db_stack[stack_pointer]); } aide-0.16~a2.git20130520/src/db_lex.l000066400000000000000000000055131214657706600166050ustar00rootroot00000000000000C [%!$&\'\(\)\*\+,\-./0-9;=?A-Za-z_] L [a-zA-ZöäåÖÄÅ0-9_] %{ /* C [a-zA-Z0-9öäåÖÄÅ\\\*=$%£&/!\^\~;:.,\?\{\}\(\)\[\]\<\>\-\+\*\|\'\`] */ /* "\ "\\*=$%£&/!\^~;:.,?\{\}\(\)\[\]\<\>-+*\|\'\`] typedef union { char* s; } YYSTYPE; extern YYSTYPE yylval; "/"({C}|{PC})+ { return (TNAME); } */ /* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2002,2005,2010,2013 Rami Lehti,Pablo Virolainen, * Richard van den Berg, Hannes von Haugwitz * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define YY_DECL int db_scan(void) #define YYDEBUG 1 #include "aide.h" #include "conf_yacc.h" #include #include "report.h" #include "commandconf.h" /* We need to define these here since we cannot include db.h*/ #define DB_OLD (1<<0) #define DB_WRITE (1<<1) #define DB_NEW (1<<2) #define NODE_ADDED (1<<4) #define NODE_REMOVED (1<<5) #define NODE_CHANGED (1<<6) long db_in_lineno=1; long db_new_lineno=1; long* db_lineno=&db_in_lineno; YY_BUFFER_STATE db_stack[2]; int db_at_hand=0; #define YY_INPUT(buf,result,max_size) \ if( ((result=db_input_wrapper(buf,max_size,db_at_hand)) == 0) \ && ferror(yyin) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); %} %option nounput %Start MDVALHUNT %% ^"\037\213" { return (TGZIPHEADER); } "@@db_spec" { return (TDBSPEC); } ^"@@begin_db" { return (TBEGIN_DB); } ^"@@end_db " { BEGIN MDVALHUNT; return (TEND_DB); } ({C})+ { BEGIN 0; return (TSTRING); } ^"@@end_db" { return (TEND_DBNOMD); } "@@"({L}+) { return (TUNKNOWN); } "#"[^\n]*"\n" { (*db_lineno)++; } ({C})+ { error(230," %s \n",yytext); return (TID); } [" "\t] {} "\n" { (*db_lineno)++; return (TNEWLINE); } [^\n] { return (TERROR); } <> { return (TEOF); } %% int dbwrap(){ return 1; } void db_buff(int db, FILE* f) { int stack_pointer=0; switch(db) { case DB_OLD: { stack_pointer=0; db_at_hand=DB_OLD; break; } case DB_NEW: { stack_pointer=1; db_at_hand=DB_NEW; break; } } if(f!=NULL){ db_stack[stack_pointer]=yy_create_buffer( f, YY_BUF_SIZE ); } yy_switch_to_buffer(db_stack[stack_pointer]); } aide-0.16~a2.git20130520/src/db_list.c000066400000000000000000000026701214657706600167600ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999,2000,2001,2002 Rami Lehti,Pablo Virolainen * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "db_list.h" /*for locale support*/ #include "locale-aide.h" /*for locale support*/ void db_list_append(db_list*item) { db_list* tmp_listp=NULL; item->next=NULL; item->prev=NULL; item->head=NULL; if(db_list_head==NULL){ db_list_head=item; db_list_head->next=NULL; db_list_head->prev=NULL; db_list_head->head=db_list_head; db_list_head->tail=db_list_head; return; } else { tmp_listp=db_list_head->tail; tmp_listp->next=item; tmp_listp->tail=item; item->head=db_list_head; item->tail=db_list_head; db_list_head->tail=item; return; } } aide-0.16~a2.git20130520/src/db_sql.c000066400000000000000000000303041214657706600165770ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 2000-2002,2004-2006,2011 Rami Lehti, Pablo Virolainen, * Richard van den Berg, Hannes von Haugwitz * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "aide.h" /*for locale support*/ #include "locale-aide.h" /*for locale support*/ #ifdef WITH_PSQL #include #include #include #include #include #include "base64.h" #include "db.h" #include "db_sql.h" #include "db_config.h" #include "libpq-fe.h" #include "report.h" #ifdef WITH_MHASH #include #endif char* db_get_sql(db_line*,db_config*); int _db_check_result(PGconn *conn, PGresult *res, char *query) { int status = 0; int ret = RETOK; if (!res || ( (PQresultStatus(res) != PGRES_COMMAND_OK) && (PQresultStatus(res) != PGRES_TUPLES_OK) )){ ret = RETFAIL; if (res!=NULL) { error(0,"Sql error %s while doing %s\n", PQerrorMessage(conn), query); } else { error(0,"Sql error while doing %s.\n",query); } } else { error(255,"Sql went ok.\n"); status = 1; } return status; } int db_writespec_sql(db_config* conf){ PGresult *res; int i; int table_exists; char* s; int ret = RETOK; s = (char*) malloc(sizeof(char)*1024); /* Hope 1023 bytes is enough for string... 390 + length of table name should be enough. */ /* We have to ensure that the database table not exist */ /* check if the table exists already */ sprintf(s, "SELECT * FROM pg_class WHERE relname = '%s'", ((psql_data*)conf->db_out)->table); res = PQexec(((psql_data*)conf->db_out)->conn, s); if ( _db_check_result(((psql_data*)conf->db_out)->conn, res, s) == 0 ) { ret = RETFAIL; } table_exists = PQntuples(res) == 1 ? 1 : 0; PQclear(res); *s = '\0'; /* reset query string */ if (table_exists == 0) { /* we need to create the table */ s = strcat(s, "CREATE TABLE "); s = strcat(s, ((psql_data*)conf->db_out)->table); s = strcat(s, "("); for (i=0;idb_out_size;i++) { if (i!=0) { s = strcat(s, ","); } s = strcat(s, db_names[conf->db_out_order[i]]); s = strcat(s, " "); s = strcat(s, db_sql_types[conf->db_out_order[i]]); } s = strcat(s,");"); error(255,"SQL:%s\n",s); res = PQexec(((psql_data*)conf->db_out)->conn,s); if (_db_check_result(((psql_data*)conf->db_out)->conn, res, s) == 0) { ret = RETFAIL; } PQclear(res); } free(s); /* Just say no to memoryleaks. */ return ret; /* FIXME!! No error checkin may be broken. Fix malloc also */ } int db_writeline_sql(db_line* line,db_config* conf){ PGresult *res; int i; int ret=RETOK; char* s=db_get_sql(line,conf) ; if (s==NULL) { return RETFAIL; } error(255,"SQL:%s",s); res = PQexec(((psql_data*)conf->db_out)->conn,s); if ( _db_check_result(((psql_data*)conf->db_out)->conn, res, s) == 0 ) { ret = RETFAIL; } PQclear(res); free(s); return ret; } void db_readline_sql_int(int* d,int db,int i, db_config* conf) { FILE** db_filep=NULL; switch (db) { case DB_OLD: { db_filep=&(conf->db_in); break; } case DB_NEW: { db_filep=&(conf->db_new); break; } } if (((psql_data*)(*db_filep))->des[i]!=-1) { *d=(int)PQgetvalue(((psql_data*)(*db_filep))->res, ((psql_data*)(*db_filep))->curread, ((psql_data*)(*db_filep))->des[i]); } else { *d=0; } error(254,"sql_readline_sql_int %s got %i\n",db_names[i],*d); } void db_readline_sql_char(void** d,int db,const int i, db_config* conf) { volatile int cr,des; psql_data* data; FILE** db_filep=NULL; switch (db) { case DB_OLD: { db_filep=&(conf->db_in); break; } case DB_NEW: { db_filep=&(conf->db_new); break; } } data=((psql_data*)(*db_filep)); cr=data->curread; des=data->des[i]; if (des!=-1) { volatile char* s=NULL; s = (char*)PQgetvalue(data->res,cr,des); if (s!=NULL) { *d=(void*)strdup((char*)s); } else { *d=NULL; } error(254,"sql_readline_sql_char %i,%i %s got %s\n",cr,des,db_names[i],*d); } else { *d=NULL; error(254,"sql_readline_sql_char %i,%i %s got NULL\n",cr,des,db_names[i]); } } void db_readline_sql_byte(void** d,int db,int i, db_config* conf) { db_readline_sql_char(d,db,i, conf); if (*d!=NULL) { *((byte*)d)=base64tobyte(*d,strlen(*d)); } } void db_readline_sql_time(void** d,int db,int i, db_config* conf) { db_readline_sql_char(d,db,i, conf); if (*d!=NULL) { *((time_t*)d)=base64totime_t(*d); } } db_line* db_readline_sql(int db, db_config* conf) { volatile db_line* rline; int i; url_t* db_url=NULL; FILE** db_filep=NULL; int* db_osize=0; DB_FIELD** db_order=NULL; switch (db) { case DB_OLD: { db_url=conf->db_in_url; db_filep=&(conf->db_in); db_osize=&(conf->db_in_size); db_order=&(conf->db_in_order); break; } case DB_NEW: { db_url=conf->db_new_url; db_filep=&(conf->db_new); db_osize=&(conf->db_new_size); db_order=&(conf->db_new_order); break; } } if (((psql_data*)(*db_filep))->curread>= ((psql_data*)(*db_filep))->maxread) { error(255,"Everything read from SQL\n"); return NULL; } rline=(db_line*)malloc(1*sizeof(db_line)); db_readline_sql_byte((void*)&(rline->md5),db,(int)db_md5, conf); db_readline_sql_byte((void*)&(rline->sha1),db,db_sha1, conf); db_readline_sql_byte((void*)&(rline->rmd160),db,db_rmd160, conf); db_readline_sql_byte((void*)&(rline->tiger),db,db_tiger, conf); #ifdef WITH_MHASH db_readline_sql_byte((void*)&(rline->crc32),db,db_crc32, conf); db_readline_sql_byte((void*)&(rline->haval),db,db_haval, conf); db_readline_sql_byte((void*)&(rline->gost),db,db_gost, conf); #endif db_readline_sql_char((void*)&(rline->fullpath),db,db_filename, conf); rline->filename=rline->fullpath; db_readline_sql_char((void*)&(rline->linkname),db,db_linkname, conf); db_readline_sql_int((void*)&(rline->perm),db,db_perm, conf); db_readline_sql_int((void*)&(rline->uid),db,db_uid, conf); db_readline_sql_int((void*)&(rline->gid),db,db_gid, conf); db_readline_sql_int((void*)&(rline->inode),db,db_inode, conf); db_readline_sql_int((void*)&(rline->nlink),db,db_lnkcount, conf); db_readline_sql_int((void*)&(rline->size),db,*db_osize, conf); db_readline_sql_int((void*)&(rline->bcount),db,db_bcount, conf); db_readline_sql_int((void*)&(rline->attr),db,db_attr, conf); db_readline_sql_time((void*)&(rline->atime),db,db_atime, conf); db_readline_sql_time((void*)&(rline->ctime),db,db_ctime, conf); db_readline_sql_time((void*)&(rline->mtime),db,db_mtime, conf); #ifdef WITH_ACL rline->acl=NULL; #endif ((psql_data*)(*db_filep))->curread++; error(255,"filename %s\n",rline->filename); return rline; } void sql_writeint(int data,char *s,int i){ char t[10]; t[0]=0; if (i!=0) { s = strcat(s,","); } sprintf(t,"%i",data); strcat(s,t); } void sql_writeoct(int data,char *s,int i){ char t[10]; t[0]=0; if (i!=0) { s = strcat(s,","); } sprintf(t,"%lo",data); strcat(s,t); } void sql_write_time_base64(time_t data,char* s,int i){ static char* ptr=NULL; char* tmpstr=NULL; int retval=0; if(i!=0){ strcat(s,","); } if(data==0){ strcat(s,"''"); return; } ptr=(char*)malloc(sizeof(char)*TIMEBUFSIZE); if (ptr==NULL) { error(0,"\nCannot allocate memory..\n"); abort(); } memset((void*)ptr,0,sizeof(char)*TIMEBUFSIZE); sprintf(ptr,"%li",data); tmpstr=encode_base64(ptr,strlen(ptr)); strcat(s,"'"); strcat(s,tmpstr); strcat(s,"'"); free(tmpstr); free(ptr); return; } void sql_write_byte_base64(byte*data,size_t len,char* s,int i ) { char* tmpstr=NULL; int retval=0; tmpstr=encode_base64(data,len); if(i){ strcat(s,","); } strcat(s,"'"); if(tmpstr){ strcat(s,tmpstr); free(tmpstr); }else { /* Do nothing.. */ } strcat(s,"'"); return; } char* db_get_sql(db_line* line,db_config* conf){ int i; char* s=(char*) malloc(sizeof(char)*10240); /* FIXME .. */ if (s==NULL) { error(0,"\nCannot allocate memory..\n"); abort(); } s[0]=0; /* Insertion was hardcoded into aide-table, now we will use the provided name from the configfile */ s = strcat(s,"INSERT INTO "); s = strcat(s, ((psql_data*)conf->db_out)->table); s = strcat(s," values("); for(i=0;idb_out_size;i++){ switch (conf->db_out_order[i]) { case db_filename : { char* tmp; if ( i!=0 ) { s = strcat(s,","); } strcat(s,"'"); tmp=encode_string(line->filename); s = strcat(s,tmp); free(tmp); strcat(s,"'"); break; } case db_linkname : { if ( i!=0 ) { s = strcat(s,","); } strcat(s,"'"); if (line->linkname != NULL) { char* tmp; tmp=encode_string(line->linkname); s = strcat(s,tmp); free(tmp); } strcat(s,"'"); break; } case db_attr : { sql_writeint(line->attr,s,i); break; } case db_bcount : { sql_writeint(line->bcount,s,i); break; } case db_mtime : { sql_write_time_base64(line->mtime,s,i); break; } case db_atime : { sql_write_time_base64(line->atime,s,i); break; } case db_ctime : { sql_write_time_base64(line->ctime,s,i); break; } case db_inode : { sql_writeint(line->inode,s,i); break; } case db_lnkcount : { sql_writeint(line->nlink,s,i); break; } case db_uid : { sql_writeint(line->uid,s,i); break; } case db_gid : { sql_writeint(line->gid,s,i); break; } case db_size : { sql_writeint(line->size,s,i); break; } case db_md5 : { sql_write_byte_base64(line->md5, gcry_md_get_algo_dlen(GCRY_MD_MD5),s,i); break; } case db_sha1 : { sql_write_byte_base64(line->sha1, gcry_md_get_algo_dlen(GCRY_MD_SHA1),s,i); break; } case db_rmd160 : { sql_write_byte_base64(line->rmd160, gcry_md_get_algo_dlen(GCRY_MD_RMD160), s,i); break; } case db_tiger : { sql_write_byte_base64(line->tiger, gcry_md_get_algo_dlen(GCRY_MD_TIGER), s,i); break; } case db_perm : { sql_writeoct(line->perm,s,i); break; } #ifdef WITH_MHASH case db_crc32 : { sql_write_byte_base64(line->crc32, mhash_get_block_size(MHASH_CRC32), s,i); break; } case db_crc32b : { sql_write_byte_base64(line->crc32b, mhash_get_block_size(MHASH_CRC32B), s,i); break; } case db_haval : { sql_write_byte_base64(line->haval, mhash_get_block_size(MHASH_HAVAL256), s,i); break; } case db_gost : { sql_write_byte_base64(line->gost , mhash_get_block_size(MHASH_GOST), s,i); break; } #endif case db_acl : { error(0,"TODO db_acl write to db_sql.c"); /* TODO */ break; } case db_xattrs : { error(0,"TODO db_xattrs write to db_sql.c"); /* TODO */ break; } case db_checkmask : { sql_writeoct(line->attr,s,i); break; } default : { error(0,"Not implemented in sql_writeline_file %i\n", conf->db_out_order[i]); return NULL; } } } strcat(s,");"); return s; } int db_close_sql(void* db){ PQexec(((psql_data*)db)->conn,"commit"); PQfinish(((psql_data*)db)->conn); return RETOK; } #endif aide-0.16~a2.git20130520/src/do_md.c000066400000000000000000000375241214657706600164300ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * vi: ts=8 sw=8 * * Copyright (C) 1999-2002,2004-2006,2009-2011,2013 Rami Lehti, Pablo * Virolainen, Mike Markley, Richard van den Berg, Hannes von Haugwitz * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "aide.h" #ifndef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 200112L #endif #include #include #include #include #include #include #include #include #include #include #include "md.h" #include "db_config.h" #include "do_md.h" #include "report.h" #include "list.h" /*for locale support*/ #include "locale-aide.h" /*for locale support*/ /* This define should be somewhere else */ #define READ_BLOCK_SIZE 16777216 #ifdef WITH_MHASH #include #endif /* WITH_MHASH */ /* Redhat 5.0 needs this */ #ifdef HAVE_MMAP #ifndef MAP_FAILED #define MAP_FAILED (-1) #endif /* MAP_FAILED */ #define MMAP_BLOCK_SIZE 16777216 #endif /* HAVE_MMAP */ /* #include */ #ifdef WITH_PRELINK #include #include /* * Is file descriptor prelinked binary/library? * Return: 1(yes) / 0(no) * */ int is_prelinked(int fd) { Elf *elf = NULL; Elf_Scn *scn = NULL; Elf_Data *data = NULL; GElf_Ehdr ehdr; GElf_Shdr shdr; GElf_Dyn dyn; int bingo; (void) elf_version(EV_CURRENT); if ((elf = elf_begin (fd, ELF_C_READ, NULL)) == NULL || elf_kind(elf) != ELF_K_ELF || gelf_getehdr(elf, &ehdr) == NULL || !(ehdr.e_type == ET_DYN || ehdr.e_type == ET_EXEC)) return 0; bingo = 0; while (!bingo && (scn = elf_nextscn(elf, scn)) != NULL) { (void) gelf_getshdr(scn, &shdr); if (shdr.sh_type != SHT_DYNAMIC) continue; while (!bingo && (data = elf_getdata (scn, data)) != NULL) { int maxndx = data->d_size / shdr.sh_entsize; int ndx; for (ndx = 0; ndx < maxndx; ++ndx) { (void) gelf_getdyn (data, ndx, &dyn); if (!(dyn.d_tag == DT_GNU_PRELINKED || dyn.d_tag == DT_GNU_LIBLIST)) continue; bingo = 1; break; } } } return bingo; } /* * Open path via prelink -y, set fd * Return: 0 failure / > 0 success * */ pid_t open_prelinked(const char * path, int * fd) { const char *cmd = PRELINK_PATH; pid_t pid = 0; int pipes[2]; pipes[0] = pipes[1] = -1; if (pipe(pipes) < 0) return 0; pid = fork(); switch (pid) { case 0: /* child */ close(pipes[0]); dup2(pipes[1], STDOUT_FILENO); close(pipes[1]); unsetenv("MALLOC_CHECK_"); execl(cmd, cmd, "--verify", path, (char *) NULL); exit(1); break; case -1: close(pipes[0]); close(pipes[1]); return 0; } /* parent */ close(pipes[1]); *fd = pipes[0]; return pid; } #endif void free_hashes(db_line* dl){ #define free_hash(a) dl->a=NULL free_hash(md5); free_hash(sha1); free_hash(rmd160); free_hash(tiger); #ifdef WITH_MHASH free_hash(crc32); free_hash(haval); free_hash(gost); free_hash(crc32b); #endif free_hash(sha256); free_hash(sha512); } int stat_cmp(struct AIDE_STAT_TYPE* f1,struct AIDE_STAT_TYPE* f2) { if (f1==NULL || f2==NULL) { return RETFAIL; } #define stat_cmp_helper(n,n2) ((f1->n!=f2->n)*n2) return (stat_cmp_helper(st_ino,DB_INODE)| stat_cmp_helper(st_mode,DB_PERM)| stat_cmp_helper(st_nlink,DB_LNKCOUNT)| stat_cmp_helper(st_size,DB_SIZE)| stat_cmp_helper(st_mtime,DB_MTIME)| stat_cmp_helper(st_ctime,DB_CTIME)| stat_cmp_helper(st_blocks,DB_BCOUNT)| stat_cmp_helper(st_blksize,DB_BSIZE)| stat_cmp_helper(st_rdev,DB_RDEV)| stat_cmp_helper(st_gid,DB_GID)| stat_cmp_helper(st_uid,DB_UID)| stat_cmp_helper(st_dev,DB_DEV)); } void no_hash(db_line* line); void calc_md(struct AIDE_STAT_TYPE* old_fs,db_line* line) { /* We stat after opening just to make sure that the file from we are about to calculate the hash is the correct one, and we don't read from a pipe :) */ struct AIDE_STAT_TYPE fs; int sres=0; int stat_diff,filedes; #ifdef WITH_PRELINK pid_t pid; #endif error(255,"calc_md called\n"); #ifdef _PARAMETER_CHECK_ if (line==NULL) { abort(); } #endif #ifdef HAVE_O_NOATIME filedes=open(line->fullpath,O_RDONLY|O_NOATIME); if(filedes<0) #endif filedes=open(line->fullpath,O_RDONLY); if (filedes==-1) { char* er=strerror(errno); if (er!=NULL) { error(3,"do_md(): open() for %s failed: %s\n", line->fullpath,er); } else { error(3,"do_md(): open() for %s failed: %i\n", line->fullpath,errno); } /* Nop. Cannot cal hashes. Mark it. */ no_hash(line); return; } sres=AIDE_FSTAT_FUNC(filedes,&fs); if(!(line->attr&DB_RDEV)) fs.st_rdev=0; #ifdef HAVE_POSIX_FADVISE if (posix_fadvise(filedes,0,fs.st_size,POSIX_FADV_NOREUSE)!=0) { error(255,"posix_fadvise error %s\n",strerror(errno)); } else { error(255,"posix_fadvise(%i,0,%li,POSIX_FADV_NOREUSE) ok\n",filedes,fs.st_size); } #endif if ((stat_diff=stat_cmp(&fs,old_fs))==RETOK) { /* Now we have a 'valid' filehandle to read from a file. */ #ifdef WITH_PRELINK /* * Let's take care of prelinked libraries/binaries */ pid=0; if ( is_prelinked(filedes) ) { close(filedes); pid = open_prelinked(line->fullpath, &filedes); if (pid == 0) { error(0, "Error on starting prelink undo\n"); return; } } #endif off_t r_size=0; off_t size=0; char* buf; struct md_container mdc; mdc.todo_attr=line->attr; if (init_md(&mdc)==RETOK) { #ifdef HAVE_MMAP #ifdef WITH_PRELINK if (pid == 0) { #endif off_t curpos=0; r_size=fs.st_size; /* in mmap branch r_size is used as size remaining */ while(r_size>0){ if(r_sizefullpath,strerror(errno)); close(filedes); close_md(&mdc); return; } conf->catch_mmap=1; if (update_md(&mdc,buf,size)!=RETOK) { error(0,"Message digest failed during update\n"); close(filedes); close_md(&mdc); munmap(buf,size); return; } munmap(buf,size); conf->catch_mmap=0; } /* we have used MMAP, let's return */ close_md(&mdc); md2line(&mdc,line); close(filedes); return; #ifdef WITH_PRELINK } #endif #endif /* not HAVE_MMAP */ buf=malloc(READ_BLOCK_SIZE); #if READ_BLOCK_SIZE>SSIZE_MAX #error "READ_BLOCK_SIZE" is too large. Max value is SSIZE_MAX, and current is READ_BLOCK_SIZE #endif while ((size=TEMP_FAILURE_RETRY(read(filedes,buf,READ_BLOCK_SIZE)))>0) { if (update_md(&mdc,buf,size)!=RETOK) { error(0,"Message digest failed during update\n"); close(filedes); close_md(&mdc); return; } r_size+=size; } #ifdef WITH_PRELINK if (pid) { int status; (void) waitpid(pid, &status, 0); if (!WIFEXITED(status) || WEXITSTATUS(status)) { error(0, "Error on exit of prelink child process\n"); close(filedes); close_md(&mdc); return; } } #endif free(buf); close_md(&mdc); md2line(&mdc,line); } else { error(3,"Message digest initialization failed.\n"); no_hash(line); close(filedes); return; } } else { unsigned i; /* Something just wasn't correct, so no hash calculated. */ error(5,"Entry %s was changed so that hash cannot be calculated for it\n" ,line->fullpath); for(i=0;iinode=fs->st_ino; if(DB_UID&line->attr) { line->uid=fs->st_uid; }else { line->uid=0; } if(DB_GID&line->attr){ line->gid=fs->st_gid; }else{ line->gid=0; } line->perm=fs->st_mode; if(DB_SIZE&line->attr||DB_SIZEG&line->attr){ line->size=fs->st_size; }else{ line->size=0; } if(DB_LNKCOUNT&line->attr){ line->nlink=fs->st_nlink; }else { line->nlink=0; } if(DB_MTIME&line->attr){ line->mtime=fs->st_mtime; }else{ line->mtime=0; } if(DB_CTIME&line->attr){ line->ctime=fs->st_ctime; }else{ line->ctime=0; } if(DB_ATIME&line->attr){ line->atime=fs->st_atime; }else{ line->atime=0; } if(DB_BCOUNT&line->attr){ line->bcount=fs->st_blocks; } else { line->bcount=0; } } #ifdef WITH_ACL void acl2line(db_line* line) { acl_type *ret = NULL; #ifdef WITH_POSIX_ACL if(DB_ACL&line->attr) { acl_t acl_a; acl_t acl_d; char *tmp = NULL; acl_a = acl_get_file(line->fullpath, ACL_TYPE_ACCESS); acl_d = acl_get_file(line->fullpath, ACL_TYPE_DEFAULT); if ((acl_a == NULL) && (errno == ENOTSUP)) { line->attr&=(~DB_ACL); return; } if (acl_a == NULL) error(0, "Tried to read access ACL on %s but failed with: %s\n", line->fullpath, strerror(errno)); if ((acl_d == NULL) && (errno != EACCES)) /* ignore DEFAULT on files */ { acl_free(acl_a); error(0, "Tried to read default ACL on %s but failed with: %s\n", line->fullpath, strerror(errno)); } /* assume memory allocs work, like rest of AIDE code... */ ret = malloc(sizeof(acl_type)); /* use tmp, so free() can be called instead of acl_free() */ tmp = acl_to_text(acl_a, NULL); if (!tmp || !*tmp) ret->acl_a = NULL; else ret->acl_a = strdup(tmp); acl_free(tmp); if (!acl_d) ret->acl_d = NULL; else { tmp = acl_to_text(acl_d, NULL); if (!tmp || !*tmp) ret->acl_d = NULL; else ret->acl_d = strdup(tmp); acl_free(tmp); } acl_free(acl_a); acl_free(acl_d); } line->acl = ret; #endif #ifdef WITH_SUN_ACL if(DB_ACL&line->attr) { /* There might be a bug here. */ int res; line->acl=malloc(sizeof(acl_type)); line->acl->entries=acl(line->fullpath,GETACLCNT,0,NULL); if (line->acl->entries==-1) { char* er=strerror(errno); line->acl->entries=0; if (er==NULL) { error(0,"ACL query failed for %s. strerror failed for %i\n",line->fullpath,errno); } else { error(0,"ACL query failed for %s:%s\n",line->fullpath,er); } } else { line->acl->acl=malloc(sizeof(aclent_t)*line->acl->entries); res=acl(line->fullpath,GETACL,line->acl->entries,line->acl->acl); if (res==-1) { error(0,"ACL error %s\n",strerror(errno)); } else { if (res!=line->acl->entries) { error(0,"Tried to read %i acl but got %i\n",line->acl->entries,res); } } } }else{ line->acl=NULL; } #endif } #endif #ifdef WITH_XATTR static xattrs_type *xattr_new(void) { xattrs_type *ret = NULL; ret = malloc(sizeof(xattrs_type)); ret->num = 0; ret->sz = 2; ret->ents = malloc(sizeof(xattr_node) * ret->sz); return (ret); } static void *xzmemdup(const void *ptr, size_t len) { /* always keeps a 0 at the end... */ void *ret = NULL; ret = malloc(len+1); memcpy(ret, ptr, len); ((char*)ret)[len] = 0; return (ret); } static void xattr_add(xattrs_type *xattrs, const char *key, const char *val, size_t vsz) { if (xattrs->num >= xattrs->sz) { xattrs->sz <<= 1; xattrs->ents = realloc(xattrs->ents, sizeof(xattr_node) * xattrs->sz); } xattrs->ents[xattrs->num].key = strdup(key); xattrs->ents[xattrs->num].val = xzmemdup(val, vsz); xattrs->ents[xattrs->num].vsz = vsz; xattrs->num += 1; } void xattrs2line(db_line *line) { /* get all generic user xattrs. */ xattrs_type *xattrs = NULL; static ssize_t xsz = 1024; static char *xatrs = NULL; ssize_t xret = -1; if (!(DB_XATTRS&line->attr)) return; /* assume memory allocs work, like rest of AIDE code... */ if (!xatrs) xatrs = malloc(xsz); while (((xret = llistxattr(line->fullpath, xatrs, xsz)) == -1) && (errno == ERANGE)) { xsz <<= 1; xatrs = realloc(xatrs, xsz); } if ((xret == -1) && ((errno == ENOSYS) || (errno == ENOTSUP))) { line->attr&=(~DB_XATTRS); } else if (xret == -1) { error(0, "listxattrs failed for %s:%s\n", line->fullpath, strerror(errno)); } else if (xret) { const char *attr = xatrs; static ssize_t asz = 1024; static char *val = NULL; if (!val) val = malloc(asz); xattrs = xattr_new(); while (xret > 0) { size_t len = strlen(attr); ssize_t aret = 0; if (strncmp(attr, "user.", strlen("user.")) && strncmp(attr, "root.", strlen("root."))) goto next_attr; /* only store normal xattrs, and SELinux */ while (((aret = getxattr(line->fullpath, attr, val, asz)) == -1) && (errno == ERANGE)) { asz <<= 1; val = realloc (val, asz); } if (aret != -1) xattr_add(xattrs, attr, val, aret); else if (errno != ENOATTR) error(0, "getxattr failed for %s:%s\n", line->fullpath, strerror(errno)); next_attr: attr += len + 1; xret -= len + 1; } } line->xattrs = xattrs; } #endif #ifdef WITH_SELINUX void selinux2line(db_line *line) { char *cntx = NULL; if (!(DB_SELINUX&line->attr)) return; if (lgetfilecon_raw(line->fullpath, &cntx) == -1) { line->attr&=(~DB_SELINUX); if ((errno != ENOATTR) && (errno != EOPNOTSUPP)) error(0, "lgetfilecon_raw failed for %s:%s\n", line->fullpath, strerror(errno)); return; } line->cntx = strdup(cntx); freecon(cntx); } #endif #ifdef WITH_E2FSATTRS void e2fsattrs2line(db_line* line) { unsigned long flags; if (DB_E2FSATTRS&line->attr) { if (fgetflags(line->fullpath, &flags) == 0) { line->e2fsattrs=flags; } else { line->attr&=(~DB_E2FSATTRS); line->e2fsattrs=0; } } else { line->e2fsattrs=0; } } #endif void no_hash(db_line* line) { line->attr&=~DB_HASHES; } aide-0.16~a2.git20130520/src/error.c000066400000000000000000000133361214657706600164720ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2006 Rami Lehti, Pablo Virolainen, Mike * Markley, Richard van den Berg * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "aide.h" #include #include #include #include #ifdef HAVE_SYSLOG #include #endif #include "report.h" #include "list.h" #include "be.h" /*for locale support*/ #include "locale-aide.h" /*for locale support*/ #include "util.h" int cmp_url(url_t* url1,url_t* url2){ return ((url1->type==url2->type)&&(strcmp(url1->value,url2->value)==0)); } int error_init(url_t* url,int initial) { list* r=NULL; FILE* fh=NULL; int sfac; if (url->type==url_database) { conf->report_db++; return RETOK; } if(initial==1){ if (url->type==url_syslog) { conf->report_syslog++; #ifdef HAVE_SYSLOG conf->initial_report_url=url; conf->initial_report_fd=NULL; sfac=syslog_facility_lookup(url->value); openlog(AIDE_IDENT,AIDE_LOGOPT, sfac); return RETOK; #endif #ifndef HAVE_SYSLOG error(0,_("This binary has no syslog support\n")); exit(INVALID_ARGUMENT_ERROR); #endif } fh=be_init(0,url,0); if(fh!=NULL){ conf->initial_report_fd=fh; conf->initial_report_url=url; return RETOK; } error(0,_("Cannot open %s for writing\n"),url->value); exit(INVALID_ARGUMENT_ERROR); } if(conf->verbose_level>=200){ error(5,_("WARNING: Debug output enabled\n")); } for(r=conf->report_url;r;r=r->next){ if (cmp_url((url_t*)r->data,url)) { error(5,_("WARNING: Already have report output %s\n"),url->value); return RETOK; } } if (url->type==url_syslog) { conf->report_syslog++; #ifdef HAVE_SYSLOG /* If you add support for facility changing in config consider multiple calls of openlog. This openlog MUST NOT mess up initial errorsto openlog. RvdB 22/1/2006: the 2 openlog calls where the same before my change, and they are still the same, I assume I did not brake anything */ sfac=syslog_facility_lookup(url->value); if(conf->report_syslog<2) openlog(AIDE_IDENT,AIDE_LOGOPT, sfac); return RETOK; #endif #ifndef HAVE_SYSLOG error(0,_("This binary has no syslog support\n")); return RETFAIL; #endif } fh=be_init(0,url,0); if(fh!=NULL) { conf->report_fd=list_append(conf->report_fd,(void*)fh); conf->report_url=list_append(conf->report_url,(void*)url); return RETOK; } error(0,_("Cannot open %s for writing\n"),url->value); return RETFAIL; } void error(int errorlevel,char* error_msg,...) { va_list ap; int retval=0; list* r=NULL; if(conf->verbose_level==-1){ if(5verbose_leveluse_initial_errorsto){ /* We are still using the initial errorsto */ va_start(ap, error_msg); if(conf->initial_report_url==NULL){ /* Error called before error_init(url,1) This most likely means that parsing compiled in initial report url failed. */ vfprintf(stderr,error_msg,ap); va_end(ap); fprintf(stderr, "Initial report url broken. Reconfigure and recompile.\n"); exit(INVALID_ARGUMENT_ERROR); } #ifdef HAVE_SYSLOG if(conf->initial_report_url->type==url_syslog){ #ifdef HAVE_VSYSLOG vsyslog(SYSLOG_PRIORITY,error_msg,ap); #else char buf[1024]; vsnprintf(buf,1024,error_msg,ap); syslog(SYSLOG_PRIORITY,"%s",buf); #endif va_end(ap); return; } #endif vfprintf(conf->initial_report_fd,error_msg,ap); va_end(ap); return; } #ifdef HAVE_SYSLOG if (conf->report_syslog!=0) { #ifdef HAVE_VSYSLOG va_start(ap,error_msg); vsyslog(SYSLOG_PRIORITY,error_msg,ap); va_end(ap); #else char buf[1024]; va_start(ap,error_msg); vsnprintf(buf,1024,error_msg,ap); va_end(ap); syslog(SYSLOG_PRIORITY,"%s",buf); #endif } #endif #ifdef WITH_DBERROR if (conf->report_db!=0 && ( conf->db_out!=NULL #ifdef WITH_ZLIB || conf->db_gzout #endif )) { db_line line; int len; memset(&line,0,sizeof(db_line)); line.filename=(char*)malloc(3); if (line.filename!=NULL) { va_start(ap,error_msg); len=vsnprintf(line.filename,2,error_msg,ap); va_end(ap); free(line.filename); line.filename=malloc(len+2); line.filename[0]='#'; if (line.filename!=NULL) { line.attr=DB_FILENAME; va_start(ap,error_msg); len=vsnprintf(line.filename+1,len+1,error_msg,ap); va_end(ap); db_writeline(&line,conf); free(line.filename); } } } #endif for(r=conf->report_fd;r;r=r->next){ va_start(ap, error_msg); retval=vfprintf((FILE*)r->data, error_msg,ap); va_end(ap); if(retval==0){ va_start(ap, error_msg); retval=vfprintf((FILE*)r->data, error_msg,ap); va_end(ap); if(retval==0){ exit(ERROR_WRITING_ERROR); } } } return; } const char* aide_key_0=CONFHMACKEY_00; const char* db_key_0=DBHMACKEY_00; aide-0.16~a2.git20130520/src/fopen.c000066400000000000000000000250071214657706600164460ustar00rootroot00000000000000/***************************************************************************** * * This example source code introduces a c library buffered I/O interface to * URL reads it supports fopen(), fread(), fgets(), feof(), fclose(), * rewind(). Supported functions have identical prototypes to their normal c * lib namesakes and are preceaded by url_ . * * Using this code you can replace your program's fopen() with url_fopen() * and fread() with url_fread() and it become possible to read remote streams * instead of (only) local files. Local files (ie those that can be directly * fopened) will drop back to using the underlying clib implementations * * See the main() function at the bottom that shows an app that retrives from a * specified url using fgets() and fread() and saves as two output files. * * Copyright (c) 2003 Simtec Electronics * * Re-implemented by Vincent Sanders with extensive * reference to original curl example code * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This example requires libcurl 7.9.7 or later. * * Modified for aide by Hannes von Haugwitz * based on modifications of previous version by Pablo Virolainen * (pablo@ipi.fi): * 2013-05-14: - moved declarations to 'include/fopen.h' * - removed (unneeded) main method */ #include "fopen.h" /* we use a global one for convenience */ CURLM *multi_handle; /* curl calls this routine to get more data */ static size_t write_callback(char *buffer, size_t size, size_t nitems, void *userp) { char *newbuff; size_t rembuff; URL_FILE *url = (URL_FILE *)userp; size *= nitems; rembuff=url->buffer_len - url->buffer_pos; /* remaining space in buffer */ if(size > rembuff) { /* not enough space in buffer */ newbuff=realloc(url->buffer,url->buffer_len + (size - rembuff)); if(newbuff==NULL) { fprintf(stderr,"callback buffer grow failed\n"); size=rembuff; } else { /* realloc suceeded increase buffer size*/ url->buffer_len+=size - rembuff; url->buffer=newbuff; } } memcpy(&url->buffer[url->buffer_pos], buffer, size); url->buffer_pos += size; return size; } /* use to attempt to fill the read buffer up to requested number of bytes */ static int fill_buffer(URL_FILE *file, size_t want) { fd_set fdread; fd_set fdwrite; fd_set fdexcep; struct timeval timeout; int rc; /* only attempt to fill buffer if transactions still running and buffer * doesnt exceed required size already */ if((!file->still_running) || (file->buffer_pos > want)) return 0; /* attempt to fill buffer */ do { int maxfd = -1; long curl_timeo = -1; FD_ZERO(&fdread); FD_ZERO(&fdwrite); FD_ZERO(&fdexcep); /* set a suitable timeout to fail on */ timeout.tv_sec = 60; /* 1 minute */ timeout.tv_usec = 0; curl_multi_timeout(multi_handle, &curl_timeo); if(curl_timeo >= 0) { timeout.tv_sec = curl_timeo / 1000; if(timeout.tv_sec > 1) timeout.tv_sec = 1; else timeout.tv_usec = (curl_timeo % 1000) * 1000; } /* get file descriptors from the transfers */ curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); /* In a real-world program you OF COURSE check the return code of the function calls. On success, the value of maxfd is guaranteed to be greater or equal than -1. We call select(maxfd + 1, ...), specially in case of (maxfd == -1), we call select(0, ...), which is basically equal to sleep. */ rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); switch(rc) { case -1: /* select error */ break; case 0: default: /* timeout or readable/writable sockets */ curl_multi_perform(multi_handle, &file->still_running); break; } } while(file->still_running && (file->buffer_pos < want)); return 1; } /* use to remove want bytes from the front of a files buffer */ static int use_buffer(URL_FILE *file,int want) { /* sort out buffer */ if((file->buffer_pos - want) <=0) { /* ditch buffer - write will recreate */ if(file->buffer) free(file->buffer); file->buffer=NULL; file->buffer_pos=0; file->buffer_len=0; } else { /* move rest down make it available for later */ memmove(file->buffer, &file->buffer[want], (file->buffer_pos - want)); file->buffer_pos -= want; } return 0; } URL_FILE *url_fopen(const char *url,const char *operation) { /* this code could check for URLs or types in the 'url' and basicly use the real fopen() for standard files */ URL_FILE *file; (void)operation; file = malloc(sizeof(URL_FILE)); if(!file) return NULL; memset(file, 0, sizeof(URL_FILE)); if((file->handle.file=fopen(url,operation))) file->type = CFTYPE_FILE; /* marked as URL */ else { file->type = CFTYPE_CURL; /* marked as URL */ file->handle.curl = curl_easy_init(); curl_easy_setopt(file->handle.curl, CURLOPT_URL, url); curl_easy_setopt(file->handle.curl, CURLOPT_WRITEDATA, file); curl_easy_setopt(file->handle.curl, CURLOPT_VERBOSE, 0L); curl_easy_setopt(file->handle.curl, CURLOPT_WRITEFUNCTION, write_callback); if(!multi_handle) multi_handle = curl_multi_init(); curl_multi_add_handle(multi_handle, file->handle.curl); /* lets start the fetch */ curl_multi_perform(multi_handle, &file->still_running); if((file->buffer_pos == 0) && (!file->still_running)) { /* if still_running is 0 now, we should return NULL */ /* make sure the easy handle is not in the multi handle anymore */ curl_multi_remove_handle(multi_handle, file->handle.curl); /* cleanup */ curl_easy_cleanup(file->handle.curl); free(file); file = NULL; } } return file; } int url_fclose(URL_FILE *file) { int ret=0;/* default is good return */ switch(file->type) { case CFTYPE_FILE: ret=fclose(file->handle.file); /* passthrough */ break; case CFTYPE_CURL: /* make sure the easy handle is not in the multi handle anymore */ curl_multi_remove_handle(multi_handle, file->handle.curl); /* cleanup */ curl_easy_cleanup(file->handle.curl); break; default: /* unknown or supported type - oh dear */ ret=EOF; errno=EBADF; break; } if(file->buffer) free(file->buffer);/* free any allocated buffer space */ free(file); return ret; } int url_feof(URL_FILE *file) { int ret=0; switch(file->type) { case CFTYPE_FILE: ret=feof(file->handle.file); break; case CFTYPE_CURL: if((file->buffer_pos == 0) && (!file->still_running)) ret = 1; break; default: /* unknown or supported type - oh dear */ ret=-1; errno=EBADF; break; } return ret; } size_t url_fread(void *ptr, size_t size, size_t nmemb, URL_FILE *file) { size_t want; switch(file->type) { case CFTYPE_FILE: want=fread(ptr,size,nmemb,file->handle.file); break; case CFTYPE_CURL: want = nmemb * size; fill_buffer(file,want); /* check if theres data in the buffer - if not fill_buffer() * either errored or EOF */ if(!file->buffer_pos) return 0; /* ensure only available data is considered */ if(file->buffer_pos < want) want = file->buffer_pos; /* xfer data to caller */ memcpy(ptr, file->buffer, want); use_buffer(file,want); want = want / size; /* number of items */ break; default: /* unknown or supported type - oh dear */ want=0; errno=EBADF; break; } return want; } char *url_fgets(char *ptr, size_t size, URL_FILE *file) { size_t want = size - 1;/* always need to leave room for zero termination */ size_t loop; switch(file->type) { case CFTYPE_FILE: ptr = fgets(ptr,size,file->handle.file); break; case CFTYPE_CURL: fill_buffer(file,want); /* check if theres data in the buffer - if not fill either errored or * EOF */ if(!file->buffer_pos) return NULL; /* ensure only available data is considered */ if(file->buffer_pos < want) want = file->buffer_pos; /*buffer contains data */ /* look for newline or eof */ for(loop=0;loop < want;loop++) { if(file->buffer[loop] == '\n') { want=loop+1;/* include newline */ break; } } /* xfer data to caller */ memcpy(ptr, file->buffer, want); ptr[want]=0;/* allways null terminate */ use_buffer(file,want); break; default: /* unknown or supported type - oh dear */ ptr=NULL; errno=EBADF; break; } return ptr;/*success */ } void url_rewind(URL_FILE *file) { switch(file->type) { case CFTYPE_FILE: rewind(file->handle.file); /* passthrough */ break; case CFTYPE_CURL: /* halt transaction */ curl_multi_remove_handle(multi_handle, file->handle.curl); /* restart */ curl_multi_add_handle(multi_handle, file->handle.curl); /* ditch buffer - write will recreate - resets stream pos*/ if(file->buffer) free(file->buffer); file->buffer=NULL; file->buffer_pos=0; file->buffer_len=0; break; default: /* unknown or supported type - oh dear */ break; } } aide-0.16~a2.git20130520/src/gen_list.c000066400000000000000000000704161214657706600171470ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2006,2009-2012 Rami Lehti,Pablo Virolainen, Mike * Markley, Richard van den Berg, Hannes von Haugwitz * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "aide.h" #include #include #include #include #include #include #include #include #include #include #include "report.h" #include "gnu_regex.h" #include "list.h" #include "gen_list.h" #include "seltree.h" #include "db.h" #include "db_config.h" #include "commandconf.h" #include "report.h" /*for locale support*/ #include "locale-aide.h" /*for locale support*/ #define CLOCK_SKEW 5 #ifdef WITH_MHASH #include #endif #include "md.h" #include "do_md.h" void hsymlnk(db_line* line); void fs2db_line(struct AIDE_STAT_TYPE* fs,db_line* line); void calc_md(struct AIDE_STAT_TYPE* old_fs,db_line* line); void no_hash(db_line* line); static int bytecmp(byte *b1, byte *b2, size_t len) { return strncmp((char *)b1, (char *)b2, len); } static int has_str_changed(char* old,char* new) { return (((old!=NULL && new!=NULL) && strcmp(old,new)!=0 ) || ((old!=NULL && new==NULL) || (old==NULL && new!=NULL))); } static int has_md_changed(byte* old,byte* new,int len) { error(255,"Debug, has_md_changed %p %p\n",old,new); return (((old!=NULL && new!=NULL) && (bytecmp(old,new,len)!=0)) || ((old!=NULL && new==NULL) || (old==NULL && new!=NULL))); } #ifdef WITH_ACL #ifdef WITH_SUN_ACL static int compare_single_acl(aclent_t* a1,aclent_t* a2) { if (a1->a_type!=a2->a_type || a1->a_id!=a2->a_id || a1->a_perm!=a2->a_perm) { return RETFAIL; } return RETOK; } #endif static int has_acl_changed(acl_type* old, acl_type* new) { #ifdef WITH_SUN_ACL int i; #endif if (old==NULL && new==NULL) { return RETOK; } if (old==NULL || new==NULL) { return RETFAIL; } #ifdef WITH_POSIX_ACL if ((!old->acl_a != !new->acl_a) || (!old->acl_d != !new->acl_d) || (old->acl_a && strcmp(old->acl_a, new->acl_a)) || (old->acl_d && strcmp(old->acl_d, new->acl_d))){ return RETFAIL; } #endif #ifdef WITH_SUN_ACL if (old->entries!=new->entries) { return RETFAIL; } /* Sort em up. */ aclsort(old->entries,0,old->acl); aclsort(new->entries,0,new->acl); for(i=0;ientries;i++){ if (compare_single_acl(old->acl+i,new->acl+i)==RETFAIL) { return RETFAIL; } } #endif return RETOK; } #endif #ifdef WITH_XATTR static int cmp_xattr_node(const void *c1, const void *c2) { const xattr_node *x1 = c1; const xattr_node *x2 = c2; return (strcmp(x1->key, x2->key)); } static int have_xattrs_changed(xattrs_type* x1,xattrs_type* x2) { size_t num = 0; if (x1 && (x1->num == 0)) x1 = NULL; if (x2 && (x2->num == 0)) x2 = NULL; if (x1==NULL && x2==NULL) { return RETOK; } if (x1==NULL || x2==NULL) { return RETFAIL; } if (x1->num != x2->num) { return RETFAIL; } qsort(x1->ents, x1->num, sizeof(xattr_node), cmp_xattr_node); qsort(x2->ents, x2->num, sizeof(xattr_node), cmp_xattr_node); while (num++ < x1->num) { const char *x1key = NULL; const byte *x1val = NULL; size_t x1vsz = 0; const char *x2key = NULL; const byte *x2val = NULL; size_t x2vsz = 0; x1key = x1->ents[num - 1].key; x1val = x1->ents[num - 1].val; x1vsz = x1->ents[num - 1].vsz; x2key = x2->ents[num - 1].key; x2val = x2->ents[num - 1].val; x2vsz = x2->ents[num - 1].vsz; if (strcmp(x1key, x2key) || x1vsz != x2vsz || memcmp(x1val, x2val, x1vsz)) return RETFAIL; } return RETOK; } #endif /* * Returns the changed attributes for two database lines. * * Attributes are only compared if they exist in both database lines. */ static DB_ATTR_TYPE get_changed_attributes(db_line* l1,db_line* l2) { #define easy_compare(a,b) \ if((a&l1->attr && (a&l2->attr)) && l1->b!=l2->b){\ ret|=a;\ } #define easy_md_compare(a,b,c) \ if((a&l1->attr && (a&l2->attr)) && has_md_changed(l1->b,l2->b, c)){ \ ret|=a; \ } #define easy_function_compare(a,b,c) \ if((a&l1->attr && (a&l2->attr)) && c(l1->b,l2->b)){ \ ret|=a; \ } DB_ATTR_TYPE ret=0; if ((DB_FTYPE&l1->attr && DB_FTYPE&l2->attr) && (l1->perm&S_IFMT)!=(l2->perm&S_IFMT)) { ret|=DB_FTYPE; } easy_function_compare(DB_LINKNAME,linkname,has_str_changed); if ((DB_SIZEG&l1->attr && DB_SIZEG&l2->attr) && l1->size>l2->size){ ret|=DB_SIZEG; } easy_compare(DB_SIZE,size); easy_compare(DB_BCOUNT,bcount); easy_compare(DB_PERM,perm); easy_compare(DB_UID,uid); easy_compare(DB_GID,gid); easy_compare(DB_ATIME,atime); easy_compare(DB_MTIME,mtime); easy_compare(DB_CTIME,ctime); easy_compare(DB_INODE,inode); easy_compare(DB_LNKCOUNT,nlink); easy_md_compare(DB_MD5,md5,HASH_MD5_LEN); easy_md_compare(DB_SHA1,sha1,HASH_SHA1_LEN); easy_md_compare(DB_RMD160,rmd160,HASH_RMD160_LEN); easy_md_compare(DB_TIGER,tiger,HASH_TIGER_LEN); easy_md_compare(DB_SHA256,sha256,HASH_SHA256_LEN); easy_md_compare(DB_SHA512,sha512,HASH_SHA512_LEN); #ifdef WITH_MHASH easy_md_compare(DB_CRC32,crc32,HASH_CRC32_LEN); easy_md_compare(DB_HAVAL,haval,HASH_HAVAL256_LEN); easy_md_compare(DB_GOST,gost,HASH_GOST_LEN); easy_md_compare(DB_CRC32B,crc32b,HASH_CRC32B_LEN); easy_md_compare(DB_WHIRLPOOL,whirlpool,HASH_WHIRLPOOL_LEN); #endif #ifdef WITH_ACL easy_function_compare(DB_ACL,acl,has_acl_changed); #endif #ifdef WITH_XATTR easy_function_compare(DB_XATTRS,xattrs,have_xattrs_changed); #endif #ifdef WITH_SELINUX easy_function_compare(DB_SELINUX,cntx,has_str_changed); #endif #ifdef WITH_E2FSATTRS easy_compare(DB_E2FSATTRS,e2fsattrs); #endif error(255,"Debug, changed attributes for entry %s [%llx %llx]: %llx\n", l1->filename,l1->attr,l2->attr,ret); return ret; } int compare_node_by_path(const void *n1, const void *n2) { const seltree *x1 = n1; const seltree *x2 = n2; return strcmp(x1->path, x2->path); } char* strrxtok(char* rx) { char*p=NULL; char*t=NULL; size_t i=0; /* The following code assumes that the first character is a slash */ size_t lastslash=1; p=strdup(rx); p[0]='/'; for(i=1;iparent) depth++; return depth; } /* This function returns a node with the same inode value as the 'file' */ /* The only place it is used is in add_file_to_tree() function */ static seltree* get_seltree_inode(seltree* tree, db_line* file, int db) { seltree* node=NULL; list* r=NULL; char* tmp=NULL; if(tree==NULL){ return NULL; } /* found the match */ if((db == DB_NEW && tree->new_data != NULL && file->inode == tree->new_data->inode) || (db == DB_OLD && tree->old_data != NULL && file->inode == tree->old_data->inode)) { return tree; } /* tmp is the directory of the file->filename */ tmp=strgetndirname(file->filename,treedepth(tree)+1); for(r=tree->childs;r;r=r->next){ /* We are interested only in files with the same regexp specification */ if(strlen(tmp) == strlen(file->filename) || strncmp(((seltree*)r->data)->path,tmp,strlen(tmp)+1)==0){ node=get_seltree_inode((seltree*)r->data,file,db); if(node!=NULL){ break; } } } free(tmp); return node; } seltree* get_seltree_node(seltree* tree,char* path) { seltree* node=NULL; list* r=NULL; char* tmp=NULL; if(tree==NULL){ return NULL; } if(strncmp(path,tree->path,strlen(path)+1)==0){ return tree; } else{ tmp=strgetndirname(path,treedepth(tree)+1); for(r=tree->childs;r;r=r->next){ if(strncmp(((seltree*)r->data)->path,tmp,strlen(tmp)+1)==0){ node=get_seltree_node((seltree*)r->data,path); if(node!=NULL){ /* Don't leak memory */ free(tmp); return node; } } } free(tmp); } return NULL; } void copy_rule_ref(seltree* node, rx_rule* r) { if( r!=NULL ){ node->conf_lineno = r->conf_lineno; node->rx=strdup(r->rx); } else { node->conf_lineno = -1; node->rx=NULL; } } seltree* new_seltree_node( seltree* tree, char*path, int isrx, rx_rule* r) { seltree* node=NULL; seltree* parent=NULL; char* tmprxtok = NULL; node=(seltree*)malloc(sizeof(seltree)); node->childs=NULL; node->path=strdup(path); node->sel_rx_lst=NULL; node->neg_rx_lst=NULL; node->equ_rx_lst=NULL; node->checked=0; node->attr=0; node->new_data=NULL; node->old_data=NULL; copy_rule_ref(node,r); if(tree!=NULL){ tmprxtok = strrxtok(path); if(isrx){ parent=get_seltree_node(tree,tmprxtok); }else { char* dirn=strlastslash(path); parent=get_seltree_node(tree,dirn); free(dirn); } if(parent==NULL){ if(isrx){ parent=new_seltree_node(tree,tmprxtok,isrx,r); }else { char* dirn=strlastslash(path); parent=new_seltree_node(tree,dirn,isrx,r); free(dirn); } } free(tmprxtok); parent->childs=list_sorted_insert(parent->childs,(void*)node, compare_node_by_path); node->parent=parent; }else { node->parent=NULL; } return node; } void gen_seltree(list* rxlist,seltree* tree,char type) { regex_t* rxtmp = NULL; seltree* curnode = NULL; list* r = NULL; char* rxtok = NULL; rx_rule* rxc = NULL; for(r=rxlist;r;r=r->next){ char* data; rx_rule* curr_rule = (rx_rule*)r->data; rxtok=strrxtok(curr_rule->rx); curnode=get_seltree_node(tree,rxtok); if(curnode==NULL){ curnode=new_seltree_node(tree,rxtok,1,curr_rule); } error(240,"Handling %s with %c \"%s\" with node \"%s\"\n",rxtok,type,curr_rule->rx,curnode->path); /* We have to add '^' to the first character of string... */ data=(char*)malloc(strlen(curr_rule->rx)+1+1); if (data==NULL){ error(0,_("Not enough memory for regexpr compile... exiting..\n")); abort(); } /* FIX ME! (returnvalue) */ strcpy(data+1,curr_rule->rx); data[0]='^'; rxtmp=(regex_t*)malloc(sizeof(regex_t)); if( regcomp(rxtmp,data,REG_EXTENDED|REG_NOSUB)){ error(0,_("Error in selective regexp: %s\n"),curr_rule->rx); free(data); }else{ /* replace regexp text with regexp compiled */ rxc=(rx_rule*)malloc(sizeof(rx_rule)); rxc->rx=data; /* and copy the rest */ rxc->crx=rxtmp; rxc->attr=curr_rule->attr; rxc->conf_lineno=curr_rule->conf_lineno; switch (type){ case 's':{ curnode->sel_rx_lst=list_append(curnode->sel_rx_lst,(void*)rxc); break; } case 'n':{ curnode->neg_rx_lst=list_append(curnode->neg_rx_lst,(void*)rxc); break; } case 'e':{ curnode->equ_rx_lst=list_append(curnode->equ_rx_lst,(void*)rxc); break; } } } /* Data should not be free'ed because it's in rxc struct * and freeing is done if error occour. */ free(rxtok); } } int check_list_for_match(list* rxrlist,char* text,DB_ATTR_TYPE* attr) { list* r=NULL; int retval=1; for(r=rxrlist;r;r=r->next){ if((retval=regexec((regex_t*)((rx_rule*)r->data)->crx,text,0,0,0))==0){ *attr=((rx_rule*)r->data)->attr; error(231,"\"%s\" matches rule from line #%ld: %s\n",text,((rx_rule*)r->data)->conf_lineno,((rx_rule*)r->data)->rx); break; } else { error(232,"\"%s\" doesn't match rule from line #%ld: %s\n",text,((rx_rule*)r->data)->conf_lineno,((rx_rule*)r->data)->rx); } } return retval; } /* * Function check_node_for_match() * calls itself recursively to go to the top and then back down. * uses check_list_for_match() * returns: * 0, if a negative rule was matched * 1, if a selective rule was matched * 2, if a equals rule was matched * retval if no rule was matched. * retval&3 if no rule was matched and first in the recursion * to keep state revat is orred with: * 4, matched deeper on equ rule * 8, matched deeper on sel rule *16, this is a recursed call */ int check_node_for_match(seltree*node,char*text,int retval,DB_ATTR_TYPE* attr) { int top=0; if(node==NULL){ return retval; } /* if this call is not recursive we check the equals list and we set top * * and retval so we know following calls are recursive */ if(!(retval&16)){ top=1; retval|=16; if(!check_list_for_match(node->equ_rx_lst,text,attr)){ retval|=2|4; } } /* We'll use retval to pass information on whether to recurse * the dir or not */ /* If 4 and 8 are not set, we will check for matches */ if(!(retval&(4|8))){ if(!check_list_for_match(node->sel_rx_lst,text,attr)) retval|=1|8; } /* Now let's check the ancestors */ retval=check_node_for_match(node->parent,text,retval,attr); /* Negative regexps are the strongest so they are checked last */ /* If this file is to be added */ if(retval){ if(!check_list_for_match(node->neg_rx_lst,text,attr)){ retval=0; } } /* Now we discard the info whether a match was made or not * * and just return 0,1 or 2 */ if(top){ retval&=3; } return retval; } void print_tree(seltree* tree) { list* r; rx_rule* rxc; error(220,"tree: \"%s\"\n",tree->path); for(r=tree->sel_rx_lst;r!=NULL;r=r->next) { rxc=r->data; error(220,"%li\t%s\n",rxc->conf_lineno,rxc->rx); } for(r=tree->equ_rx_lst;r!=NULL;r=r->next) { rxc=r->data; error(220,"%li=\t%s\n",rxc->conf_lineno,rxc->rx); } for(r=tree->neg_rx_lst;r!=NULL;r=r->next) { rxc=r->data; error(220,"%li!\t%s\n",rxc->conf_lineno,rxc->rx); } for(r=tree->childs;r!=NULL;r=r->next) { print_tree(r->data); } } seltree* gen_tree(list* prxlist,list* nrxlist,list* erxlist) { seltree* tree=NULL; tree=new_seltree_node(NULL,"/",0,NULL); gen_seltree(prxlist,tree,'s'); gen_seltree(nrxlist,tree,'n'); gen_seltree(erxlist,tree,'e'); print_tree(tree); return tree; } /* * strip_dbline() * strips given dbline */ void strip_dbline(db_line* line) { #define checked_free(x) do { free(x); x=NULL; } while (0) DB_ATTR_TYPE attr = line->attr; /* filename is always needed, hence it is never stripped */ if(!(attr&DB_LINKNAME)){ checked_free(line->linkname); } /* permissions are always needed for file type detection, hence they are * never stripped */ if(!(attr&DB_UID)){ line->uid=0; } if(!(attr&DB_GID)){ line->gid=0; } if(!(attr&DB_ATIME)){ line->atime=0; } if(!(attr&DB_CTIME)){ line->ctime=0; } if(!(attr&DB_MTIME)){ line->mtime=0; } /* inode is always needed for ignoring changed filename, hence it is * never stripped */ if(!(attr&DB_LNKCOUNT)){ line->nlink=0; } if(!(attr&DB_SIZE)&&!(attr&DB_SIZEG)){ line->size=0; } if(!(attr&DB_BCOUNT)){ line->bcount=0; } if(!(attr&DB_MD5)){ checked_free(line->md5); } if(!(attr&DB_SHA1)){ checked_free(line->sha1); } if(!(attr&DB_RMD160)){ checked_free(line->rmd160); } if(!(attr&DB_TIGER)){ checked_free(line->tiger); } if(!(attr&DB_HAVAL)){ checked_free(line->haval); } if(!(attr&DB_CRC32)){ checked_free(line->crc32); } #ifdef WITH_MHASH if(!(attr&DB_CRC32B)){ checked_free(line->crc32b); } if(!(attr&DB_GOST)){ checked_free(line->gost); } if(!(attr&DB_WHIRLPOOL)){ checked_free(line->whirlpool); } #endif if(!(attr&DB_SHA256)){ checked_free(line->sha256); } if(!(attr&DB_SHA512)){ checked_free(line->sha512); } #ifdef WITH_ACL if(!(attr&DB_ACL)){ if (line->acl) { free(line->acl->acl_a); free(line->acl->acl_d); } checked_free(line->acl); } #endif #ifdef WITH_XATTR if(!(attr&DB_XATTRS)){ if (line->xattrs) free(line->xattrs->ents); checked_free(line->xattrs); } #endif #ifdef WITH_SELINUX if(!(attr&DB_SELINUX)){ checked_free(line->cntx); } #endif /* e2fsattrs is stripped within e2fsattrs2line in do_md */ } /* * add_file_to_tree * db = which db this file belongs to * status = what to do with this node * attr attributes to add */ void add_file_to_tree(seltree* tree,db_line* file,int db,int status, DB_ATTR_TYPE attr) { seltree* node=NULL; DB_ATTR_TYPE localignorelist=0; DB_ATTR_TYPE ignorelist=0; node=get_seltree_node(tree,file->filename); if(!node){ node=new_seltree_node(tree,file->filename,0,NULL); } if(file==NULL){ error(0, "add_file_to_tree was called with NULL db_line\n"); } /* add note to this node which db has modified it */ node->checked|=db; /* add note whether to add this node's children */ if(S_ISDIR(file->perm)&&status==NODE_ADD_CHILDREN){ node->checked|=NODE_ADD_CHILDREN; } node->attr=attr; strip_dbline(file); switch (db) { case DB_OLD: { node->old_data=file; break; } case DB_NEW: { node->new_data=file; break; } } /* We have a way to ignore some changes... */ ignorelist=get_groupval("ignore_list"); if (ignorelist==DB_ATTR_UNDEF) { ignorelist=0; } if((node->checked&DB_OLD)&&(node->checked&DB_NEW)){ if (node->new_data->attr^node->old_data->attr) { error(2,"Entry %s in databases has different attributes: %llx %llx\n", node->old_data->filename,node->old_data->attr,node->new_data->attr); } /* Free the data if same else leave as is for report_tree */ node->changed_attrs=get_changed_attributes(node->old_data,node->new_data); if((~(ignorelist)&node->changed_attrs)==RETOK){ /* FIXME this messes up the tree on SunOS. Don't know why. Fix needed badly otherwise we leak memory like hell. */ free_db_line(node->old_data); free(node->old_data); free_db_line(node->new_data); free(node->new_data); node->old_data=NULL; node->new_data=NULL; node->changed_attrs=0; } } /* Do verification if file was moved only if we are asked for it. * old and new data are NULL only if file present in both DBs * and has not been changed. */ if( (node->old_data!=NULL || node->new_data!=NULL) && (file->attr & DB_CHECKINODE)) { /* Check if file was moved (same inode, different name in the other DB)*/ db_line *oldData; db_line *newData; seltree* moved_node; moved_node=get_seltree_inode(tree,file,db==DB_OLD?DB_NEW:DB_OLD); if(!(moved_node == NULL || moved_node == node)) { /* There's mo match for inode or it matches the node with the same name. * In first case we don't have a match to compare with. * In the second - we already compared those files. */ if(db == DB_NEW) { newData = node->new_data; oldData = moved_node->old_data; } else { newData = moved_node->new_data; oldData = node->old_data; } localignorelist=(oldData->attr^newData->attr)&(~(DB_NEWFILE|DB_RMFILE|DB_CHECKINODE)); if (localignorelist!=0) { error(220,"Ignoring moved entry (\"%s\" [%llx] => \"%s\" [%llx]) due to different attributes: %llx\n", oldData->filename, oldData->attr, newData->filename, newData->attr, localignorelist); } else { /* Free the data if same else leave as is for report_tree */ if ((get_changed_attributes(oldData, newData)&~(ignorelist|DB_CTIME)) == RETOK) { node->checked |= db==DB_NEW ? NODE_MOVED_IN : NODE_MOVED_OUT; moved_node->checked |= db==DB_NEW ? NODE_MOVED_OUT : NODE_MOVED_IN; error(220,_("Entry was moved: %s [%llx] => %s [%llx]\n"), oldData->filename , oldData->attr, newData->filename, newData->attr); } else { error(220,"Ignoring moved entry (\"%s\" => \"%s\") because the entries mismatch\n", oldData->filename, newData->filename); } } } } if( (db == DB_NEW) && (node->new_data!=NULL) && (file->attr & DB_NEWFILE) ){ node->checked|=NODE_ALLOW_NEW; } if( (db == DB_OLD) && (node->old_data!=NULL) && (file->attr & DB_RMFILE) ){ node->checked|=NODE_ALLOW_RM; } } int check_rxtree(char* filename,seltree* tree,DB_ATTR_TYPE* attr) { int retval=0; char * tmp=NULL; char * parentname=NULL; seltree* pnode=NULL; parentname=strdup(filename); tmp=strrchr(parentname,'/'); if(tmp!=parentname){ *tmp='\0'; }else { if(parentname[1]!='\0'){ /* we are in the root dir */ parentname[1]='\0'; } } pnode=get_seltree_node(tree,parentname); if(pnode&&(pnode->checked&NODE_ADD_CHILDREN)){ *attr=pnode->attr; retval=check_node_for_match(pnode,filename,1,attr); }else{ *attr=0; retval=check_node_for_match(pnode,filename,0,attr); } free(parentname); return retval; } db_line* get_file_attrs(char* filename,DB_ATTR_TYPE attr) { struct AIDE_STAT_TYPE fs; int sres=0; db_line* line=NULL; time_t cur_time; sres=AIDE_LSTAT_FUNC(filename,&fs); if(sres==-1){ char* er=strerror(errno); if (er==NULL) { error(0,"lstat() failed for %s. strerror failed for %i\n",filename,errno); } else { error(0,"lstat() failed for %s:%s\n",filename,strerror(errno)); } return NULL; } if(!(attr&DB_RDEV)) fs.st_rdev=0; /* Get current time for future time notification. */ cur_time=time(NULL); if (cur_time==(time_t)-1) { char* er=strerror(errno); if (er==NULL) { error(0,_("Can not get current time. strerror failed for %i\n"),errno); } else { error(0,_("Can not get current time with reason %s\n"),er); } } else { if(fs.st_atime>cur_time){ error(CLOCK_SKEW,_("%s atime in future\n"),filename); } if(fs.st_mtime>cur_time){ error(CLOCK_SKEW,_("%s mtime in future\n"),filename); } if(fs.st_ctime>cur_time){ error(CLOCK_SKEW,_("%s ctime in future\n"),filename); } } /* Malloc if we have something to store.. */ line=(db_line*)malloc(sizeof(db_line)); memset(line,0,sizeof(db_line)); /* We want filename */ line->attr=attr|DB_FILENAME; /* Just copy some needed fields. */ line->fullpath=filename; line->filename=&filename[conf->root_prefix_length]; line->perm_o=fs.st_mode; line->size_o=fs.st_size; line->linkname=NULL; /* Handle symbolic link */ hsymlnk(line); /* Set normal part */ fs2db_line(&fs,line); /* ACL stuff */ #ifdef WITH_ACL acl2line(line); #endif #ifdef WITH_XATTR xattrs2line(line); #endif #ifdef WITH_SELINUX selinux2line(line); #endif #ifdef WITH_E2FSATTRS e2fsattrs2line(line); #endif if (attr&DB_HASHES && S_ISREG(fs.st_mode)) { calc_md(&fs,line); } else { /* We cannot calculate hash for nonfile. Mark it to attr. */ no_hash(line); } return line; } void populate_tree(seltree* tree) { /* FIXME this function could really use threads */ int add=0; db_line* old=NULL; db_line* new=NULL; int initdbwarningprinted=0; DB_ATTR_TYPE ignorelist=0; DB_ATTR_TYPE attr=0; seltree* node=NULL; /* With this we avoid unnecessary checking of removed files. */ if(conf->action&DO_INIT){ initdbwarningprinted=1; } /* We have a way to ignore some changes... */ ignorelist=get_groupval("ignore_list"); if (ignorelist==DB_ATTR_UNDEF) { ignorelist=0; } if(conf->action&DO_DIFF){ do { if((new=db_readline(DB_NEW)) != NULL){ /* FIXME add support config checking at this stage config check = add only those files that match config rxs make this configurable Only configurability is not implemented. */ /* This is needed because check_rxtree assumes there is a parent for the node for old->filename */ if((node=get_seltree_node(tree,new->filename))==NULL){ node=new_seltree_node(tree,new->filename,0,NULL); } if((add=check_rxtree(new->filename,tree,&attr))>0){ add_file_to_tree(tree,new,DB_NEW,0,attr); } else { free_db_line(new); free(new); new=NULL; } } } while (new); } if((conf->action&DO_INIT)||(conf->action&DO_COMPARE)){ /* FIXME */ new=NULL; do { if((new=db_readline(DB_DISK)) != NULL) { /* Write to db only if needed */ if(conf->action&DO_INIT){ db_writeline(new,conf); } if((add=check_rxtree(new->filename,tree,&attr))>0){ add_file_to_tree(tree,new,DB_NEW,0,attr); } } } while (new); } if((conf->action&DO_COMPARE)||(conf->action&DO_DIFF)){ do{ if((old=db_readline(DB_OLD)) != NULL) { /* This is needed because check_rxtree assumes there is a parent for the node for old->filename */ if((node=get_seltree_node(tree,old->filename))==NULL){ node=new_seltree_node(tree,old->filename,0,NULL); } if((add=check_rxtree(old->filename,tree,&attr))>0){ add_file_to_tree(tree,old,DB_OLD,0,attr); }else{ free_db_line(old); free(old); old=NULL; if(!initdbwarningprinted){ error(3,_("WARNING: Old db contains a entry that shouldn\'t be there, run --init or --update\n")); initdbwarningprinted=1; } } } }while(old); } } void hsymlnk(db_line* line) { if((S_ISLNK(line->perm_o))){ int len=0; #ifdef WITH_ACL if(conf->no_acl_on_symlinks!=1) { line->attr&=(~DB_ACL); } #endif if(conf->warn_dead_symlinks==1) { struct AIDE_STAT_TYPE fs; int sres; sres=AIDE_STAT_FUNC(line->fullpath,&fs); if (sres!=0 && sres!=EACCES) { error(4,"Dead symlink detected at %s\n",line->fullpath); } if(!(line->attr&DB_RDEV)) fs.st_rdev=0; } /* Is this valid?? No, We should do this elsewhere. */ line->linkname=(char*)malloc(_POSIX_PATH_MAX+1); if(line->linkname==NULL){ error(0,_("malloc failed in hsymlnk()\n")); abort(); } /* Remember to nullify the buffer, because man page says readlink places the contents of the symbolic link path in the buffer buf, which has size bufsiz. readlink does not append a NUL character to buf. It will truncate the con- tents (to a length of bufsiz characters), in case the buffer is too small to hold all of the contents. */ memset(line->linkname,0,_POSIX_PATH_MAX+1); len=readlink(line->fullpath,line->linkname,_POSIX_PATH_MAX+1); /* * We use realloc :) */ line->linkname=realloc(line->linkname,len+1); } else { line->attr&=(~DB_LINKNAME); } } // vi: ts=8 sw=2 aide-0.16~a2.git20130520/src/getopt.c000066400000000000000000000725271214657706600166520ustar00rootroot00000000000000/* Getopt for GNU. NOTE: getopt is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This tells Alpha OSF/1 not to define a getopt prototype in . Ditto for AIX 3.2 and . */ #ifndef _NO_PROTO # define _NO_PROTO #endif #include "aide.h" #if !defined __STDC__ || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ # ifndef const # define const # endif #endif #include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #define GETOPT_INTERFACE_VERSION 2 #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 # include # if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION # define ELIDE_CODE # endif #endif #ifndef ELIDE_CODE /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ /* Don't include stdlib.h for non-GNU C libraries because some of them contain conflicting prototypes for getopt. */ # include # include #endif /* GNU C library. */ #ifdef VMS # include # if HAVE_STRING_H - 0 # include # endif #endif #ifndef _ /* This is for other GNU distributions with internationalized messages. When compiling libc, the _ macro is predefined. */ # ifdef HAVE_LIBINTL_H # include # define _(msgid) gettext (msgid) # else # define _(msgid) (msgid) # endif #endif /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. As `getopt' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. Setting the environment variable POSIXLY_CORRECT disables permutation. Then the behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments. */ #include "getopt.h" /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ char *optarg = NULL; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ /* 1003.2 says this must be 1 before any call. */ int optind = 1; /* Formerly, initialization of getopt depended on optind==0, which causes problems with re-calling getopt as programs generally don't know that. */ int __getopt_initialized = 0; /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ static char *nextchar; /* Callers store zero here to inhibit the error message for unrecognized options. */ int opterr = 1; /* Set to an option character which was unrecognized. This must be initialized on some systems to avoid linking in the system's own getopt implementation. */ int optopt = '?'; /* Describe how to deal with options that follow non-option ARGV-elements. If the caller did not specify anything, the default is REQUIRE_ORDER if the environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise. REQUIRE_ORDER means don't recognize them as options; stop option processing when the first non-option is seen. This is what Unix does. This mode of operation is selected by either setting the environment variable POSIXLY_CORRECT, or using `+' as the first character of the list of option characters. PERMUTE is the default. We permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. Using `-' as the first character of the list of option characters selects this mode of operation. The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return -1 with `optind' != ARGC. */ static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; /* Value of POSIXLY_CORRECT environment variable. */ static char *posixly_correct; #ifdef __GNU_LIBRARY__ /* We want to avoid inclusion of string.h with non-GNU libraries because there are many ways it can cause trouble. On some systems, it contains special magic macros that don't work in GCC. */ # include # define my_index strchr #else # if HAVE_STRING_H # include # else # include # endif /* Avoid depending on library functions or files whose names are inconsistent. */ #ifndef getenv extern char *getenv (); #endif static char * my_index (str, chr) const char *str; int chr; { while (*str) { if (*str == chr) return (char *) str; str++; } return 0; } /* If using GCC, we can safely declare strlen this way. If not using GCC, it is ok not to declare it. */ #ifdef __GNUC__ /* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. That was relevant to code that was here before. */ # if (!defined __STDC__ || !__STDC__) && !defined strlen /* gcc with -traditional declares the built-in strlen to return int, and has done so at least since version 2.4.5. -- rms. */ extern int strlen (const char *); # endif /* not __STDC__ */ #endif /* __GNUC__ */ #endif /* not __GNU_LIBRARY__ */ /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have been skipped. `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is the index after the last of them. */ static int first_nonopt; static int last_nonopt; #ifdef _LIBC /* Bash 2.0 gives us an environment variable containing flags indicating ARGV elements that should not be considered arguments. */ /* Defined in getopt_init.c */ extern char *__getopt_nonoption_flags; static int nonoption_flags_max_len; static int nonoption_flags_len; static int original_argc; static char *const *original_argv; /* Make sure the environment variable bash 2.0 puts in the environment is valid for the getopt call we must make sure that the ARGV passed to getopt is that one passed to the process. */ static void __attribute__ ((unused)) store_args_and_env (int argc, char *const *argv) { /* XXX This is no good solution. We should rather copy the args so that we can compare them later. But we must not use malloc(3). */ original_argc = argc; original_argv = argv; } # ifdef text_set_element text_set_element (__libc_subinit, store_args_and_env); # endif /* text_set_element */ # define SWAP_FLAGS(ch1, ch2) \ if (nonoption_flags_len > 0) \ { \ char __tmp = __getopt_nonoption_flags[ch1]; \ __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ __getopt_nonoption_flags[ch2] = __tmp; \ } #else /* !_LIBC */ # define SWAP_FLAGS(ch1, ch2) #endif /* _LIBC */ /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. The other is elements [last_nonopt,optind), which contains all the options processed since those non-options were skipped. `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ #if defined __STDC__ && __STDC__ static void exchange (char **); #endif static void exchange (argv) char **argv; { int bottom = first_nonopt; int middle = last_nonopt; int top = optind; char *tem; /* Exchange the shorter segment with the far end of the longer segment. That puts the shorter segment into the right place. It leaves the longer segment in the right place overall, but it consists of two parts that need to be swapped next. */ #ifdef _LIBC /* First make sure the handling of the `__getopt_nonoption_flags' string can work normally. Our top argument must be in the range of the string. */ if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) { /* We must extend the array. The user plays games with us and presents new arguments. */ char *new_str = malloc (top + 1); if (new_str == NULL) nonoption_flags_len = nonoption_flags_max_len = 0; else { memset (__mempcpy (new_str, __getopt_nonoption_flags, nonoption_flags_max_len), '\0', top + 1 - nonoption_flags_max_len); nonoption_flags_max_len = top + 1; __getopt_nonoption_flags = new_str; } } #endif while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; register int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; register int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; SWAP_FLAGS (bottom + i, middle + i); } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ first_nonopt += (optind - last_nonopt); last_nonopt = optind; } /* Initialize the internal data when the first call is made. */ #if defined __STDC__ && __STDC__ static const char *_getopt_initialize (int, char *const *, const char *); #endif static const char * _getopt_initialize (argc, argv, optstring) int argc; char *const *argv; const char *optstring; { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ first_nonopt = last_nonopt = optind; nextchar = NULL; posixly_correct = getenv ("POSIXLY_CORRECT"); /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { ordering = REQUIRE_ORDER; ++optstring; } else if (posixly_correct != NULL) ordering = REQUIRE_ORDER; else ordering = PERMUTE; #ifdef _LIBC if (posixly_correct == NULL && argc == original_argc && argv == original_argv) { if (nonoption_flags_max_len == 0) { if (__getopt_nonoption_flags == NULL || __getopt_nonoption_flags[0] == '\0') nonoption_flags_max_len = -1; else { const char *orig_str = __getopt_nonoption_flags; int len = nonoption_flags_max_len = strlen (orig_str); if (nonoption_flags_max_len < argc) nonoption_flags_max_len = argc; __getopt_nonoption_flags = (char *) malloc (nonoption_flags_max_len); if (__getopt_nonoption_flags == NULL) nonoption_flags_max_len = -1; else memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), '\0', nonoption_flags_max_len - len); } } nonoption_flags_len = nonoption_flags_max_len; } else nonoption_flags_len = 0; #endif return optstring; } /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element (aside from the initial '-') are option characters. If `getopt' is called repeatedly, it returns successively each of the option characters from each of the option elements. If `getopt' finds another option character, it returns that character, updating `optind' and `nextchar' so that the next call to `getopt' can resume the scan with the following option character or ARGV-element. If there are no more option characters, `getopt' returns -1. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return '?' after printing an error message. If you set `opterr' to zero, the error message is suppressed but we still return '?'. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following ARGV-element, is returned in `optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, it is returned in `optarg', otherwise `optarg' is set to zero. If OPTSTRING starts with `-' or `+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. Long-named options begin with `--' instead of `-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated from the option name by a `=', or else the in next ARGV-element. When `getopt' finds a long-named option, it returns 0 if that option's `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. The elements of ARGV aren't really const, because we permute them. But we pretend they're const in the prototype to be compatible with other systems. LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. It is only valid when a long-named option has been found by the most recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. */ int _getopt_internal (argc, argv, optstring, longopts, longind, long_only) int argc; char *const *argv; const char *optstring; const struct option *longopts; int *longind; int long_only; { optarg = NULL; if (optind == 0 || !__getopt_initialized) { if (optind == 0) optind = 1; /* Don't scan ARGV[0], the program name. */ optstring = _getopt_initialize (argc, argv, optstring); __getopt_initialized = 1; } /* Test whether ARGV[optind] points to a non-option argument. Either it does not have option syntax, or there is an environment flag from the shell indicating it is not an option. The later information is only used when the used in the GNU libc. */ #ifdef _LIBC # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ || (optind < nonoption_flags_len \ && __getopt_nonoption_flags[optind] == '1')) #else # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') #endif if (nextchar == NULL || *nextchar == '\0') { /* Advance to the next ARGV-element. */ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been moved back by the user (who may also have changed the arguments). */ if (last_nonopt > optind) last_nonopt = optind; if (first_nonopt > optind) first_nonopt = optind; if (ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (last_nonopt != optind) first_nonopt = optind; /* Skip any additional non-options and extend the range of non-options previously skipped. */ while (optind < argc && NONOPTION_P) optind++; last_nonopt = optind; } /* The special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ if (optind != argc && !strcmp (argv[optind], "--")) { optind++; if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (first_nonopt == last_nonopt) first_nonopt = optind; last_nonopt = argc; optind = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ if (optind == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ if (first_nonopt != last_nonopt) optind = first_nonopt; return -1; } /* If we have come to a non-option and did not permute it, either stop the scan or describe it to the caller and pass it by. */ if (NONOPTION_P) { if (ordering == REQUIRE_ORDER) return -1; optarg = argv[optind++]; return 1; } /* We have found another option-ARGV-element. Skip the initial punctuation. */ nextchar = (argv[optind] + 1 + (longopts != NULL && argv[optind][1] == '-')); } /* Decode the current option-ARGV-element. */ /* Check whether the ARGV-element is a long option. If long_only and the ARGV-element has the form "-f", where f is a valid short option, don't consider it an abbreviated form of a long option that starts with f. Otherwise there would be no way to give the -f short option. On the other hand, if there's a long option "fubar" and the ARGV-element is "-fu", do consider that an abbreviation of the long option, just like "--fu", and not "-f" with arg "u". This distinction seems to be the most useful approach. */ if (longopts != NULL && (argv[optind][1] == '-' || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = -1; int option_index; for (nameend = nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) == (unsigned int) strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (opterr) fprintf (stderr, _("%s: option `%s' is ambiguous\n"), argv[0], argv[optind]); nextchar += strlen (nextchar); optind++; optopt = 0; return '?'; } if (pfound != NULL) { option_index = indfound; optind++; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (opterr) { if (argv[optind - 1][1] == '-') /* --option */ fprintf (stderr, _("%s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); else /* +option or -option */ fprintf (stderr, _("%s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[optind - 1][0], pfound->name); } nextchar += strlen (nextchar); optopt = pfound->val; return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (opterr) fprintf (stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); nextchar += strlen (nextchar); optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* Can't find it as a long option. If this is not getopt_long_only, or the option starts with '--' or is not a valid short option, then it's an error. Otherwise interpret it as a short option. */ if (!long_only || argv[optind][1] == '-' || my_index (optstring, *nextchar) == NULL) { if (opterr) { if (argv[optind][1] == '-') /* --option */ fprintf (stderr, _("%s: unrecognized option `--%s'\n"), argv[0], nextchar); else /* +option or -option */ fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), argv[0], argv[optind][0], nextchar); } nextchar = (char *) ""; optind++; optopt = 0; return '?'; } } /* Look at and handle the next short option-character. */ { char c = *nextchar++; char *temp = my_index (optstring, c); /* Increment `optind' when we start to process its last character. */ if (*nextchar == '\0') ++optind; if (temp == NULL || c == ':') { if (opterr) { if (posixly_correct) /* 1003.2 specifies the format of this message. */ fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c); else fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c); } optopt = c; return '?'; } /* Convenience. Treat POSIX -W foo same as long option --foo */ if (temp[0] == 'W' && temp[1] == ';') { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = 0; int option_index; /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (opterr) { /* 1003.2 specifies the format of this message. */ fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; return c; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; /* optarg is now the argument, see if it's in the table of longopts. */ for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) == strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (opterr) fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[optind]); nextchar += strlen (nextchar); optind++; return '?'; } if (pfound != NULL) { option_index = indfound; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (opterr) fprintf (stderr, _("\ %s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name); nextchar += strlen (nextchar); return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (opterr) fprintf (stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); nextchar += strlen (nextchar); return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } nextchar = NULL; return 'W'; /* Let the application handle it. */ } if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*nextchar != '\0') { optarg = nextchar; optind++; } else optarg = NULL; nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (opterr) { /* 1003.2 specifies the format of this message. */ fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; nextchar = NULL; } } return c; } } int getopt (argc, argv, optstring) int argc; char *const *argv; const char *optstring; { return _getopt_internal (argc, argv, optstring, (const struct option *) 0, (int *) 0, 0); } #endif /* Not ELIDE_CODE. */ #ifdef TEST /* Compile with -DTEST to make an executable for use in testing the above definition of `getopt'. */ int main (argc, argv) int argc; char **argv; { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; c = getopt (argc, argv, "abc:d:0123456789"); if (c == -1) break; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ aide-0.16~a2.git20130520/src/getopt1.c000066400000000000000000000106511214657706600167210ustar00rootroot00000000000000/* getopt_long and getopt_long_only entry points for GNU getopt. Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 Free Software Foundation, Inc. This file was part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "aide.h" #include "getopt.h" #if !defined __STDC__ || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ #ifndef const #define const #endif #endif #include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #define GETOPT_INTERFACE_VERSION 2 #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 #include #if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION #define ELIDE_CODE #endif #endif #ifndef ELIDE_CODE /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ #include #endif #ifndef NULL #define NULL 0 #endif int getopt_long (argc, argv, options, long_options, opt_index) int argc; char *const *argv; const char *options; const struct option *long_options; int *opt_index; { return _getopt_internal (argc, argv, options, long_options, opt_index, 0); } /* Like getopt_long, but '-' as well as '--' can indicate a long option. If an option that starts with '-' (not '--') doesn't match a long option, but does match a short option, it is parsed as a short option instead. */ int getopt_long_only (argc, argv, options, long_options, opt_index) int argc; char *const *argv; const char *options; const struct option *long_options; int *opt_index; { return _getopt_internal (argc, argv, options, long_options, opt_index, 1); } #endif /* Not ELIDE_CODE. */ #ifdef TEST #include int main (argc, argv) int argc; char **argv; { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; int option_index = 0; static struct option long_options[] = { {"add", 1, 0, 0}, {"append", 0, 0, 0}, {"delete", 1, 0, 0}, {"verbose", 0, 0, 0}, {"create", 0, 0, 0}, {"file", 1, 0, 0}, {0, 0, 0, 0} }; c = getopt_long (argc, argv, "abc:d:0123456789", long_options, &option_index); if (c == -1) break; switch (c) { case 0: printf ("option %s", long_options[option_index].name); if (optarg) printf (" with arg %s", optarg); printf ("\n"); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case 'd': printf ("option d with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ aide-0.16~a2.git20130520/src/gnu_regex.c000066400000000000000000004741071214657706600173330ustar00rootroot00000000000000char *gnu_regex_rcs = "$Id$"; #include "aide.h" #ifdef REGEX #define REGEX_MALLOC /* Extended regular expression matching and search library, version 0.12. (Implements POSIX draft P10003.2/D11.2, except for internationalization features.) Copyright (C) 1993 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* AIX requires this to be the first thing in the file. */ #if defined (_AIX) && !defined (REGEX_MALLOC) # pragma alloca #endif #define _GNU_SOURCE /* We need this for `regex.h', and perhaps for the Emacs include files. */ #if !macintosh #include #else #include #endif /* The `emacs' switch turns on certain matching commands that make sense only in Emacs. */ #ifdef emacs #include "lisp.h" #include "buffer.h" #include "syntax.h" /* Emacs uses `NULL' as a predicate. */ #undef NULL #else /* not emacs */ /* We used to test for `BSTRING' here, but only GCC and Emacs define `BSTRING', as far as I know, and neither of them use this code. */ #if HAVE_STRING_H || STDC_HEADERS #include #ifndef bcmp #define bcmp(s1, s2, n) memcmp ((s1), (s2), (n)) #endif #ifndef bcopy #define bcopy(s, d, n) memcpy ((d), (s), (n)) #endif #ifndef bzero #define bzero(s, n) memset ((s), 0, (n)) #endif #else #include #endif #ifdef STDC_HEADERS #include #else char *malloc (); char *realloc (); #endif /* Define the syntax stuff for \<, \>, etc. */ /* This must be nonzero for the wordchar and notwordchar pattern commands in re_match_2. */ #ifndef Sword #define Sword 1 #endif #ifdef SYNTAX_TABLE extern char *re_syntax_table; #else /* not SYNTAX_TABLE */ /* How many characters in the character set. */ #define CHAR_SET_SIZE 256 static char re_syntax_table[CHAR_SET_SIZE]; static void init_syntax_once () { register int c; static int done = 0; if (done) return; bzero (re_syntax_table, sizeof re_syntax_table); for (c = 'a'; c <= 'z'; c++) re_syntax_table[c] = Sword; for (c = 'A'; c <= 'Z'; c++) re_syntax_table[c] = Sword; for (c = '0'; c <= '9'; c++) re_syntax_table[c] = Sword; re_syntax_table['_'] = Sword; done = 1; } #endif /* not SYNTAX_TABLE */ #define SYNTAX(c) re_syntax_table[c] #endif /* not emacs */ /* Get the interface, including the syntax bits. */ #include "gnu_regex.h" /* isalpha etc. are used for the character classes. */ #include #ifndef isascii #define isascii(c) 1 #endif #ifdef isblank #define ISBLANK(c) (isascii (c) && isblank (c)) #else #define ISBLANK(c) ((c) == ' ' || (c) == '\t') #endif #ifdef isgraph #define ISGRAPH(c) (isascii (c) && isgraph (c)) #else #define ISGRAPH(c) (isascii (c) && isprint (c) && !isspace (c)) #endif #define ISPRINT(c) (isascii (c) && isprint (c)) #define ISDIGIT(c) (isascii (c) && isdigit (c)) #define ISALNUM(c) (isascii (c) && isalnum (c)) #define ISALPHA(c) (isascii (c) && isalpha (c)) #define ISCNTRL(c) (isascii (c) && iscntrl (c)) #define ISLOWER(c) (isascii (c) && islower (c)) #define ISPUNCT(c) (isascii (c) && ispunct (c)) #define ISSPACE(c) (isascii (c) && isspace (c)) #define ISUPPER(c) (isascii (c) && isupper (c)) #define ISXDIGIT(c) (isascii (c) && isxdigit (c)) #ifndef NULL #define NULL 0 #endif /* We remove any previous definition of `SIGN_EXTEND_CHAR', since ours (we hope) works properly with all combinations of machines, compilers, `char' and `unsigned char' argument types. (Per Bothner suggested the basic approach.) */ #undef SIGN_EXTEND_CHAR #if __STDC__ #define SIGN_EXTEND_CHAR(c) ((signed char) (c)) #else /* not __STDC__ */ /* As in Harbison and Steele. */ #define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128) #endif /* Should we use malloc or alloca? If REGEX_MALLOC is not defined, we use `alloca' instead of `malloc'. This is because using malloc in re_search* or re_match* could cause memory leaks when C-g is used in Emacs; also, malloc is slower and causes storage fragmentation. On the other hand, malloc is more portable, and easier to debug. Because we sometimes use alloca, some routines have to be macros, not functions -- `alloca'-allocated space disappears at the end of the function it is called in. */ #ifdef REGEX_MALLOC #define REGEX_ALLOCATE malloc #define REGEX_REALLOCATE(source, osize, nsize) realloc (source, nsize) #else /* not REGEX_MALLOC */ /* Emacs already defines alloca, sometimes. */ #ifndef alloca /* Make alloca work the best possible way. */ #ifdef __GNUC__ #define alloca __builtin_alloca #else /* not __GNUC__ */ #if HAVE_ALLOCA_H #include #else /* not __GNUC__ or HAVE_ALLOCA_H */ #ifndef _AIX /* Already did AIX, up at the top. */ char *alloca (); #endif /* not _AIX */ #endif /* not HAVE_ALLOCA_H */ #endif /* not __GNUC__ */ #endif /* not alloca */ #define REGEX_ALLOCATE alloca /* Assumes a `char *destination' variable. */ #define REGEX_REALLOCATE(source, osize, nsize) \ (destination = (char *) alloca (nsize), \ bcopy (source, destination, osize), \ destination) #endif /* not REGEX_MALLOC */ /* True if `size1' is non-NULL and PTR is pointing anywhere inside `string1' or just past its end. This works if PTR is NULL, which is a good thing. */ #define FIRST_STRING_P(ptr) \ (size1 && string1 <= (ptr) && (ptr) <= string1 + size1) /* (Re)Allocate N items of type T using malloc, or fail. */ #define TALLOC(n, t) ((t *) malloc ((n) * sizeof (t))) #define RETALLOC(addr, n, t) ((addr) = (t *) realloc (addr, (n) * sizeof (t))) #define REGEX_TALLOC(n, t) ((t *) REGEX_ALLOCATE ((n) * sizeof (t))) #define BYTEWIDTH 8 /* In bits. */ #define STREQ(s1, s2) ((strcmp (s1, s2) == 0)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b)) typedef char boolean; #define false 0 #define true 1 /* These are the command codes that appear in compiled regular expressions. Some opcodes are followed by argument bytes. A command code can specify any interpretation whatsoever for its arguments. Zero bytes may appear in the compiled regular expression. The value of `exactn' is needed in search.c (search_buffer) in Emacs. So regex.h defines a symbol `RE_EXACTN_VALUE' to be 1; the value of `exactn' we use here must also be 1. */ typedef enum { no_op = 0, /* Followed by one byte giving n, then by n literal bytes. */ exactn = 1, /* Matches any (more or less) character. */ anychar, /* Matches any one char belonging to specified set. First following byte is number of bitmap bytes. Then come bytes for a bitmap saying which chars are in. Bits in each byte are ordered low-bit-first. A character is in the set if its bit is 1. A character too large to have a bit in the map is automatically not in the set. */ charset, /* Same parameters as charset, but match any character that is not one of those specified. */ charset_not, /* Start remembering the text that is matched, for storing in a register. Followed by one byte with the register number, in the range 0 to one less than the pattern buffer's re_nsub field. Then followed by one byte with the number of groups inner to this one. (This last has to be part of the start_memory only because we need it in the on_failure_jump of re_match_2.) */ start_memory, /* Stop remembering the text that is matched and store it in a memory register. Followed by one byte with the register number, in the range 0 to one less than `re_nsub' in the pattern buffer, and one byte with the number of inner groups, just like `start_memory'. (We need the number of inner groups here because we don't have any easy way of finding the corresponding start_memory when we're at a stop_memory.) */ stop_memory, /* Match a duplicate of something remembered. Followed by one byte containing the register number. */ duplicate, /* Fail unless at beginning of line. */ begline, /* Fail unless at end of line. */ endline, /* Succeeds if at beginning of buffer (if emacs) or at beginning of string to be matched (if not). */ begbuf, /* Analogously, for end of buffer/string. */ endbuf, /* Followed by two byte relative address to which to jump. */ jump, /* Same as jump, but marks the end of an alternative. */ jump_past_alt, /* Followed by two-byte relative address of place to resume at in case of failure. */ on_failure_jump, /* Like on_failure_jump, but pushes a placeholder instead of the current string position when executed. */ on_failure_keep_string_jump, /* Throw away latest failure point and then jump to following two-byte relative address. */ pop_failure_jump, /* Change to pop_failure_jump if know won't have to backtrack to match; otherwise change to jump. This is used to jump back to the beginning of a repeat. If what follows this jump clearly won't match what the repeat does, such that we can be sure that there is no use backtracking out of repetitions already matched, then we change it to a pop_failure_jump. Followed by two-byte address. */ maybe_pop_jump, /* Jump to following two-byte address, and push a dummy failure point. This failure point will be thrown away if an attempt is made to use it for a failure. A `+' construct makes this before the first repeat. Also used as an intermediary kind of jump when compiling an alternative. */ dummy_failure_jump, /* Push a dummy failure point and continue. Used at the end of alternatives. */ push_dummy_failure, /* Followed by two-byte relative address and two-byte number n. After matching N times, jump to the address upon failure. */ succeed_n, /* Followed by two-byte relative address, and two-byte number n. Jump to the address N times, then fail. */ jump_n, /* Set the following two-byte relative address to the subsequent two-byte number. The address *includes* the two bytes of number. */ set_number_at, wordchar, /* Matches any word-constituent character. */ notwordchar, /* Matches any char that is not a word-constituent. */ wordbeg, /* Succeeds if at word beginning. */ wordend, /* Succeeds if at word end. */ wordbound, /* Succeeds if at a word boundary. */ notwordbound /* Succeeds if not at a word boundary. */ #ifdef emacs ,before_dot, /* Succeeds if before point. */ at_dot, /* Succeeds if at point. */ after_dot, /* Succeeds if after point. */ /* Matches any character whose syntax is specified. Followed by a byte which contains a syntax code, e.g., Sword. */ syntaxspec, /* Matches any character whose syntax is not that specified. */ notsyntaxspec #endif /* emacs */ } re_opcode_t; /* Common operations on the compiled pattern. */ /* Store NUMBER in two contiguous bytes starting at DESTINATION. */ #define STORE_NUMBER(destination, number) \ do { \ (destination)[0] = (number) & 0377; \ (destination)[1] = (number) >> 8; \ } while (0) /* Same as STORE_NUMBER, except increment DESTINATION to the byte after where the number is stored. Therefore, DESTINATION must be an lvalue. */ #define STORE_NUMBER_AND_INCR(destination, number) \ do { \ STORE_NUMBER (destination, number); \ (destination) += 2; \ } while (0) /* Put into DESTINATION a number stored in two contiguous bytes starting at SOURCE. */ #define EXTRACT_NUMBER(destination, source) \ do { \ (destination) = *(source) & 0377; \ (destination) += SIGN_EXTEND_CHAR (*((source) + 1)) << 8; \ } while (0) #ifdef DEBUG static void extract_number (dest, source) int *dest; unsigned char *source; { int temp = SIGN_EXTEND_CHAR (*(source + 1)); *dest = *source & 0377; *dest += temp << 8; } #ifndef EXTRACT_MACROS /* To debug the macros. */ #undef EXTRACT_NUMBER #define EXTRACT_NUMBER(dest, src) extract_number (&dest, src) #endif /* not EXTRACT_MACROS */ #endif /* DEBUG */ /* Same as EXTRACT_NUMBER, except increment SOURCE to after the number. SOURCE must be an lvalue. */ #define EXTRACT_NUMBER_AND_INCR(destination, source) \ do { \ EXTRACT_NUMBER (destination, source); \ (source) += 2; \ } while (0) #ifdef DEBUG static void extract_number_and_incr (destination, source) int *destination; unsigned char **source; { extract_number (destination, *source); *source += 2; } #ifndef EXTRACT_MACROS #undef EXTRACT_NUMBER_AND_INCR #define EXTRACT_NUMBER_AND_INCR(dest, src) \ extract_number_and_incr (&dest, &src) #endif /* not EXTRACT_MACROS */ #endif /* DEBUG */ /* If DEBUG is defined, Regex prints many voluminous messages about what it is doing (if the variable `debug' is nonzero). If linked with the main program in `iregex.c', you can enter patterns and strings interactively. And if linked with the main program in `main.c' and the other test files, you can run the already-written tests. */ #ifdef DEBUG /* We use standard I/O for debugging. */ #include /* It is useful to test things that ``must'' be true when debugging. */ #include static int debug = 0; #define DEBUG_STATEMENT(e) e #define DEBUG_PRINT1(x) if (debug) printf (x) #define DEBUG_PRINT2(x1, x2) if (debug) printf (x1, x2) #define DEBUG_PRINT3(x1, x2, x3) if (debug) printf (x1, x2, x3) #define DEBUG_PRINT4(x1, x2, x3, x4) if (debug) printf (x1, x2, x3, x4) #define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) \ if (debug) print_partial_compiled_pattern (s, e) #define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) \ if (debug) print_double_string (w, s1, sz1, s2, sz2) extern void printchar(); /* Print the fastmap in human-readable form. */ void print_fastmap (fastmap) char *fastmap; { unsigned was_a_range = 0; unsigned i = 0; while (i < (1 << BYTEWIDTH)) { if (fastmap[i++]) { was_a_range = 0; printchar (i - 1); while (i < (1 << BYTEWIDTH) && fastmap[i]) { was_a_range = 1; i++; } if (was_a_range) { printf ("-"); printchar (i - 1); } } } putchar ('\n'); } /* Print a compiled pattern string in human-readable form, starting at the START pointer into it and ending just before the pointer END. */ void print_partial_compiled_pattern (start, end) unsigned char *start; unsigned char *end; { int mcnt, mcnt2; unsigned char *p = start; unsigned char *pend = end; if (start == NULL) { printf ("(null)\n"); return; } /* Loop over pattern commands. */ while (p < pend) { switch ((re_opcode_t) *p++) { case no_op: printf ("/no_op"); break; case exactn: mcnt = *p++; printf ("/exactn/%d", mcnt); do { putchar ('/'); printchar (*p++); } while (--mcnt); break; case start_memory: mcnt = *p++; printf ("/start_memory/%d/%d", mcnt, *p++); break; case stop_memory: mcnt = *p++; printf ("/stop_memory/%d/%d", mcnt, *p++); break; case duplicate: printf ("/duplicate/%d", *p++); break; case anychar: printf ("/anychar"); break; case charset: case charset_not: { register int c; printf ("/charset%s", (re_opcode_t) *(p - 1) == charset_not ? "_not" : ""); assert (p + *p < pend); for (c = 0; c < *p; c++) { unsigned bit; unsigned char map_byte = p[1 + c]; putchar ('/'); for (bit = 0; bit < BYTEWIDTH; bit++) if (map_byte & (1 << bit)) printchar (c * BYTEWIDTH + bit); } p += 1 + *p; break; } case begline: printf ("/begline"); break; case endline: printf ("/endline"); break; case on_failure_jump: extract_number_and_incr (&mcnt, &p); printf ("/on_failure_jump/0/%d", mcnt); break; case on_failure_keep_string_jump: extract_number_and_incr (&mcnt, &p); printf ("/on_failure_keep_string_jump/0/%d", mcnt); break; case dummy_failure_jump: extract_number_and_incr (&mcnt, &p); printf ("/dummy_failure_jump/0/%d", mcnt); break; case push_dummy_failure: printf ("/push_dummy_failure"); break; case maybe_pop_jump: extract_number_and_incr (&mcnt, &p); printf ("/maybe_pop_jump/0/%d", mcnt); break; case pop_failure_jump: extract_number_and_incr (&mcnt, &p); printf ("/pop_failure_jump/0/%d", mcnt); break; case jump_past_alt: extract_number_and_incr (&mcnt, &p); printf ("/jump_past_alt/0/%d", mcnt); break; case jump: extract_number_and_incr (&mcnt, &p); printf ("/jump/0/%d", mcnt); break; case succeed_n: extract_number_and_incr (&mcnt, &p); extract_number_and_incr (&mcnt2, &p); printf ("/succeed_n/0/%d/0/%d", mcnt, mcnt2); break; case jump_n: extract_number_and_incr (&mcnt, &p); extract_number_and_incr (&mcnt2, &p); printf ("/jump_n/0/%d/0/%d", mcnt, mcnt2); break; case set_number_at: extract_number_and_incr (&mcnt, &p); extract_number_and_incr (&mcnt2, &p); printf ("/set_number_at/0/%d/0/%d", mcnt, mcnt2); break; case wordbound: printf ("/wordbound"); break; case notwordbound: printf ("/notwordbound"); break; case wordbeg: printf ("/wordbeg"); break; case wordend: printf ("/wordend"); #ifdef emacs case before_dot: printf ("/before_dot"); break; case at_dot: printf ("/at_dot"); break; case after_dot: printf ("/after_dot"); break; case syntaxspec: printf ("/syntaxspec"); mcnt = *p++; printf ("/%d", mcnt); break; case notsyntaxspec: printf ("/notsyntaxspec"); mcnt = *p++; printf ("/%d", mcnt); break; #endif /* emacs */ case wordchar: printf ("/wordchar"); break; case notwordchar: printf ("/notwordchar"); break; case begbuf: printf ("/begbuf"); break; case endbuf: printf ("/endbuf"); break; default: printf ("?%d", *(p-1)); } } printf ("/\n"); } void print_compiled_pattern (bufp) struct re_pattern_buffer *bufp; { unsigned char *buffer = bufp->buffer; print_partial_compiled_pattern (buffer, buffer + bufp->used); printf ("%d bytes used/%d bytes allocated.\n", bufp->used, bufp->allocated); if (bufp->fastmap_accurate && bufp->fastmap) { printf ("fastmap: "); print_fastmap (bufp->fastmap); } printf ("re_nsub: %d\t", bufp->re_nsub); printf ("regs_alloc: %d\t", bufp->regs_allocated); printf ("can_be_null: %d\t", bufp->can_be_null); printf ("newline_anchor: %d\n", bufp->newline_anchor); printf ("no_sub: %d\t", bufp->no_sub); printf ("not_bol: %d\t", bufp->not_bol); printf ("not_eol: %d\t", bufp->not_eol); printf ("syntax: %d\n", bufp->syntax); /* Perhaps we should print the translate table? */ } void print_double_string (where, string1, size1, string2, size2) const char *where; const char *string1; const char *string2; int size1; int size2; { unsigned this_char; if (where == NULL) printf ("(null)"); else { if (FIRST_STRING_P (where)) { for (this_char = where - string1; this_char < size1; this_char++) printchar (string1[this_char]); where = string2; } for (this_char = where - string2; this_char < size2; this_char++) printchar (string2[this_char]); } } #else /* not DEBUG */ #undef assert #define assert(e) #define DEBUG_STATEMENT(e) #define DEBUG_PRINT1(x) #define DEBUG_PRINT2(x1, x2) #define DEBUG_PRINT3(x1, x2, x3) #define DEBUG_PRINT4(x1, x2, x3, x4) #define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) #define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) #endif /* not DEBUG */ /* Set by `re_set_syntax' to the current regexp syntax to recognize. Can also be assigned to arbitrarily: each pattern buffer stores its own syntax, so it can be changed between regex compilations. */ reg_syntax_t re_syntax_options = RE_SYNTAX_EMACS; /* Specify the precise syntax of regexps for compilation. This provides for compatibility for various utilities which historically have different, incompatible syntaxes. The argument SYNTAX is a bit mask comprised of the various bits defined in regex.h. We return the old syntax. */ reg_syntax_t re_set_syntax (syntax) reg_syntax_t syntax; { reg_syntax_t ret = re_syntax_options; re_syntax_options = syntax; return ret; } /* This table gives an error message for each of the error codes listed in regex.h. Obviously the order here has to be same as there. */ static const char *re_error_msg[] = { NULL, /* REG_NOERROR */ "No match", /* REG_NOMATCH */ "Invalid regular expression", /* REG_BADPAT */ "Invalid collation character", /* REG_ECOLLATE */ "Invalid character class name", /* REG_ECTYPE */ "Trailing backslash", /* REG_EESCAPE */ "Invalid back reference", /* REG_ESUBREG */ "Unmatched [ or [^", /* REG_EBRACK */ "Unmatched ( or \\(", /* REG_EPAREN */ "Unmatched \\{", /* REG_EBRACE */ "Invalid content of \\{\\}", /* REG_BADBR */ "Invalid range end", /* REG_ERANGE */ "Memory exhausted", /* REG_ESPACE */ "Invalid preceding regular expression", /* REG_BADRPT */ "Premature end of regular expression", /* REG_EEND */ "Regular expression too big", /* REG_ESIZE */ "Unmatched ) or \\)", /* REG_ERPAREN */ }; /* Subroutine declarations and macros for regex_compile. */ static void store_op1 (), store_op2 (); static void insert_op1 (), insert_op2 (); static boolean at_begline_loc_p (), at_endline_loc_p (); static boolean group_in_compile_stack (); static reg_errcode_t compile_range (); /* Fetch the next character in the uncompiled pattern---translating it if necessary. Also cast from a signed character in the constant string passed to us by the user to an unsigned char that we can use as an array index (in, e.g., `translate'). */ #define PATFETCH(c) \ do {if (p == pend) return REG_EEND; \ c = (unsigned char) *p++; \ if (translate) c = translate[c]; \ } while (0) /* Fetch the next character in the uncompiled pattern, with no translation. */ #define PATFETCH_RAW(c) \ do {if (p == pend) return REG_EEND; \ c = (unsigned char) *p++; \ } while (0) /* Go backwards one character in the pattern. */ #define PATUNFETCH p-- /* If `translate' is non-null, return translate[D], else just D. We cast the subscript to translate because some data is declared as `char *', to avoid warnings when a string constant is passed. But when we use a character as a subscript we must make it unsigned. */ #define TRANSLATE(d) (translate ? translate[(unsigned char) (d)] : (d)) /* Macros for outputting the compiled pattern into `buffer'. */ /* If the buffer isn't allocated when it comes in, use this. */ #define INIT_BUF_SIZE 32 /* Make sure we have at least N more bytes of space in buffer. */ #define GET_BUFFER_SPACE(n) \ while (b - bufp->buffer + (n) > bufp->allocated) \ EXTEND_BUFFER () /* Make sure we have one more byte of buffer space and then add C to it. */ #define BUF_PUSH(c) \ do { \ GET_BUFFER_SPACE (1); \ *b++ = (unsigned char) (c); \ } while (0) /* Ensure we have two more bytes of buffer space and then append C1 and C2. */ #define BUF_PUSH_2(c1, c2) \ do { \ GET_BUFFER_SPACE (2); \ *b++ = (unsigned char) (c1); \ *b++ = (unsigned char) (c2); \ } while (0) /* As with BUF_PUSH_2, except for three bytes. */ #define BUF_PUSH_3(c1, c2, c3) \ do { \ GET_BUFFER_SPACE (3); \ *b++ = (unsigned char) (c1); \ *b++ = (unsigned char) (c2); \ *b++ = (unsigned char) (c3); \ } while (0) /* Store a jump with opcode OP at LOC to location TO. We store a relative address offset by the three bytes the jump itself occupies. */ #define STORE_JUMP(op, loc, to) \ store_op1 (op, loc, (to) - (loc) - 3) /* Likewise, for a two-argument jump. */ #define STORE_JUMP2(op, loc, to, arg) \ store_op2 (op, loc, (to) - (loc) - 3, arg) /* Like `STORE_JUMP', but for inserting. Assume `b' is the buffer end. */ #define INSERT_JUMP(op, loc, to) \ insert_op1 (op, loc, (to) - (loc) - 3, b) /* Like `STORE_JUMP2', but for inserting. Assume `b' is the buffer end. */ #define INSERT_JUMP2(op, loc, to, arg) \ insert_op2 (op, loc, (to) - (loc) - 3, arg, b) /* This is not an arbitrary limit: the arguments which represent offsets into the pattern are two bytes long. So if 2^16 bytes turns out to be too small, many things would have to change. */ #define MAX_BUF_SIZE (1L << 16) /* Extend the buffer by twice its current size via realloc and reset the pointers that pointed into the old block to point to the correct places in the new one. If extending the buffer results in it being larger than MAX_BUF_SIZE, then flag memory exhausted. */ #define EXTEND_BUFFER() \ do { \ unsigned char *old_buffer = bufp->buffer; \ if (bufp->allocated == MAX_BUF_SIZE) \ return REG_ESIZE; \ bufp->allocated <<= 1; \ if (bufp->allocated > MAX_BUF_SIZE) \ bufp->allocated = MAX_BUF_SIZE; \ bufp->buffer = (unsigned char *) realloc (bufp->buffer, bufp->allocated);\ if (bufp->buffer == NULL) \ return REG_ESPACE; \ /* If the buffer moved, move all the pointers into it. */ \ if (old_buffer != bufp->buffer) \ { \ b = (b - old_buffer) + bufp->buffer; \ begalt = (begalt - old_buffer) + bufp->buffer; \ if (fixup_alt_jump) \ fixup_alt_jump = (fixup_alt_jump - old_buffer) + bufp->buffer;\ if (laststart) \ laststart = (laststart - old_buffer) + bufp->buffer; \ if (pending_exact) \ pending_exact = (pending_exact - old_buffer) + bufp->buffer; \ } \ } while (0) /* Since we have one byte reserved for the register number argument to {start,stop}_memory, the maximum number of groups we can report things about is what fits in that byte. */ #define MAX_REGNUM 255 /* But patterns can have more than `MAX_REGNUM' registers. We just ignore the excess. */ typedef unsigned regnum_t; /* Macros for the compile stack. */ /* Since offsets can go either forwards or backwards, this type needs to be able to hold values from -(MAX_BUF_SIZE - 1) to MAX_BUF_SIZE - 1. */ typedef int pattern_offset_t; typedef struct { pattern_offset_t begalt_offset; pattern_offset_t fixup_alt_jump; pattern_offset_t inner_group_offset; pattern_offset_t laststart_offset; regnum_t regnum; } compile_stack_elt_t; typedef struct { compile_stack_elt_t *stack; unsigned size; unsigned avail; /* Offset of next open position. */ } compile_stack_type; #define INIT_COMPILE_STACK_SIZE 32 #define COMPILE_STACK_EMPTY (compile_stack.avail == 0) #define COMPILE_STACK_FULL (compile_stack.avail == compile_stack.size) /* The next available element. */ #define COMPILE_STACK_TOP (compile_stack.stack[compile_stack.avail]) /* Set the bit for character C in a list. */ #define SET_LIST_BIT(c) \ (b[((unsigned char) (c)) / BYTEWIDTH] \ |= 1 << (((unsigned char) c) % BYTEWIDTH)) /* Get the next unsigned number in the uncompiled pattern. */ #define GET_UNSIGNED_NUMBER(num) \ { if (p != pend) \ { \ PATFETCH (c); \ while (ISDIGIT (c)) \ { \ if (num < 0) \ num = 0; \ num = num * 10 + c - '0'; \ if (p == pend) \ break; \ PATFETCH (c); \ } \ } \ } #define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */ #define IS_CHAR_CLASS(string) \ (STREQ (string, "alpha") || STREQ (string, "upper") \ || STREQ (string, "lower") || STREQ (string, "digit") \ || STREQ (string, "alnum") || STREQ (string, "xdigit") \ || STREQ (string, "space") || STREQ (string, "print") \ || STREQ (string, "punct") || STREQ (string, "graph") \ || STREQ (string, "cntrl") || STREQ (string, "blank")) /* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX. Returns one of error codes defined in `regex.h', or zero for success. Assumes the `allocated' (and perhaps `buffer') and `translate' fields are set in BUFP on entry. If it succeeds, results are put in BUFP (if it returns an error, the contents of BUFP are undefined): `buffer' is the compiled pattern; `syntax' is set to SYNTAX; `used' is set to the length of the compiled pattern; `fastmap_accurate' is zero; `re_nsub' is the number of subexpressions in PATTERN; `not_bol' and `not_eol' are zero; The `fastmap' and `newline_anchor' fields are neither examined nor set. */ static reg_errcode_t regex_compile (pattern, size, syntax, bufp) const char *pattern; int size; reg_syntax_t syntax; struct re_pattern_buffer *bufp; { /* We fetch characters from PATTERN here. Even though PATTERN is `char *' (i.e., signed), we declare these variables as unsigned, so they can be reliably used as array indices. */ register unsigned char c, c1; /* A random tempory spot in PATTERN. */ const char *p1; /* Points to the end of the buffer, where we should append. */ register unsigned char *b; /* Keeps track of unclosed groups. */ compile_stack_type compile_stack; /* Points to the current (ending) position in the pattern. */ const char *p = pattern; const char *pend = pattern + size; /* How to translate the characters in the pattern. */ char *translate = bufp->translate; /* Address of the count-byte of the most recently inserted `exactn' command. This makes it possible to tell if a new exact-match character can be added to that command or if the character requires a new `exactn' command. */ unsigned char *pending_exact = 0; /* Address of start of the most recently finished expression. This tells, e.g., postfix * where to find the start of its operand. Reset at the beginning of groups and alternatives. */ unsigned char *laststart = 0; /* Address of beginning of regexp, or inside of last group. */ unsigned char *begalt; /* Place in the uncompiled pattern (i.e., the {) to which to go back if the interval is invalid. */ const char *beg_interval; /* Address of the place where a forward jump should go to the end of the containing expression. Each alternative of an `or' -- except the last -- ends with a forward jump of this sort. */ unsigned char *fixup_alt_jump = 0; /* Counts open-groups as they are encountered. Remembered for the matching close-group on the compile stack, so the same register number is put in the stop_memory as the start_memory. */ regnum_t regnum = 0; #ifdef DEBUG DEBUG_PRINT1 ("\nCompiling pattern: "); if (debug) { unsigned debug_count; for (debug_count = 0; debug_count < size; debug_count++) printchar (pattern[debug_count]); putchar ('\n'); } #endif /* DEBUG */ /* Initialize the compile stack. */ compile_stack.stack = TALLOC (INIT_COMPILE_STACK_SIZE, compile_stack_elt_t); if (compile_stack.stack == NULL) return REG_ESPACE; compile_stack.size = INIT_COMPILE_STACK_SIZE; compile_stack.avail = 0; /* Initialize the pattern buffer. */ bufp->syntax = syntax; bufp->fastmap_accurate = 0; bufp->not_bol = bufp->not_eol = 0; /* Set `used' to zero, so that if we return an error, the pattern printer (for debugging) will think there's no pattern. We reset it at the end. */ bufp->used = 0; /* Always count groups, whether or not bufp->no_sub is set. */ bufp->re_nsub = 0; #if !defined (emacs) && !defined (SYNTAX_TABLE) /* Initialize the syntax table. */ init_syntax_once (); #endif if (bufp->allocated == 0) { if (bufp->buffer) { /* If zero allocated, but buffer is non-null, try to realloc enough space. This loses if buffer's address is bogus, but that is the user's responsibility. */ RETALLOC (bufp->buffer, INIT_BUF_SIZE, unsigned char); } else { /* Caller did not allocate a buffer. Do it for them. */ bufp->buffer = TALLOC (INIT_BUF_SIZE, unsigned char); } if (!bufp->buffer) return REG_ESPACE; bufp->allocated = INIT_BUF_SIZE; } begalt = b = bufp->buffer; /* Loop through the uncompiled pattern until we're at the end. */ while (p != pend) { PATFETCH (c); switch (c) { case '^': { if ( /* If at start of pattern, it's an operator. */ p == pattern + 1 /* If context independent, it's an operator. */ || syntax & RE_CONTEXT_INDEP_ANCHORS /* Otherwise, depends on what's come before. */ || at_begline_loc_p (pattern, p, syntax)) BUF_PUSH (begline); else goto normal_char; } break; case '$': { if ( /* If at end of pattern, it's an operator. */ p == pend /* If context independent, it's an operator. */ || syntax & RE_CONTEXT_INDEP_ANCHORS /* Otherwise, depends on what's next. */ || at_endline_loc_p (p, pend, syntax)) BUF_PUSH (endline); else goto normal_char; } break; case '+': case '?': if ((syntax & RE_BK_PLUS_QM) || (syntax & RE_LIMITED_OPS)) goto normal_char; handle_plus: case '*': /* If there is no previous pattern... */ if (!laststart) { if (syntax & RE_CONTEXT_INVALID_OPS) return REG_BADRPT; else if (!(syntax & RE_CONTEXT_INDEP_OPS)) goto normal_char; } { /* Are we optimizing this jump? */ boolean keep_string_p = false; /* 1 means zero (many) matches is allowed. */ char zero_times_ok = 0, many_times_ok = 0; /* If there is a sequence of repetition chars, collapse it down to just one (the right one). We can't combine interval operators with these because of, e.g., `a{2}*', which should only match an even number of `a's. */ for (;;) { zero_times_ok |= c != '+'; many_times_ok |= c != '?'; if (p == pend) break; PATFETCH (c); if (c == '*' || (!(syntax & RE_BK_PLUS_QM) && (c == '+' || c == '?'))) ; else if (syntax & RE_BK_PLUS_QM && c == '\\') { if (p == pend) return REG_EESCAPE; PATFETCH (c1); if (!(c1 == '+' || c1 == '?')) { PATUNFETCH; PATUNFETCH; break; } c = c1; } else { PATUNFETCH; break; } /* If we get here, we found another repeat character. */ } /* Star, etc. applied to an empty pattern is equivalent to an empty pattern. */ if (!laststart) break; /* Now we know whether or not zero matches is allowed and also whether or not two or more matches is allowed. */ if (many_times_ok) { /* More than one repetition is allowed, so put in at the end a backward relative jump from `b' to before the next jump we're going to put in below (which jumps from laststart to after this jump). But if we are at the `*' in the exact sequence `.*\n', insert an unconditional jump backwards to the ., instead of the beginning of the loop. This way we only push a failure point once, instead of every time through the loop. */ assert (p - 1 > pattern); /* Allocate the space for the jump. */ GET_BUFFER_SPACE (3); /* We know we are not at the first character of the pattern, because laststart was nonzero. And we've already incremented `p', by the way, to be the character after the `*'. Do we have to do something analogous here for null bytes, because of RE_DOT_NOT_NULL? */ if (TRANSLATE (*(p - 2)) == TRANSLATE ('.') && zero_times_ok && p < pend && TRANSLATE (*p) == TRANSLATE ('\n') && !(syntax & RE_DOT_NEWLINE)) { /* We have .*\n. */ STORE_JUMP (jump, b, laststart); keep_string_p = true; } else /* Anything else. */ STORE_JUMP (maybe_pop_jump, b, laststart - 3); /* We've added more stuff to the buffer. */ b += 3; } /* On failure, jump from laststart to b + 3, which will be the end of the buffer after this jump is inserted. */ GET_BUFFER_SPACE (3); INSERT_JUMP (keep_string_p ? on_failure_keep_string_jump : on_failure_jump, laststart, b + 3); pending_exact = 0; b += 3; if (!zero_times_ok) { /* At least one repetition is required, so insert a `dummy_failure_jump' before the initial `on_failure_jump' instruction of the loop. This effects a skip over that instruction the first time we hit that loop. */ GET_BUFFER_SPACE (3); INSERT_JUMP (dummy_failure_jump, laststart, laststart + 6); b += 3; } } break; case '.': laststart = b; BUF_PUSH (anychar); break; case '[': { boolean had_char_class = false; if (p == pend) return REG_EBRACK; /* Ensure that we have enough space to push a charset: the opcode, the length count, and the bitset; 34 bytes in all. */ GET_BUFFER_SPACE (34); laststart = b; /* We test `*p == '^' twice, instead of using an if statement, so we only need one BUF_PUSH. */ BUF_PUSH (*p == '^' ? charset_not : charset); if (*p == '^') p++; /* Remember the first position in the bracket expression. */ p1 = p; /* Push the number of bytes in the bitmap. */ BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH); /* Clear the whole map. */ bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH); /* charset_not matches newline according to a syntax bit. */ if ((re_opcode_t) b[-2] == charset_not && (syntax & RE_HAT_LISTS_NOT_NEWLINE)) SET_LIST_BIT ('\n'); /* Read in characters and ranges, setting map bits. */ for (;;) { if (p == pend) return REG_EBRACK; PATFETCH (c); /* \ might escape characters inside [...] and [^...]. */ if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\') { if (p == pend) return REG_EESCAPE; PATFETCH (c1); SET_LIST_BIT (c1); continue; } /* Could be the end of the bracket expression. If it's not (i.e., when the bracket expression is `[]' so far), the ']' character bit gets set way below. */ if (c == ']' && p != p1 + 1) break; /* Look ahead to see if it's a range when the last thing was a character class. */ if (had_char_class && c == '-' && *p != ']') return REG_ERANGE; /* Look ahead to see if it's a range when the last thing was a character: if this is a hyphen not at the beginning or the end of a list, then it's the range operator. */ if (c == '-' && !(p - 2 >= pattern && p[-2] == '[') && !(p - 3 >= pattern && p[-3] == '[' && p[-2] == '^') && *p != ']') { reg_errcode_t ret = compile_range (&p, pend, translate, syntax, b); if (ret != REG_NOERROR) return ret; } else if (p[0] == '-' && p[1] != ']') { /* This handles ranges made up of characters only. */ reg_errcode_t ret; /* Move past the `-'. */ PATFETCH (c1); ret = compile_range (&p, pend, translate, syntax, b); if (ret != REG_NOERROR) return ret; } /* See if we're at the beginning of a possible character class. */ else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == ':') { /* Leave room for the null. */ char str[CHAR_CLASS_MAX_LENGTH + 1]; PATFETCH (c); c1 = 0; /* If pattern is `[[:'. */ if (p == pend) return REG_EBRACK; for (;;) { PATFETCH (c); if (c == ':' || c == ']' || p == pend || c1 == CHAR_CLASS_MAX_LENGTH) break; str[c1++] = c; } str[c1] = '\0'; /* If isn't a word bracketed by `[:' and:`]': undo the ending character, the letters, and leave the leading `:' and `[' (but set bits for them). */ if (c == ':' && *p == ']') { int ch; boolean is_alnum = STREQ (str, "alnum"); boolean is_alpha = STREQ (str, "alpha"); boolean is_blank = STREQ (str, "blank"); boolean is_cntrl = STREQ (str, "cntrl"); boolean is_digit = STREQ (str, "digit"); boolean is_graph = STREQ (str, "graph"); boolean is_lower = STREQ (str, "lower"); boolean is_print = STREQ (str, "print"); boolean is_punct = STREQ (str, "punct"); boolean is_space = STREQ (str, "space"); boolean is_upper = STREQ (str, "upper"); boolean is_xdigit = STREQ (str, "xdigit"); if (!IS_CHAR_CLASS (str)) return REG_ECTYPE; /* Throw away the ] at the end of the character class. */ PATFETCH (c); if (p == pend) return REG_EBRACK; for (ch = 0; ch < 1 << BYTEWIDTH; ch++) { if ( (is_alnum && ISALNUM (ch)) || (is_alpha && ISALPHA (ch)) || (is_blank && ISBLANK (ch)) || (is_cntrl && ISCNTRL (ch)) || (is_digit && ISDIGIT (ch)) || (is_graph && ISGRAPH (ch)) || (is_lower && ISLOWER (ch)) || (is_print && ISPRINT (ch)) || (is_punct && ISPUNCT (ch)) || (is_space && ISSPACE (ch)) || (is_upper && ISUPPER (ch)) || (is_xdigit && ISXDIGIT (ch))) SET_LIST_BIT (ch); } had_char_class = true; } else { c1++; while (c1--) PATUNFETCH; SET_LIST_BIT ('['); SET_LIST_BIT (':'); had_char_class = false; } } else { had_char_class = false; SET_LIST_BIT (c); } } /* Discard any (non)matching list bytes that are all 0 at the end of the map. Decrease the map-length byte too. */ while ((int) b[-1] > 0 && b[b[-1] - 1] == 0) b[-1]--; b += b[-1]; } break; case '(': if (syntax & RE_NO_BK_PARENS) goto handle_open; else goto normal_char; case ')': if (syntax & RE_NO_BK_PARENS) goto handle_close; else goto normal_char; case '\n': if (syntax & RE_NEWLINE_ALT) goto handle_alt; else goto normal_char; case '|': if (syntax & RE_NO_BK_VBAR) goto handle_alt; else goto normal_char; case '{': if (syntax & RE_INTERVALS && syntax & RE_NO_BK_BRACES) goto handle_interval; else goto normal_char; case '\\': if (p == pend) return REG_EESCAPE; /* Do not translate the character after the \, so that we can distinguish, e.g., \B from \b, even if we normally would translate, e.g., B to b. */ PATFETCH_RAW (c); switch (c) { case '(': if (syntax & RE_NO_BK_PARENS) goto normal_backslash; handle_open: bufp->re_nsub++; regnum++; if (COMPILE_STACK_FULL) { RETALLOC (compile_stack.stack, compile_stack.size << 1, compile_stack_elt_t); if (compile_stack.stack == NULL) return REG_ESPACE; compile_stack.size <<= 1; } /* These are the values to restore when we hit end of this group. They are all relative offsets, so that if the whole pattern moves because of realloc, they will still be valid. */ COMPILE_STACK_TOP.begalt_offset = begalt - bufp->buffer; COMPILE_STACK_TOP.fixup_alt_jump = fixup_alt_jump ? fixup_alt_jump - bufp->buffer + 1 : 0; COMPILE_STACK_TOP.laststart_offset = b - bufp->buffer; COMPILE_STACK_TOP.regnum = regnum; /* We will eventually replace the 0 with the number of groups inner to this one. But do not push a start_memory for groups beyond the last one we can represent in the compiled pattern. */ if (regnum <= MAX_REGNUM) { COMPILE_STACK_TOP.inner_group_offset = b - bufp->buffer + 2; BUF_PUSH_3 (start_memory, regnum, 0); } compile_stack.avail++; fixup_alt_jump = 0; laststart = 0; begalt = b; /* If we've reached MAX_REGNUM groups, then this open won't actually generate any code, so we'll have to clear pending_exact explicitly. */ pending_exact = 0; break; case ')': if (syntax & RE_NO_BK_PARENS) goto normal_backslash; if (COMPILE_STACK_EMPTY){ if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD){ goto normal_backslash; } else { return REG_ERPAREN; } } handle_close: if (fixup_alt_jump) { /* Push a dummy failure point at the end of the alternative for a possible future `pop_failure_jump' to pop. See comments at `push_dummy_failure' in `re_match_2'. */ BUF_PUSH (push_dummy_failure); /* We allocated space for this jump when we assigned to `fixup_alt_jump', in the `handle_alt' case below. */ STORE_JUMP (jump_past_alt, fixup_alt_jump, b - 1); } /* See similar code for backslashed left paren above. */ if (COMPILE_STACK_EMPTY){ if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD){ goto normal_char; } else { return REG_ERPAREN; } } /* Since we just checked for an empty stack above, this ``can't happen''. */ assert (compile_stack.avail != 0); { /* We don't just want to restore into `regnum', because later groups should continue to be numbered higher, as in `(ab)c(de)' -- the second group is #2. */ regnum_t this_group_regnum; compile_stack.avail--; begalt = bufp->buffer + COMPILE_STACK_TOP.begalt_offset; fixup_alt_jump = COMPILE_STACK_TOP.fixup_alt_jump ? bufp->buffer + COMPILE_STACK_TOP.fixup_alt_jump - 1 : 0; laststart = bufp->buffer + COMPILE_STACK_TOP.laststart_offset; this_group_regnum = COMPILE_STACK_TOP.regnum; /* If we've reached MAX_REGNUM groups, then this open won't actually generate any code, so we'll have to clear pending_exact explicitly. */ pending_exact = 0; /* We're at the end of the group, so now we know how many groups were inside this one. */ if (this_group_regnum <= MAX_REGNUM) { unsigned char *inner_group_loc = bufp->buffer + COMPILE_STACK_TOP.inner_group_offset; *inner_group_loc = regnum - this_group_regnum; BUF_PUSH_3 (stop_memory, this_group_regnum, regnum - this_group_regnum); } } break; case '|': /* `\|'. */ if (syntax & RE_LIMITED_OPS || syntax & RE_NO_BK_VBAR) goto normal_backslash; handle_alt: if (syntax & RE_LIMITED_OPS) goto normal_char; /* Insert before the previous alternative a jump which jumps to this alternative if the former fails. */ GET_BUFFER_SPACE (3); INSERT_JUMP (on_failure_jump, begalt, b + 6); pending_exact = 0; b += 3; /* The alternative before this one has a jump after it which gets executed if it gets matched. Adjust that jump so it will jump to this alternative's analogous jump (put in below, which in turn will jump to the next (if any) alternative's such jump, etc.). The last such jump jumps to the correct final destination. A picture: _____ _____ | | | | | v | v a | b | c If we are at `b', then fixup_alt_jump right now points to a three-byte space after `a'. We'll put in the jump, set fixup_alt_jump to right after `b', and leave behind three bytes which we'll fill in when we get to after `c'. */ if (fixup_alt_jump) STORE_JUMP (jump_past_alt, fixup_alt_jump, b); /* Mark and leave space for a jump after this alternative, to be filled in later either by next alternative or when know we're at the end of a series of alternatives. */ fixup_alt_jump = b; GET_BUFFER_SPACE (3); b += 3; laststart = 0; begalt = b; break; case '{': /* If \{ is a literal. */ if (!(syntax & RE_INTERVALS) /* If we're at `\{' and it's not the open-interval operator. */ || ((syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES)) || (p - 2 == pattern && p == pend)) goto normal_backslash; handle_interval: { /* If got here, then the syntax allows intervals. */ /* At least (most) this many matches must be made. */ int lower_bound = -1, upper_bound = -1; beg_interval = p - 1; if (p == pend) { if (syntax & RE_NO_BK_BRACES) goto unfetch_interval; else return REG_EBRACE; } GET_UNSIGNED_NUMBER (lower_bound); if (c == ',') { GET_UNSIGNED_NUMBER (upper_bound); if (upper_bound < 0) upper_bound = RE_DUP_MAX; } else /* Interval such as `{1}' => match exactly once. */ upper_bound = lower_bound; if (lower_bound < 0 || upper_bound > RE_DUP_MAX || lower_bound > upper_bound) { if (syntax & RE_NO_BK_BRACES) goto unfetch_interval; else return REG_BADBR; } if (!(syntax & RE_NO_BK_BRACES)) { if (c != '\\') return REG_EBRACE; PATFETCH (c); } if (c != '}') { if (syntax & RE_NO_BK_BRACES) goto unfetch_interval; else return REG_BADBR; } /* We just parsed a valid interval. */ /* If it's invalid to have no preceding re. */ if (!laststart) { if (syntax & RE_CONTEXT_INVALID_OPS) return REG_BADRPT; else if (syntax & RE_CONTEXT_INDEP_OPS) laststart = b; else goto unfetch_interval; } /* If the upper bound is zero, don't want to succeed at all; jump from `laststart' to `b + 3', which will be the end of the buffer after we insert the jump. */ if (upper_bound == 0) { GET_BUFFER_SPACE (3); INSERT_JUMP (jump, laststart, b + 3); b += 3; } /* Otherwise, we have a nontrivial interval. When we're all done, the pattern will look like: set_number_at set_number_at succeed_n jump_n (The upper bound and `jump_n' are omitted if `upper_bound' is 1, though.) */ else { /* If the upper bound is > 1, we need to insert more at the end of the loop. */ unsigned nbytes = 10 + (upper_bound > 1) * 10; GET_BUFFER_SPACE (nbytes); /* Initialize lower bound of the `succeed_n', even though it will be set during matching by its attendant `set_number_at' (inserted next), because `re_compile_fastmap' needs to know. Jump to the `jump_n' we might insert below. */ INSERT_JUMP2 (succeed_n, laststart, b + 5 + (upper_bound > 1) * 5, lower_bound); b += 5; /* Code to initialize the lower bound. Insert before the `succeed_n'. The `5' is the last two bytes of this `set_number_at', plus 3 bytes of the following `succeed_n'. */ insert_op2 (set_number_at, laststart, 5, lower_bound, b); b += 5; if (upper_bound > 1) { /* More than one repetition is allowed, so append a backward jump to the `succeed_n' that starts this interval. When we've reached this during matching, we'll have matched the interval once, so jump back only `upper_bound - 1' times. */ STORE_JUMP2 (jump_n, b, laststart + 5, upper_bound - 1); b += 5; /* The location we want to set is the second parameter of the `jump_n'; that is `b-2' as an absolute address. `laststart' will be the `set_number_at' we're about to insert; `laststart+3' the number to set, the source for the relative address. But we are inserting into the middle of the pattern -- so everything is getting moved up by 5. Conclusion: (b - 2) - (laststart + 3) + 5, i.e., b - laststart. We insert this at the beginning of the loop so that if we fail during matching, we'll reinitialize the bounds. */ insert_op2 (set_number_at, laststart, b - laststart, upper_bound - 1, b); b += 5; } } pending_exact = 0; beg_interval = NULL; } break; unfetch_interval: /* If an invalid interval, match the characters as literals. */ assert (beg_interval); p = beg_interval; beg_interval = NULL; /* normal_char and normal_backslash need `c'. */ PATFETCH (c); if (!(syntax & RE_NO_BK_BRACES)) { if (p > pattern && p[-1] == '\\') goto normal_backslash; } goto normal_char; #ifdef emacs /* There is no way to specify the before_dot and after_dot operators. rms says this is ok. --karl */ case '=': BUF_PUSH (at_dot); break; case 's': laststart = b; PATFETCH (c); BUF_PUSH_2 (syntaxspec, syntax_spec_code[c]); break; case 'S': laststart = b; PATFETCH (c); BUF_PUSH_2 (notsyntaxspec, syntax_spec_code[c]); break; #endif /* emacs */ case 'w': laststart = b; BUF_PUSH (wordchar); break; case 'W': laststart = b; BUF_PUSH (notwordchar); break; case '<': BUF_PUSH (wordbeg); break; case '>': BUF_PUSH (wordend); break; case 'b': BUF_PUSH (wordbound); break; case 'B': BUF_PUSH (notwordbound); break; case '`': BUF_PUSH (begbuf); break; case '\'': BUF_PUSH (endbuf); break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (syntax & RE_NO_BK_REFS) goto normal_char; c1 = c - '0'; if (c1 > regnum) return REG_ESUBREG; /* Can't back reference to a subexpression if inside of it. */ if (group_in_compile_stack (compile_stack, c1)) goto normal_char; laststart = b; BUF_PUSH_2 (duplicate, c1); break; case '+': case '?': if (syntax & RE_BK_PLUS_QM) goto handle_plus; else goto normal_backslash; default: normal_backslash: /* You might think it would be useful for \ to mean not to translate; but if we don't translate it it will never match anything. */ c = TRANSLATE (c); goto normal_char; } break; default: /* Expects the character in `c'. */ normal_char: /* If no exactn currently being built. */ if (!pending_exact /* If last exactn not at current position. */ || pending_exact + *pending_exact + 1 != b /* We have only one byte following the exactn for the count. */ || *pending_exact == (1 << BYTEWIDTH) - 1 /* If followed by a repetition operator. */ || *p == '*' || *p == '^' || ((syntax & RE_BK_PLUS_QM) ? *p == '\\' && (p[1] == '+' || p[1] == '?') : (*p == '+' || *p == '?')) || ((syntax & RE_INTERVALS) && ((syntax & RE_NO_BK_BRACES) ? *p == '{' : (p[0] == '\\' && p[1] == '{')))) { /* Start building a new exactn. */ laststart = b; BUF_PUSH_2 (exactn, 0); pending_exact = b - 1; } BUF_PUSH (c); (*pending_exact)++; break; } /* switch (c) */ } /* while p != pend */ /* Through the pattern now. */ if (fixup_alt_jump) STORE_JUMP (jump_past_alt, fixup_alt_jump, b); if (!COMPILE_STACK_EMPTY) return REG_EPAREN; free (compile_stack.stack); /* We have succeeded; set the length of the buffer. */ bufp->used = b - bufp->buffer; #ifdef DEBUG if (debug) { DEBUG_PRINT1 ("\nCompiled pattern: "); print_compiled_pattern (bufp); } #endif /* DEBUG */ return REG_NOERROR; } /* regex_compile */ /* Subroutines for `regex_compile'. */ /* Store OP at LOC followed by two-byte integer parameter ARG. */ static void store_op1 (op, loc, arg) re_opcode_t op; unsigned char *loc; int arg; { *loc = (unsigned char) op; STORE_NUMBER (loc + 1, arg); } /* Like `store_op1', but for two two-byte parameters ARG1 and ARG2. */ static void store_op2 (op, loc, arg1, arg2) re_opcode_t op; unsigned char *loc; int arg1, arg2; { *loc = (unsigned char) op; STORE_NUMBER (loc + 1, arg1); STORE_NUMBER (loc + 3, arg2); } /* Copy the bytes from LOC to END to open up three bytes of space at LOC for OP followed by two-byte integer parameter ARG. */ static void insert_op1 (op, loc, arg, end) re_opcode_t op; unsigned char *loc; int arg; unsigned char *end; { register unsigned char *pfrom = end; register unsigned char *pto = end + 3; while (pfrom != loc) *--pto = *--pfrom; store_op1 (op, loc, arg); } /* Like `insert_op1', but for two two-byte parameters ARG1 and ARG2. */ static void insert_op2 (op, loc, arg1, arg2, end) re_opcode_t op; unsigned char *loc; int arg1, arg2; unsigned char *end; { register unsigned char *pfrom = end; register unsigned char *pto = end + 5; while (pfrom != loc) *--pto = *--pfrom; store_op2 (op, loc, arg1, arg2); } /* P points to just after a ^ in PATTERN. Return true if that ^ comes after an alternative or a begin-subexpression. We assume there is at least one character before the ^. */ static boolean at_begline_loc_p (pattern, p, syntax) const char *pattern, *p; reg_syntax_t syntax; { const char *prev = p - 2; boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\'; return /* After a subexpression? */ (*prev == '(' && (syntax & RE_NO_BK_PARENS || prev_prev_backslash)) /* After an alternative? */ || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash)); } /* The dual of at_begline_loc_p. This one is for $. We assume there is at least one character after the $, i.e., `P < PEND'. */ static boolean at_endline_loc_p (p, pend, syntax) const char *p, *pend; int syntax; { const char *next = p; boolean next_backslash = *next == '\\'; const char *next_next = p + 1 < pend ? p + 1 : NULL; return /* Before a subexpression? */ (syntax & RE_NO_BK_PARENS ? *next == ')' : next_backslash && next_next && *next_next == ')') /* Before an alternative? */ || (syntax & RE_NO_BK_VBAR ? *next == '|' : next_backslash && next_next && *next_next == '|'); } /* Returns true if REGNUM is in one of COMPILE_STACK's elements and false if it's not. */ static boolean group_in_compile_stack (compile_stack, regnum) compile_stack_type compile_stack; regnum_t regnum; { int this_element; for (this_element = compile_stack.avail - 1; this_element >= 0; this_element--) if (compile_stack.stack[this_element].regnum == regnum) return true; return false; } /* Read the ending character of a range (in a bracket expression) from the uncompiled pattern *P_PTR (which ends at PEND). We assume the starting character is in `P[-2]'. (`P[-1]' is the character `-'.) Then we set the translation of all bits between the starting and ending characters (inclusive) in the compiled pattern B. Return an error code. We use these short variable names so we can use the same macros as `regex_compile' itself. */ static reg_errcode_t compile_range (p_ptr, pend, translate, syntax, b) const char **p_ptr, *pend; char *translate; reg_syntax_t syntax; unsigned char *b; { unsigned this_char; const char *p = *p_ptr; int range_start, range_end; if (p == pend) return REG_ERANGE; /* Even though the pattern is a signed `char *', we need to fetch with unsigned char *'s; if the high bit of the pattern character is set, the range endpoints will be negative if we fetch using a signed char *. We also want to fetch the endpoints without translating them; the appropriate translation is done in the bit-setting loop below. */ range_start = ((unsigned char *) p)[-2]; range_end = ((unsigned char *) p)[0]; /* Have to increment the pointer into the pattern string, so the caller isn't still at the ending character. */ (*p_ptr)++; /* If the start is after the end, the range is empty. */ if (range_start > range_end) return syntax & RE_NO_EMPTY_RANGES ? REG_ERANGE : REG_NOERROR; /* Here we see why `this_char' has to be larger than an `unsigned char' -- the range is inclusive, so if `range_end' == 0xff (assuming 8-bit characters), we would otherwise go into an infinite loop, since all characters <= 0xff. */ for (this_char = range_start; this_char <= range_end; this_char++) { SET_LIST_BIT (TRANSLATE (this_char)); } return REG_NOERROR; } /* Failure stack declarations and macros; both re_compile_fastmap and re_match_2 use a failure stack. These have to be macros because of REGEX_ALLOCATE. */ /* Number of failure points for which to initially allocate space when matching. If this number is exceeded, we allocate more space, so it is not a hard limit. */ #ifndef INIT_FAILURE_ALLOC #define INIT_FAILURE_ALLOC 5 #endif /* Roughly the maximum number of failure points on the stack. Would be exactly that if always used MAX_FAILURE_SPACE each time we failed. This is a variable only so users of regex can assign to it; we never change it ourselves. */ int re_max_failures = 2000; typedef const unsigned char *fail_stack_elt_t; typedef struct { fail_stack_elt_t *stack; unsigned size; unsigned avail; /* Offset of next open position. */ } fail_stack_type; #define FAIL_STACK_EMPTY() (fail_stack.avail == 0) #define FAIL_STACK_PTR_EMPTY() (fail_stack_ptr->avail == 0) #define FAIL_STACK_FULL() (fail_stack.avail == fail_stack.size) #define FAIL_STACK_TOP() (fail_stack.stack[fail_stack.avail]) /* Initialize `fail_stack'. Do `return -2' if the alloc fails. */ #define INIT_FAIL_STACK() \ do { \ fail_stack.stack = (fail_stack_elt_t *) \ REGEX_ALLOCATE (INIT_FAILURE_ALLOC * sizeof (fail_stack_elt_t)); \ \ if (fail_stack.stack == NULL) \ return -2; \ \ fail_stack.size = INIT_FAILURE_ALLOC; \ fail_stack.avail = 0; \ } while (0) /* Double the size of FAIL_STACK, up to approximately `re_max_failures' items. Return 1 if succeeds, and 0 if either ran out of memory allocating space for it or it was already too large. REGEX_REALLOCATE requires `destination' be declared. */ #define DOUBLE_FAIL_STACK(fail_stack) \ ((fail_stack).size > re_max_failures * MAX_FAILURE_ITEMS \ ? 0 \ : ((fail_stack).stack = (fail_stack_elt_t *) \ REGEX_REALLOCATE ((fail_stack).stack, \ (fail_stack).size * sizeof (fail_stack_elt_t), \ ((fail_stack).size << 1) * sizeof (fail_stack_elt_t)), \ \ (fail_stack).stack == NULL \ ? 0 \ : ((fail_stack).size <<= 1, \ 1))) /* Push PATTERN_OP on FAIL_STACK. Return 1 if was able to do so and 0 if ran out of memory allocating space to do so. */ #define PUSH_PATTERN_OP(pattern_op, fail_stack) \ ((FAIL_STACK_FULL () \ && !DOUBLE_FAIL_STACK (fail_stack)) \ ? 0 \ : ((fail_stack).stack[(fail_stack).avail++] = pattern_op, \ 1)) /* This pushes an item onto the failure stack. Must be a four-byte value. Assumes the variable `fail_stack'. Probably should only be called from within `PUSH_FAILURE_POINT'. */ #define PUSH_FAILURE_ITEM(item) \ fail_stack.stack[fail_stack.avail++] = (fail_stack_elt_t) item /* The complement operation. Assumes `fail_stack' is nonempty. */ #define POP_FAILURE_ITEM() fail_stack.stack[--fail_stack.avail] /* Used to omit pushing failure point id's when we're not debugging. */ #ifdef DEBUG #define DEBUG_PUSH PUSH_FAILURE_ITEM #define DEBUG_POP(item_addr) *(item_addr) = POP_FAILURE_ITEM () #else #define DEBUG_PUSH(item) #define DEBUG_POP(item_addr) #endif /* Push the information about the state we will need if we ever fail back to it. Requires variables fail_stack, regstart, regend, reg_info, and num_regs be declared. DOUBLE_FAIL_STACK requires `destination' be declared. Does `return FAILURE_CODE' if runs out of memory. */ #define PUSH_FAILURE_POINT(pattern_place, string_place, failure_code) \ do { \ char *destination; \ /* Must be int, so when we don't save any registers, the arithmetic \ of 0 + -1 isn't done as unsigned. */ \ int this_reg; \ \ DEBUG_STATEMENT (failure_id++); \ DEBUG_STATEMENT (nfailure_points_pushed++); \ DEBUG_PRINT2 ("\nPUSH_FAILURE_POINT #%u:\n", failure_id); \ DEBUG_PRINT2 (" Before push, next avail: %d\n", (fail_stack).avail);\ DEBUG_PRINT2 (" size: %d\n", (fail_stack).size);\ \ DEBUG_PRINT2 (" slots needed: %d\n", NUM_FAILURE_ITEMS); \ DEBUG_PRINT2 (" available: %d\n", REMAINING_AVAIL_SLOTS); \ \ /* Ensure we have enough space allocated for what we will push. */ \ while (REMAINING_AVAIL_SLOTS < NUM_FAILURE_ITEMS) \ { \ if (!DOUBLE_FAIL_STACK (fail_stack)) \ return failure_code; \ \ DEBUG_PRINT2 ("\n Doubled stack; size now: %d\n", \ (fail_stack).size); \ DEBUG_PRINT2 (" slots available: %d\n", REMAINING_AVAIL_SLOTS);\ } \ \ /* Push the info, starting with the registers. */ \ DEBUG_PRINT1 ("\n"); \ \ for (this_reg = lowest_active_reg; this_reg <= highest_active_reg; \ this_reg++) \ { \ DEBUG_PRINT2 (" Pushing reg: %d\n", this_reg); \ DEBUG_STATEMENT (num_regs_pushed++); \ \ DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \ PUSH_FAILURE_ITEM (regstart[this_reg]); \ \ DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \ PUSH_FAILURE_ITEM (regend[this_reg]); \ \ DEBUG_PRINT2 (" info: 0x%x\n ", reg_info[this_reg]); \ DEBUG_PRINT2 (" match_null=%d", \ REG_MATCH_NULL_STRING_P (reg_info[this_reg])); \ DEBUG_PRINT2 (" active=%d", IS_ACTIVE (reg_info[this_reg])); \ DEBUG_PRINT2 (" matched_something=%d", \ MATCHED_SOMETHING (reg_info[this_reg])); \ DEBUG_PRINT2 (" ever_matched=%d", \ EVER_MATCHED_SOMETHING (reg_info[this_reg])); \ DEBUG_PRINT1 ("\n"); \ PUSH_FAILURE_ITEM (reg_info[this_reg].word); \ } \ \ DEBUG_PRINT2 (" Pushing low active reg: %d\n", lowest_active_reg);\ PUSH_FAILURE_ITEM (lowest_active_reg); \ \ DEBUG_PRINT2 (" Pushing high active reg: %d\n", highest_active_reg);\ PUSH_FAILURE_ITEM (highest_active_reg); \ \ DEBUG_PRINT2 (" Pushing pattern 0x%x: ", pattern_place); \ DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend); \ PUSH_FAILURE_ITEM (pattern_place); \ \ DEBUG_PRINT2 (" Pushing string 0x%x: `", string_place); \ DEBUG_PRINT_DOUBLE_STRING (string_place, string1, size1, string2, \ size2); \ DEBUG_PRINT1 ("'\n"); \ PUSH_FAILURE_ITEM (string_place); \ \ DEBUG_PRINT2 (" Pushing failure id: %u\n", failure_id); \ DEBUG_PUSH (failure_id); \ } while (0) /* This is the number of items that are pushed and popped on the stack for each register. */ #define NUM_REG_ITEMS 3 /* Individual items aside from the registers. */ #ifdef DEBUG #define NUM_NONREG_ITEMS 5 /* Includes failure point id. */ #else #define NUM_NONREG_ITEMS 4 #endif /* We push at most this many items on the stack. */ #define MAX_FAILURE_ITEMS ((num_regs - 1) * NUM_REG_ITEMS + NUM_NONREG_ITEMS) /* We actually push this many items. */ #define NUM_FAILURE_ITEMS \ ((highest_active_reg - lowest_active_reg + 1) * NUM_REG_ITEMS \ + NUM_NONREG_ITEMS) /* How many items can still be added to the stack without overflowing it. */ #define REMAINING_AVAIL_SLOTS ((fail_stack).size - (fail_stack).avail) /* Pops what PUSH_FAIL_STACK pushes. We restore into the parameters, all of which should be lvalues: STR -- the saved data position. PAT -- the saved pattern position. LOW_REG, HIGH_REG -- the highest and lowest active registers. REGSTART, REGEND -- arrays of string positions. REG_INFO -- array of information about each subexpression. Also assumes the variables `fail_stack' and (if debugging), `bufp', `pend', `string1', `size1', `string2', and `size2'. */ #define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)\ { \ DEBUG_STATEMENT (fail_stack_elt_t failure_id;) \ int this_reg; \ const unsigned char *string_temp; \ \ assert (!FAIL_STACK_EMPTY ()); \ \ /* Remove failure points and point to how many regs pushed. */ \ DEBUG_PRINT1 ("POP_FAILURE_POINT:\n"); \ DEBUG_PRINT2 (" Before pop, next avail: %d\n", fail_stack.avail); \ DEBUG_PRINT2 (" size: %d\n", fail_stack.size); \ \ assert (fail_stack.avail >= NUM_NONREG_ITEMS); \ \ DEBUG_POP (&failure_id); \ DEBUG_PRINT2 (" Popping failure id: %u\n", failure_id); \ \ /* If the saved string location is NULL, it came from an \ on_failure_keep_string_jump opcode, and we want to throw away the \ saved NULL, thus retaining our current position in the string. */ \ string_temp = POP_FAILURE_ITEM (); \ if (string_temp != NULL) \ str = (const char *) string_temp; \ \ DEBUG_PRINT2 (" Popping string 0x%x: `", str); \ DEBUG_PRINT_DOUBLE_STRING (str, string1, size1, string2, size2); \ DEBUG_PRINT1 ("'\n"); \ \ pat = (unsigned char *) POP_FAILURE_ITEM (); \ DEBUG_PRINT2 (" Popping pattern 0x%x: ", pat); \ DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \ \ /* Restore register info. */ \ high_reg = (unsigned) POP_FAILURE_ITEM (); \ DEBUG_PRINT2 (" Popping high active reg: %d\n", high_reg); \ \ low_reg = (unsigned) POP_FAILURE_ITEM (); \ DEBUG_PRINT2 (" Popping low active reg: %d\n", low_reg); \ \ for (this_reg = high_reg; this_reg >= low_reg; this_reg--) \ { \ DEBUG_PRINT2 (" Popping reg: %d\n", this_reg); \ \ reg_info[this_reg].word = POP_FAILURE_ITEM (); \ DEBUG_PRINT2 (" info: 0x%x\n", reg_info[this_reg]); \ \ regend[this_reg] = (const char *) POP_FAILURE_ITEM (); \ DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \ \ regstart[this_reg] = (const char *) POP_FAILURE_ITEM (); \ DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \ } \ \ DEBUG_STATEMENT (nfailure_points_popped++); \ } /* POP_FAILURE_POINT */ /* re_compile_fastmap computes a ``fastmap'' for the compiled pattern in BUFP. A fastmap records which of the (1 << BYTEWIDTH) possible characters can start a string that matches the pattern. This fastmap is used by re_search to skip quickly over impossible starting points. The caller must supply the address of a (1 << BYTEWIDTH)-byte data area as BUFP->fastmap. We set the `fastmap', `fastmap_accurate', and `can_be_null' fields in the pattern buffer. Returns 0 if we succeed, -2 if an internal error. */ int re_compile_fastmap (bufp) struct re_pattern_buffer *bufp; { int j, k; fail_stack_type fail_stack; #ifndef REGEX_MALLOC char *destination; #endif /* We don't push any register information onto the failure stack. */ unsigned num_regs = 0; register char *fastmap = bufp->fastmap; unsigned char *pattern = bufp->buffer; unsigned long size = bufp->used; const unsigned char *p = pattern; register unsigned char *pend = pattern + size; /* Assume that each path through the pattern can be null until proven otherwise. We set this false at the bottom of switch statement, to which we get only if a particular path doesn't match the empty string. */ boolean path_can_be_null = true; /* We aren't doing a `succeed_n' to begin with. */ boolean succeed_n_p = false; assert (fastmap != NULL && p != NULL); INIT_FAIL_STACK (); bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */ bufp->fastmap_accurate = 1; /* It will be when we're done. */ bufp->can_be_null = 0; while (p != pend || !FAIL_STACK_EMPTY ()) { if (p == pend) { bufp->can_be_null |= path_can_be_null; /* Reset for next path. */ path_can_be_null = true; p = fail_stack.stack[--fail_stack.avail]; } /* We should never be about to go beyond the end of the pattern. */ assert (p < pend); #ifdef SWITCH_ENUM_BUG switch ((int) ((re_opcode_t) *p++)) #else switch ((re_opcode_t) *p++) #endif { /* I guess the idea here is to simply not bother with a fastmap if a backreference is used, since it's too hard to figure out the fastmap for the corresponding group. Setting `can_be_null' stops `re_search_2' from using the fastmap, so that is all we do. */ case duplicate: bufp->can_be_null = 1; return 0; /* Following are the cases which match a character. These end with `break'. */ case exactn: fastmap[p[1]] = 1; break; case charset: for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--) if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))) fastmap[j] = 1; break; case charset_not: /* Chars beyond end of map must be allowed. */ for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++) fastmap[j] = 1; for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--) if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))) fastmap[j] = 1; break; case wordchar: for (j = 0; j < (1 << BYTEWIDTH); j++) if (SYNTAX (j) == Sword) fastmap[j] = 1; break; case notwordchar: for (j = 0; j < (1 << BYTEWIDTH); j++) if (SYNTAX (j) != Sword) fastmap[j] = 1; break; case anychar: /* `.' matches anything ... */ for (j = 0; j < (1 << BYTEWIDTH); j++) fastmap[j] = 1; /* ... except perhaps newline. */ if (!(bufp->syntax & RE_DOT_NEWLINE)) fastmap['\n'] = 0; /* Return if we have already set `can_be_null'; if we have, then the fastmap is irrelevant. Something's wrong here. */ else if (bufp->can_be_null) return 0; /* Otherwise, have to check alternative paths. */ break; #ifdef emacs case syntaxspec: k = *p++; for (j = 0; j < (1 << BYTEWIDTH); j++) if (SYNTAX (j) == (enum syntaxcode) k) fastmap[j] = 1; break; case notsyntaxspec: k = *p++; for (j = 0; j < (1 << BYTEWIDTH); j++) if (SYNTAX (j) != (enum syntaxcode) k) fastmap[j] = 1; break; /* All cases after this match the empty string. These end with `continue'. */ case before_dot: case at_dot: case after_dot: continue; #endif /* not emacs */ case no_op: case begline: case endline: case begbuf: case endbuf: case wordbound: case notwordbound: case wordbeg: case wordend: case push_dummy_failure: continue; case jump_n: case pop_failure_jump: case maybe_pop_jump: case jump: case jump_past_alt: case dummy_failure_jump: EXTRACT_NUMBER_AND_INCR (j, p); p += j; if (j > 0) continue; /* Jump backward implies we just went through the body of a loop and matched nothing. Opcode jumped to should be `on_failure_jump' or `succeed_n'. Just treat it like an ordinary jump. For a * loop, it has pushed its failure point already; if so, discard that as redundant. */ if ((re_opcode_t) *p != on_failure_jump && (re_opcode_t) *p != succeed_n) continue; p++; EXTRACT_NUMBER_AND_INCR (j, p); p += j; /* If what's on the stack is where we are now, pop it. */ if (!FAIL_STACK_EMPTY () && fail_stack.stack[fail_stack.avail - 1] == p) fail_stack.avail--; continue; case on_failure_jump: case on_failure_keep_string_jump: handle_on_failure_jump: EXTRACT_NUMBER_AND_INCR (j, p); /* For some patterns, e.g., `(a?)?', `p+j' here points to the end of the pattern. We don't want to push such a point, since when we restore it above, entering the switch will increment `p' past the end of the pattern. We don't need to push such a point since we obviously won't find any more fastmap entries beyond `pend'. Such a pattern can match the null string, though. */ if (p + j < pend) { if (!PUSH_PATTERN_OP (p + j, fail_stack)) return -2; } else bufp->can_be_null = 1; if (succeed_n_p) { EXTRACT_NUMBER_AND_INCR (k, p); /* Skip the n. */ succeed_n_p = false; } continue; case succeed_n: /* Get to the number of times to succeed. */ p += 2; /* Increment p past the n for when k != 0. */ EXTRACT_NUMBER_AND_INCR (k, p); if (k == 0) { p -= 4; succeed_n_p = true; /* Spaghetti code alert. */ goto handle_on_failure_jump; } continue; case set_number_at: p += 4; continue; case start_memory: case stop_memory: p += 2; continue; default: abort (); /* We have listed all the cases. */ } /* switch *p++ */ /* Getting here means we have found the possible starting characters for one path of the pattern -- and that the empty string does not match. We need not follow this path further. Instead, look at the next alternative (remembered on the stack), or quit if no more. The test at the top of the loop does these things. */ path_can_be_null = false; p = pend; } /* while p */ /* Set `can_be_null' for the last path (also the first path, if the pattern is empty). */ bufp->can_be_null |= path_can_be_null; return 0; } /* re_compile_fastmap */ /* Set REGS to hold NUM_REGS registers, storing them in STARTS and ENDS. Subsequent matches using PATTERN_BUFFER and REGS will use this memory for recording register information. STARTS and ENDS must be allocated using the malloc library routine, and must each be at least NUM_REGS * sizeof (regoff_t) bytes long. If NUM_REGS == 0, then subsequent matches should allocate their own register data. Unless this function is called, the first search or match using PATTERN_BUFFER will allocate its own register data, without freeing the old data. */ void re_set_registers (bufp, regs, num_regs, starts, ends) struct re_pattern_buffer *bufp; struct re_registers *regs; unsigned num_regs; regoff_t *starts, *ends; { if (num_regs) { bufp->regs_allocated = REGS_REALLOCATE; regs->num_regs = num_regs; regs->start = starts; regs->end = ends; } else { bufp->regs_allocated = REGS_UNALLOCATED; regs->num_regs = 0; regs->start = regs->end = (regoff_t) 0; } } /* Searching routines. */ /* Like re_search_2, below, but only one string is specified, and doesn't let you say where to stop matching. */ int re_search (bufp, string, size, startpos, range, regs) struct re_pattern_buffer *bufp; const char *string; int size, startpos, range; struct re_registers *regs; { return re_search_2 (bufp, NULL, 0, string, size, startpos, range, regs, size); } /* Using the compiled pattern in BUFP->buffer, first tries to match the virtual concatenation of STRING1 and STRING2, starting first at index STARTPOS, then at STARTPOS + 1, and so on. STRING1 and STRING2 have length SIZE1 and SIZE2, respectively. RANGE is how far to scan while trying to match. RANGE = 0 means try only at STARTPOS; in general, the last start tried is STARTPOS + RANGE. In REGS, return the indices of the virtual concatenation of STRING1 and STRING2 that matched the entire BUFP->buffer and its contained subexpressions. Do not consider matching one past the index STOP in the virtual concatenation of STRING1 and STRING2. We return either the position in the strings at which the match was found, -1 if no match, or -2 if error (such as failure stack overflow). */ int re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop) struct re_pattern_buffer *bufp; const char *string1, *string2; int size1, size2; int startpos; int range; struct re_registers *regs; int stop; { int val; register char *fastmap = bufp->fastmap; register char *translate = bufp->translate; int total_size = size1 + size2; int endpos = startpos + range; /* Check for out-of-range STARTPOS. */ if (startpos < 0 || startpos > total_size) return -1; /* Fix up RANGE if it might eventually take us outside the virtual concatenation of STRING1 and STRING2. */ if (endpos < -1) range = -1 - startpos; else if (endpos > total_size) range = total_size - startpos; /* If the search isn't to be a backwards one, don't waste time in a search for a pattern that must be anchored. */ if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == begbuf && range > 0) { if (startpos > 0) return -1; else range = 1; } /* Update the fastmap now if not correct already. */ if (fastmap && !bufp->fastmap_accurate) if (re_compile_fastmap (bufp) == -2) return -2; /* Loop through the string, looking for a place to start matching. */ for (;;) { /* If a fastmap is supplied, skip quickly over characters that cannot be the start of a match. If the pattern can match the null string, however, we don't need to skip characters; we want the first null string. */ if (fastmap && startpos < total_size && !bufp->can_be_null) { if (range > 0) /* Searching forwards. */ { register const char *d; register int lim = 0; int irange = range; if (startpos < size1 && startpos + range >= size1) lim = range - (size1 - startpos); d = (startpos >= size1 ? string2 - size1 : string1) + startpos; /* Written out as an if-else to avoid testing `translate' inside the loop. */ if (translate) while (range > lim && !fastmap[(unsigned char) translate[(unsigned char) *d++]]) range--; else while (range > lim && !fastmap[(unsigned char) *d++]) range--; startpos += irange - range; } else /* Searching backwards. */ { register char c = (size1 == 0 || startpos >= size1 ? string2[startpos - size1] : string1[startpos]); if (!fastmap[(unsigned char) TRANSLATE (c)]) goto advance; } } /* If can't match the null string, and that's all we have left, fail. */ if (range >= 0 && startpos == total_size && fastmap && !bufp->can_be_null) return -1; val = re_match_2 (bufp, string1, size1, string2, size2, startpos, regs, stop); if (val >= 0) return startpos; if (val == -2) return -2; advance: if (!range) break; else if (range > 0) { range--; startpos++; } else { range++; startpos--; } } return -1; } /* re_search_2 */ /* Declarations and macros for re_match_2. */ static int bcmp_translate (); static boolean alt_match_null_string_p (), common_op_match_null_string_p (), group_match_null_string_p (); /* Structure for per-register (a.k.a. per-group) information. This must not be longer than one word, because we push this value onto the failure stack. Other register information, such as the starting and ending positions (which are addresses), and the list of inner groups (which is a bits list) are maintained in separate variables. We are making a (strictly speaking) nonportable assumption here: that the compiler will pack our bit fields into something that fits into the type of `word', i.e., is something that fits into one item on the failure stack. */ typedef union { fail_stack_elt_t word; struct { /* This field is one if this group can match the empty string, zero if not. If not yet determined, `MATCH_NULL_UNSET_VALUE'. */ #define MATCH_NULL_UNSET_VALUE 3 unsigned match_null_string_p : 2; unsigned is_active : 1; unsigned matched_something : 1; unsigned ever_matched_something : 1; } bits; } register_info_type; #define REG_MATCH_NULL_STRING_P(R) ((R).bits.match_null_string_p) #define IS_ACTIVE(R) ((R).bits.is_active) #define MATCHED_SOMETHING(R) ((R).bits.matched_something) #define EVER_MATCHED_SOMETHING(R) ((R).bits.ever_matched_something) /* Call this when have matched a real character; it sets `matched' flags for the subexpressions which we are currently inside. Also records that those subexprs have matched. */ #define SET_REGS_MATCHED() \ do \ { \ unsigned r; \ for (r = lowest_active_reg; r <= highest_active_reg; r++) \ { \ MATCHED_SOMETHING (reg_info[r]) \ = EVER_MATCHED_SOMETHING (reg_info[r]) \ = 1; \ } \ } \ while (0) /* This converts PTR, a pointer into one of the search strings `string1' and `string2' into an offset from the beginning of that string. */ #define POINTER_TO_OFFSET(ptr) \ (FIRST_STRING_P (ptr) ? (ptr) - string1 : (ptr) - string2 + size1) /* Registers are set to a sentinel when they haven't yet matched. */ #define REG_UNSET_VALUE ((char *) -1) #define REG_UNSET(e) ((e) == REG_UNSET_VALUE) /* Macros for dealing with the split strings in re_match_2. */ #define MATCHING_IN_FIRST_STRING (dend == end_match_1) /* Call before fetching a character with *d. This switches over to string2 if necessary. */ #define PREFETCH() \ while (d == dend) \ { \ /* End of string2 => fail. */ \ if (dend == end_match_2) \ goto fail; \ /* End of string1 => advance to string2. */ \ d = string2; \ dend = end_match_2; \ } /* Test if at very beginning or at very end of the virtual concatenation of `string1' and `string2'. If only one string, it's `string2'. */ #define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2) #define AT_STRINGS_END(d) ((d) == end2) /* Test if D points to a character which is word-constituent. We have two special cases to check for: if past the end of string1, look at the first character in string2; and if before the beginning of string2, look at the last character in string1. */ #define WORDCHAR_P(d) \ (SYNTAX ((d) == end1 ? *string2 \ : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \ == Sword) /* Test if the character before D and the one at D differ with respect to being word-constituent. */ #define AT_WORD_BOUNDARY(d) \ (AT_STRINGS_BEG (d) || AT_STRINGS_END (d) \ || WORDCHAR_P (d - 1) != WORDCHAR_P (d)) /* Free everything we malloc. */ #ifdef REGEX_MALLOC #define FREE_VAR(var) if (var) free (var); var = NULL #define FREE_VARIABLES() \ do { \ FREE_VAR (fail_stack.stack); \ FREE_VAR (regstart); \ FREE_VAR (regend); \ FREE_VAR (old_regstart); \ FREE_VAR (old_regend); \ FREE_VAR (best_regstart); \ FREE_VAR (best_regend); \ FREE_VAR (reg_info); \ FREE_VAR (reg_dummy); \ FREE_VAR (reg_info_dummy); \ } while (0) #else /* not REGEX_MALLOC */ /* Some MIPS systems (at least) want this to free alloca'd storage. */ #define FREE_VARIABLES() alloca (0) #endif /* not REGEX_MALLOC */ /* These values must meet several constraints. They must not be valid register values; since we have a limit of 255 registers (because we use only one byte in the pattern for the register number), we can use numbers larger than 255. They must differ by 1, because of NUM_FAILURE_ITEMS above. And the value for the lowest register must be larger than the value for the highest register, so we do not try to actually save any registers when none are active. */ #define NO_HIGHEST_ACTIVE_REG (1 << BYTEWIDTH) #define NO_LOWEST_ACTIVE_REG (NO_HIGHEST_ACTIVE_REG + 1) /* Matching routines. */ #ifndef emacs /* Emacs never uses this. */ /* re_match is like re_match_2 except it takes only a single string. */ int re_match (bufp, string, size, pos, regs) struct re_pattern_buffer *bufp; const char *string; int size, pos; struct re_registers *regs; { return re_match_2 (bufp, NULL, 0, string, size, pos, regs, size); } #endif /* not emacs */ /* re_match_2 matches the compiled pattern in BUFP against the the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1 and SIZE2, respectively). We start matching at POS, and stop matching at STOP. If REGS is non-null and the `no_sub' field of BUFP is nonzero, we store offsets for the substring each group matched in REGS. See the documentation for exactly how many groups we fill. We return -1 if no match, -2 if an internal error (such as the failure stack overflowing). Otherwise, we return the length of the matched substring. */ int re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) struct re_pattern_buffer *bufp; const char *string1, *string2; int size1, size2; int pos; struct re_registers *regs; int stop; { /* General temporaries. */ int mcnt; unsigned char *p1; /* Just past the end of the corresponding string. */ const char *end1, *end2; /* Pointers into string1 and string2, just past the last characters in each to consider matching. */ const char *end_match_1, *end_match_2; /* Where we are in the data, and the end of the current string. */ const char *d, *dend; /* Where we are in the pattern, and the end of the pattern. */ unsigned char *p = bufp->buffer; register unsigned char *pend = p + bufp->used; /* We use this to map every character in the string. */ char *translate = bufp->translate; /* Failure point stack. Each place that can handle a failure further down the line pushes a failure point on this stack. It consists of restart, regend, and reg_info for all registers corresponding to the subexpressions we're currently inside, plus the number of such registers, and, finally, two char *'s. The first char * is where to resume scanning the pattern; the second one is where to resume scanning the strings. If the latter is zero, the failure point is a ``dummy''; if a failure happens and the failure point is a dummy, it gets discarded and the next next one is tried. */ fail_stack_type fail_stack; #ifdef DEBUG static unsigned failure_id = 0; unsigned nfailure_points_pushed = 0, nfailure_points_popped = 0; #endif /* We fill all the registers internally, independent of what we return, for use in backreferences. The number here includes an element for register zero. */ unsigned num_regs = bufp->re_nsub + 1; /* The currently active registers. */ unsigned lowest_active_reg = NO_LOWEST_ACTIVE_REG; unsigned highest_active_reg = NO_HIGHEST_ACTIVE_REG; /* Information on the contents of registers. These are pointers into the input strings; they record just what was matched (on this attempt) by a subexpression part of the pattern, that is, the regnum-th regstart pointer points to where in the pattern we began matching and the regnum-th regend points to right after where we stopped matching the regnum-th subexpression. (The zeroth register keeps track of what the whole pattern matches.) */ const char **regstart, **regend; /* If a group that's operated upon by a repetition operator fails to match anything, then the register for its start will need to be restored because it will have been set to wherever in the string we are when we last see its open-group operator. Similarly for a register's end. */ const char **old_regstart, **old_regend; /* The is_active field of reg_info helps us keep track of which (possibly nested) subexpressions we are currently in. The matched_something field of reg_info[reg_num] helps us tell whether or not we have matched any of the pattern so far this time through the reg_num-th subexpression. These two fields get reset each time through any loop their register is in. */ register_info_type *reg_info; /* The following record the register info as found in the above variables when we find a match better than any we've seen before. This happens as we backtrack through the failure points, which in turn happens only if we have not yet matched the entire string. */ unsigned best_regs_set = false; const char **best_regstart, **best_regend; /* Logically, this is `best_regend[0]'. But we don't want to have to allocate space for that if we're not allocating space for anything else (see below). Also, we never need info about register 0 for any of the other register vectors, and it seems rather a kludge to treat `best_regend' differently than the rest. So we keep track of the end of the best match so far in a separate variable. We initialize this to NULL so that when we backtrack the first time and need to test it, it's not garbage. */ const char *match_end = NULL; /* Used when we pop values we don't care about. */ const char **reg_dummy; register_info_type *reg_info_dummy; #ifdef DEBUG /* Counts the total number of registers pushed. */ unsigned num_regs_pushed = 0; #endif DEBUG_PRINT1 ("\n\nEntering re_match_2.\n"); INIT_FAIL_STACK (); /* Do not bother to initialize all the register variables if there are no groups in the pattern, as it takes a fair amount of time. If there are groups, we include space for register 0 (the whole pattern), even though we never use it, since it simplifies the array indexing. We should fix this. */ if (bufp->re_nsub) { regstart = REGEX_TALLOC (num_regs, const char *); regend = REGEX_TALLOC (num_regs, const char *); old_regstart = REGEX_TALLOC (num_regs, const char *); old_regend = REGEX_TALLOC (num_regs, const char *); best_regstart = REGEX_TALLOC (num_regs, const char *); best_regend = REGEX_TALLOC (num_regs, const char *); reg_info = REGEX_TALLOC (num_regs, register_info_type); reg_dummy = REGEX_TALLOC (num_regs, const char *); reg_info_dummy = REGEX_TALLOC (num_regs, register_info_type); if (!(regstart && regend && old_regstart && old_regend && reg_info && best_regstart && best_regend && reg_dummy && reg_info_dummy)) { FREE_VARIABLES (); return -2; } } #ifdef REGEX_MALLOC else { /* We must initialize all our variables to NULL, so that `FREE_VARIABLES' doesn't try to free them. */ regstart = regend = old_regstart = old_regend = best_regstart = best_regend = reg_dummy = NULL; reg_info = reg_info_dummy = (register_info_type *) NULL; } #endif /* REGEX_MALLOC */ /* The starting position is bogus. */ if (pos < 0 || pos > size1 + size2) { FREE_VARIABLES (); return -1; } /* Initialize subexpression text positions to -1 to mark ones that no start_memory/stop_memory has been seen for. Also initialize the register information struct. */ for (mcnt = 1; mcnt < num_regs; mcnt++) { regstart[mcnt] = regend[mcnt] = old_regstart[mcnt] = old_regend[mcnt] = REG_UNSET_VALUE; REG_MATCH_NULL_STRING_P (reg_info[mcnt]) = MATCH_NULL_UNSET_VALUE; IS_ACTIVE (reg_info[mcnt]) = 0; MATCHED_SOMETHING (reg_info[mcnt]) = 0; EVER_MATCHED_SOMETHING (reg_info[mcnt]) = 0; } /* We move `string1' into `string2' if the latter's empty -- but not if `string1' is null. */ if (size2 == 0 && string1 != NULL) { string2 = string1; size2 = size1; string1 = 0; size1 = 0; } end1 = string1 + size1; end2 = string2 + size2; /* Compute where to stop matching, within the two strings. */ if (stop <= size1) { end_match_1 = string1 + stop; end_match_2 = string2; } else { end_match_1 = end1; end_match_2 = string2 + stop - size1; } /* `p' scans through the pattern as `d' scans through the data. `dend' is the end of the input string that `d' points within. `d' is advanced into the following input string whenever necessary, but this happens before fetching; therefore, at the beginning of the loop, `d' can be pointing at the end of a string, but it cannot equal `string2'. */ if (size1 > 0 && pos <= size1) { d = string1 + pos; dend = end_match_1; } else { d = string2 + pos - size1; dend = end_match_2; } DEBUG_PRINT1 ("The compiled pattern is: "); DEBUG_PRINT_COMPILED_PATTERN (bufp, p, pend); DEBUG_PRINT1 ("The string to match is: `"); DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2); DEBUG_PRINT1 ("'\n"); /* This loops over pattern commands. It exits by returning from the function if the match is complete, or it drops through if the match fails at this starting point in the input data. */ for (;;) { DEBUG_PRINT2 ("\n0x%x: ", p); if (p == pend) { /* End of pattern means we might have succeeded. */ DEBUG_PRINT1 ("end of pattern ... "); /* If we haven't matched the entire string, and we want the longest match, try backtracking. */ if (d != end_match_2) { DEBUG_PRINT1 ("backtracking.\n"); if (!FAIL_STACK_EMPTY ()) { /* More failure points to try. */ boolean same_str_p = (FIRST_STRING_P (match_end) == MATCHING_IN_FIRST_STRING); /* If exceeds best match so far, save it. */ if (!best_regs_set || (same_str_p && d > match_end) || (!same_str_p && !MATCHING_IN_FIRST_STRING)) { best_regs_set = true; match_end = d; DEBUG_PRINT1 ("\nSAVING match as best so far.\n"); for (mcnt = 1; mcnt < num_regs; mcnt++) { best_regstart[mcnt] = regstart[mcnt]; best_regend[mcnt] = regend[mcnt]; } } goto fail; } /* If no failure points, don't restore garbage. */ else if (best_regs_set) { restore_best_regs: /* Restore best match. It may happen that `dend == end_match_1' while the restored d is in string2. For example, the pattern `x.*y.*z' against the strings `x-' and `y-z-', if the two strings are not consecutive in memory. */ DEBUG_PRINT1 ("Restoring best registers.\n"); d = match_end; dend = ((d >= string1 && d <= end1) ? end_match_1 : end_match_2); for (mcnt = 1; mcnt < num_regs; mcnt++) { regstart[mcnt] = best_regstart[mcnt]; regend[mcnt] = best_regend[mcnt]; } } } /* d != end_match_2 */ DEBUG_PRINT1 ("Accepting match.\n"); /* If caller wants register contents data back, do it. */ if (regs && !bufp->no_sub) { /* Have the register data arrays been allocated? */ if (bufp->regs_allocated == REGS_UNALLOCATED) { /* No. So allocate them with malloc. We need one extra element beyond `num_regs' for the `-1' marker GNU code uses. */ regs->num_regs = MAX (RE_NREGS, num_regs + 1); regs->start = TALLOC (regs->num_regs, regoff_t); regs->end = TALLOC (regs->num_regs, regoff_t); if (regs->start == NULL || regs->end == NULL) return -2; bufp->regs_allocated = REGS_REALLOCATE; } else if (bufp->regs_allocated == REGS_REALLOCATE) { /* Yes. If we need more elements than were already allocated, reallocate them. If we need fewer, just leave it alone. */ if (regs->num_regs < num_regs + 1) { regs->num_regs = num_regs + 1; RETALLOC (regs->start, regs->num_regs, regoff_t); RETALLOC (regs->end, regs->num_regs, regoff_t); if (regs->start == NULL || regs->end == NULL) return -2; } } else assert (bufp->regs_allocated == REGS_FIXED); /* Convert the pointer data in `regstart' and `regend' to indices. Register zero has to be set differently, since we haven't kept track of any info for it. */ if (regs->num_regs > 0) { regs->start[0] = pos; regs->end[0] = (MATCHING_IN_FIRST_STRING ? d - string1 : d - string2 + size1); } /* Go through the first `min (num_regs, regs->num_regs)' registers, since that is all we initialized. */ for (mcnt = 1; mcnt < MIN (num_regs, regs->num_regs); mcnt++) { if (REG_UNSET (regstart[mcnt]) || REG_UNSET (regend[mcnt])) regs->start[mcnt] = regs->end[mcnt] = -1; else { regs->start[mcnt] = POINTER_TO_OFFSET (regstart[mcnt]); regs->end[mcnt] = POINTER_TO_OFFSET (regend[mcnt]); } } /* If the regs structure we return has more elements than were in the pattern, set the extra elements to -1. If we (re)allocated the registers, this is the case, because we always allocate enough to have at least one -1 at the end. */ for (mcnt = num_regs; mcnt < regs->num_regs; mcnt++) regs->start[mcnt] = regs->end[mcnt] = -1; } /* regs && !bufp->no_sub */ FREE_VARIABLES (); DEBUG_PRINT4 ("%u failure points pushed, %u popped (%u remain).\n", nfailure_points_pushed, nfailure_points_popped, nfailure_points_pushed - nfailure_points_popped); DEBUG_PRINT2 ("%u registers pushed.\n", num_regs_pushed); mcnt = d - pos - (MATCHING_IN_FIRST_STRING ? string1 : string2 - size1); DEBUG_PRINT2 ("Returning %d from re_match_2.\n", mcnt); return mcnt; } /* Otherwise match next pattern command. */ #ifdef SWITCH_ENUM_BUG switch ((int) ((re_opcode_t) *p++)) #else switch ((re_opcode_t) *p++) #endif { /* Ignore these. Used to ignore the n of succeed_n's which currently have n == 0. */ case no_op: DEBUG_PRINT1 ("EXECUTING no_op.\n"); break; /* Match the next n pattern characters exactly. The following byte in the pattern defines n, and the n bytes after that are the characters to match. */ case exactn: mcnt = *p++; DEBUG_PRINT2 ("EXECUTING exactn %d.\n", mcnt); /* This is written out as an if-else so we don't waste time testing `translate' inside the loop. */ if (translate) { do { PREFETCH (); if (translate[(unsigned char) *d++] != (char) *p++) goto fail; } while (--mcnt); } else { do { PREFETCH (); if (*d++ != (char) *p++) goto fail; } while (--mcnt); } SET_REGS_MATCHED (); break; /* Match any character except possibly a newline or a null. */ case anychar: DEBUG_PRINT1 ("EXECUTING anychar.\n"); PREFETCH (); if ((!(bufp->syntax & RE_DOT_NEWLINE) && TRANSLATE (*d) == '\n') || (bufp->syntax & RE_DOT_NOT_NULL && TRANSLATE (*d) == '\000')) goto fail; SET_REGS_MATCHED (); DEBUG_PRINT2 (" Matched `%d'.\n", *d); d++; break; case charset: case charset_not: { register unsigned char c; boolean not = (re_opcode_t) *(p - 1) == charset_not; DEBUG_PRINT2 ("EXECUTING charset%s.\n", not ? "_not" : ""); PREFETCH (); c = TRANSLATE (*d); /* The character to match. */ /* Cast to `unsigned' instead of `unsigned char' in case the bit list is a full 32 bytes long. */ if (c < (unsigned) (*p * BYTEWIDTH) && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) not = !not; p += 1 + *p; if (!not) goto fail; SET_REGS_MATCHED (); d++; break; } /* The beginning of a group is represented by start_memory. The arguments are the register number in the next byte, and the number of groups inner to this one in the next. The text matched within the group is recorded (in the internal registers data structure) under the register number. */ case start_memory: DEBUG_PRINT3 ("EXECUTING start_memory %d (%d):\n", *p, p[1]); /* Find out if this group can match the empty string. */ p1 = p; /* To send to group_match_null_string_p. */ if (REG_MATCH_NULL_STRING_P (reg_info[*p]) == MATCH_NULL_UNSET_VALUE) REG_MATCH_NULL_STRING_P (reg_info[*p]) = group_match_null_string_p (&p1, pend, reg_info); /* Save the position in the string where we were the last time we were at this open-group operator in case the group is operated upon by a repetition operator, e.g., with `(a*)*b' against `ab'; then we want to ignore where we are now in the string in case this attempt to match fails. */ old_regstart[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p]) ? REG_UNSET (regstart[*p]) ? d : regstart[*p] : regstart[*p]; DEBUG_PRINT2 (" old_regstart: %d\n", POINTER_TO_OFFSET (old_regstart[*p])); regstart[*p] = d; DEBUG_PRINT2 (" regstart: %d\n", POINTER_TO_OFFSET (regstart[*p])); IS_ACTIVE (reg_info[*p]) = 1; MATCHED_SOMETHING (reg_info[*p]) = 0; /* This is the new highest active register. */ highest_active_reg = *p; /* If nothing was active before, this is the new lowest active register. */ if (lowest_active_reg == NO_LOWEST_ACTIVE_REG) lowest_active_reg = *p; /* Move past the register number and inner group count. */ p += 2; break; /* The stop_memory opcode represents the end of a group. Its arguments are the same as start_memory's: the register number, and the number of inner groups. */ case stop_memory: DEBUG_PRINT3 ("EXECUTING stop_memory %d (%d):\n", *p, p[1]); /* We need to save the string position the last time we were at this close-group operator in case the group is operated upon by a repetition operator, e.g., with `((a*)*(b*)*)*' against `aba'; then we want to ignore where we are now in the string in case this attempt to match fails. */ old_regend[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p]) ? REG_UNSET (regend[*p]) ? d : regend[*p] : regend[*p]; DEBUG_PRINT2 (" old_regend: %d\n", POINTER_TO_OFFSET (old_regend[*p])); regend[*p] = d; DEBUG_PRINT2 (" regend: %d\n", POINTER_TO_OFFSET (regend[*p])); /* This register isn't active anymore. */ IS_ACTIVE (reg_info[*p]) = 0; /* If this was the only register active, nothing is active anymore. */ if (lowest_active_reg == highest_active_reg) { lowest_active_reg = NO_LOWEST_ACTIVE_REG; highest_active_reg = NO_HIGHEST_ACTIVE_REG; } else { /* We must scan for the new highest active register, since it isn't necessarily one less than now: consider (a(b)c(d(e)f)g). When group 3 ends, after the f), the new highest active register is 1. */ unsigned char r = *p - 1; while (r > 0 && !IS_ACTIVE (reg_info[r])) r--; /* If we end up at register zero, that means that we saved the registers as the result of an `on_failure_jump', not a `start_memory', and we jumped to past the innermost `stop_memory'. For example, in ((.)*) we save registers 1 and 2 as a result of the *, but when we pop back to the second ), we are at the stop_memory 1. Thus, nothing is active. */ if (r == 0) { lowest_active_reg = NO_LOWEST_ACTIVE_REG; highest_active_reg = NO_HIGHEST_ACTIVE_REG; } else highest_active_reg = r; } /* If just failed to match something this time around with a group that's operated on by a repetition operator, try to force exit from the ``loop'', and restore the register information for this group that we had before trying this last match. */ if ((!MATCHED_SOMETHING (reg_info[*p]) || (re_opcode_t) p[-3] == start_memory) && (p + 2) < pend) { boolean is_a_jump_n = false; p1 = p + 2; mcnt = 0; switch ((re_opcode_t) *p1++) { case jump_n: is_a_jump_n = true; case pop_failure_jump: case maybe_pop_jump: case jump: case dummy_failure_jump: EXTRACT_NUMBER_AND_INCR (mcnt, p1); if (is_a_jump_n) p1 += 2; break; default: /* do nothing */ ; } p1 += mcnt; /* If the next operation is a jump backwards in the pattern to an on_failure_jump right before the start_memory corresponding to this stop_memory, exit from the loop by forcing a failure after pushing on the stack the on_failure_jump's jump in the pattern, and d. */ if (mcnt < 0 && (re_opcode_t) *p1 == on_failure_jump && (re_opcode_t) p1[3] == start_memory && p1[4] == *p) { /* If this group ever matched anything, then restore what its registers were before trying this last failed match, e.g., with `(a*)*b' against `ab' for regstart[1], and, e.g., with `((a*)*(b*)*)*' against `aba' for regend[3]. Also restore the registers for inner groups for, e.g., `((a*)(b*))*' against `aba' (register 3 would otherwise get trashed). */ if (EVER_MATCHED_SOMETHING (reg_info[*p])) { unsigned r; EVER_MATCHED_SOMETHING (reg_info[*p]) = 0; /* Restore this and inner groups' (if any) registers. */ for (r = *p; r < *p + *(p + 1); r++) { regstart[r] = old_regstart[r]; /* xx why this test? */ if ((int) old_regend[r] >= (int) regstart[r]) regend[r] = old_regend[r]; } } p1++; EXTRACT_NUMBER_AND_INCR (mcnt, p1); PUSH_FAILURE_POINT (p1 + mcnt, d, -2); goto fail; } } /* Move past the register number and the inner group count. */ p += 2; break; /* \ has been turned into a `duplicate' command which is followed by the numeric value of as the register number. */ case duplicate: { register const char *d2, *dend2; int regno = *p++; /* Get which register to match against. */ DEBUG_PRINT2 ("EXECUTING duplicate %d.\n", regno); /* Can't back reference a group which we've never matched. */ if (REG_UNSET (regstart[regno]) || REG_UNSET (regend[regno])) goto fail; /* Where in input to try to start matching. */ d2 = regstart[regno]; /* Where to stop matching; if both the place to start and the place to stop matching are in the same string, then set to the place to stop, otherwise, for now have to use the end of the first string. */ dend2 = ((FIRST_STRING_P (regstart[regno]) == FIRST_STRING_P (regend[regno])) ? regend[regno] : end_match_1); for (;;) { /* If necessary, advance to next segment in register contents. */ while (d2 == dend2) { if (dend2 == end_match_2) break; if (dend2 == regend[regno]) break; /* End of string1 => advance to string2. */ d2 = string2; dend2 = regend[regno]; } /* At end of register contents => success */ if (d2 == dend2) break; /* If necessary, advance to next segment in data. */ PREFETCH (); /* How many characters left in this segment to match. */ mcnt = dend - d; /* Want how many consecutive characters we can match in one shot, so, if necessary, adjust the count. */ if (mcnt > dend2 - d2) mcnt = dend2 - d2; /* Compare that many; failure if mismatch, else move past them. */ if (translate ? bcmp_translate (d, d2, mcnt, translate) : bcmp (d, d2, mcnt)) goto fail; d += mcnt, d2 += mcnt; } } break; /* begline matches the empty string at the beginning of the string (unless `not_bol' is set in `bufp'), and, if `newline_anchor' is set, after newlines. */ case begline: DEBUG_PRINT1 ("EXECUTING begline.\n"); if (AT_STRINGS_BEG (d)) { if (!bufp->not_bol) break; } else if (d[-1] == '\n' && bufp->newline_anchor) { break; } /* In all other cases, we fail. */ goto fail; /* endline is the dual of begline. */ case endline: DEBUG_PRINT1 ("EXECUTING endline.\n"); if (AT_STRINGS_END (d)) { if (!bufp->not_eol) break; } /* We have to ``prefetch'' the next character. */ else if ((d == end1 ? *string2 : *d) == '\n' && bufp->newline_anchor) { break; } goto fail; /* Match at the very beginning of the data. */ case begbuf: DEBUG_PRINT1 ("EXECUTING begbuf.\n"); if (AT_STRINGS_BEG (d)) break; goto fail; /* Match at the very end of the data. */ case endbuf: DEBUG_PRINT1 ("EXECUTING endbuf.\n"); if (AT_STRINGS_END (d)) break; goto fail; /* on_failure_keep_string_jump is used to optimize `.*\n'. It pushes NULL as the value for the string on the stack. Then `pop_failure_point' will keep the current value for the string, instead of restoring it. To see why, consider matching `foo\nbar' against `.*\n'. The .* matches the foo; then the . fails against the \n. But the next thing we want to do is match the \n against the \n; if we restored the string value, we would be back at the foo. Because this is used only in specific cases, we don't need to check all the things that `on_failure_jump' does, to make sure the right things get saved on the stack. Hence we don't share its code. The only reason to push anything on the stack at all is that otherwise we would have to change `anychar's code to do something besides goto fail in this case; that seems worse than this. */ case on_failure_keep_string_jump: DEBUG_PRINT1 ("EXECUTING on_failure_keep_string_jump"); EXTRACT_NUMBER_AND_INCR (mcnt, p); DEBUG_PRINT3 (" %d (to 0x%x):\n", mcnt, p + mcnt); PUSH_FAILURE_POINT (p + mcnt, NULL, -2); break; /* Uses of on_failure_jump: Each alternative starts with an on_failure_jump that points to the beginning of the next alternative. Each alternative except the last ends with a jump that in effect jumps past the rest of the alternatives. (They really jump to the ending jump of the following alternative, because tensioning these jumps is a hassle.) Repeats start with an on_failure_jump that points past both the repetition text and either the following jump or pop_failure_jump back to this on_failure_jump. */ case on_failure_jump: on_failure: DEBUG_PRINT1 ("EXECUTING on_failure_jump"); EXTRACT_NUMBER_AND_INCR (mcnt, p); DEBUG_PRINT3 (" %d (to 0x%x)", mcnt, p + mcnt); /* If this on_failure_jump comes right before a group (i.e., the original * applied to a group), save the information for that group and all inner ones, so that if we fail back to this point, the group's information will be correct. For example, in \(a*\)*\1, we need the preceding group, and in \(\(a*\)b*\)\2, we need the inner group. */ /* We can't use `p' to check ahead because we push a failure point to `p + mcnt' after we do this. */ p1 = p; /* We need to skip no_op's before we look for the start_memory in case this on_failure_jump is happening as the result of a completed succeed_n, as in \(a\)\{1,3\}b\1 against aba. */ while (p1 < pend && (re_opcode_t) *p1 == no_op) p1++; if (p1 < pend && (re_opcode_t) *p1 == start_memory) { /* We have a new highest active register now. This will get reset at the start_memory we are about to get to, but we will have saved all the registers relevant to this repetition op, as described above. */ highest_active_reg = *(p1 + 1) + *(p1 + 2); if (lowest_active_reg == NO_LOWEST_ACTIVE_REG) lowest_active_reg = *(p1 + 1); } DEBUG_PRINT1 (":\n"); PUSH_FAILURE_POINT (p + mcnt, d, -2); break; /* A smart repeat ends with `maybe_pop_jump'. We change it to either `pop_failure_jump' or `jump'. */ case maybe_pop_jump: EXTRACT_NUMBER_AND_INCR (mcnt, p); DEBUG_PRINT2 ("EXECUTING maybe_pop_jump %d.\n", mcnt); { register unsigned char *p2 = p; /* Compare the beginning of the repeat with what in the pattern follows its end. If we can establish that there is nothing that they would both match, i.e., that we would have to backtrack because of (as in, e.g., `a*a') then we can change to pop_failure_jump, because we'll never have to backtrack. This is not true in the case of alternatives: in `(a|ab)*' we do need to backtrack to the `ab' alternative (e.g., if the string was `ab'). But instead of trying to detect that here, the alternative has put on a dummy failure point which is what we will end up popping. */ /* Skip over open/close-group commands. */ while (p2 + 2 < pend && ((re_opcode_t) *p2 == stop_memory || (re_opcode_t) *p2 == start_memory)) p2 += 3; /* Skip over args, too. */ /* If we're at the end of the pattern, we can change. */ if (p2 == pend) { /* Consider what happens when matching ":\(.*\)" against ":/". I don't really understand this code yet. */ p[-3] = (unsigned char) pop_failure_jump; DEBUG_PRINT1 (" End of pattern: change to `pop_failure_jump'.\n"); } else if ((re_opcode_t) *p2 == exactn || (bufp->newline_anchor && (re_opcode_t) *p2 == endline)) { register unsigned char c = *p2 == (unsigned char) endline ? '\n' : p2[2]; p1 = p + mcnt; /* p1[0] ... p1[2] are the `on_failure_jump' corresponding to the `maybe_finalize_jump' of this case. Examine what follows. */ if ((re_opcode_t) p1[3] == exactn && p1[5] != c) { p[-3] = (unsigned char) pop_failure_jump; DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n", c, p1[5]); } else if ((re_opcode_t) p1[3] == charset || (re_opcode_t) p1[3] == charset_not) { int not = (re_opcode_t) p1[3] == charset_not; if (c < (unsigned char) (p1[4] * BYTEWIDTH) && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) not = !not; /* `not' is equal to 1 if c would match, which means that we can't change to pop_failure_jump. */ if (!not) { p[-3] = (unsigned char) pop_failure_jump; DEBUG_PRINT1 (" No match => pop_failure_jump.\n"); } } } } p -= 2; /* Point at relative address again. */ if ((re_opcode_t) p[-1] != pop_failure_jump) { p[-1] = (unsigned char) jump; DEBUG_PRINT1 (" Match => jump.\n"); goto unconditional_jump; } /* Note fall through. */ /* The end of a simple repeat has a pop_failure_jump back to its matching on_failure_jump, where the latter will push a failure point. The pop_failure_jump takes off failure points put on by this pop_failure_jump's matching on_failure_jump; we got through the pattern to here from the matching on_failure_jump, so didn't fail. */ case pop_failure_jump: { /* We need to pass separate storage for the lowest and highest registers, even though we don't care about the actual values. Otherwise, we will restore only one register from the stack, since lowest will == highest in `pop_failure_point'. */ unsigned dummy_low_reg, dummy_high_reg; unsigned char *pdummy; const char *sdummy; DEBUG_PRINT1 ("EXECUTING pop_failure_jump.\n"); POP_FAILURE_POINT (sdummy, pdummy, dummy_low_reg, dummy_high_reg, reg_dummy, reg_dummy, reg_info_dummy); } /* Note fall through. */ /* Unconditionally jump (without popping any failure points). */ case jump: unconditional_jump: EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */ DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt); p += mcnt; /* Do the jump. */ DEBUG_PRINT2 ("(to 0x%x).\n", p); break; /* We need this opcode so we can detect where alternatives end in `group_match_null_string_p' et al. */ case jump_past_alt: DEBUG_PRINT1 ("EXECUTING jump_past_alt.\n"); goto unconditional_jump; /* Normally, the on_failure_jump pushes a failure point, which then gets popped at pop_failure_jump. We will end up at pop_failure_jump, also, and with a pattern of, say, `a+', we are skipping over the on_failure_jump, so we have to push something meaningless for pop_failure_jump to pop. */ case dummy_failure_jump: DEBUG_PRINT1 ("EXECUTING dummy_failure_jump.\n"); /* It doesn't matter what we push for the string here. What the code at `fail' tests is the value for the pattern. */ PUSH_FAILURE_POINT (0, 0, -2); goto unconditional_jump; /* At the end of an alternative, we need to push a dummy failure point in case we are followed by a `pop_failure_jump', because we don't want the failure point for the alternative to be popped. For example, matching `(a|ab)*' against `aab' requires that we match the `ab' alternative. */ case push_dummy_failure: DEBUG_PRINT1 ("EXECUTING push_dummy_failure.\n"); /* See comments just above at `dummy_failure_jump' about the two zeroes. */ PUSH_FAILURE_POINT (0, 0, -2); break; /* Have to succeed matching what follows at least n times. After that, handle like `on_failure_jump'. */ case succeed_n: EXTRACT_NUMBER (mcnt, p + 2); DEBUG_PRINT2 ("EXECUTING succeed_n %d.\n", mcnt); assert (mcnt >= 0); /* Originally, this is how many times we HAVE to succeed. */ if (mcnt > 0) { mcnt--; p += 2; STORE_NUMBER_AND_INCR (p, mcnt); DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p, mcnt); } else if (mcnt == 0) { DEBUG_PRINT2 (" Setting two bytes from 0x%x to no_op.\n", p+2); p[2] = (unsigned char) no_op; p[3] = (unsigned char) no_op; goto on_failure; } break; case jump_n: EXTRACT_NUMBER (mcnt, p + 2); DEBUG_PRINT2 ("EXECUTING jump_n %d.\n", mcnt); /* Originally, this is how many times we CAN jump. */ if (mcnt) { mcnt--; STORE_NUMBER (p + 2, mcnt); goto unconditional_jump; } /* If don't have to jump any more, skip over the rest of command. */ else p += 4; break; case set_number_at: { DEBUG_PRINT1 ("EXECUTING set_number_at.\n"); EXTRACT_NUMBER_AND_INCR (mcnt, p); p1 = p + mcnt; EXTRACT_NUMBER_AND_INCR (mcnt, p); DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p1, mcnt); STORE_NUMBER (p1, mcnt); break; } case wordbound: DEBUG_PRINT1 ("EXECUTING wordbound.\n"); if (AT_WORD_BOUNDARY (d)) break; goto fail; case notwordbound: DEBUG_PRINT1 ("EXECUTING notwordbound.\n"); if (AT_WORD_BOUNDARY (d)) goto fail; break; case wordbeg: DEBUG_PRINT1 ("EXECUTING wordbeg.\n"); if (WORDCHAR_P (d) && (AT_STRINGS_BEG (d) || !WORDCHAR_P (d - 1))) break; goto fail; case wordend: DEBUG_PRINT1 ("EXECUTING wordend.\n"); if (!AT_STRINGS_BEG (d) && WORDCHAR_P (d - 1) && (!WORDCHAR_P (d) || AT_STRINGS_END (d))) break; goto fail; #ifdef emacs #ifdef emacs19 case before_dot: DEBUG_PRINT1 ("EXECUTING before_dot.\n"); if (PTR_CHAR_POS ((unsigned char *) d) >= point) goto fail; break; case at_dot: DEBUG_PRINT1 ("EXECUTING at_dot.\n"); if (PTR_CHAR_POS ((unsigned char *) d) != point) goto fail; break; case after_dot: DEBUG_PRINT1 ("EXECUTING after_dot.\n"); if (PTR_CHAR_POS ((unsigned char *) d) <= point) goto fail; break; #else /* not emacs19 */ case at_dot: DEBUG_PRINT1 ("EXECUTING at_dot.\n"); if (PTR_CHAR_POS ((unsigned char *) d) + 1 != point) goto fail; break; #endif /* not emacs19 */ case syntaxspec: DEBUG_PRINT2 ("EXECUTING syntaxspec %d.\n", mcnt); mcnt = *p++; goto matchsyntax; case wordchar: DEBUG_PRINT1 ("EXECUTING Emacs wordchar.\n"); mcnt = (int) Sword; matchsyntax: PREFETCH (); if (SYNTAX (*d++) != (enum syntaxcode) mcnt) goto fail; SET_REGS_MATCHED (); break; case notsyntaxspec: DEBUG_PRINT2 ("EXECUTING notsyntaxspec %d.\n", mcnt); mcnt = *p++; goto matchnotsyntax; case notwordchar: DEBUG_PRINT1 ("EXECUTING Emacs notwordchar.\n"); mcnt = (int) Sword; matchnotsyntax: PREFETCH (); if (SYNTAX (*d++) == (enum syntaxcode) mcnt) goto fail; SET_REGS_MATCHED (); break; #else /* not emacs */ case wordchar: DEBUG_PRINT1 ("EXECUTING non-Emacs wordchar.\n"); PREFETCH (); if (!WORDCHAR_P (d)) goto fail; SET_REGS_MATCHED (); d++; break; case notwordchar: DEBUG_PRINT1 ("EXECUTING non-Emacs notwordchar.\n"); PREFETCH (); if (WORDCHAR_P (d)) goto fail; SET_REGS_MATCHED (); d++; break; #endif /* not emacs */ default: abort (); } continue; /* Successfully executed one pattern command; keep going. */ /* We goto here if a matching operation fails. */ fail: if (!FAIL_STACK_EMPTY ()) { /* A restart point is known. Restore to that state. */ DEBUG_PRINT1 ("\nFAIL:\n"); POP_FAILURE_POINT (d, p, lowest_active_reg, highest_active_reg, regstart, regend, reg_info); /* If this failure point is a dummy, try the next one. */ if (!p) goto fail; /* If we failed to the end of the pattern, don't examine *p. */ assert (p <= pend); if (p < pend) { boolean is_a_jump_n = false; /* If failed to a backwards jump that's part of a repetition loop, need to pop this failure point and use the next one. */ switch ((re_opcode_t) *p) { case jump_n: is_a_jump_n = true; case maybe_pop_jump: case pop_failure_jump: case jump: p1 = p + 1; EXTRACT_NUMBER_AND_INCR (mcnt, p1); p1 += mcnt; if ((is_a_jump_n && (re_opcode_t) *p1 == succeed_n) || (!is_a_jump_n && (re_opcode_t) *p1 == on_failure_jump)) goto fail; break; default: /* do nothing */ ; } } if (d >= string1 && d <= end1) dend = end_match_1; } else break; /* Matching at this starting point really fails. */ } /* for (;;) */ if (best_regs_set) goto restore_best_regs; FREE_VARIABLES (); return -1; /* Failure to match. */ } /* re_match_2 */ /* Subroutine definitions for re_match_2. */ /* We are passed P pointing to a register number after a start_memory. Return true if the pattern up to the corresponding stop_memory can match the empty string, and false otherwise. If we find the matching stop_memory, sets P to point to one past its number. Otherwise, sets P to an undefined byte less than or equal to END. We don't handle duplicates properly (yet). */ static boolean group_match_null_string_p (p, end, reg_info) unsigned char **p, *end; register_info_type *reg_info; { int mcnt; /* Point to after the args to the start_memory. */ unsigned char *p1 = *p + 2; while (p1 < end) { /* Skip over opcodes that can match nothing, and return true or false, as appropriate, when we get to one that can't, or to the matching stop_memory. */ switch ((re_opcode_t) *p1) { /* Could be either a loop or a series of alternatives. */ case on_failure_jump: p1++; EXTRACT_NUMBER_AND_INCR (mcnt, p1); /* If the next operation is not a jump backwards in the pattern. */ if (mcnt >= 0) { /* Go through the on_failure_jumps of the alternatives, seeing if any of the alternatives cannot match nothing. The last alternative starts with only a jump, whereas the rest start with on_failure_jump and end with a jump, e.g., here is the pattern for `a|b|c': /on_failure_jump/0/6/exactn/1/a/jump_past_alt/0/6 /on_failure_jump/0/6/exactn/1/b/jump_past_alt/0/3 /exactn/1/c So, we have to first go through the first (n-1) alternatives and then deal with the last one separately. */ /* Deal with the first (n-1) alternatives, which start with an on_failure_jump (see above) that jumps to right past a jump_past_alt. */ while ((re_opcode_t) p1[mcnt-3] == jump_past_alt) { /* `mcnt' holds how many bytes long the alternative is, including the ending `jump_past_alt' and its number. */ if (!alt_match_null_string_p (p1, p1 + mcnt - 3, reg_info)) return false; /* Move to right after this alternative, including the jump_past_alt. */ p1 += mcnt; /* Break if it's the beginning of an n-th alternative that doesn't begin with an on_failure_jump. */ if ((re_opcode_t) *p1 != on_failure_jump) break; /* Still have to check that it's not an n-th alternative that starts with an on_failure_jump. */ p1++; EXTRACT_NUMBER_AND_INCR (mcnt, p1); if ((re_opcode_t) p1[mcnt-3] != jump_past_alt) { /* Get to the beginning of the n-th alternative. */ p1 -= 3; break; } } /* Deal with the last alternative: go back and get number of the `jump_past_alt' just before it. `mcnt' contains the length of the alternative. */ EXTRACT_NUMBER (mcnt, p1 - 2); if (!alt_match_null_string_p (p1, p1 + mcnt, reg_info)) return false; p1 += mcnt; /* Get past the n-th alternative. */ } /* if mcnt > 0 */ break; case stop_memory: assert (p1[1] == **p); *p = p1 + 2; return true; default: if (!common_op_match_null_string_p (&p1, end, reg_info)) return false; } } /* while p1 < end */ return false; } /* group_match_null_string_p */ /* Similar to group_match_null_string_p, but doesn't deal with alternatives: It expects P to be the first byte of a single alternative and END one byte past the last. The alternative can contain groups. */ static boolean alt_match_null_string_p (p, end, reg_info) unsigned char *p, *end; register_info_type *reg_info; { int mcnt; unsigned char *p1 = p; while (p1 < end) { /* Skip over opcodes that can match nothing, and break when we get to one that can't. */ switch ((re_opcode_t) *p1) { /* It's a loop. */ case on_failure_jump: p1++; EXTRACT_NUMBER_AND_INCR (mcnt, p1); p1 += mcnt; break; default: if (!common_op_match_null_string_p (&p1, end, reg_info)) return false; } } /* while p1 < end */ return true; } /* alt_match_null_string_p */ /* Deals with the ops common to group_match_null_string_p and alt_match_null_string_p. Sets P to one after the op and its arguments, if any. */ static boolean common_op_match_null_string_p (p, end, reg_info) unsigned char **p, *end; register_info_type *reg_info; { int mcnt; boolean ret; int reg_no; unsigned char *p1 = *p; switch ((re_opcode_t) *p1++) { case no_op: case begline: case endline: case begbuf: case endbuf: case wordbeg: case wordend: case wordbound: case notwordbound: #ifdef emacs case before_dot: case at_dot: case after_dot: #endif break; case start_memory: reg_no = *p1; assert (reg_no > 0 && reg_no <= MAX_REGNUM); ret = group_match_null_string_p (&p1, end, reg_info); /* Have to set this here in case we're checking a group which contains a group and a back reference to it. */ if (REG_MATCH_NULL_STRING_P (reg_info[reg_no]) == MATCH_NULL_UNSET_VALUE) REG_MATCH_NULL_STRING_P (reg_info[reg_no]) = ret; if (!ret) return false; break; /* If this is an optimized succeed_n for zero times, make the jump. */ case jump: EXTRACT_NUMBER_AND_INCR (mcnt, p1); if (mcnt >= 0) p1 += mcnt; else return false; break; case succeed_n: /* Get to the number of times to succeed. */ p1 += 2; EXTRACT_NUMBER_AND_INCR (mcnt, p1); if (mcnt == 0) { p1 -= 4; EXTRACT_NUMBER_AND_INCR (mcnt, p1); p1 += mcnt; } else return false; break; case duplicate: if (!REG_MATCH_NULL_STRING_P (reg_info[*p1])) return false; break; case set_number_at: p1 += 4; default: /* All other opcodes mean we cannot match the empty string. */ return false; } *p = p1; return true; } /* common_op_match_null_string_p */ /* Return zero if TRANSLATE[S1] and TRANSLATE[S2] are identical for LEN bytes; nonzero otherwise. */ static int bcmp_translate (s1, s2, len, translate) unsigned char *s1, *s2; register int len; char *translate; { register unsigned char *p1 = s1, *p2 = s2; while (len) { if (translate[*p1++] != translate[*p2++]) return 1; len--; } return 0; } /* Entry points for GNU code. */ /* re_compile_pattern is the GNU regular expression compiler: it compiles PATTERN (of length SIZE) and puts the result in BUFP. Returns 0 if the pattern was valid, otherwise an error string. Assumes the `allocated' (and perhaps `buffer') and `translate' fields are set in BUFP on entry. We call regex_compile to do the actual compilation. */ const char * re_compile_pattern (pattern, length, bufp) const char *pattern; int length; struct re_pattern_buffer *bufp; { reg_errcode_t ret; /* GNU code is written to assume at least RE_NREGS registers will be set (and at least one extra will be -1). */ bufp->regs_allocated = REGS_UNALLOCATED; /* And GNU code determines whether or not to get register information by passing null for the REGS argument to re_match, etc., not by setting no_sub. */ bufp->no_sub = 0; /* Match anchors at newline. */ bufp->newline_anchor = 1; ret = regex_compile (pattern, length, re_syntax_options, bufp); return re_error_msg[(int) ret]; } /* Entry points compatible with 4.2 BSD regex library. We don't define them if this is an Emacs or POSIX compilation. */ #if !defined (emacs) && !defined (_POSIX_SOURCE) /* BSD has one and only one pattern buffer. */ static struct re_pattern_buffer re_comp_buf; char * re_comp (s) const char *s; { reg_errcode_t ret; if (!s) { if (!re_comp_buf.buffer) return "No previous regular expression"; return 0; } if (!re_comp_buf.buffer) { re_comp_buf.buffer = (unsigned char *) malloc (200); if (re_comp_buf.buffer == NULL) return "Memory exhausted"; re_comp_buf.allocated = 200; re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH); if (re_comp_buf.fastmap == NULL) return "Memory exhausted"; } /* Since `re_exec' always passes NULL for the `regs' argument, we don't need to initialize the pattern buffer fields which affect it. */ /* Match anchors at newlines. */ re_comp_buf.newline_anchor = 1; ret = regex_compile (s, strlen (s), re_syntax_options, &re_comp_buf); /* Yes, we're discarding `const' here. */ return (char *) re_error_msg[(int) ret]; } int re_exec (s) const char *s; { const int len = strlen (s); return 0 <= re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0); } #endif /* not emacs and not _POSIX_SOURCE */ /* POSIX.2 functions. Don't define these for Emacs. */ #ifndef emacs /* regcomp takes a regular expression as a string and compiles it. PREG is a regex_t *. We do not expect any fields to be initialized, since POSIX says we shouldn't. Thus, we set `buffer' to the compiled pattern; `used' to the length of the compiled pattern; `syntax' to RE_SYNTAX_POSIX_EXTENDED if the REG_EXTENDED bit in CFLAGS is set; otherwise, to RE_SYNTAX_POSIX_BASIC; `newline_anchor' to REG_NEWLINE being set in CFLAGS; `fastmap' and `fastmap_accurate' to zero; `re_nsub' to the number of subexpressions in PATTERN. PATTERN is the address of the pattern string. CFLAGS is a series of bits which affect compilation. If REG_EXTENDED is set, we use POSIX extended syntax; otherwise, we use POSIX basic syntax. If REG_NEWLINE is set, then . and [^...] don't match newline. Also, regexec will try a match beginning after every newline. If REG_ICASE is set, then we considers upper- and lowercase versions of letters to be equivalent when matching. If REG_NOSUB is set, then when PREG is passed to regexec, that routine will report only success or failure, and nothing about the registers. It returns 0 if it succeeds, nonzero if it doesn't. (See regex.h for the return codes and their meanings.) */ int regcomp (preg, pattern, cflags) regex_t *preg; const char *pattern; int cflags; { reg_errcode_t ret; unsigned syntax = (cflags & REG_EXTENDED) ? RE_SYNTAX_POSIX_EXTENDED : RE_SYNTAX_POSIX_BASIC; /* regex_compile will allocate the space for the compiled pattern. */ preg->buffer = 0; preg->allocated = 0; /* Don't bother to use a fastmap when searching. This simplifies the REG_NEWLINE case: if we used a fastmap, we'd have to put all the characters after newlines into the fastmap. This way, we just try every character. */ preg->fastmap = 0; if (cflags & REG_ICASE) { unsigned i; preg->translate = (char *) malloc (CHAR_SET_SIZE); if (preg->translate == NULL) return (int) REG_ESPACE; /* Map uppercase characters to corresponding lowercase ones. */ for (i = 0; i < CHAR_SET_SIZE; i++) preg->translate[i] = ISUPPER (i) ? tolower (i) : i; } else preg->translate = NULL; /* If REG_NEWLINE is set, newlines are treated differently. */ if (cflags & REG_NEWLINE) { /* REG_NEWLINE implies neither . nor [^...] match newline. */ syntax &= ~RE_DOT_NEWLINE; syntax |= RE_HAT_LISTS_NOT_NEWLINE; /* It also changes the matching behavior. */ preg->newline_anchor = 1; } else preg->newline_anchor = 0; preg->no_sub = !!(cflags & REG_NOSUB); /* POSIX says a null character in the pattern terminates it, so we can use strlen here in compiling the pattern. */ ret = regex_compile (pattern, strlen (pattern), syntax, preg); /* POSIX doesn't distinguish between an unmatched open-group and an unmatched close-group: both are REG_EPAREN. */ if (ret == REG_ERPAREN) ret = REG_EPAREN; return (int) ret; } /* regexec searches for a given pattern, specified by PREG, in the string STRING. If NMATCH is zero or REG_NOSUB was set in the cflags argument to `regcomp', we ignore PMATCH. Otherwise, we assume PMATCH has at least NMATCH elements, and we set them to the offsets of the corresponding matched substrings. EFLAGS specifies `execution flags' which affect matching: if REG_NOTBOL is set, then ^ does not match at the beginning of the string; if REG_NOTEOL is set, then $ does not match at the end. We return 0 if we find a match and REG_NOMATCH if not. */ int regexec (preg, string, nmatch, pmatch, eflags) const regex_t *preg; const char *string; size_t nmatch; regmatch_t pmatch[]; int eflags; { int ret; struct re_registers regs; regex_t private_preg; int len = strlen (string); boolean want_reg_info = !preg->no_sub && nmatch > 0; private_preg = *preg; private_preg.not_bol = !!(eflags & REG_NOTBOL); private_preg.not_eol = !!(eflags & REG_NOTEOL); /* The user has told us exactly how many registers to return information about, via `nmatch'. We have to pass that on to the matching routines. */ private_preg.regs_allocated = REGS_FIXED; if (want_reg_info) { regs.num_regs = nmatch; regs.start = TALLOC (nmatch, regoff_t); regs.end = TALLOC (nmatch, regoff_t); if (regs.start == NULL || regs.end == NULL) return (int) REG_NOMATCH; } /* Perform the searching operation. */ ret = re_search (&private_preg, string, len, /* start: */ 0, /* range: */ len, want_reg_info ? ®s : (struct re_registers *) 0); /* Copy the register information to the POSIX structure. */ if (want_reg_info) { if (ret >= 0) { unsigned r; for (r = 0; r < nmatch; r++) { pmatch[r].rm_so = regs.start[r]; pmatch[r].rm_eo = regs.end[r]; } } /* If we needed the temporary register info, free the space now. */ free (regs.start); free (regs.end); } /* We want zero return to mean success, unlike `re_search'. */ return ret >= 0 ? (int) REG_NOERROR : (int) REG_NOMATCH; } /* Returns a message corresponding to an error code, ERRCODE, returned from either regcomp or regexec. We don't use PREG here. */ size_t regerror (errcode, preg, errbuf, errbuf_size) int errcode; const regex_t *preg; char *errbuf; size_t errbuf_size; { const char *msg; size_t msg_size; if (errcode < 0 || errcode >= (sizeof (re_error_msg) / sizeof (re_error_msg[0]))) /* Only error codes returned by the rest of the code should be passed to this routine. If we are given anything else, or if other regex code generates an invalid error code, then the program has a bug. Dump core so we can fix it. */ abort (); msg = re_error_msg[errcode]; /* POSIX doesn't require that we do anything in this case, but why not be nice. */ if (! msg) msg = "Success"; msg_size = strlen (msg) + 1; /* Includes the null. */ if (errbuf_size != 0) { if (msg_size > errbuf_size) { strncpy (errbuf, msg, errbuf_size - 1); errbuf[errbuf_size - 1] = 0; } else strcpy (errbuf, msg); } return msg_size; } /* Free dynamically allocated space used by PREG. */ void regfree (preg) regex_t *preg; { if (preg->buffer != NULL) free (preg->buffer); preg->buffer = NULL; preg->allocated = 0; preg->used = 0; if (preg->fastmap != NULL) free (preg->fastmap); preg->fastmap = NULL; preg->fastmap_accurate = 0; if (preg->translate != NULL) free (preg->translate); preg->translate = NULL; } #endif /* not emacs */ /* Local variables: make-backup-files: t version-control: t trim-versions-without-asking: nil End: */ #endif aide-0.16~a2.git20130520/src/list.c000066400000000000000000000133011214657706600163040ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2002,2005,2006,2010 Rami Lehti,Pablo Virolainen, * Richard van den Berg, Hannes von Haugwitz * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "aide.h" #include #include "list.h" #include "report.h" /*for locale support*/ #include "locale-aide.h" /*for locale support*/ /* list * limitations: * Only the head knows where the tail is * Every item knows where the head is * And that is not true anymore. * Now list has header which knows head and tail. * Every item knows header. */ /* list_sorted_insert() * Adds an item in a sorted list: * - The first argument is the head of the list * - The second argument is the data to be added * - The third argument is the function pointer to the compare function to use * - Returns the head of the list */ list* list_sorted_insert(list* listp, void* data, int (*compare) (const void*, const void*)) { list* newitem=NULL; list* curitem=NULL; newitem=(list*)malloc(sizeof(list)); if (newitem==NULL) { error(0,"Not enough memory to add a new item to list.\n"); exit(EXIT_FAILURE); } if (listp==NULL){ list_header* header=(list_header*)malloc(sizeof(list_header)); if (header==NULL){ error(0,"Not enough memory for list header allocation\n"); exit(EXIT_FAILURE); } newitem->data=data; newitem->header=header; newitem->next=NULL; newitem->prev=NULL; header->head=newitem; header->tail=newitem; return newitem; } else { /* add element in sorted, non-empty list (use insertion sort) */ curitem = listp->header->head; newitem->header=listp->header; newitem->data=data; if (compare(newitem->data,curitem->data) <= 0) { /* new element is the new head */ listp->header->head=newitem; curitem->prev=newitem; newitem->next=curitem; newitem->prev=NULL; return newitem; } else { /* find position for new element */ while(compare(newitem->data, curitem->data) > 0 && curitem->next != NULL) { curitem=curitem->next; } if (curitem->next == NULL && compare(newitem->data, curitem->data) > 0) { /* new element is the new tail */ listp->header->tail=newitem; curitem->next=newitem; newitem->prev=curitem; newitem->next=NULL; } else { /* new element is an inner element */ curitem->prev->next=newitem; newitem->prev=curitem->prev; curitem->prev=newitem; newitem->next=curitem; } } return listp; } } /* list_append() * append an item to list * returns the head * The first argument is the head of the list * The second argument is the data to be added * Returns list head */ /* * Some way to handle mallocs failure would be nice. */ list* list_append(list* listp,void*data) { list* newitem=NULL; newitem=(list*)malloc(sizeof(list)); if (newitem==NULL) { error(0,"Not enough memory to add a new item to list.\n"); exit(EXIT_FAILURE); } if(listp==NULL){ list_header* header=(list_header*)malloc(sizeof(list_header)); if (header==NULL){ error(0,"Not enough memory for list header allocation\n"); exit(EXIT_FAILURE); } newitem->data=data; newitem->header=header; newitem->next=NULL; newitem->prev=NULL; header->head=newitem; header->tail=newitem; return newitem; }else { /* We have nonempthy list. * add to last */ newitem->prev=listp->header->tail; newitem->next=NULL; newitem->data=data; newitem->header=listp->header; listp->header->tail->next=newitem; listp->header->tail=newitem; return listp; } /* Not reached */ return NULL; } /* * delete_list_item() * delete a item from list * returns head of a list. */ list* list_delete_item(list* item){ list* r; if (item==NULL) { error(200,"Tried to remove from empthy list\n"); return item; } if (item->header->head==item->header->tail) { /* * Ollaan poistamassa listan ainoaa alkiota. * Tällöin palautetaan NULL */ free(item->header); free(item); return NULL; } /* * Nyt meillä on listassa ainakin kaksi alkiota * */ /* poistetaan listan viimeistä alkiota */ if (item==item->header->tail){ r=item->prev; item->header->tail=r; r->next=NULL; r=r->header->head; free(item); return r; } /* * Poistetaan listan ensimmäinen alkio. */ if (item==item->header->head) { r=item->next; item->header->head=r; r->prev=NULL; r=r->header->head; free(item); return r; } r=item->prev; item->prev->next=item->next; item->next->prev=item->prev; free(item); r=r->header->head; return r; } aide-0.16~a2.git20130520/src/md.c000066400000000000000000000175501214657706600157430ustar00rootroot00000000000000/* Aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2002,2005,2006,2010 Rami Lehti, Pablo Virolainen, * Richard van den Berg * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "aide.h" #include #include "md.h" #include "report.h" #include #ifdef WITH_MHASH #include #endif #define HASH_HAVAL_LEN HASH_HAVAL256_LEN /* It might be a good idea to construct a table, where these values are stored. Only a speed issue. */ DB_ATTR_TYPE hash_gcrypt2attr(int i) { DB_ATTR_TYPE r=0; #ifdef WITH_GCRYPT switch (i) { case GCRY_MD_MD5: { r=DB_MD5; break; } case GCRY_MD_SHA1: { r=DB_SHA1; break; } case GCRY_MD_RMD160: { r=DB_RMD160; break; } case GCRY_MD_TIGER: { r=DB_TIGER; break; } case GCRY_MD_HAVAL: { r=DB_HAVAL; break; } case GCRY_MD_SHA256: { r=DB_SHA256; break; } case GCRY_MD_SHA512: { r=DB_SHA512; break; } case GCRY_MD_CRC32: { r=DB_CRC32; break; } default: break; } #endif return r; } DB_ATTR_TYPE hash_mhash2attr(int i) { DB_ATTR_TYPE r=0; #ifdef WITH_MHASH switch (i) { case MHASH_CRC32: { r=DB_CRC32; break; } case MHASH_MD5: { r=DB_MD5; break; } case MHASH_SHA1: { r=DB_SHA1; break; } case MHASH_HAVAL: { r=DB_HAVAL; break; } case MHASH_RMD160: { r=DB_RMD160; break; } case MHASH_TIGER: { r=DB_TIGER; break; } case MHASH_GOST: { r=DB_GOST; break; } case MHASH_CRC32B: { r=DB_CRC32B; break; } case MHASH_HAVAL224: { break; } case MHASH_HAVAL192: { break; } case MHASH_HAVAL160: { break; } case MHASH_HAVAL128: { break; } case MHASH_TIGER128: { break; } case MHASH_TIGER160: { break; } case MHASH_MD4: { break; } case MHASH_SHA256: { r=DB_SHA256; break; } case MHASH_SHA512: { r=DB_SHA512; break; } #ifdef HAVE_MHASH_WHIRLPOOL case MHASH_WHIRLPOOL: { r=DB_WHIRLPOOL; break; } #endif case MHASH_ADLER32: { break; } default: break; } #endif return r; } /* Initialise md_container according it's todo_attr field */ int init_md(struct md_container* md) { int i; /* First we check the parameter.. */ #ifdef _PARAMETER_CHECK_ if (md==NULL) { return RETFAIL; } #endif error(255,"init_md called\n"); /* We don't have calculator for this yet :) */ md->calc_attr=0; #ifdef WITH_MHASH error(255,"Mhash library initialization\n"); for(i=0;i<=HASH_MHASH_COUNT;i++) { if (((hash_mhash2attr(i)&HASH_USE_MHASH)&md->todo_attr)!=0) { DB_ATTR_TYPE h=hash_mhash2attr(i); error(255,"inserting %llu\n",h); md->mhash_mdh[i]=mhash_init(i); if (md->mhash_mdh[i]!=MHASH_FAILED) { md->calc_attr|=h; } else { /* Oops.. We just don't calculate this. */ md->todo_attr&=~h; } } else { md->mhash_mdh[i]=MHASH_FAILED; } } #endif #ifdef WITH_GCRYPT error(255,"Gcrypt library initialization\n"); if(!gcry_check_version(GCRYPT_VERSION)) { error(0,"libgcrypt version mismatch\n"); exit(VERSION_MISMATCH_ERROR); } gcry_control(GCRYCTL_DISABLE_SECMEM, 0); gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); if(gcry_md_open(&md->mdh,0,0)!=GPG_ERR_NO_ERROR){ error(0,"gcrypt_md_open failed\n"); exit(IO_ERROR); } for(i=0;i<=HASH_GCRYPT_COUNT;i++) { if (((hash_gcrypt2attr(i)&HASH_USE_GCRYPT)&md->todo_attr)!=0) { DB_ATTR_TYPE h=hash_gcrypt2attr(i); error(255,"inserting %llu\n",h); if(gcry_md_enable(md->mdh,i)==GPG_ERR_NO_ERROR){ md->calc_attr|=h; } else { error(0,"gcry_md_enable %i failed",i); md->todo_attr&=~h; } } } #endif return RETOK; } /* update :) Just call this when you have more data. */ int update_md(struct md_container* md,void* data,ssize_t size) { int i; error(255,"update_md called\n"); #ifdef _PARAMETER_CHECK_ if (md==NULL||data==NULL) { return RETFAIL; } #endif #ifdef WITH_MHASH for(i=0;i<=HASH_MHASH_COUNT;i++) { if (md->mhash_mdh[i]!=MHASH_FAILED) { mhash (md->mhash_mdh[i], data, size); } } #endif /* WITH_MHASH */ #ifdef WITH_GCRYPT gcry_md_write(md->mdh, data, size); #endif return RETOK; } /* close.. Does some magic. After this calling update_db is not a good idea. */ int close_md(struct md_container* md) { int i; #ifdef _PARAMETER_CHECK_ if (md==NULL) { return RETFAIL; } #endif error(255,"close_md called \n"); #ifdef WITH_MHASH for(i=0;i<=HASH_MHASH_COUNT;i++) { if (md->mhash_mdh[i]!=MHASH_FAILED) { mhash (md->mhash_mdh[i], NULL, 0); } } #endif /* WITH_MHASH */ #ifdef WITH_GCRYPT gcry_md_final(md->mdh); /* Let's flush the buffers */ #define get_libgcrypt_hash(a,b,c,d) \ if(md->calc_attr&a&HASH_USE_GCRYPT){\ error(255,"Getting hash %i\n",b);\ memcpy(md->c,gcry_md_read(md->mdh,b),d);\ } get_libgcrypt_hash(DB_MD5,GCRY_MD_MD5,md5,HASH_MD5_LEN); get_libgcrypt_hash(DB_SHA1,GCRY_MD_SHA1,sha1,HASH_SHA1_LEN); get_libgcrypt_hash(DB_TIGER,GCRY_MD_TIGER,tiger,HASH_TIGER_LEN); get_libgcrypt_hash(DB_RMD160,GCRY_MD_RMD160,rmd160,HASH_RMD160_LEN); get_libgcrypt_hash(DB_SHA256,GCRY_MD_SHA256,sha256,HASH_SHA256_LEN); get_libgcrypt_hash(DB_SHA512,GCRY_MD_SHA512,sha512,HASH_SHA512_LEN); get_libgcrypt_hash(DB_CRC32,GCRY_MD_CRC32,crc32,HASH_CRC32_LEN); /*. There might be more hashes in the library. Add those here.. */ gcry_md_reset(md->mdh); #endif #ifdef WITH_MHASH #define get_mhash_hash(b,c) \ if(md->mhash_mdh[b]!=MHASH_FAILED){ \ mhash_deinit(md->mhash_mdh[b],(void*)md->c); \ } get_mhash_hash(MHASH_MD5,md5); get_mhash_hash(MHASH_SHA1,sha1); get_mhash_hash(MHASH_TIGER,tiger); get_mhash_hash(MHASH_RMD160,rmd160); get_mhash_hash(MHASH_CRC32,crc32); get_mhash_hash(MHASH_HAVAL,haval); get_mhash_hash(MHASH_GOST,gost); get_mhash_hash(MHASH_CRC32B,crc32b); get_mhash_hash(MHASH_SHA256,sha256); get_mhash_hash(MHASH_SHA512,sha512); #ifdef HAVE_MHASH_WHIRLPOOL get_mhash_hash(MHASH_WHIRLPOOL,whirlpool); #endif /* There might be more hashes in the library we want to use. Add those here.. */ #endif return RETOK; } /* Writes md_container to db_line. */ void md2line(struct md_container* md,struct db_line* line) { error(255,"md2line \n"); #ifdef _PARAMETER_CHECK_ if (md==NULL||line==NULL) { return RETFAIL; } #endif #define copyhash(a,b,c) \ if (line->attr&a) { \ error(255,"Line has %llu\n",a); \ if (md->calc_attr&a) { \ error(255,"copying %llu\n",a); \ line->b=(byte*)malloc(c); \ memcpy(line->b,md->b,c); \ } else { \ line->attr&=~a; \ } \ } copyhash(DB_MD5,md5,HASH_MD5_LEN); copyhash(DB_SHA1,sha1,HASH_SHA1_LEN); copyhash(DB_RMD160,rmd160,HASH_RMD160_LEN); copyhash(DB_TIGER,tiger,HASH_TIGER_LEN); copyhash(DB_CRC32,crc32,HASH_CRC32_LEN); copyhash(DB_HAVAL,haval,HASH_HAVAL_LEN); copyhash(DB_GOST,gost,HASH_GOST_LEN); copyhash(DB_CRC32B,crc32b,HASH_CRC32B_LEN); copyhash(DB_SHA256,sha256,HASH_SHA256_LEN); copyhash(DB_SHA512,sha512,HASH_SHA512_LEN); copyhash(DB_WHIRLPOOL,whirlpool,HASH_WHIRLPOOL_LEN); } aide-0.16~a2.git20130520/src/snprintf.c000066400000000000000000000575651214657706600172200ustar00rootroot00000000000000/* * NOTE: If you change this file, please merge it into rsync, samba, etc. */ /* * Copyright Patrick Powell 1995 * This code is based on code written by Patrick Powell (papowell@astart.com) * It may be used for any purpose as long as this notice remains intact * on all source code distributions */ /************************************************************** * Original: * Patrick Powell Tue Apr 11 09:48:21 PDT 1995 * A bombproof version of doprnt (dopr) included. * Sigh. This sort of thing is always nasty do deal with. Note that * the version here does not include floating point... * * snprintf() is used instead of sprintf() as it does limit checks * for string length. This covers a nasty loophole. * * The other functions are there to prevent NULL pointers from * causing nast effects. * * More Recently: * Brandon Long 9/15/96 for mutt 0.43 * This was ugly. It is still ugly. I opted out of floating point * numbers, but the formatter understands just about everything * from the normal C string format, at least as far as I can tell from * the Solaris 2.5 printf(3S) man page. * * Brandon Long 10/22/97 for mutt 0.87.1 * Ok, added some minimal floating point support, which means this * probably requires libm on most operating systems. Don't yet * support the exponent (e,E) and sigfig (g,G). Also, fmtint() * was pretty badly broken, it just wasn't being exercised in ways * which showed it, so that's been fixed. Also, formated the code * to mutt conventions, and removed dead code left over from the * original. Also, there is now a builtin-test, just compile with: * gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm * and run snprintf for results. * * Thomas Roessler 01/27/98 for mutt 0.89i * The PGP code was using unsigned hexadecimal formats. * Unfortunately, unsigned formats simply didn't work. * * Michael Elkins 03/05/98 for mutt 0.90.8 * The original code assumed that both snprintf() and vsnprintf() were * missing. Some systems only have snprintf() but not vsnprintf(), so * the code is now broken down under HAVE_SNPRINTF and HAVE_VSNPRINTF. * * Andrew Tridgell (tridge@samba.org) Oct 1998 * fixed handling of %.0f * added test for HAVE_LONG_DOUBLE * * tridge@samba.org, idra@samba.org, April 2001 * got rid of fcvt code (twas buggy and made testing harder) * added C99 semantics * * date: 2002/12/19 19:56:31; author: herb; state: Exp; lines: +2 -0 * actually print args for %g and %e * * date: 2002/06/03 13:37:52; author: jmcd; state: Exp; lines: +8 -0 * Since includes.h isn't included here, VA_COPY has to be defined here. I don't * see any include file that is guaranteed to be here, so I'm defining it * locally. Fixes AIX and Solaris builds. * * date: 2002/06/03 03:07:24; author: tridge; state: Exp; lines: +5 -13 * put the ifdef for HAVE_VA_COPY in one place rather than in lots of * functions * * date: 2002/05/17 14:51:22; author: jmcd; state: Exp; lines: +21 -4 * Fix usage of va_list passed as an arg. Use __va_copy before using it * when it exists. * * date: 2002/04/16 22:38:04; author: idra; state: Exp; lines: +20 -14 * Fix incorrect zpadlen handling in fmtfp. * Thanks to Ollie Oldham for spotting it. * few mods to make it easier to compile the tests. * addedd the "Ollie" test to the floating point ones. * * Martin Pool (mbp@samba.org) April 2003 * Remove NO_CONFIG_H so that the test case can be built within a source * tree with less trouble. * Remove unnecessary SAFE_FREE() definition. * * Martin Pool (mbp@samba.org) May 2003 * Put in a prototype for dummy_snprintf() to quiet compiler warnings. * * Move #endif to make sure VA_COPY, LDOUBLE, etc are defined even * if the C library has some snprintf functions already. **************************************************************/ #ifndef NO_CONFIG_H #include "config.h" #else #define NULL 0 #endif #ifdef TEST_SNPRINTF /* need math library headers for testing */ /* In test mode, we pretend that this system doesn't have any snprintf * functions, regardless of what config.h says. */ # undef HAVE_SNPRINTF # undef HAVE_VSNPRINTF # undef HAVE_C99_VSNPRINTF # undef HAVE_ASPRINTF # undef HAVE_VASPRINTF # include #endif /* TEST_SNPRINTF */ #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_CTYPE_H #include #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #if defined(HAVE_SNPRINTF) && defined(HAVE_VSNPRINTF) && defined(HAVE_C99_VSNPRINTF) /* only include stdio.h if we are not re-defining snprintf or vsnprintf */ #include /* make the compiler happy with an empty file */ void dummy_snprintf(void); void dummy_snprintf(void) {} #endif /* HAVE_SNPRINTF, etc */ #ifdef HAVE_LONG_DOUBLE #define LDOUBLE long double #else #define LDOUBLE double #endif #if SIZEOF_LONG_LONG #define LLONG long long #else #define LLONG long #endif #ifndef VA_COPY #if defined HAVE_VA_COPY || defined va_copy #define VA_COPY(dest, src) va_copy(dest, src) #else #ifdef HAVE___VA_COPY #define VA_COPY(dest, src) __va_copy(dest, src) #else #define VA_COPY(dest, src) (dest) = (src) #endif #endif /* * dopr(): poor man's version of doprintf */ /* format read states */ #define DP_S_DEFAULT 0 #define DP_S_FLAGS 1 #define DP_S_MIN 2 #define DP_S_DOT 3 #define DP_S_MAX 4 #define DP_S_MOD 5 #define DP_S_CONV 6 #define DP_S_DONE 7 /* format flags - Bits */ #define DP_F_MINUS (1 << 0) #define DP_F_PLUS (1 << 1) #define DP_F_SPACE (1 << 2) #define DP_F_NUM (1 << 3) #define DP_F_ZERO (1 << 4) #define DP_F_UP (1 << 5) #define DP_F_UNSIGNED (1 << 6) /* Conversion Flags */ #define DP_C_SHORT 1 #define DP_C_LONG 2 #define DP_C_LDOUBLE 3 #define DP_C_LLONG 4 #define char_to_int(p) ((p)- '0') #ifndef MAX #define MAX(p,q) (((p) >= (q)) ? (p) : (q)) #endif /* yes this really must be a ||. Don't muck with this (tridge) */ #if !defined(HAVE_VSNPRINTF) || !defined(HAVE_C99_VSNPRINTF) static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args_in); static void fmtstr(char *buffer, size_t *currlen, size_t maxlen, char *value, int flags, int min, int max); static void fmtint(char *buffer, size_t *currlen, size_t maxlen, long value, int base, int min, int max, int flags); static void fmtfp(char *buffer, size_t *currlen, size_t maxlen, LDOUBLE fvalue, int min, int max, int flags); static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c); static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args_in) { char ch; LLONG value; LDOUBLE fvalue; char *strvalue; int min; int max; int state; int flags; int cflags; size_t currlen; va_list args; VA_COPY(args, args_in); state = DP_S_DEFAULT; currlen = flags = cflags = min = 0; max = -1; ch = *format++; while (state != DP_S_DONE) { if (ch == '\0') state = DP_S_DONE; switch(state) { case DP_S_DEFAULT: if (ch == '%') state = DP_S_FLAGS; else dopr_outch (buffer, &currlen, maxlen, ch); ch = *format++; break; case DP_S_FLAGS: switch (ch) { case '-': flags |= DP_F_MINUS; ch = *format++; break; case '+': flags |= DP_F_PLUS; ch = *format++; break; case ' ': flags |= DP_F_SPACE; ch = *format++; break; case '#': flags |= DP_F_NUM; ch = *format++; break; case '0': flags |= DP_F_ZERO; ch = *format++; break; default: state = DP_S_MIN; break; } break; case DP_S_MIN: if (isdigit((unsigned char)ch)) { min = 10*min + char_to_int (ch); ch = *format++; } else if (ch == '*') { min = va_arg (args, int); ch = *format++; state = DP_S_DOT; } else { state = DP_S_DOT; } break; case DP_S_DOT: if (ch == '.') { state = DP_S_MAX; ch = *format++; } else { state = DP_S_MOD; } break; case DP_S_MAX: if (isdigit((unsigned char)ch)) { if (max < 0) max = 0; max = 10*max + char_to_int (ch); ch = *format++; } else if (ch == '*') { max = va_arg (args, int); ch = *format++; state = DP_S_MOD; } else { state = DP_S_MOD; } break; case DP_S_MOD: switch (ch) { case 'h': cflags = DP_C_SHORT; ch = *format++; break; case 'l': cflags = DP_C_LONG; ch = *format++; if (ch == 'l') { /* It's a long long */ cflags = DP_C_LLONG; ch = *format++; } break; case 'L': cflags = DP_C_LDOUBLE; ch = *format++; break; default: break; } state = DP_S_CONV; break; case DP_S_CONV: switch (ch) { case 'd': case 'i': if (cflags == DP_C_SHORT) value = va_arg (args, int); else if (cflags == DP_C_LONG) value = va_arg (args, long int); else if (cflags == DP_C_LLONG) value = va_arg (args, LLONG); else value = va_arg (args, int); fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags); break; case 'o': flags |= DP_F_UNSIGNED; if (cflags == DP_C_SHORT) value = va_arg (args, unsigned int); else if (cflags == DP_C_LONG) value = (long)va_arg (args, unsigned long int); else if (cflags == DP_C_LLONG) value = (long)va_arg (args, unsigned LLONG); else value = (long)va_arg (args, unsigned int); fmtint (buffer, &currlen, maxlen, value, 8, min, max, flags); break; case 'u': flags |= DP_F_UNSIGNED; if (cflags == DP_C_SHORT) value = va_arg (args, unsigned int); else if (cflags == DP_C_LONG) value = (long)va_arg (args, unsigned long int); else if (cflags == DP_C_LLONG) value = (LLONG)va_arg (args, unsigned LLONG); else value = (long)va_arg (args, unsigned int); fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags); break; case 'X': flags |= DP_F_UP; case 'x': flags |= DP_F_UNSIGNED; if (cflags == DP_C_SHORT) value = va_arg (args, unsigned int); else if (cflags == DP_C_LONG) value = (long)va_arg (args, unsigned long int); else if (cflags == DP_C_LLONG) value = (LLONG)va_arg (args, unsigned LLONG); else value = (long)va_arg (args, unsigned int); fmtint (buffer, &currlen, maxlen, value, 16, min, max, flags); break; case 'f': if (cflags == DP_C_LDOUBLE) fvalue = va_arg (args, LDOUBLE); else fvalue = va_arg (args, double); /* um, floating point? */ fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags); break; case 'E': flags |= DP_F_UP; case 'e': if (cflags == DP_C_LDOUBLE) fvalue = va_arg (args, LDOUBLE); else fvalue = va_arg (args, double); fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags); break; case 'G': flags |= DP_F_UP; case 'g': if (cflags == DP_C_LDOUBLE) fvalue = va_arg (args, LDOUBLE); else fvalue = va_arg (args, double); fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags); break; case 'c': dopr_outch (buffer, &currlen, maxlen, va_arg (args, int)); break; case 's': strvalue = va_arg (args, char *); if (!strvalue) strvalue = "(NULL)"; if (max == -1) { max = strlen(strvalue); } if (min > 0 && max >= 0 && min > max) max = min; fmtstr (buffer, &currlen, maxlen, strvalue, flags, min, max); break; case 'p': strvalue = va_arg (args, void *); fmtint (buffer, &currlen, maxlen, (long) strvalue, 16, min, max, flags); break; case 'n': if (cflags == DP_C_SHORT) { short int *num; num = va_arg (args, short int *); *num = currlen; } else if (cflags == DP_C_LONG) { long int *num; num = va_arg (args, long int *); *num = (long int)currlen; } else if (cflags == DP_C_LLONG) { LLONG *num; num = va_arg (args, LLONG *); *num = (LLONG)currlen; } else { int *num; num = va_arg (args, int *); *num = currlen; } break; case '%': dopr_outch (buffer, &currlen, maxlen, ch); break; case 'w': /* not supported yet, treat as next char */ ch = *format++; break; default: /* Unknown, skip */ break; } ch = *format++; state = DP_S_DEFAULT; flags = cflags = min = 0; max = -1; break; case DP_S_DONE: break; default: /* hmm? */ break; /* some picky compilers need this */ } } if (maxlen != 0) { if (currlen < maxlen - 1) buffer[currlen] = '\0'; else if (maxlen > 0) buffer[maxlen - 1] = '\0'; } return currlen; } static void fmtstr(char *buffer, size_t *currlen, size_t maxlen, char *value, int flags, int min, int max) { int padlen, strln; /* amount to pad */ int cnt = 0; #ifdef DEBUG_SNPRINTF printf("fmtstr min=%d max=%d s=[%s]\n", min, max, value); #endif if (value == 0) { value = ""; } for (strln = 0; value[strln]; ++strln); /* strlen */ padlen = min - strln; if (padlen < 0) padlen = 0; if (flags & DP_F_MINUS) padlen = -padlen; /* Left Justify */ while ((padlen > 0) && (cnt < max)) { dopr_outch (buffer, currlen, maxlen, ' '); --padlen; ++cnt; } while (*value && (cnt < max)) { dopr_outch (buffer, currlen, maxlen, *value++); ++cnt; } while ((padlen < 0) && (cnt < max)) { dopr_outch (buffer, currlen, maxlen, ' '); ++padlen; ++cnt; } } /* Have to handle DP_F_NUM (ie 0x and 0 alternates) */ static void fmtint(char *buffer, size_t *currlen, size_t maxlen, long value, int base, int min, int max, int flags) { int signvalue = 0; unsigned long uvalue; char convert[20]; int place = 0; int spadlen = 0; /* amount to space pad */ int zpadlen = 0; /* amount to zero pad */ int caps = 0; if (max < 0) max = 0; uvalue = value; if(!(flags & DP_F_UNSIGNED)) { if( value < 0 ) { signvalue = '-'; uvalue = -value; } else { if (flags & DP_F_PLUS) /* Do a sign (+/i) */ signvalue = '+'; else if (flags & DP_F_SPACE) signvalue = ' '; } } if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */ do { convert[place++] = (caps? "0123456789ABCDEF":"0123456789abcdef") [uvalue % (unsigned)base ]; uvalue = (uvalue / (unsigned)base ); } while(uvalue && (place < 20)); if (place == 20) place--; convert[place] = 0; zpadlen = max - place; spadlen = min - MAX (max, place) - (signvalue ? 1 : 0); if (zpadlen < 0) zpadlen = 0; if (spadlen < 0) spadlen = 0; if (flags & DP_F_ZERO) { zpadlen = MAX(zpadlen, spadlen); spadlen = 0; } if (flags & DP_F_MINUS) spadlen = -spadlen; /* Left Justifty */ #ifdef DEBUG_SNPRINTF printf("zpad: %d, spad: %d, min: %d, max: %d, place: %d\n", zpadlen, spadlen, min, max, place); #endif /* Spaces */ while (spadlen > 0) { dopr_outch (buffer, currlen, maxlen, ' '); --spadlen; } /* Sign */ if (signvalue) dopr_outch (buffer, currlen, maxlen, signvalue); /* Zeros */ if (zpadlen > 0) { while (zpadlen > 0) { dopr_outch (buffer, currlen, maxlen, '0'); --zpadlen; } } /* Digits */ while (place > 0) dopr_outch (buffer, currlen, maxlen, convert[--place]); /* Left Justified spaces */ while (spadlen < 0) { dopr_outch (buffer, currlen, maxlen, ' '); ++spadlen; } } static LDOUBLE abs_val(LDOUBLE value) { LDOUBLE result = value; if (value < 0) result = -value; return result; } static LDOUBLE POW10(int exp) { LDOUBLE result = 1; while (exp) { result *= 10; exp--; } return result; } static LLONG ROUND(LDOUBLE value) { LLONG intpart; intpart = (LLONG)value; value = value - intpart; if (value >= 0.5) intpart++; return intpart; } /* a replacement for modf that doesn't need the math library. Should be portable, but slow */ static double my_modf(double x0, double *iptr) { int i; long l; double x = x0; double f = 1.0; for (i=0;i<100;i++) { l = (long)x; if (l <= (x+1) && l >= (x-1)) { if (i != 0) { double i2; double ret; ret = my_modf(x0-l*f, &i2); (*iptr) = l*f + i2; return ret; } (*iptr) = l; return x - (*iptr); } x *= 0.1; f *= 10.0; } /* yikes! the number is beyond what we can handle. What do we do? */ (*iptr) = 0; return 0; } static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, LDOUBLE fvalue, int min, int max, int flags) { int signvalue = 0; double ufvalue; char iconvert[311]; char fconvert[311]; int iplace = 0; int fplace = 0; int padlen = 0; /* amount to pad */ int zpadlen = 0; int caps = 0; int idx; double intpart; double fracpart; double temp; /* * AIX manpage says the default is 0, but Solaris says the default * is 6, and sprintf on AIX defaults to 6 */ if (max < 0) max = 6; ufvalue = abs_val (fvalue); if (fvalue < 0) { signvalue = '-'; } else { if (flags & DP_F_PLUS) { /* Do a sign (+/i) */ signvalue = '+'; } else { if (flags & DP_F_SPACE) signvalue = ' '; } } #if 0 if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */ #endif #if 0 if (max == 0) ufvalue += 0.5; /* if max = 0 we must round */ #endif /* * Sorry, we only support 16 digits past the decimal because of our * conversion method */ if (max > 16) max = 16; /* We "cheat" by converting the fractional part to integer by * multiplying by a factor of 10 */ temp = ufvalue; my_modf(temp, &intpart); fracpart = ROUND((POW10(max)) * (ufvalue - intpart)); if (fracpart >= POW10(max)) { intpart++; fracpart -= POW10(max); } /* Convert integer part */ do { temp = intpart*0.1; my_modf(temp, &intpart); idx = (int) ((temp -intpart +0.05)* 10.0); /* idx = (int) (((double)(temp*0.1) -intpart +0.05) *10.0); */ /* printf ("%llf, %f, %x\n", temp, intpart, idx); */ iconvert[iplace++] = (caps? "0123456789ABCDEF":"0123456789abcdef")[idx]; } while (intpart && (iplace < 311)); if (iplace == 311) iplace--; iconvert[iplace] = 0; /* Convert fractional part */ if (fracpart) { do { temp = fracpart*0.1; my_modf(temp, &fracpart); idx = (int) ((temp -fracpart +0.05)* 10.0); /* idx = (int) ((((temp/10) -fracpart) +0.05) *10); */ /* printf ("%lf, %lf, %ld\n", temp, fracpart, idx ); */ fconvert[fplace++] = (caps? "0123456789ABCDEF":"0123456789abcdef")[idx]; } while(fracpart && (fplace < 311)); if (fplace == 311) fplace--; } fconvert[fplace] = 0; /* -1 for decimal point, another -1 if we are printing a sign */ padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0); zpadlen = max - fplace; if (zpadlen < 0) zpadlen = 0; if (padlen < 0) padlen = 0; if (flags & DP_F_MINUS) padlen = -padlen; /* Left Justifty */ if ((flags & DP_F_ZERO) && (padlen > 0)) { if (signvalue) { dopr_outch (buffer, currlen, maxlen, signvalue); --padlen; signvalue = 0; } while (padlen > 0) { dopr_outch (buffer, currlen, maxlen, '0'); --padlen; } } while (padlen > 0) { dopr_outch (buffer, currlen, maxlen, ' '); --padlen; } if (signvalue) dopr_outch (buffer, currlen, maxlen, signvalue); while (iplace > 0) dopr_outch (buffer, currlen, maxlen, iconvert[--iplace]); #ifdef DEBUG_SNPRINTF printf("fmtfp: fplace=%d zpadlen=%d\n", fplace, zpadlen); #endif /* * Decimal point. This should probably use locale to find the correct * char to print out. */ if (max > 0) { dopr_outch (buffer, currlen, maxlen, '.'); while (zpadlen > 0) { dopr_outch (buffer, currlen, maxlen, '0'); --zpadlen; } while (fplace > 0) dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]); } while (padlen < 0) { dopr_outch (buffer, currlen, maxlen, ' '); ++padlen; } } static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c) { if (*currlen < maxlen) { buffer[(*currlen)] = c; } (*currlen)++; } int rsync_vsnprintf (char *str, size_t count, const char *fmt, va_list args) { return dopr(str, count, fmt, args); } #define vsnprintf rsync_vsnprintf #endif /* yes this really must be a ||. Don't muck with this (tridge) * * The logic for these two is that we need our own definition if the * OS *either* has no definition of *sprintf, or if it does have one * that doesn't work properly according to the autoconf test. */ #if !defined(HAVE_SNPRINTF) || !defined(HAVE_C99_VSNPRINTF) int rsync_snprintf(char *str,size_t count,const char *fmt,...) { size_t ret; va_list ap; va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap); return ret; } #define snprintf rsync_snprintf #endif #endif #ifndef HAVE_VASPRINTF int vasprintf(char **ptr, const char *format, va_list ap) { int ret; va_list ap2; VA_COPY(ap2, ap); ret = vsnprintf(NULL, 0, format, ap2); if (ret <= 0) return ret; (*ptr) = (char *)malloc(ret+1); if (!*ptr) return -1; VA_COPY(ap2, ap); ret = vsnprintf(*ptr, ret+1, format, ap2); return ret; } #endif #ifndef HAVE_ASPRINTF int asprintf(char **ptr, const char *format, ...) { va_list ap; int ret; *ptr = NULL; va_start(ap, format); ret = vasprintf(ptr, format, ap); va_end(ap); return ret; } #endif #ifdef TEST_SNPRINTF int sprintf(char *str,const char *fmt,...); int main (void) { char buf1[1024]; char buf2[1024]; char *fp_fmt[] = { "%1.1f", "%-1.5f", "%1.5f", "%123.9f", "%10.5f", "% 10.5f", "%+22.9f", "%+4.9f", "%01.3f", "%4f", "%3.1f", "%3.2f", "%.0f", "%f", "-16.16f", NULL }; double fp_nums[] = { 6442452944.1234, -1.5, 134.21, 91340.2, 341.1234, 203.9, 0.96, 0.996, 0.9996, 1.996, 4.136, 5.030201, 0.00205, /* END LIST */ 0}; char *int_fmt[] = { "%-1.5d", "%1.5d", "%123.9d", "%5.5d", "%10.5d", "% 10.5d", "%+22.33d", "%01.3d", "%4d", "%d", NULL }; long int_nums[] = { -1, 134, 91340, 341, 0203, 0}; char *str_fmt[] = { "10.5s", "5.10s", "10.1s", "0.10s", "10.0s", "1.10s", "%s", "%.1s", "%.10s", "%10s", NULL }; char *str_vals[] = {"hello", "a", "", "a longer string", NULL}; int x, y; int fail = 0; int num = 0; printf ("Testing snprintf format codes against system sprintf...\n"); for (x = 0; fp_fmt[x] ; x++) { for (y = 0; fp_nums[y] != 0 ; y++) { int l1 = snprintf(NULL, 0, fp_fmt[x], fp_nums[y]); int l2 = snprintf(buf1, sizeof(buf1), fp_fmt[x], fp_nums[y]); sprintf (buf2, fp_fmt[x], fp_nums[y]); if (strcmp (buf1, buf2)) { printf("snprintf doesn't match Format: %s\n\tsnprintf = [%s]\n\t sprintf = [%s]\n", fp_fmt[x], buf1, buf2); fail++; } if (l1 != l2) { printf("snprintf l1 != l2 (%d %d) %s\n", l1, l2, fp_fmt[x]); fail++; } num++; } } for (x = 0; int_fmt[x] ; x++) { for (y = 0; int_nums[y] != 0 ; y++) { int l1 = snprintf(NULL, 0, int_fmt[x], int_nums[y]); int l2 = snprintf(buf1, sizeof(buf1), int_fmt[x], int_nums[y]); sprintf (buf2, int_fmt[x], int_nums[y]); if (strcmp (buf1, buf2)) { printf("snprintf doesn't match Format: %s\n\tsnprintf = [%s]\n\t sprintf = [%s]\n", int_fmt[x], buf1, buf2); fail++; } if (l1 != l2) { printf("snprintf l1 != l2 (%d %d) %s\n", l1, l2, int_fmt[x]); fail++; } num++; } } for (x = 0; str_fmt[x] ; x++) { for (y = 0; str_vals[y] != 0 ; y++) { int l1 = snprintf(NULL, 0, str_fmt[x], str_vals[y]); int l2 = snprintf(buf1, sizeof(buf1), str_fmt[x], str_vals[y]); sprintf (buf2, str_fmt[x], str_vals[y]); if (strcmp (buf1, buf2)) { printf("snprintf doesn't match Format: %s\n\tsnprintf = [%s]\n\t sprintf = [%s]\n", str_fmt[x], buf1, buf2); fail++; } if (l1 != l2) { printf("snprintf l1 != l2 (%d %d) %s\n", l1, l2, str_fmt[x]); fail++; } num++; } } printf ("%d tests failed out of %d.\n", fail, num); printf("seeing how many digits we support\n"); { double v0 = 0.12345678901234567890123456789012345678901; for (x=0; x<100; x++) { double p = pow(10, x); double r = v0*p; snprintf(buf1, sizeof(buf1), "%1.1f", r); sprintf(buf2, "%1.1f", r); if (strcmp(buf1, buf2)) { printf("we seem to support %d digits\n", x-1); break; } } } return 0; } #endif /* TEST_SNPRINTF */ aide-0.16~a2.git20130520/src/symboltable.c000066400000000000000000000026071214657706600176550ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2002,2005,2006 Rami Lehti,Pablo Virolainen, * Richard van den Berg * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "aide.h" #include #include #include "symboltable.h" /*for locale support*/ #include "locale-aide.h" /*for locale support*/ list* list_find(char* s,list* item){ list* l; list* p; if (item==NULL) { return NULL; } p=item; while(p!=NULL){ if (strcmp(s,((symba*)p->data)->name)==0) return p; p=p->next; } l=item->prev; while(l!=NULL){ /* Insert bug to here return l-> return p */ if (strcmp(s,((symba*)l->data)->name)==0) return l; l=l->prev; } return NULL; } aide-0.16~a2.git20130520/src/util.c000066400000000000000000000270411214657706600163140ustar00rootroot00000000000000/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999-2002,2004-2006,2010,2011,2013 Rami Lehti, Pablo * Virolainen, Mike Markley, Richard van den Berg, Hannes von Haugwitz * $Header$ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "aide.h" #include #include #include #include #include #include #include /*for locale support*/ #include "locale-aide.h" /*for locale support*/ #ifndef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 256 #endif #include "report.h" #include "db_config.h" #include "util.h" #define URL_UNSAFE " <>\"#%{}|\\^~[]`@:\033'" #define ISPRINT(c) (isascii(c) && isprint(c)) static const char* url_name[] = { "file", "stdin", "stdout", "stderr", "fd", "sql", "syslog", "database", "https", "http", "ftp" }; static const int url_value[] = { url_file, url_stdin, url_stdout,url_stderr,url_fd, url_sql, url_syslog, url_database, url_https, url_http, url_ftp }; const int url_ntypes=sizeof(url_value)/sizeof(URL_TYPE); int cmpurl(url_t* u1,url_t* u2) { if(u1->type!= u2->type){ return RETFAIL; }; if(strcmp(u1->value,u2->value)!=0){ return RETFAIL; } return RETOK; }; url_t* parse_url(char* val) { url_t* u=NULL; char* r=NULL; char* val_copy=NULL; int i=0; if(val==NULL){ return NULL; } u=(url_t*)malloc(sizeof(url_t)); /* We don't want to modify the original hence strdup(val) */ val_copy=strdup(val); for(r=val_copy;r[0]!=':'&&r[0]!='\0';r++); if(r[0]!='\0'){ r[0]='\0'; r++; } u->type=url_unknown; for(i=0;itype=url_value[i]; break; } } switch (u->type) { case url_file : { if(r[0]=='/'&&(r+1)[0]=='/'&&(r+2)[0]=='/'){ u->value=strdup(r+2); break; } if(r[0]=='/'&&(r+1)[0]=='/'&&(r+2)[0]!='/'){ char*hostname=(char*)malloc(sizeof(char)*MAXHOSTNAMELEN); char* t=r+2; r+=2; for(i=0;r[0]!='/'&&r[0]!='\0';r++,i++); if(r[0]=='\0'){ error(0,"Invalid file-URL,no path after hostname: file:%s\n",t); return NULL; } u->value=strdup(r); r[0]='\0'; if(gethostname(hostname,MAXHOSTNAMELEN)==-1){ strncpy(hostname,"localhost", 10); } if( (strcmp(t,"localhost")==0)||(strcmp(t,hostname)==0)){ free(hostname); break; } else { error(0,"Invalid file-URL, cannot use hostname other than localhost or %s: file:%s\n",hostname,u->value); free(hostname); return NULL; } free(hostname); break; } u->value=strdup(r); break; } case url_https : case url_http : case url_ftp : { u->value=strdup(val); break; } case url_unknown : { error(0,"Unknown URL-type:%s\n",val_copy); break; } default : { u->value=strdup(r); break; } } free(val_copy); return u; } /* Returns 1 if the string contains unsafe characters, 0 otherwise. */ int contains_unsafe (const char *s) { for (; *s; s++) if (strchr (URL_UNSAFE,(int) *s)||!ISPRINT((int)*s)) return 1; return 0; } /* Decodes the forms %xy in a URL to the character the hexadecimal code of which is xy. xy are hexadecimal digits from [0123456789ABCDEF] (case-insensitive). If x or y are not hex-digits or `%' precedes `\0', the sequence is inserted literally. */ void decode_string (char* s) { char *p = s; for (; *s; s++, p++) { if (*s != '%') *p = *s; else { /* Do nothing if at the end of the string, or if the chars are not hex-digits. */ if (!*(s + 1) || !*(s + 2) || !(ISXDIGIT (*(s + 1)) && ISXDIGIT (*(s + 2)))) { *p = *s; continue; } *p = (ASC2HEXD (*(s + 1)) << 4) + ASC2HEXD (*(s + 2)); s += 2; } } *p = '\0'; } /* Encodes the unsafe characters (listed in URL_UNSAFE) in a given string, returning a malloc-ed %XX encoded string. */ char* encode_string (const char* s) { const char *b; char *p, *res; int i; b = s; for (i = 0; *s; s++, i++){ if (strchr (URL_UNSAFE,(int) *s)||!ISPRINT((int)*s)){ i += 2; /* Two more characters (hex digits) */ } } res = (char *)malloc (i + 1); s = b; for (p = res; *s; s++){ if (strchr (URL_UNSAFE, *s)||!ISPRINT((int)*s)) { const unsigned char c = *s; *p++ = '%'; *p++ = HEXD2ASC (c >> 4); *p++ = HEXD2ASC (c & 0xf); } else { *p++ = *s; } } *p = '\0'; return res; } char* perm_to_char(mode_t perm) { char*pc=NULL; int i=0; pc=(char*)malloc(sizeof(char)*11); for(i=0;i<10;i++){ pc[i]='-'; } pc[10]='\0'; if(S_ISDIR(perm)) pc[0]='d'; #ifdef S_ISFIFO if(S_ISFIFO(perm)) pc[0]='p'; #endif if(S_ISLNK(perm)) pc[0]='l'; if(S_ISBLK(perm)) pc[0]='b'; if(S_ISCHR(perm)) pc[0]='c'; #ifdef S_ISDOOR if(S_ISDOOR(perm)) pc[0]='|'; #endif #ifdef S_ISSOCK if(S_ISSOCK(perm)) pc[0]='s'; #endif if((S_IRUSR&perm)==S_IRUSR){ pc[1]='r'; } if((S_IWUSR&perm)==S_IWUSR){ pc[2]='w'; } if((S_IXUSR&perm)==S_IXUSR){ pc[3]='x'; } if((S_IRGRP&perm)==S_IRGRP){ pc[4]='r'; } if((S_IWGRP&perm)==S_IWGRP){ pc[5]='w'; } if((S_IXGRP&perm)==S_IXGRP){ pc[6]='x'; } if((S_IROTH&perm)==S_IROTH){ pc[7]='r'; } if((S_IWOTH&perm)==S_IWOTH){ pc[8]='w'; } if((S_IXOTH&perm)==S_IXOTH){ pc[9]='x'; } if((S_ISUID&perm)==S_ISUID){ if((S_IXUSR&perm)==S_IXUSR){ pc[3]='s'; } else { pc[3]='S'; } } if((S_ISGID&perm)==S_ISGID){ if((S_IXGRP&perm)==S_IXGRP){ pc[6]='s'; } else { pc[6]='l'; } } #if defined (S_ISVTX) && defined (S_IXOTH) if((S_ISVTX&perm)==S_ISVTX){ if((S_IXOTH&perm)==S_IXOTH){ pc[9]='t'; } else { pc[9]='T'; } } #endif error(230,"perm_to_char(): %i -> %s\n",perm,pc); return pc; } void init_sighandler() { signal(SIGBUS,sig_handler); signal(SIGTERM,sig_handler); signal(SIGUSR1,sig_handler); signal(SIGUSR2,sig_handler); signal(SIGHUP,sig_handler); return; } void sig_handler(int signum) { switch(signum){ case SIGBUS : case SIGSEGV :{ error(200,"Caught SIGBUS/SIGSEGV\n"); if(conf->catch_mmap==1){ error(4,"Caught SIGBUS/SEGV while mmapping. File was truncated while aide was running?\n"); conf->catch_mmap=0; } else { error(0,"Caught SIGBUS/SEGV. Exiting\n"); exit(EXIT_FAILURE); } break; } case SIGHUP : { error(4,"Caught SIGHUP\n"); break; } case SIGTERM : { error(4,"Caught SIGTERM\nUse SIGKILL to terminate\n"); break; } case SIGUSR1 : { error(4,"Setting output to debug level according to signal\n"); conf->verbose_level=220; break; } case SIGUSR2 : { error(4,"Setting output to normal level according to signal\n"); conf->verbose_level=5; break; } } error(220,"Caught signal %d\n",signum); init_sighandler(); return; } char *expand_tilde(char *path) { char *homedir, *full; size_t path_len, homedir_len, full_len; if (path != NULL) { if (path[0] == '~') { if((homedir=getenv("HOME")) != NULL) { path_len = strlen(path+sizeof(char)); homedir_len = strlen(homedir); full_len = homedir_len+path_len; full = malloc(sizeof(char) * (full_len+1)); strncpy(full, homedir, homedir_len); strncpy(full+homedir_len, path+sizeof(char), path_len); full[full_len] = '\0'; free(path); /* Don't free(homedir); because it is not safe on some platforms */ path = full; } else { error(3, _("Variable name 'HOME' not found in environment. '~' cannot be expanded\n")); } } else if (path[0] == '\\' && path[1] == '~') { path += sizeof(char); } } return path; } /* Like strstr but only do search for maximum of n chars. haystack does not have to be NULL terminated needle has to be NULL terminated. NULL in needle is not used in compare. NULLs in haystack are ignored. */ #ifndef HAVE_STRNSTR char* strnstr(char* haystack,char* needle,int n) { char* h=haystack; char* s=needle; int slen=strlen(s); int i=0; for(i=0;imaxlen) return maxlen; return l; } #endif /* Lookup syslog facilities by name */ int syslog_facility_lookup(char *s) { if(!s || strlen(s)<1) return(AIDE_SYSLOG_FACILITY); #ifdef LOG_KERN if(strcasecmp(s,"LOG_KERN")==0) return(LOG_KERN); #endif #ifdef LOG_USER if(strcasecmp(s,"LOG_USER")==0) return(LOG_USER); #endif #ifdef LOG_MAIL if(strcasecmp(s,"LOG_MAIL")==0) return(LOG_MAIL); #endif #ifdef LOG_DAEMON if(strcasecmp(s,"LOG_DAEMON")==0) return(LOG_DAEMON); #endif #ifdef LOG_AUTH if(strcasecmp(s,"LOG_AUTH")==0) return(LOG_AUTH); #endif #ifdef LOG_SYSLOG if(strcasecmp(s,"LOG_SYSLOG")==0) return(LOG_SYSLOG); #endif #ifdef LOG_LPR if(strcasecmp(s,"LOG_LPR")==0) return(LOG_LPR); #endif #ifdef LOG_NEWS if(strcasecmp(s,"LOG_NEWS")==0) return(LOG_NEWS); #endif #ifdef LOG_UUCP if(strcasecmp(s,"LOG_UUCP")==0) return(LOG_UUCP); #endif #ifdef LOG_CRON if(strcasecmp(s,"LOG_CRON")==0) return(LOG_CRON); #endif #ifdef LOG_LOCAL0 if(strcasecmp(s,"LOG_LOCAL0")==0) return(LOG_LOCAL0); #endif #ifdef LOG_LOCAL1 if(strcasecmp(s,"LOG_LOCAL1")==0) return(LOG_LOCAL1); #endif #ifdef LOG_LOCAL2 if(strcasecmp(s,"LOG_LOCAL2")==0) return(LOG_LOCAL2); #endif #ifdef LOG_LOCAL3 if(strcasecmp(s,"LOG_LOCAL3")==0) return(LOG_LOCAL3); #endif #ifdef LOG_LOCAL4 if(strcasecmp(s,"LOG_LOCAL4")==0) return(LOG_LOCAL4); #endif #ifdef LOG_LOCAL5 if(strcasecmp(s,"LOG_LOCAL5")==0) return(LOG_LOCAL5); #endif #ifdef LOG_LOCAL6 if(strcasecmp(s,"LOG_LOCAL6")==0) return(LOG_LOCAL6); #endif #ifdef LOG_LOCAL7 if(strcasecmp(s,"LOG_LOCAL7")==0) return(LOG_LOCAL7); #endif error(0,"Syslog facility \"%s\" is unknown, using default\n",s); return(AIDE_SYSLOG_FACILITY); } /* We need these dummy stubs to fool the linker into believing that we do not need them at link time */ void* dlopen(char*filename,int flag) { return NULL; } void* dlsym(void*handle,char*symbol) { return NULL; } void* dlclose(void*handle) { return NULL; } const char* dlerror(void) { return NULL; } const char* aide_key_2=CONFHMACKEY_02; const char* db_key_2=DBHMACKEY_02; aide-0.16~a2.git20130520/version.m4000066400000000000000000000000601214657706600163230ustar00rootroot00000000000000m4_define([AIDE_VERSION], [0.16a2-19-g16ed855]) aide-0.16~a2.git20130520/ylwrap000077500000000000000000000143571214657706600156560ustar00rootroot00000000000000#! /bin/sh # ylwrap - wrapper for lex/yacc invocations. scriptversion=2011-08-25.18; # UTC # Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005, # 2007, 2009, 2010, 2011 Free Software Foundation, Inc. # # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . case "$1" in '') echo "$0: No files given. Try \`$0 --help' for more information." 1>&2 exit 1 ;; --basedir) basedir=$2 shift 2 ;; -h|--h*) cat <<\EOF Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]... Wrapper for lex/yacc invocations, renaming files as desired. INPUT is the input file OUTPUT is one file PROG generates DESIRED is the file we actually want instead of OUTPUT PROGRAM is program to run ARGS are passed to PROG Any number of OUTPUT,DESIRED pairs may be used. Report bugs to . EOF exit $? ;; -v|--v*) echo "ylwrap $scriptversion" exit $? ;; esac # The input. input="$1" shift case "$input" in [\\/]* | ?:[\\/]*) # Absolute path; do nothing. ;; *) # Relative path. Make it absolute. input="`pwd`/$input" ;; esac pairlist= while test "$#" -ne 0; do if test "$1" = "--"; then shift break fi pairlist="$pairlist $1" shift done # The program to run. prog="$1" shift # Make any relative path in $prog absolute. case "$prog" in [\\/]* | ?:[\\/]*) ;; *[\\/]*) prog="`pwd`/$prog" ;; esac # FIXME: add hostname here for parallel makes that run commands on # other machines. But that might take us over the 14-char limit. dirname=ylwrap$$ do_exit="cd '`pwd`' && rm -rf $dirname > /dev/null 2>&1;"' (exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 mkdir $dirname || exit 1 cd $dirname case $# in 0) "$prog" "$input" ;; *) "$prog" "$@" "$input" ;; esac ret=$? if test $ret -eq 0; then set X $pairlist shift first=yes # Since DOS filename conventions don't allow two dots, # the DOS version of Bison writes out y_tab.c instead of y.tab.c # and y_tab.h instead of y.tab.h. Test to see if this is the case. y_tab_nodot="no" if test -f y_tab.c || test -f y_tab.h; then y_tab_nodot="yes" fi # The directory holding the input. input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'` # Quote $INPUT_DIR so we can use it in a regexp. # FIXME: really we should care about more than `.' and `\'. input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'` while test "$#" -ne 0; do from="$1" # Handle y_tab.c and y_tab.h output by DOS if test $y_tab_nodot = "yes"; then if test $from = "y.tab.c"; then from="y_tab.c" else if test $from = "y.tab.h"; then from="y_tab.h" fi fi fi if test -f "$from"; then # If $2 is an absolute path name, then just use that, # otherwise prepend `../'. case "$2" in [\\/]* | ?:[\\/]*) target="$2";; *) target="../$2";; esac # We do not want to overwrite a header file if it hasn't # changed. This avoid useless recompilations. However the # parser itself (the first file) should always be updated, # because it is the destination of the .y.c rule in the # Makefile. Divert the output of all other files to a temporary # file so we can compare them to existing versions. if test $first = no; then realtarget="$target" target="tmp-`echo $target | sed s/.*[\\/]//g`" fi # Edit out `#line' or `#' directives. # # We don't want the resulting debug information to point at # an absolute srcdir; it is better for it to just mention the # .y file with no path. # # We want to use the real output file name, not yy.lex.c for # instance. # # We want the include guards to be adjusted too. FROM=`echo "$from" | sed \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` TARGET=`echo "$2" | sed \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` sed -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \ -e "s,$FROM,$TARGET," "$from" >"$target" || ret=$? # Check whether header files must be updated. if test $first = no; then if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then echo "$2" is unchanged rm -f "$target" else echo updating "$2" mv -f "$target" "$realtarget" fi fi else # A missing file is only an error for the first file. This # is a blatant hack to let us support using "yacc -d". If -d # is not specified, we don't want an error when the header # file is "missing". if test $first = yes; then ret=1 fi fi shift shift first=no done else ret=$? fi # Remove the directory. cd .. rm -rf $dirname exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: