From: <mad...@us...> - 2006-10-31 18:39:33
|
Revision: 2076 http://svn.sourceforge.net/selinux/?rev=2076&view=rev Author: madmethod Date: 2006-10-31 10:39:13 -0800 (Tue, 31 Oct 2006) Log Message: ----------- branch for libsepol 1.15.2 Added Paths: ----------- tags/libsepol_1_15_2/ tags/libsepol_1_15_2/libsepol/ tags/libsepol_1_15_2/libsepol/ChangeLog tags/libsepol_1_15_2/libsepol/VERSION tags/libsepol_1_15_2/libsepol/src/link.c Removed Paths: ------------- tags/libsepol_1_15_2/libsepol/ChangeLog tags/libsepol_1_15_2/libsepol/VERSION tags/libsepol_1_15_2/libsepol/src/link.c Copied: tags/libsepol_1_15_2/libsepol (from rev 2074, trunk/libsepol) Deleted: tags/libsepol_1_15_2/libsepol/ChangeLog =================================================================== --- trunk/libsepol/ChangeLog 2006-10-24 16:09:54 UTC (rev 2074) +++ tags/libsepol_1_15_2/libsepol/ChangeLog 2006-10-31 18:39:13 UTC (rev 2076) @@ -1,581 +0,0 @@ -1.15.1 2006-10-24 - * Merged fix for version comparison that was preventing range - transition rules from being written for a version 5 base policy - from Darrel Goeddel. - -1.14 2006-10-17 - * Updated version for release. - -1.12.28 2006-09-28 - * Build libsepol's static object files with -fpic - -1.12.27 2006-09-28 - * Merged mls user and range_transition support in modules - from Darrel Goeddel - -1.12.26 2006-09-05 - * Merged range transition enhancements and user format changes - Darrel Goeddel - -1.12.25 2006-08-24 - * Merged conditionally expand neverallows patch from Jeremy Mowery. - * Merged refactor expander patch from Jeremy Mowery. - -1.12.24 2006-08-03 - * Merged libsepol unit tests from Joshua Brindle. - -1.12.23 2006-08-03 - * Merged symtab datum patch from Karl MacMillan. - -1.12.22 2006-08-03 - * Merged netfilter contexts support from Chris PeBenito. - -1.12.21 2006-07-28 - * Merged helpful hierarchy check errors patch from Joshua Brindle. - -1.12.20 2006-07-25 - * Merged semodule_deps patch from Karl MacMillan. - This adds source module names to the avrule decls. - -1.12.19 2006-06-29 - * Lindent. - -1.12.18 2006-06-26 - * Merged optionals in base take 2 patch set from Joshua Brindle. - -1.12.17 2006-05-30 - * Revert 1.12.16. - -1.12.16 2006-05-30 - * Merged cleaner fix for bool_ids overflow from Karl MacMillan, - replacing the prior patch. - -1.12.15 2006-05-30 - * Merged fixes for several memory leaks in the error paths during - policy read from Serge Hallyn. - -1.12.14 2006-05-25 - * Fixed bool_ids overflow bug in cond_node_find and cond_copy_list, - based on bug report and suggested fix by Cedric Roux. - -1.12.13 2006-05-24 - * Merged sens_copy_callback, check_role_hierarchy_callback, - and node_from_record fixes from Serge Hallyn. - -1.12.12 2006-05-22 - * Added sepol_policydb_compat_net() interface for testing whether - a policy requires the compatibility support for network checks - to be enabled in the kernel. - -1.12.11 2006-05-17 - * Merged patch to initialize sym_val_to_name arrays from Kevin Carr. - Reworked to use calloc in the first place, and converted some other - malloc/memset pairs to calloc calls. - -1.12.10 2006-05-08 - * Merged patch to revert role/user decl upgrade from Karl MacMillan. - -1.12.9 2006-05-08 - * Dropped tests from all Makefile target. - -1.12.8 2006-05-05 - * Merged fix warnings patch from Karl MacMillan. - -1.12.7 2006-05-05 - * Merged libsepol test framework patch from Karl MacMillan. - -1.12.6 2006-04-28 - * Fixed cond_normalize to traverse the entire cond list at link time. - -1.12.5 2006-04-03 - * Merged fix for leak of optional package sections from Ivan Gyurdiev. - -1.12.4 2006-03-29 - * Generalize test for bitmap overflow in ebitmap_set_bit. - -1.12.3 2006-03-27 - * Fixed attr_convert_callback and expand_convert_type_set - typemap bug. - -1.12.2 2006-03-24 - * Fixed avrule_block_write num_decls endian bug. - -1.12.1 2006-03-20 - * Fixed sepol_module_package_write buffer overflow bug. - -1.12 2006-03-14 - * Updated version for release. - -1.11.20 2006-03-08 - * Merged cond_evaluate_expr fix from Serge Hallyn (IBM). - * Fixed bug in copy_avrule_list reported by Ivan Gyurdiev. - -1.11.19 2006-02-21 - * Merged sepol_policydb_mls_enabled interface and error handling - changes from Ivan Gyurdiev. - -1.11.18 2006-02-16 - * Merged node_expand_addr bugfix and node_compare* change from - Ivan Gyurdiev. - -1.11.17 2006-02-15 - * Merged nodes, ports: always prepend patch from Ivan Gyurdiev. - * Merged bug fix patch from Ivan Gyurdiev. - -1.11.16 2006-02-14 - * Added a defined flag to level_datum_t for use by checkpolicy. - -1.11.15 2006-02-14 - * Merged nodecon support patch from Ivan Gyurdiev. - * Merged cleanups patch from Ivan Gyurdiev. - -1.11.14 2006-02-13 - * Merged optionals in base patch from Joshua Brindle. - -1.11.13 2006-02-07 - * Merged seuser/user_extra support patch from Joshua Brindle. - * Merged fix patch from Ivan Gyurdiev. - -1.11.12 2006-02-02 - * Merged clone record on set_con patch from Ivan Gyurdiev. - -1.11.11 2006-02-01 - * Merged assertion copying bugfix from Joshua Brindle. - * Merged sepol_av_to_string patch from Joshua Brindle. - -1.11.10 2006-01-30 - * Merged cond_expr mapping and package section count bug fixes - from Joshua Brindle. - * Merged improve port/fcontext API patch from Ivan Gyurdiev. - * Merged fixes for overflow bugs on 64-bit from Ivan Gyurdiev. - -1.11.9 2006-01-12 - * Merged size_t -> unsigned int patch from Ivan Gyurdiev. - -1.11.8 2006-01-09 - * Merged 2nd const in APIs patch from Ivan Gyurdiev. - -1.11.7 2006-01-06 - * Merged const in APIs patch from Ivan Gyurdiev. - * Merged compare2 function patch from Ivan Gyurdiev. - -1.11.6 2006-01-06 - * Fixed hierarchy checker to only check allow rules. - -1.11.5 2006-01-05 - * Merged further fixes from Russell Coker, specifically: - - av_to_string overflow checking - - sepol_context_to_string error handling - - hierarchy checking memory leak fixes and optimizations - - avrule_block_read variable initialization - * Marked deprecated code in genbools and genusers. - -1.11.4 2006-01-05 - * Merged bugfix for sepol_port_modify from Russell Coker. - -1.11.3 2006-01-05 - * Fixed bug in sepol_iface_modify error path noted by Ivan Gyurdiev. - * Merged port ordering patch from Ivan Gyurdiev. - -1.11.2 2006-01-04 - * Merged patch series from Ivan Gyurdiev. - This includes patches to: - - support ordering of records in compare function - - enable port interfaces - - add interfaces for context validity and range checks - - add include guards - -1.11.1 2005-12-16 - * Fixed mls_range_cpy bug. - -1.10 2005-12-07 - * Updated version for release. - -1.9.42 2005-12-05 - * Dropped handle from user_del_role interface. - -1.9.41 2005-11-28 - * Merged remove defrole from sepol patch from Ivan Gyurdiev. - -1.9.40 2005-11-15 - * Merged module function and map file cleanup from Ivan Gyurdiev. - * Merged MLS and genusers cleanups from Ivan Gyurdiev. - -1.9.39 2005-11-09 - Prepare for removal of booleans* and *.users files. - * Cleaned up sepol_genbools to not regenerate the image if - there were no changes in the boolean values, including the - degenerate case where there are no booleans or booleans.local - files. - * Cleaned up sepol_genusers to not warn on missing local.users. - -1.9.38 2005-11-08 - * Removed sepol_port_* from libsepol.map, as the port interfaces - are not yet stable. - -1.9.37 2005-11-04 - * Merged context destroy cleanup patch from Ivan Gyurdiev. - -1.9.36 2005-11-03 - * Merged context_to_string interface change patch from Ivan Gyurdiev. - -1.9.35 2005-11-01 - * Added src/dso.h and src/*_internal.h. - Added hidden_def for exported symbols used within libsepol. - Added hidden for symbols that should not be exported by - the wildcards in libsepol.map. - -1.9.34 2005-10-31 - * Merged record interface, record bugfix, and set_roles patches - from Ivan Gyurdiev. - -1.9.33 2005-10-27 - * Merged count specification change from Ivan Gyurdiev. - -1.9.32 2005-10-26 - * Added further checking and error reporting to - sepol_module_package_read and _info. - -1.9.31 2005-10-26 - * Merged sepol handle passing, DEBUG conversion, and memory leak - fix patches from Ivan Gyurdiev. - -1.9.30 2005-10-25 - * Removed processing of system.users from sepol_genusers and - dropped delusers logic. - -1.9.29 2005-10-25 - * Removed policydb_destroy from error path of policydb_read, - since create/init/destroy/free of policydb is handled by the - caller now. - * Fixed sepol_module_package_read to handle a failed policydb_read - properly. - -1.9.28 2005-10-25 - * Merged query/exists and count patches from Ivan Gyurdiev. - -1.9.27 2005-10-25 - * Merged fix for pruned types in expand code from Joshua Brindle. - * Merged new module package format code from Joshua Brindle. - -1.9.26 2005-10-24 - * Merged context interface cleanup, record conversion code, - key passing, and bug fix patches from Ivan Gyurdiev. - -1.9.25 2005-10-21 - * Merged users cleanup patch from Ivan Gyurdiev. - -1.9.24 2005-10-21 - * Merged user record memory leak fix from Ivan Gyurdiev. - * Merged reorganize users patch from Ivan Gyurdiev. - -1.9.23 2005-10-19 - * Added check flag to expand_module() to control assertion - and hierarchy checking on expansion. - -1.9.22 2005-10-19 - * Reworked check_assertions() and hierarchy_check_constraints() - to take handles and use callback-based error reporting. - * Changed expand_module() to call check_assertions() and - hierarchy_check_constraints() prior to returning the expanded - policy. - -1.9.21 2005-10-18 - * Changed sepol_module_package_set_file_contexts to copy the - file contexts data since it is internally managed. - -1.9.20 2005-10-18 - * Added sepol_policy_file_set_handle interface to associate - a handle with a policy file. - * Added handle argument to policydb_from_image/to_image. - * Added sepol_module_package_set_file_contexts interface. - * Dropped sepol_module_package_create_file interface. - * Reworked policydb_read/write, policydb_from_image/to_image, - and sepol_module_package_read/write to use callback-based error - reporting system rather than DEBUG. - -1.9.19 2005-10-17 - * Reworked link_packages, link_modules, and expand_module to use - callback-based error reporting system rather than error buffering. - -1.9.18 2005-10-14 - * Merged conditional expression mapping fix in the module linking - code from Joshua Brindle. - -1.9.17 2005-10-13 - * Hid sepol_module_package type definition, and added get interfaces. - -1.9.16 2005-10-13 - * Merged new callback-based error reporting system from Ivan - Gyurdiev. - -1.9.15 2005-10-13 - * Merged support for require blocks inside conditionals from - Joshua Brindle (Tresys). - -1.9.14 2005-10-07 - * Fixed use of policydb_from_image/to_image to ensure proper - init of policydb. - -1.9.13 2005-10-07 - * Isolated policydb internal headers under <sepol/policydb/*.h>. - These headers should only be used by users of the static libsepol. - Created new <sepol/policydb.h> with new public types and interfaces - for shared libsepol. - Created new <sepol/module.h> with public types and interfaces moved - or wrapped from old module.h, link.h, and expand.h, adjusted for - new public types for policydb and policy_file. - Added public interfaces to libsepol.map. - Some implementation changes visible to users of the static libsepol: - 1) policydb_read no longer calls policydb_init. - Caller must do so first. - 2) policydb_init no longer takes policy_type argument. - Caller must set policy_type separately. - 3) expand_module automatically enables the global branch. - Caller no longer needs to do so. - 4) policydb_write uses the policy_type and policyvers from the - policydb itself, and sepol_set_policyvers() has been removed. - -1.9.12 2005-10-06 - * Merged function renaming and static cleanup from Ivan Gyurdiev. - -1.9.11 2005-10-05 - * Merged bug fix for check_assertions handling of no assertions - from Joshua Brindle (Tresys). - -1.9.10 2005-10-04 - * Merged iterate patch from Ivan Gyurdiev. - -1.9.9 2005-10-03 - * Merged MLS in modules patch from Joshua Brindle (Tresys). - -1.9.8 2005-09-30 - * Merged pointer typedef elimination patch from Ivan Gyurdiev. - * Merged user list function, new mls functions, and bugfix patch - from Ivan Gyurdiev. - -1.9.7 2005-09-28 - * Merged sepol_get_num_roles fix from Karl MacMillan (Tresys). - -1.9.6 2005-09-23 - * Merged bug fix patches from Joshua Brindle (Tresys). - -1.9.5 2005-09-21 - * Merged boolean record and memory leak fix patches from Ivan - Gyurdiev. - -1.9.4 2005-09-19 - * Merged interface record patch from Ivan Gyurdiev. - -1.9.3 2005-09-14 - * Merged fix for sepol_enable/disable_debug from Ivan - Gyurdiev. - -1.9.2 2005-09-14 - * Merged stddef.h patch and debug conversion patch from - Ivan Gyurdiev. - -1.9.1 2005-09-09 - * Fixed expand_avtab and expand_cond_av_list to keep separate - entries with identical keys but different enabled flags. - -1.8 2005-09-06 - * Updated version for release. - -1.7.24 2005-08-31 - * Fixed symtab_insert return value for duplicate declarations. - -1.7.23 2005-08-31 - * Merged fix for memory error in policy_module_destroy from - Jason Tang (Tresys). - -1.7.22 2005-08-26 - * Merged fix for memory leak in sepol_context_to_sid from - Jason Tang (Tresys). - -1.7.21 2005-08-25 - * Merged fixes for resource leaks on error paths and - change to scope_destroy from Joshua Brindle (Tresys). - -1.7.20 2005-08-23 - * Merged more fixes for resource leaks on error paths - from Serge Hallyn (IBM). Bugs found by Coverity. - -1.7.19 2005-08-19 - * Changed to treat all type conflicts as fatal errors. - -1.7.18 2005-08-18 - * Merged several error handling fixes from - Serge Hallyn (IBM). Bugs found by Coverity. - -1.7.17 2005-08-15 - * Fixed further memory leaks found by valgrind. - -1.7.16 2005-08-15 - * Fixed several memory leaks found by valgrind. - -1.7.15 2005-08-12 - * Fixed empty list test in cond_write_av_list. Bug found by - Coverity, reported by Serge Hallyn (IBM). - * Merged patch to policydb_write to check errors - when writing the type->attribute reverse map from - Serge Hallyn (IBM). Bug found by Coverity. - * Fixed policydb_destroy to properly handle NULL type_attr_map - or attr_type_map. - -1.7.14 2005-08-12 - * Fixed use of uninitialized data by expand_avtab_node by - clearing type_val_to_struct in policydb_index_others. - -1.7.13 2005-08-11 - * Improved memory use by SELinux by both reducing the avtab - node size and reducing the number of avtab nodes (by not - expanding attributes in TE rules when possible). Added - expand_avtab and expand_cond_av_list functions for use by - assertion checker, hierarchy checker, compatibility code, - and dispol. Added new inline ebitmap operators and converted - existing users of ebitmaps to the new operators for greater - efficiency. - Note: The binary policy format version has been incremented to - version 20 as a result of these changes. - -1.7.12 2005-08-10 - * Fixed bug in constraint_node_clone handling of name sets. - -1.7.11 2005-08-08 - * Fix range_trans_clone to map the type values properly. - -1.7.10 2005-08-02 - * Merged patch to move module read/write code from libsemanage - to libsepol from Jason Tang (Tresys). - -1.7.9 2005-08-02 - * Enabled further compiler warning flags and fixed them. - -1.7.8 2005-08-02 - * Merged user, context, port records patch from Ivan Gyurdiev. - * Merged key extract function patch from Ivan Gyurdiev. - -1.7.7 2005-07-27 - * Merged mls_context_to_sid bugfix from Ivan Gyurdiev. - -1.7.6 2005-07-26 - * Merged context reorganization, memory leak fixes, - port and interface loading, replacements for genusers and - genbools, debug traceback, and bugfix patches from Ivan Gyurdiev. - * Merged uninitialized variable bugfix from Dan Walsh. - -1.7.5 2005-07-18 - * Merged debug support, policydb conversion functions from Ivan Gyurdiev (Red Hat). - * Removed genpolbools and genpolusers utilities. - -1.7.4 2005-07-18 - * Merged hierarchy check fix from Joshua Brindle (Tresys). - -1.7.3 2005-07-13 - * Merged header file cleanup and memory leak fix from Ivan Gyurdiev (Red Hat). - -1.7.2 2005-07-11 - * Merged genbools debugging message cleanup from Red Hat. - -1.7.1 2005-07-06 - * Merged loadable module support from Tresys Technology. - -1.6 2005-06-20 - * Updated version for release. - -1.5.10 2005-05-19 - * License changed to LGPL v2.1, see COPYING. - -1.5.9 2005-05-16 - * Added sepol_genbools_policydb and sepol_genusers_policydb for - audit2why. - -1.5.8 2005-05-13 - * Added sepol_ prefix to Flask types to avoid - namespace collision with libselinux. - -1.5.7 2005-05-13 - * Added sepol_compute_av_reason() for audit2why. - -1.5.6 2005-04-25 - * Fixed bug in role hierarchy checker. - -1.5.5 2005-04-13 - * Merged hierarchical type/role patch from Tresys Technology. - * Merged MLS fixes from Darrel Goeddel of TCS. - -1.5.4 2005-04-13 - * Changed sepol_genusers to not delete users by default, - and added a sepol_set_delusers function to enable deletion. - Also, removed special case handling of system_u and user_u. - -1.5.3 2005-03-29 - * Merged booleans.local patch from Dan Walsh. - -1.5.2 2005-03-16 - * Added man page for sepol_check_context. - -1.5.1 2005-03-15 - * Added man page for sepol_genusers function. - * Merged man pages for genpolusers and chkcon from Manoj Srivastava. - -1.4 2005-03-09 - * Updated version for release. - -1.3.8 2005-03-08 - * Cleaned up error handling in sepol_genusers and sepol_genbools. - -1.3.7 2005-02-28 - * Merged sepol_debug and fclose patch from Dan Walsh. - -1.3.6 2005-02-22 - * Changed sepol_genusers to also use getline and correctly handle - EOL. - -1.3.5 2005-02-17 - * Merged range_transition support from Darrel Goeddel (TCS). - -1.3.4 2005-02-16 - * Added sepol_genusers function. - -1.3.3 2005-02-14 - * Merged endianness and compute_av patches from Darrel Goeddel (TCS). - -1.3.2 2005-02-09 - * Changed relabel Makefile target to use restorecon. - -1.3.1 2005-01-26 - * Merged enhanced MLS support from Darrel Goeddel (TCS). - -1.2.1 2005-01-19 - * Merged build fix patch from Manoj Srivastava. - -1.2 2004-10-07 - * MLS build fixes. - * Added sepol_set_policydb_from_file and sepol_check_context for setfiles. - -1.0 2004-08-19 - * Initial public release. - -0.4 2004-08-13 - * Merged patch from Dan Walsh to ignore case on booleans. - * Changed sepol_genbools* to preserve the original policy version. - * Replaced exported global variables with set functions. - * Moved genpolbools utility from checkpolicy to libsepol. - * Added man pages for sepol_genbools* and genpolbools. - -0.3 2004-08-10 - * Added ChangeLog, COPYING, spec file. - * Added sepol_genbools_array() for load_policy. - * Created libsepol.map to limit exported symbols in shared library. - -0.2 2004-08-09 - * Exported other functions for checkpolicy and friends. - * Renamed service and sidtab functions to avoid libselinux conflict. - * Removed original code from checkpolicy, which now uses libsepol. - * Code cleanup: kill legacy references to kernel types/functions. - -0.1 2004-08-06 - * Moved checkpolicy core logic into a library. - * Exported sepol_genbools() for load_policy. Copied: tags/libsepol_1_15_2/libsepol/ChangeLog (from rev 2075, trunk/libsepol/ChangeLog) =================================================================== --- tags/libsepol_1_15_2/libsepol/ChangeLog (rev 0) +++ tags/libsepol_1_15_2/libsepol/ChangeLog 2006-10-31 18:39:13 UTC (rev 2076) @@ -0,0 +1,585 @@ +1.15.2 2006-10-31 + * Merged fix from Karl MacMillan for a segfault when linking + non-MLS modules with users in them. + +1.15.1 2006-10-24 + * Merged fix for version comparison that was preventing range + transition rules from being written for a version 5 base policy + from Darrel Goeddel. + +1.14 2006-10-17 + * Updated version for release. + +1.12.28 2006-09-28 + * Build libsepol's static object files with -fpic + +1.12.27 2006-09-28 + * Merged mls user and range_transition support in modules + from Darrel Goeddel + +1.12.26 2006-09-05 + * Merged range transition enhancements and user format changes + Darrel Goeddel + +1.12.25 2006-08-24 + * Merged conditionally expand neverallows patch from Jeremy Mowery. + * Merged refactor expander patch from Jeremy Mowery. + +1.12.24 2006-08-03 + * Merged libsepol unit tests from Joshua Brindle. + +1.12.23 2006-08-03 + * Merged symtab datum patch from Karl MacMillan. + +1.12.22 2006-08-03 + * Merged netfilter contexts support from Chris PeBenito. + +1.12.21 2006-07-28 + * Merged helpful hierarchy check errors patch from Joshua Brindle. + +1.12.20 2006-07-25 + * Merged semodule_deps patch from Karl MacMillan. + This adds source module names to the avrule decls. + +1.12.19 2006-06-29 + * Lindent. + +1.12.18 2006-06-26 + * Merged optionals in base take 2 patch set from Joshua Brindle. + +1.12.17 2006-05-30 + * Revert 1.12.16. + +1.12.16 2006-05-30 + * Merged cleaner fix for bool_ids overflow from Karl MacMillan, + replacing the prior patch. + +1.12.15 2006-05-30 + * Merged fixes for several memory leaks in the error paths during + policy read from Serge Hallyn. + +1.12.14 2006-05-25 + * Fixed bool_ids overflow bug in cond_node_find and cond_copy_list, + based on bug report and suggested fix by Cedric Roux. + +1.12.13 2006-05-24 + * Merged sens_copy_callback, check_role_hierarchy_callback, + and node_from_record fixes from Serge Hallyn. + +1.12.12 2006-05-22 + * Added sepol_policydb_compat_net() interface for testing whether + a policy requires the compatibility support for network checks + to be enabled in the kernel. + +1.12.11 2006-05-17 + * Merged patch to initialize sym_val_to_name arrays from Kevin Carr. + Reworked to use calloc in the first place, and converted some other + malloc/memset pairs to calloc calls. + +1.12.10 2006-05-08 + * Merged patch to revert role/user decl upgrade from Karl MacMillan. + +1.12.9 2006-05-08 + * Dropped tests from all Makefile target. + +1.12.8 2006-05-05 + * Merged fix warnings patch from Karl MacMillan. + +1.12.7 2006-05-05 + * Merged libsepol test framework patch from Karl MacMillan. + +1.12.6 2006-04-28 + * Fixed cond_normalize to traverse the entire cond list at link time. + +1.12.5 2006-04-03 + * Merged fix for leak of optional package sections from Ivan Gyurdiev. + +1.12.4 2006-03-29 + * Generalize test for bitmap overflow in ebitmap_set_bit. + +1.12.3 2006-03-27 + * Fixed attr_convert_callback and expand_convert_type_set + typemap bug. + +1.12.2 2006-03-24 + * Fixed avrule_block_write num_decls endian bug. + +1.12.1 2006-03-20 + * Fixed sepol_module_package_write buffer overflow bug. + +1.12 2006-03-14 + * Updated version for release. + +1.11.20 2006-03-08 + * Merged cond_evaluate_expr fix from Serge Hallyn (IBM). + * Fixed bug in copy_avrule_list reported by Ivan Gyurdiev. + +1.11.19 2006-02-21 + * Merged sepol_policydb_mls_enabled interface and error handling + changes from Ivan Gyurdiev. + +1.11.18 2006-02-16 + * Merged node_expand_addr bugfix and node_compare* change from + Ivan Gyurdiev. + +1.11.17 2006-02-15 + * Merged nodes, ports: always prepend patch from Ivan Gyurdiev. + * Merged bug fix patch from Ivan Gyurdiev. + +1.11.16 2006-02-14 + * Added a defined flag to level_datum_t for use by checkpolicy. + +1.11.15 2006-02-14 + * Merged nodecon support patch from Ivan Gyurdiev. + * Merged cleanups patch from Ivan Gyurdiev. + +1.11.14 2006-02-13 + * Merged optionals in base patch from Joshua Brindle. + +1.11.13 2006-02-07 + * Merged seuser/user_extra support patch from Joshua Brindle. + * Merged fix patch from Ivan Gyurdiev. + +1.11.12 2006-02-02 + * Merged clone record on set_con patch from Ivan Gyurdiev. + +1.11.11 2006-02-01 + * Merged assertion copying bugfix from Joshua Brindle. + * Merged sepol_av_to_string patch from Joshua Brindle. + +1.11.10 2006-01-30 + * Merged cond_expr mapping and package section count bug fixes + from Joshua Brindle. + * Merged improve port/fcontext API patch from Ivan Gyurdiev. + * Merged fixes for overflow bugs on 64-bit from Ivan Gyurdiev. + +1.11.9 2006-01-12 + * Merged size_t -> unsigned int patch from Ivan Gyurdiev. + +1.11.8 2006-01-09 + * Merged 2nd const in APIs patch from Ivan Gyurdiev. + +1.11.7 2006-01-06 + * Merged const in APIs patch from Ivan Gyurdiev. + * Merged compare2 function patch from Ivan Gyurdiev. + +1.11.6 2006-01-06 + * Fixed hierarchy checker to only check allow rules. + +1.11.5 2006-01-05 + * Merged further fixes from Russell Coker, specifically: + - av_to_string overflow checking + - sepol_context_to_string error handling + - hierarchy checking memory leak fixes and optimizations + - avrule_block_read variable initialization + * Marked deprecated code in genbools and genusers. + +1.11.4 2006-01-05 + * Merged bugfix for sepol_port_modify from Russell Coker. + +1.11.3 2006-01-05 + * Fixed bug in sepol_iface_modify error path noted by Ivan Gyurdiev. + * Merged port ordering patch from Ivan Gyurdiev. + +1.11.2 2006-01-04 + * Merged patch series from Ivan Gyurdiev. + This includes patches to: + - support ordering of records in compare function + - enable port interfaces + - add interfaces for context validity and range checks + - add include guards + +1.11.1 2005-12-16 + * Fixed mls_range_cpy bug. + +1.10 2005-12-07 + * Updated version for release. + +1.9.42 2005-12-05 + * Dropped handle from user_del_role interface. + +1.9.41 2005-11-28 + * Merged remove defrole from sepol patch from Ivan Gyurdiev. + +1.9.40 2005-11-15 + * Merged module function and map file cleanup from Ivan Gyurdiev. + * Merged MLS and genusers cleanups from Ivan Gyurdiev. + +1.9.39 2005-11-09 + Prepare for removal of booleans* and *.users files. + * Cleaned up sepol_genbools to not regenerate the image if + there were no changes in the boolean values, including the + degenerate case where there are no booleans or booleans.local + files. + * Cleaned up sepol_genusers to not warn on missing local.users. + +1.9.38 2005-11-08 + * Removed sepol_port_* from libsepol.map, as the port interfaces + are not yet stable. + +1.9.37 2005-11-04 + * Merged context destroy cleanup patch from Ivan Gyurdiev. + +1.9.36 2005-11-03 + * Merged context_to_string interface change patch from Ivan Gyurdiev. + +1.9.35 2005-11-01 + * Added src/dso.h and src/*_internal.h. + Added hidden_def for exported symbols used within libsepol. + Added hidden for symbols that should not be exported by + the wildcards in libsepol.map. + +1.9.34 2005-10-31 + * Merged record interface, record bugfix, and set_roles patches + from Ivan Gyurdiev. + +1.9.33 2005-10-27 + * Merged count specification change from Ivan Gyurdiev. + +1.9.32 2005-10-26 + * Added further checking and error reporting to + sepol_module_package_read and _info. + +1.9.31 2005-10-26 + * Merged sepol handle passing, DEBUG conversion, and memory leak + fix patches from Ivan Gyurdiev. + +1.9.30 2005-10-25 + * Removed processing of system.users from sepol_genusers and + dropped delusers logic. + +1.9.29 2005-10-25 + * Removed policydb_destroy from error path of policydb_read, + since create/init/destroy/free of policydb is handled by the + caller now. + * Fixed sepol_module_package_read to handle a failed policydb_read + properly. + +1.9.28 2005-10-25 + * Merged query/exists and count patches from Ivan Gyurdiev. + +1.9.27 2005-10-25 + * Merged fix for pruned types in expand code from Joshua Brindle. + * Merged new module package format code from Joshua Brindle. + +1.9.26 2005-10-24 + * Merged context interface cleanup, record conversion code, + key passing, and bug fix patches from Ivan Gyurdiev. + +1.9.25 2005-10-21 + * Merged users cleanup patch from Ivan Gyurdiev. + +1.9.24 2005-10-21 + * Merged user record memory leak fix from Ivan Gyurdiev. + * Merged reorganize users patch from Ivan Gyurdiev. + +1.9.23 2005-10-19 + * Added check flag to expand_module() to control assertion + and hierarchy checking on expansion. + +1.9.22 2005-10-19 + * Reworked check_assertions() and hierarchy_check_constraints() + to take handles and use callback-based error reporting. + * Changed expand_module() to call check_assertions() and + hierarchy_check_constraints() prior to returning the expanded + policy. + +1.9.21 2005-10-18 + * Changed sepol_module_package_set_file_contexts to copy the + file contexts data since it is internally managed. + +1.9.20 2005-10-18 + * Added sepol_policy_file_set_handle interface to associate + a handle with a policy file. + * Added handle argument to policydb_from_image/to_image. + * Added sepol_module_package_set_file_contexts interface. + * Dropped sepol_module_package_create_file interface. + * Reworked policydb_read/write, policydb_from_image/to_image, + and sepol_module_package_read/write to use callback-based error + reporting system rather than DEBUG. + +1.9.19 2005-10-17 + * Reworked link_packages, link_modules, and expand_module to use + callback-based error reporting system rather than error buffering. + +1.9.18 2005-10-14 + * Merged conditional expression mapping fix in the module linking + code from Joshua Brindle. + +1.9.17 2005-10-13 + * Hid sepol_module_package type definition, and added get interfaces. + +1.9.16 2005-10-13 + * Merged new callback-based error reporting system from Ivan + Gyurdiev. + +1.9.15 2005-10-13 + * Merged support for require blocks inside conditionals from + Joshua Brindle (Tresys). + +1.9.14 2005-10-07 + * Fixed use of policydb_from_image/to_image to ensure proper + init of policydb. + +1.9.13 2005-10-07 + * Isolated policydb internal headers under <sepol/policydb/*.h>. + These headers should only be used by users of the static libsepol. + Created new <sepol/policydb.h> with new public types and interfaces + for shared libsepol. + Created new <sepol/module.h> with public types and interfaces moved + or wrapped from old module.h, link.h, and expand.h, adjusted for + new public types for policydb and policy_file. + Added public interfaces to libsepol.map. + Some implementation changes visible to users of the static libsepol: + 1) policydb_read no longer calls policydb_init. + Caller must do so first. + 2) policydb_init no longer takes policy_type argument. + Caller must set policy_type separately. + 3) expand_module automatically enables the global branch. + Caller no longer needs to do so. + 4) policydb_write uses the policy_type and policyvers from the + policydb itself, and sepol_set_policyvers() has been removed. + +1.9.12 2005-10-06 + * Merged function renaming and static cleanup from Ivan Gyurdiev. + +1.9.11 2005-10-05 + * Merged bug fix for check_assertions handling of no assertions + from Joshua Brindle (Tresys). + +1.9.10 2005-10-04 + * Merged iterate patch from Ivan Gyurdiev. + +1.9.9 2005-10-03 + * Merged MLS in modules patch from Joshua Brindle (Tresys). + +1.9.8 2005-09-30 + * Merged pointer typedef elimination patch from Ivan Gyurdiev. + * Merged user list function, new mls functions, and bugfix patch + from Ivan Gyurdiev. + +1.9.7 2005-09-28 + * Merged sepol_get_num_roles fix from Karl MacMillan (Tresys). + +1.9.6 2005-09-23 + * Merged bug fix patches from Joshua Brindle (Tresys). + +1.9.5 2005-09-21 + * Merged boolean record and memory leak fix patches from Ivan + Gyurdiev. + +1.9.4 2005-09-19 + * Merged interface record patch from Ivan Gyurdiev. + +1.9.3 2005-09-14 + * Merged fix for sepol_enable/disable_debug from Ivan + Gyurdiev. + +1.9.2 2005-09-14 + * Merged stddef.h patch and debug conversion patch from + Ivan Gyurdiev. + +1.9.1 2005-09-09 + * Fixed expand_avtab and expand_cond_av_list to keep separate + entries with identical keys but different enabled flags. + +1.8 2005-09-06 + * Updated version for release. + +1.7.24 2005-08-31 + * Fixed symtab_insert return value for duplicate declarations. + +1.7.23 2005-08-31 + * Merged fix for memory error in policy_module_destroy from + Jason Tang (Tresys). + +1.7.22 2005-08-26 + * Merged fix for memory leak in sepol_context_to_sid from + Jason Tang (Tresys). + +1.7.21 2005-08-25 + * Merged fixes for resource leaks on error paths and + change to scope_destroy from Joshua Brindle (Tresys). + +1.7.20 2005-08-23 + * Merged more fixes for resource leaks on error paths + from Serge Hallyn (IBM). Bugs found by Coverity. + +1.7.19 2005-08-19 + * Changed to treat all type conflicts as fatal errors. + +1.7.18 2005-08-18 + * Merged several error handling fixes from + Serge Hallyn (IBM). Bugs found by Coverity. + +1.7.17 2005-08-15 + * Fixed further memory leaks found by valgrind. + +1.7.16 2005-08-15 + * Fixed several memory leaks found by valgrind. + +1.7.15 2005-08-12 + * Fixed empty list test in cond_write_av_list. Bug found by + Coverity, reported by Serge Hallyn (IBM). + * Merged patch to policydb_write to check errors + when writing the type->attribute reverse map from + Serge Hallyn (IBM). Bug found by Coverity. + * Fixed policydb_destroy to properly handle NULL type_attr_map + or attr_type_map. + +1.7.14 2005-08-12 + * Fixed use of uninitialized data by expand_avtab_node by + clearing type_val_to_struct in policydb_index_others. + +1.7.13 2005-08-11 + * Improved memory use by SELinux by both reducing the avtab + node size and reducing the number of avtab nodes (by not + expanding attributes in TE rules when possible). Added + expand_avtab and expand_cond_av_list functions for use by + assertion checker, hierarchy checker, compatibility code, + and dispol. Added new inline ebitmap operators and converted + existing users of ebitmaps to the new operators for greater + efficiency. + Note: The binary policy format version has been incremented to + version 20 as a result of these changes. + +1.7.12 2005-08-10 + * Fixed bug in constraint_node_clone handling of name sets. + +1.7.11 2005-08-08 + * Fix range_trans_clone to map the type values properly. + +1.7.10 2005-08-02 + * Merged patch to move module read/write code from libsemanage + to libsepol from Jason Tang (Tresys). + +1.7.9 2005-08-02 + * Enabled further compiler warning flags and fixed them. + +1.7.8 2005-08-02 + * Merged user, context, port records patch from Ivan Gyurdiev. + * Merged key extract function patch from Ivan Gyurdiev. + +1.7.7 2005-07-27 + * Merged mls_context_to_sid bugfix from Ivan Gyurdiev. + +1.7.6 2005-07-26 + * Merged context reorganization, memory leak fixes, + port and interface loading, replacements for genusers and + genbools, debug traceback, and bugfix patches from Ivan Gyurdiev. + * Merged uninitialized variable bugfix from Dan Walsh. + +1.7.5 2005-07-18 + * Merged debug support, policydb conversion functions from Ivan Gyurdiev (Red Hat). + * Removed genpolbools and genpolusers utilities. + +1.7.4 2005-07-18 + * Merged hierarchy check fix from Joshua Brindle (Tresys). + +1.7.3 2005-07-13 + * Merged header file cleanup and memory leak fix from Ivan Gyurdiev (Red Hat). + +1.7.2 2005-07-11 + * Merged genbools debugging message cleanup from Red Hat. + +1.7.1 2005-07-06 + * Merged loadable module support from Tresys Technology. + +1.6 2005-06-20 + * Updated version for release. + +1.5.10 2005-05-19 + * License changed to LGPL v2.1, see COPYING. + +1.5.9 2005-05-16 + * Added sepol_genbools_policydb and sepol_genusers_policydb for + audit2why. + +1.5.8 2005-05-13 + * Added sepol_ prefix to Flask types to avoid + namespace collision with libselinux. + +1.5.7 2005-05-13 + * Added sepol_compute_av_reason() for audit2why. + +1.5.6 2005-04-25 + * Fixed bug in role hierarchy checker. + +1.5.5 2005-04-13 + * Merged hierarchical type/role patch from Tresys Technology. + * Merged MLS fixes from Darrel Goeddel of TCS. + +1.5.4 2005-04-13 + * Changed sepol_genusers to not delete users by default, + and added a sepol_set_delusers function to enable deletion. + Also, removed special case handling of system_u and user_u. + +1.5.3 2005-03-29 + * Merged booleans.local patch from Dan Walsh. + +1.5.2 2005-03-16 + * Added man page for sepol_check_context. + +1.5.1 2005-03-15 + * Added man page for sepol_genusers function. + * Merged man pages for genpolusers and chkcon from Manoj Srivastava. + +1.4 2005-03-09 + * Updated version for release. + +1.3.8 2005-03-08 + * Cleaned up error handling in sepol_genusers and sepol_genbools. + +1.3.7 2005-02-28 + * Merged sepol_debug and fclose patch from Dan Walsh. + +1.3.6 2005-02-22 + * Changed sepol_genusers to also use getline and correctly handle + EOL. + +1.3.5 2005-02-17 + * Merged range_transition support from Darrel Goeddel (TCS). + +1.3.4 2005-02-16 + * Added sepol_genusers function. + +1.3.3 2005-02-14 + * Merged endianness and compute_av patches from Darrel Goeddel (TCS). + +1.3.2 2005-02-09 + * Changed relabel Makefile target to use restorecon. + +1.3.1 2005-01-26 + * Merged enhanced MLS support from Darrel Goeddel (TCS). + +1.2.1 2005-01-19 + * Merged build fix patch from Manoj Srivastava. + +1.2 2004-10-07 + * MLS build fixes. + * Added sepol_set_policydb_from_file and sepol_check_context for setfiles. + +1.0 2004-08-19 + * Initial public release. + +0.4 2004-08-13 + * Merged patch from Dan Walsh to ignore case on booleans. + * Changed sepol_genbools* to preserve the original policy version. + * Replaced exported global variables with set functions. + * Moved genpolbools utility from checkpolicy to libsepol. + * Added man pages for sepol_genbools* and genpolbools. + +0.3 2004-08-10 + * Added ChangeLog, COPYING, spec file. + * Added sepol_genbools_array() for load_policy. + * Created libsepol.map to limit exported symbols in shared library. + +0.2 2004-08-09 + * Exported other functions for checkpolicy and friends. + * Renamed service and sidtab functions to avoid libselinux conflict. + * Removed original code from checkpolicy, which now uses libsepol. + * Code cleanup: kill legacy references to kernel types/functions. + +0.1 2004-08-06 + * Moved checkpolicy core logic into a library. + * Exported sepol_genbools() for load_policy. Deleted: tags/libsepol_1_15_2/libsepol/VERSION =================================================================== --- trunk/libsepol/VERSION 2006-10-24 16:09:54 UTC (rev 2074) +++ tags/libsepol_1_15_2/libsepol/VERSION 2006-10-31 18:39:13 UTC (rev 2076) @@ -1 +0,0 @@ -1.15.1 Copied: tags/libsepol_1_15_2/libsepol/VERSION (from rev 2075, trunk/libsepol/VERSION) =================================================================== --- tags/libsepol_1_15_2/libsepol/VERSION (rev 0) +++ tags/libsepol_1_15_2/libsepol/VERSION 2006-10-31 18:39:13 UTC (rev 2076) @@ -0,0 +1 @@ +1.15.2 Deleted: tags/libsepol_1_15_2/libsepol/src/link.c =================================================================== --- trunk/libsepol/src/link.c 2006-10-24 16:09:54 UTC (rev 2074) +++ tags/libsepol_1_15_2/libsepol/src/link.c 2006-10-31 18:39:13 UTC (rev 2076) @@ -1,2216 +0,0 @@ -/* Authors: Karl MacMillan <kma...@tr...> - * Joshua Brindle <jbr...@tr...> - * Jason Tang <jt...@tr...> - * - * Copyright (C) 2004-2005 Tresys Technology, LLC - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <sepol/policydb/policydb.h> -#include <sepol/policydb/conditional.h> -#include <sepol/policydb/hashtab.h> -#include <sepol/policydb/avrule_block.h> -#include <sepol/policydb/link.h> -#include <sepol/policydb/util.h> - -#include <stdlib.h> -#include <stdarg.h> -#include <stdio.h> -#include <string.h> -#include <assert.h> - -#include "debug.h" - -#undef min -#define min(a,b) (((a) < (b)) ? (a) : (b)) - -typedef struct policy_module { - policydb_t *policy; - uint32_t num_decls; - uint32_t *map[SYM_NUM]; - uint32_t *avdecl_map; - uint32_t **perm_map; - uint32_t *perm_map_len; - - /* a pointer to within the base module's avrule_block chain to - * where this module's global now resides */ - avrule_block_t *base_global; -} policy_module_t; - -typedef struct link_state { - int verbose; - policydb_t *base; - avrule_block_t *last_avrule_block, *last_base_avrule_block; - uint32_t next_decl_id, current_decl_id; - - /* temporary variables, used during hashtab_map() calls */ - policy_module_t *cur; - char *cur_mod_name; - avrule_decl_t *dest_decl; - class_datum_t *src_class, *dest_class; - char *dest_class_name; - char dest_class_req; /* flag indicating the class was not declared */ - uint32_t symbol_num; - /* used to report the name of the module if dependancy error occurs */ - policydb_t **decl_to_mod; - - /* error reporting fields */ - sepol_handle_t *handle; -} link_state_t; - -typedef struct missing_requirement { - uint32_t symbol_type; - uint32_t symbol_value; - uint32_t perm_value; -} missing_requirement_t; - -static const char *symtab_names[SYM_NUM] = { - "common", "class", "role", "type/attribute", "user", - "bool", "level", "category" -}; - -/* Deallocates all elements within a module, but NOT the policydb_t - * structure within, as well as the pointer itself. */ -static void policy_module_destroy(policy_module_t * mod) -{ - unsigned int i; - if (mod == NULL) { - return; - } - for (i = 0; i < SYM_NUM; i++) { - free(mod->map[i]); - } - for (i = 0; mod->perm_map != NULL && i < mod->policy->p_classes.nprim; - i++) { - free(mod->perm_map[i]); - } - free(mod->perm_map); - free(mod->perm_map_len); - free(mod->avdecl_map); - free(mod); -} - -/***** functions that copy identifiers from a module to base *****/ - -/* Note: there is currently no scoping for permissions, which causes some - * strange side-effects. The current approach is this: - * - * a) perm is required and the class _and_ perm are declared in base: only add a mapping. - * b) perm is required and the class and perm are _not_ declared in base: simply add the permissions - * to the object class. This means that the requirements for the decl are the union of the permissions - * required for all decls, but who cares. - * c) perm is required, the class is declared in base, but the perm is not present. Nothing we can do - * here because we can't mark a single permission as required, so we bail with a requirement error - * _even_ if we are in an optional. - * - * A is correct behavior, b is wrong but not too bad, c is totall wrong for optionals. Fixing this requires - * a format change. - */ -static int permission_copy_callback(hashtab_key_t key, hashtab_datum_t datum, - void *data) -{ - char *perm_id = key, *new_id = NULL; - perm_datum_t *perm, *new_perm = NULL, *dest_perm; - link_state_t *state = (link_state_t *) data; - - class_datum_t *src_class = state->src_class; - class_datum_t *dest_class = state->dest_class; - policy_module_t *mod = state->cur; - uint32_t sclassi = src_class->s.value - 1; - int ret; - - perm = (perm_datum_t *) datum; - dest_perm = hashtab_search(dest_class->permissions.table, perm_id); - if (dest_perm == NULL && dest_class->comdatum != NULL) { - dest_perm = - hashtab_search(dest_class->comdatum->permissions.table, - perm_id); - } - - if (dest_perm == NULL) { - /* If the object class was not declared in the base, add the perm - * to the object class. */ - if (state->dest_class_req) { - /* If the class was required (not declared), insert the new permission */ - new_id = strdup(perm_id); - if (new_id == NULL) { - ERR(state->handle, "Memory error"); - ret = -SEPOL_LINK_ERROR; - goto err; - } - new_perm = - (perm_datum_t *) calloc(1, sizeof(perm_datum_t)); - if (new_perm == NULL) { - ERR(state->handle, "Memory error"); - ret = -SEPOL_LINK_ERROR; - goto err; - } - ret = hashtab_insert(dest_class->permissions.table, - (hashtab_key_t) new_id, - (hashtab_datum_t) new_perm); - if (ret) { - ERR(state->handle, - "could not insert permission into class\n"); - goto err; - } - new_perm->s.value = dest_class->permissions.nprim + 1; - dest_perm = new_perm; - } else { - /* this is case c from above */ - ERR(state->handle, - "Module %s depends on permission %s in class %s, not satisfied", - state->cur_mod_name, perm_id, - state->dest_class_name); - return -SEPOL_LINK_REQNOTMET; - } - } - - /* build the mapping for permissions encompassing this class. - * unlike symbols, the permission map translates between - * module permission bit to target permission bit. that bit - * may have originated from the class -or- it could be from - * the class's common parent.*/ - if (perm->s.value > mod->perm_map_len[sclassi]) { - uint32_t *newmap = calloc(perm->s.value, sizeof(*newmap)); - if (newmap == NULL) { - ERR(state->handle, "Out of memory!"); - return -1; - } - memcpy(newmap, mod->perm_map[sclassi], - mod->perm_map_len[sclassi] * sizeof(*newmap)); - free(mod->perm_map[sclassi]); - mod->perm_map[sclassi] = newmap; - mod->perm_map_len[sclassi] = perm->s.value; - } - mod->perm_map[sclassi][perm->s.value - 1] = dest_perm->s.value; - - return 0; - err: - free(new_id); - free(new_perm); - return ret; -} - -static int class_copy_callback(hashtab_key_t key, hashtab_datum_t datum, - void *data) -{ - char *id = key, *new_id = NULL; - class_datum_t *cladatum, *new_class = NULL; - link_state_t *state = (link_state_t *) data; - scope_datum_t *scope = NULL; - int ret; - - cladatum = (class_datum_t *) datum; - state->dest_class_req = 0; - - new_class = hashtab_search(state->base->p_classes.table, id); - /* If there is not an object class already in the base symtab that means - * that either a) a module is trying to declare a new object class (which - * the compiler should prevent) or b) an object class was required that is - * not in the base. - */ - if (new_class == NULL) { - scope = - hashtab_search(state->cur->policy->p_classes_scope.table, - id); - if (scope == NULL) { - ret = -SEPOL_LINK_ERROR; - goto err; - } - if (scope->scope == SCOPE_DECL) { - /* disallow declarations in modules */ - ERR(state->handle, - "%s: Modules may not yet declare new classes.", - state->cur_mod_name); - ret = -SEPOL_LINK_NOTSUP; - goto err; - } else { - /* It would be nice to error early here because the requirement is - * not met, but we cannot because the decl might be optional (in which - * case we should record the requirement so that it is just turned - * off). Note: this will break horribly if modules can declare object - * classes because the class numbers will be all wrong (i.e., they - * might be assigned in the order they were required rather than the - * current scheme which ensures correct numbering by ordering the - * declarations properly). This can't be fixed until some infrastructure - * for querying the object class numbers is in place. */ - state->dest_class_req = 1; - new_class = - (class_datum_t *) calloc(1, sizeof(class_datum_t)); - if (new_class == NULL) { - ERR(state->handle, "Memory error\n"); - ret = -SEPOL_LINK_ERROR; - goto err; - } - if (symtab_init - (&new_class->permissions, PERM_SYMTAB_SIZE)) { - ret = -SEPOL_LINK_ERROR; - goto err; - } - new_id = strdup(id); - if (new_id == NULL) { - ERR(state->handle, "Memory error\n"); - ret = -SEPOL_LINK_ERROR; - goto err; - } - ret = hashtab_insert(state->base->p_classes.table, - (hashtab_key_t) new_id, - (hashtab_datum_t) new_class); - if (ret) { - ERR(state->handle, - "could not insert new class into symtab"); - goto err; - } - new_class->s.value = ++(state->base->p_classes.nprim); - } - } - - state->cur->map[SYM_CLASSES][cladatum->s.value - 1] = - new_class->s.value; - - /* copy permissions */ - state->src_class = cladatum; - state->dest_class = new_class; - state->dest_class_name = (char *)key; - - ret = - hashtab_map(cladatum->permissions.table, permission_copy_callback, - state); - if (ret != 0) { - return ret; - } - - return 0; - err: - free(new_class); - free(new_id); - return ret; -} - -static int role_copy_callback(hashtab_key_t key, hashtab_datum_t datum, - void *data) -{ - int ret; - char *id = key, *new_id = NULL; - role_datum_t *role, *base_role, *new_role = NULL; - link_state_t *state = (link_state_t *) data; - - role = (role_datum_t *) datum; - - base_role = hashtab_search(state->base->p_roles.table, id); - if (base_role == NULL) { - if (state->verbose) - INFO(state->handle, "copying role %s", id); - - if ((new_id = strdup(id)) == NULL) { - goto cleanup; - } - - if ((new_role = - (role_datum_t *) malloc(sizeof(*new_role))) == NULL) { - goto cleanup; - } - role_datum_init(new_role); - - /* new_role's dominates and types field will be copied - * during role_fix_callback() */ - new_role->s.value = state->base->p_roles.nprim + 1; - - ret = hashtab_insert(state->base->p_roles.table, - (hashtab_key_t) new_id, - (hashtab_datum_t) new_role); - if (ret) { - goto cleanup; - } - state->base->p_roles.nprim++; - base_role = new_role; - } - - if (state->dest_decl) { - new_id = NULL; - if ((new_role = malloc(sizeof(*new_role))) == NULL) { - goto cleanup; - } - role_datum_init(new_role); - new_role->s.value = base_role->s.value; - if ((new_id = strdup(id)) == NULL) { - goto cleanup; - } - if (hashtab_insert - (state->dest_decl->p_roles.table, new_id, new_role)) { - goto cleanup; - } - state->dest_decl->p_roles.nprim++; - } - - state->cur->map[SYM_ROLES][role->s.value - 1] = base_role->s.value; - return 0; - - cleanup: - ERR(state->handle, "Out of memory!"); - role_datum_destroy(new_role); - free(new_id); - free(new_role); - return -1; -} - -/* Copy types and attributes from a module into the base module. The - * attributes are copied, but the types that make up this attribute - * are delayed type_fix_callback(). */ -static int type_copy_callback(hashtab_key_t key, hashtab_datum_t datum, - void *data) -{ - int ret; - char *id = key, *new_id = NULL; - type_datum_t *type, *base_type, *new_type = NULL; - link_state_t *state = (link_state_t *) data; - - type = (type_datum_t *) datum; - if ((type->flavor == TYPE_TYPE && !type->primary) - || type->flavor == TYPE_ALIAS) { - /* aliases are handled later, in alias_copy_callback() */ - return 0; - } - - base_type = hashtab_search(state->base->p_types.table, id); - if (base_type != NULL) { - /* type already exists. check that it is what this - * module expected. duplicate declarations (e.g., two - * modules both declare type foo_t) is checked during - * scope_copy_callback(). */ - if (type->flavor == TYPE_ATTRIB - && base_type->flavor != TYPE_ATTRIB) { - ERR(state->handle, - "%s: Expected %s to be an attribute, but it was already declared as a type.", - state->cur_mod_name, id); - return -1; - } else if (type->flavor != TYPE_ATTRIB - && base_type->flavor == TYPE_ATTRIB) { - ERR(state->handle, - "%s: Expected %s to be a type, but it was already declared as an attribute.", - state->cur_mod_name, id); - return -1; - } - } else { - if (state->verbose) - INFO(state->handle, "copying type %s", id); - - if ((new_id = strdup(id)) == NULL) { - goto cleanup; - } - - if ((new_type = - (type_datum_t *) calloc(1, sizeof(*new_type))) == NULL) { - goto cleanup; - } - new_type->primary = type->primary; - new_type->flavor = type->flavor; - /* for attributes, the writing of new_type->types is - done in type_fix_callback() */ - - new_type->s.value = state->base->p_types.nprim + 1; - - ret = hashtab_insert(state->base->p_types.table, - (hashtab_key_t) new_id, - (hashtab_datum_t) new_type); - if (ret) { - goto cleanup; - } - state->base->p_types.nprim++; - base_type = new_type; - } - - if (state->dest_decl) { - new_id = NULL; - if ((new_type = calloc(1, sizeof(*new_type))) == NULL) { - goto cleanup; - } - new_type->primary = type->primary; - new_type->flavor = type->flavor; - new_type->s.value = base_type->s.value; - if ((new_id = strdup(id)) == NULL) { - goto cleanup; - } - if (hashtab_insert - (state->dest_decl->p_types.table, new_id, new_type)) { - goto cleanup; - } - state->dest_decl->p_types.nprim++; - } - - state->cur->map[SYM_TYPES][type->s.value - 1] = base_type->s.value; - return 0; - - cleanup: - ERR(state->handle, "Out of memory!"); - free(new_id); - free(new_type); - return -1; -} - -static int user_copy_callback(hashtab_key_t key, hashtab_datum_t datum, - void *data) -{ - int ret; - char *id = key, *new_id = NULL; - user_datum_t *user, *base_user, *new_user = NULL; - link_state_t *state = (link_state_t *) data; - - user = (user_datum_t *) datum; - - base_user = hashtab_search(state->base->p_users.table, id); - if (base_user == NULL) { - if (state->verbose) - INFO(state->handle, "copying user %s", id); - - if ((new_id = strdup(id)) == NULL) { - goto cleanup; - } - - if ((new_user = - (user_datum_t *) malloc(sizeof(*new_user))) == NULL) { - goto cleanup; - } - user_datum_init(new_user); - /* new_users's roles and MLS fields will be copied during - user_fix_callback(). */ - - new_user->s.value = state->base->p_users.nprim + 1; - - ret = hashtab_insert(state->base->p_users.table, - (hashtab_key_t) new_id, - (hashtab_datum_t) new_user); - if (ret) { - goto cleanup; - } - state->base->p_users.nprim++; - base_user = new_user; - } - - if (state->dest_decl) { - new_id = NULL; - if ((new_user = malloc(sizeof(*new_user))) == NULL) { - goto cleanup; - } - user_datum_init(new_user); - new_user->s.value = base_user->s.value; - if ((new_id = strdup(id)) == NULL) { - goto cleanup; - } - if (hashtab_insert - (state->dest_decl->p_users.table, new_id, new_user)) { - goto cleanup; - } - state->dest_decl->p_users.nprim++; - } - - state->cur->map[SYM_USERS][user->s.value - 1] = base_user->s.value; - return 0; - - cleanup: - ERR(state->handle, "Out of memory!"); - user_datum_destroy(new_user); - free(new_id); - free(new_user); - return -1; -} - -static int bool_copy_callback(hashtab_key_t key, hashtab_datum_t datum, - void *data) -{ - int ret; - char *id = key, *new_id = NULL; - cond_bool_datum_t *booldatum, *base_bool, *new_bool = NULL; - link_state_t *state = (link_state_t *) data; - - booldatum = (cond_bool_datum_t *) datum; - - base_bool = hashtab_search(state->base->p_bools.table, id); - if (base_bool == NULL) { - if (state->verbose) - INFO(state->handle, "copying boolean %s", id); - - if ((new_id = strdup(id)) == NULL) { - goto cleanup; - } - - if ((new_bool = - (cond_bool_datum_t *) malloc(sizeof(*new_bool))) == NULL) { - goto cleanup; - } - new_bool->state = booldatum->state; - new_bool->s.value = state->base->p_bools.nprim + 1; - - ret = hashtab_insert(state->base->p_bools.table, - (hashtab_key_t) new_id, - (hashtab_datum_t) new_bool); - if (ret) { - goto cleanup; - } - state->base->p_bools.nprim++; - base_bool = new_bool; - - } - - state->cur->map[SYM_BOOLS][booldatum->s.value - 1] = base_bool->s.value; - return 0; - - cleanup: - ERR(state->handle, "Out of memory!"); - cond_destroy_bool(new_id, new_bool, NULL); - return -1; -} - -static int sens_copy_callback(hashtab_key_t key, hashtab_datum_t datum, - void *data) -{ - char *id = key; - level_datum_t *level, *base_level; - link_state_t *state = (link_state_t *) data; - scope_datum_t *scope; - - level = (level_datum_t *) datum; - - base_level = hashtab_search(state->base->p_levels.table, id); - if (!base_level) { - scope = - hashtab_search(state->cur->policy->p_sens_scope.table, id); - if (!scope) - return -SEPOL_LINK_ERROR; - if (scope->scope == SCOPE_DECL) { - /* disallow declarations in modules */ - ERR(state->handle, - "%s: Modules may not declare new sensitivities.", - state->cur_mod_name); - return -SEPOL_LINK_NOTSUP; - } - } - - state->cur->map[SYM_LEVELS][level->level->sens - 1] = - base_level->level->sens; - - return 0; -} - -static int cat_copy_callback(hashtab_key_t key, hashtab_datum_t datum, - void *data) -{ - char *id = key; - cat_datum_t *cat, *base_cat; - link_state_t *state = (link_state_t *) data; - scope_datum_t *scope; - - cat = (cat_datum_t *) datum; - - base_cat = hashtab_search(state->base->p_cats.table, id); - if (!base_cat) { - scope = - hashtab_search(state->cur->policy->p_cat_scope.table, id); - if (!scope) - return -SEPOL_LINK_ERROR; - if (scope->scope == SCOPE_DECL) { - /* disallow declarations in modules */ - ERR(state->handle, - "%s: Modules may not declare new categories.", - state->cur_mod_name); - return -SEPOL_LINK_NOTSUP; - } - } - - state->cur->map[SYM_CATS][cat->s.value - 1] = base_cat->s.value; - - return 0; -} - -static int (*copy_callback_f[SYM_NUM]) (hashtab_key_t key, - hashtab_datum_t datum, void *datap) = { -NULL, class_copy_callback, role_copy_callback, type_copy_callback, - user_copy_callback, bool_copy_callback, sens_copy_callback, - cat_copy_callback}; - -/* The aliases have to be copied after the types and attributes to be - * certain that the base symbol table will have the type that the - * alias refers. Otherwise, we won't be able to find the type value - * for the alias. We can't depend on the declaration ordering because - * of the hash table. - */ -static int alias_copy_callback(hashtab_key_t key, hashtab_datum_t datum, - void *data) -{ - char *id = key, *new_id = NULL, *target_id; - type_datum_t *type, *base_type, *new_type = NULL, *target_type; - link_state_t *state = (link_state_t *) data; - policy_module_t *mod = state->cur; - int primval; - - type = (type_datum_t *) datum; - /* there are 2 kinds of aliases. Ones with their own value (TYPE_ALIAS) - * and ones with the value of their primary (TYPE_TYPE && type->primary = 0) - */ - if (! - (type->flavor == TYPE_ALIAS - || (type->flavor == TYPE_TYPE && !type->primary))) { - /* ignore types and attributes -- they were handled in - * type_copy_callback() */ - return 0; - } - - if (type->flavor == TYPE_ALIAS) - primval = type->primary; - else - primval = type->s.value; - - target_id = mod->policy->p_type_val_to_name[primval - 1]; - target_type = hashtab_search(state->base->p_types.table, target_id); - if (target_type == NULL) { - ERR(state->handle, "%s: Could not find type %s for alias %s.", - state->cur_mod_name, target_id, id); - return -1; - } - - base_type = hashtab_search(state->base->p_types.table, id); - if (base_type == NULL) { - if (state->verbose) - INFO(state->handle, "copying alias %s", id); - - if ((new_type = - (type_datum_t *) calloc(1, sizeof(*new_type))) == NULL) { - goto cleanup; - } - /* the linked copy always has TYPE_ALIAS style aliases */ - new_type->primary = target_type->s.value; - new_type->flavor = TYPE_ALIAS; - new_type->s.value = state->base->p_types.nprim + 1; - if ((new_id = strdup(id)) == NULL) { - goto cleanup; - } - if (hashtab_insert - (state->base->p_types.table, new_id, new_type)) { - goto cleanup; - } - state->base->p_types.nprim++; - base_type = new_type; - } else { - - /* if this already exists and isn't an alias it was required by another module (or base) - * and inserted into the hashtable as a type, fix it up now */ - - if (base_type->flavor == TYPE_ALIAS) { - /* error checking */ - assert(base_type->primary == target_type->s.value); - assert(base_type->primary == - mod->map[SYM_TYPES][primval - 1]); - assert(mod->map[SYM_TYPES][type->s.value - 1] == - base_type->primary); - return 0; - } - - if (base_type->flavor == TYPE_ATTRIB) { - ERR(state->handle, - "%s is an alias of an attribute, not allowed", id); - return -1; - } - - base_type->fla... [truncated message content] |