1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 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 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710
|
#############################################################
# types_relation_module.tcl
# -----------------------------------------------------------
# Copyright (C) 2004-2006 Tresys Technology, LLC
# see file 'COPYING' for use and warranty information
#
# Requires tcl and tk 8.3+, with BWidgets
# Author: <don.patterson@tresys.com> 8-11-2004
# -----------------------------------------------------------
#
# This module implements the two types relationship analysis interface.
##############################################################
# ::Apol_Analysis_tra module namespace
##############################################################
namespace eval Apol_Analysis_tra {
# GUI variables
variable descriptive_text \
"The types relationship summary analysis in Apol is a convenience \
mechanism to allow a user to quickly do several queries and \
analyses already in present in Apol to understand the \
relationship between two types. This is meant to quickly display \
the relationship between two types and therefore doesn't include \
all of the options present in the standard queries and analyses. \
The analyses are grouped into two categories: Basic and Analysis.\n\n \
The basic group includes several rule searches that can be \n \
performed using the Policy Rules tab.\n\n \
\tCommon Attributes: the attributes common to both types.\n\n \
\tCommon Roles: the roles to which both types are assigned.\n\n \
\tCommon Users: the users allowed associate with roles to which\n \
\t\tboth types are assigned.\n\n \
\tCommon Access to Resources: object types to which both types \n \
\t\thave some access.\n\n \
\tDissimilar Access to Resources: object types to which one type\n \
\t\thas some access but the other type has none.\n\n \
The analysis group includes several other analyses that can be \n \
performed using the Analysis tab. \n\n \
\tDirect Flows Between A and B: direct information flow analysis\n \
\t\tbetween the two types.\n\n \
\tTransitive Flows A->B: transitive information flows from type A to B.\n\n \
\tTransitive Flows B->A: transitive information flows from type B to A.\n\n \
\tDomain Transitions A->B: domain transitions allowed from type A to B.\n\n \
\tDomain Transitions B->A: domain transitions allowed from type B to A.\n\n \
"
variable progressmsg ""
variable progress_indicator -1
# Query variables
variable typeA ""
variable typeB ""
variable attribA ""
variable attribB ""
variable attribA_sel 0
variable attribB_sel 0
variable comm_attribs_sel 1
variable comm_roles_sel 1
variable comm_users_sel 1
variable comm_access_sel 0
variable unique_access_sel 0
variable dta_AB_sel 0
variable dta_BA_sel 0
variable trans_flow_AB_sel 0
variable trans_flow_BA_sel 0
variable dir_flow_sel 0
variable te_rules_sel 0
variable tt_rule_sel 0
# Global widgets
variable combo_typeA
variable combo_typeB
variable combo_attribA
variable combo_attribB
variable cb_attribA
variable cb_attribB
variable tra_listbox
variable tra_info_text
variable progressDlg
set progressDlg .progress
variable notebook
# Advanced options dialogs/variables - Not used in this release
variable forward_options_Dlg
set forward_options_Dlg .forward_options_Dlg_tra
variable transflow_options_Dlg
set transflow_options_Dlg .transflow_options_Dlg_tra
variable dirflow_options_Dlg
set dirflow_options_Dlg .dirflow_options_Dlg
variable included_dirflow_objs ""
variable excluded_dirflow_objs ""
# defined tag names for output
variable title_tag TITLE
variable title_type_tag TITLE_TYPE
variable subtitle_tag SUBTITLES
variable rules_tag RULES
variable counters_tag COUNTERS
variable types_tag TYPE
variable disabled_rule_tag DISABLE_RULE
# Notebook tab names/labels
variable basic_TabID "BasicTab"
variable analysis_TabID "AnalysisTab"
variable tab1_label "Basic"
variable tab2_label "Analysis"
Apol_Analysis::register_analysis_modules "Apol_Analysis_tra" "Types Relationship Summary"
}
proc Apol_Analysis_tra::get_short_name {} {
return "Types Relationship"
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::display_dta_options
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::display_dta_options { } {
Apol_Analysis_dta::forward_options_create_dialog \
$Apol_Analysis_tra::forward_options_Dlg \
"Types Relationship Domain Transitions Advanced Options"
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::display_tif_options
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::display_tif_options { } {
Apol_Analysis_fulflow::advanced_filters_create_dialog \
$Apol_Analysis_tra::transflow_options_Dlg \
"Types Relationship Transitive Information Flows Options"
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::dirflow_options_include_exclude_objs
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::dirflow_options_include_exclude_objs {remove_list_1 \
add_list_1 \
remove_lbox \
add_lbox} {
upvar #0 $remove_list_1 remove_list
upvar #0 $add_list_1 add_list
set type_indices [$remove_lbox curselection]
if {$type_indices != ""} {
set tmp_list ""
foreach idx $type_indices {
set tmp_list [lappend tmp_list [$remove_lbox get $idx]]
}
foreach type $tmp_list {
set idx [lsearch -exact $remove_list $type]
if {$idx != -1} {
set remove_list [lreplace $remove_list $idx $idx]
# put in add list
set add_list [lappend add_list $type]
set add_list [lsort $add_list]
}
}
$remove_lbox selection clear 0 end
}
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::select_all_lbox_items
# - Takes a Tk listbox widget as an argument.
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::select_all_lbox_items {lbox} {
$lbox selection set 0 end
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::clear_all_lbox_items
# - Takes a Tk listbox widget as an argument.
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::clear_all_lbox_items {lbox} {
$lbox selection clear 0 end
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::display_dif_options
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::display_dif_options { } {
variable dirflow_options_Dlg
if {![ApolTop::is_policy_open]} {
tk_messageBox -icon error -type ok -title "Error" -message "No current policy file is opened!"
return -1
}
if {[winfo exists $dirflow_options_Dlg]} {
raise $dirflow_options_Dlg
focus -force $dirflow_options_Dlg
return 0
}
# Create the top-level dialog and subordinate widgets
toplevel $dirflow_options_Dlg
wm withdraw $dirflow_options_Dlg
wm title $dirflow_options_Dlg \
"Types Relationship Direct Information Flows Options"
wm protocol $dirflow_options_Dlg WM_DELETE_WINDOW " "
set top_frame [TitleFrame $dirflow_options_Dlg.top_frame \
-text "Filter results by object class:"]
set objcl_frame [frame [$top_frame getframe].objcl_frame]
set objcl_frame_1 [frame $objcl_frame.objcl_frame_1]
set objcl_frame_2 [frame $objcl_frame.objcl_frame_2]
set objcl_frame_3 [frame $objcl_frame.objcl_frame_3]
set b_frame_1 [frame $objcl_frame_1.b_frame_1]
set b_frame_3 [frame $objcl_frame_3.b_frame_3]
set lbl_incl [Label $objcl_frame_1.lbl_incl \
-text "Include these objects:"]
set sw_objs_1 [ScrolledWindow $objcl_frame_1.sw_objs_1 -auto both]
set list_objs_1 [listbox [$sw_objs_1 getframe].list_objs_1 \
-height 7 \
-highlightthickness 0 \
-selectmode extended \
-exportselection 0 -bg white \
-listvar Apol_Analysis_tra::included_dirflow_objs]
$sw_objs_1 setwidget $list_objs_1
set lbl_excl [Label $objcl_frame_3.lbl_excl \
-text "Exclude these objects:"]
set sw_objs_2 [ScrolledWindow $objcl_frame_3.sw_objs_2 -auto both]
set list_objs_2 [listbox [$sw_objs_2 getframe].list_objs_2 \
-height 7 \
-highlightthickness 0 \
-selectmode extended \
-exportselection 0 -bg white \
-listvar Apol_Analysis_tra::excluded_dirflow_objs]
$sw_objs_2 setwidget $list_objs_2
bindtags $list_objs_1 \
[linsert [bindtags $list_objs_1] 3 \
list_objs_1_Tag]
bindtags $list_objs_2 \
[linsert [bindtags $list_objs_2] 3 \
list_objs_2_Tag]
bind list_objs_1_Tag <<ListboxSelect>> "focus -force $list_objs_1"
bind list_objs_2_Tag <<ListboxSelect>> "focus -force $list_objs_2"
# Buttons
set include_bttn [Button $objcl_frame_2.include_bttn -text "<--" \
-helptext "Include object(s) in the query" -width 8 \
-command "Apol_Analysis_tra::dirflow_options_include_exclude_objs \
Apol_Analysis_tra::excluded_dirflow_objs \
Apol_Analysis_tra::included_dirflow_objs \
$list_objs_2 \
$list_objs_1"]
set exclude_bttn [Button $objcl_frame_2.exclude_bttn -text "-->" \
-helptext "Exclude object(s) from the query" -width 8 \
-command "Apol_Analysis_tra::dirflow_options_include_exclude_objs \
Apol_Analysis_tra::included_dirflow_objs \
Apol_Analysis_tra::excluded_dirflow_objs \
$list_objs_1 \
$list_objs_2"]
set b_incl_all_sel [Button $b_frame_1.b_incl_all_sel \
-text "Select All" \
-command "Apol_Analysis_tra::select_all_lbox_items $list_objs_1"]
set b_incl_all_clear [Button $b_frame_1.b_incl_all_clear \
-text "Unselect" \
-command "Apol_Analysis_tra::clear_all_lbox_items $list_objs_1"]
set b_excl_all_sel [Button $b_frame_3.b_excl_all_sel \
-text "Select All" \
-command "Apol_Analysis_tra::select_all_lbox_items $list_objs_2"]
set b_excl_all_clear [Button $b_frame_3.b_excl_all_clear \
-text "Unselect" \
-command "Apol_Analysis_tra::clear_all_lbox_items $list_objs_2"]
set button_f [frame $dirflow_options_Dlg.button_f]
# Create and pack close button for the dialog
set close_bttn [Button $button_f.close_bttn \
-text "Close" \
-width 8 \
-command "destroy $dirflow_options_Dlg"]
pack $b_frame_3 $b_frame_1 -side bottom -anchor center
pack $objcl_frame_3 -side right -anchor nw -fill both -expand yes
pack $objcl_frame_1 -side left -anchor nw -fill both -expand yes
pack $objcl_frame_2 -side top -anchor center -pady 80 -padx 10
pack $button_f -side bottom -anchor center -expand yes -pady 4 -padx 4
pack $objcl_frame -side top -anchor nw -fill both -expand yes -pady 4 -padx 4
pack $top_frame -side left -anchor nw -fill both -expand yes -pady 4 -padx 4
pack $b_incl_all_sel $b_incl_all_clear $b_excl_all_sel $b_excl_all_clear \
-side left -anchor nw -fill x
pack $include_bttn $exclude_bttn -side top -anchor center -fill y
pack $sw_objs_1 $sw_objs_2 -side bottom -anchor nw -fill both -expand yes \
-padx 5 -pady 5
pack $lbl_incl $lbl_excl -side top -anchor nw -padx 5 -pady 2
pack $close_bttn -side left -anchor center
set width 580
set height 300
wm geom $dirflow_options_Dlg ${width}x${height}
wm deiconify $dirflow_options_Dlg
focus $dirflow_options_Dlg
wm protocol $dirflow_options_Dlg WM_DELETE_WINDOW \
"destroy $dirflow_options_Dlg"
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::initialize_widgets_state
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::initialize_widgets_state { } {
variable combo_typeA
variable combo_typeB
variable combo_attribA
variable combo_attribB
variable cb_attribA
variable cb_attribB
variable notebook
$notebook raise [$notebook pages 0]
Apol_Analysis_tra::config_attrib_comboBox_state \
$cb_attribA $combo_attribA $combo_typeA 0
Apol_Analysis_tra::config_attrib_comboBox_state \
$cb_attribB $combo_attribB $combo_typeB 0
Apol_Analysis_tra::configure_tab_label $Apol_Analysis_tra::basic_TabID
Apol_Analysis_tra::configure_tab_label $Apol_Analysis_tra::analysis_TabID
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::initialize
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::initialize { } {
Apol_Analysis_tra::reset_variables
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::do_analysis
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::do_analysis {results_frame} {
variable tra_listbox
variable typeA
variable typeB
variable comm_attribs_sel
variable comm_roles_sel
variable comm_users_sel
variable comm_access_sel
variable unique_access_sel
variable dta_AB_sel
variable dta_BA_sel
variable trans_flow_AB_sel
variable trans_flow_BA_sel
variable dir_flow_sel
variable te_rules_sel
variable tt_rule_sel
variable excluded_dirflow_objs
variable forward_options_Dlg
if {![ApolTop::is_policy_open]} {
tk_messageBox -icon error -type ok -title "Error" \
-message "No current policy file is opened!"
return -code error
}
if {$typeA == ""} {
tk_messageBox -icon error -type ok -title "Error" \
-message "Type A cannot be empty!"
return -code error
}
if {$typeB == ""} {
tk_messageBox -icon error -type ok -title "Error" \
-message "Type B cannot be empty!"
return -code error
}
if {!$comm_attribs_sel && !$comm_roles_sel && !$comm_users_sel && !$comm_access_sel && \
!$unique_access_sel && !$dta_AB_sel && !$dta_BA_sel && !$trans_flow_AB_sel && \
!$trans_flow_BA_sel && !$dir_flow_sel && !$te_rules_sel && !$tt_rule_sel} {
tk_messageBox -icon error -type ok -title "Error" \
-message "You did not select any search items."
return -code error
}
# if a permap is not loaded then load the default permap
# if an error occurs on open, then skip analysis
set rt [catch {set map_loaded [Apol_Perms_Map::is_pmap_loaded]} err]
if {$rt != 0} {
tk_messageBox -icon error -type ok -title "Error" \
-message "$err"
return -code error
}
set do_trans [expr ($trans_flow_AB_sel || $trans_flow_BA_sel)]
if {[expr (!$map_loaded && ($do_trans || $dir_flow_sel))]} {
set rt [catch {Apol_Perms_Map::load_default_perm_map} err]
if { $rt != 0 } {
if {$rt == $Apol_Perms_Map::warning_return_val} {
tk_messageBox -icon warning -type ok -title "Warning" -message "$err"
} else {
tk_messageBox -icon error -type ok -title "Error" -message "$err"
return -code error
}
}
}
Apol_Analysis_tra::display_progressDlg
set dta_object(x) ""
if {$dta_AB_sel || $dta_BA_sel} {
Apol_Analysis_dta::forward_options_copy_object $forward_options_Dlg dta_object
}
# Initialize dta variables - These options are here for setting advanced options for DTA analysis.
set dta_reverse 0
set dta_num_object_classes 0
set dta_perm_options ""
set dta_filter_types 0
set dta_types ""
set dta_objects_sel 0
if {$dta_AB_sel || $dta_BA_sel} {
foreach class $dta_object($forward_options_Dlg,class_list) {
set perms ""
# Make sure to strip out just the class name, as this may be an excluded class.
set idx [string first $Apol_Analysis_dta::excluded_tag $class]
if {$idx == -1} {
set class_elements [array names dta_object "$forward_options_Dlg,perm_status_array,$class,*"]
set class_added 0
foreach element $class_elements {
set perm [lindex [split $element ","] 3]
if {[string equal $dta_object($element) "include"]} {
if {$class_added == 0} {
incr dta_num_object_classes
set dta_perm_options [lappend dta_perm_options $class]
set class_added 1
}
set perms [lappend perms $perm]
}
}
if {$perms != ""} {
set dta_perm_options [lappend dta_perm_options [llength $perms]]
foreach perm $perms {
set dta_perm_options [lappend dta_perm_options $perm]
}
}
}
}
set dta_types $Apol_Types::typelist
if {$dta_num_object_classes} {
set dta_objects_sel 1
}
if {$dta_types != ""} {
set dta_filter_types 1
}
}
array unset dta_object
# Initialize transitive flow variables - These options are here for setting advanced options for DTA analysis.
set tif_num_object_classes 0
set tif_perm_options ""
set tif_types ""
set tif_objects_sel 0
set tif_filter_types 0
# Initialize direct flow variables - These options are here for setting advanced options for DTA analysis.
set filter_dirflow_objs 0
set rt [catch {set results [apol_TypesRelationshipAnalysis \
$typeA \
$typeB \
$comm_attribs_sel \
$comm_roles_sel \
$comm_users_sel \
$comm_access_sel \
$unique_access_sel \
[expr ($dta_AB_sel || $dta_BA_sel)] \
[expr ($trans_flow_AB_sel || $trans_flow_BA_sel)] \
$dir_flow_sel \
$tt_rule_sel \
$te_rules_sel \
$tif_objects_sel \
$tif_num_object_classes \
$tif_perm_options \
$tif_filter_types \
$tif_types \
$dta_objects_sel \
$dta_num_object_classes \
$dta_perm_options \
$dta_filter_types \
$dta_types \
$filter_dirflow_objs \
$excluded_dirflow_objs]} err]
Apol_Analysis_tra::destroy_progressDlg
if {$rt != 0} {
tk_messageBox -icon error -type ok -title "Error" -message "$err"
return -code error
}
set tra_listbox [Apol_Analysis_tra::create_resultsDisplay $results_frame]
set rt [catch {Apol_Analysis_tra::create_results_list_structure $tra_listbox $results} err]
if {$rt != 0} {
tk_messageBox -icon error -type ok -title "Error" -message "$err"
return -code error
}
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::listSelect
# ---------------------------------------------------------
proc Apol_Analysis_tra::listSelect {tra_listbox tra_info_text selected_item} {
variable typeA
variable typeB
$tra_info_text configure -state normal
$tra_info_text delete 0.0 end
$tra_info_text mark set insert 1.0
switch -exact -- $selected_item {
common_attribs {
Apol_Analysis_tra::display_common_attribs \
$tra_listbox \
$tra_info_text \
"Common Attributes" \
[$tra_listbox itemcget $selected_item -data]
}
common_roles {
Apol_Analysis_tra::display_common_attribs \
$tra_listbox \
$tra_info_text \
"Common Roles" \
[$tra_listbox itemcget $selected_item -data]
}
common_users {
Apol_Analysis_tra::display_common_attribs \
$tra_listbox \
$tra_info_text \
"Common Users" \
[$tra_listbox itemcget $selected_item -data]
}
tt_rules {
Apol_Analysis_tra::display_rules \
$tra_listbox \
$tra_info_text \
"Type transition/change rules" \
[$tra_listbox itemcget $selected_item -data]
}
te_rules {
Apol_Analysis_tra::display_rules \
$tra_listbox \
$tra_info_text \
"TE Allow Rules" \
[$tra_listbox itemcget $selected_item -data]
}
common_objects {
$tra_info_text configure -wrap word
set start_idx [$tra_info_text index insert]
$tra_info_text insert end "$typeA"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_type_tag $start_idx $end_idx
set start_idx [$tra_info_text index insert]
$tra_info_text insert end " and "
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_tag $start_idx $end_idx
set start_idx [$tra_info_text index insert]
$tra_info_text insert end "$typeB"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_type_tag $start_idx $end_idx
set start_idx [$tra_info_text index insert]
$tra_info_text insert end " access \
[$tra_listbox itemcget $selected_item -data] common type(s).\n\n"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_tag $start_idx $end_idx
if {[$tra_listbox itemcget $selected_item -data] > 0} {
$tra_info_text insert end "Open the subtree for this item to see the list of \
common types that can be accessed. You may then select a type from the \
subtree to see the allow rules which provide the access."
}
}
unique_objects {
$tra_info_text configure -wrap word
$tra_info_text insert end "Open the subtree for this item to access individual \
subtrees of types which can be accessed by either "
set start_idx [$tra_info_text index insert]
$tra_info_text insert end "$typeA"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_type_tag $start_idx $end_idx
$tra_info_text insert end " or "
set start_idx [$tra_info_text index insert]
$tra_info_text insert end "$typeB"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_type_tag $start_idx $end_idx
$tra_info_text insert end ".\nYou may then select a type from a subtree to see the \
allow rules which provide the access."
}
unique_objects:typeA {
$tra_info_text configure -wrap word
set start_idx [$tra_info_text index insert]
$tra_info_text insert end "$typeA"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_type_tag $start_idx $end_idx
set start_idx [$tra_info_text index insert]
$tra_info_text insert end " accesses \
[$tra_listbox itemcget $selected_item -data] type(s) to which "
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_tag $start_idx $end_idx
set start_idx [$tra_info_text index insert]
$tra_info_text insert end "$typeB"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_type_tag $start_idx $end_idx
set start_idx [$tra_info_text index insert]
$tra_info_text insert end " does not have access.\n\n"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_tag $start_idx $end_idx
if {[$tra_listbox itemcget $selected_item -data] > 0} {
$tra_info_text insert end "Open the subtree for this item to see the list of types. \
You may then select a type from the subtree to see the allow rules which provide \
the access."
}
}
unique_objects:typeB {
$tra_info_text configure -wrap word
set start_idx [$tra_info_text index insert]
$tra_info_text insert end "$typeB"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_type_tag $start_idx $end_idx
set start_idx [$tra_info_text index insert]
$tra_info_text insert end " accesses \
[$tra_listbox itemcget $selected_item -data] type(s) to which "
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_tag $start_idx $end_idx
set start_idx [$tra_info_text index insert]
$tra_info_text insert end "$typeA"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_type_tag $start_idx $end_idx
set start_idx [$tra_info_text index insert]
$tra_info_text insert end " does not have access.\n\n"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_tag $start_idx $end_idx
if {[$tra_listbox itemcget $selected_item -data] > 0} {
$tra_info_text insert end "Open the subtree for this item to see the list of types. \
You may then select a type from the subtree to see the allow rules which provide \
the access."
}
}
dir_flows {
Apol_Analysis_tra::display_direct_flows \
$tra_listbox \
$tra_info_text \
[$tra_listbox itemcget $selected_item -data] \
}
trans_flows_A {
Apol_Analysis_tra::display_transitive_flows \
$tra_listbox \
$tra_info_text \
[$tra_listbox itemcget $selected_item -data] \
$Apol_Analysis_tra::typeA
}
trans_flows_B {
Apol_Analysis_tra::display_transitive_flows \
$tra_listbox \
$tra_info_text \
[$tra_listbox itemcget $selected_item -data] \
$Apol_Analysis_tra::typeB
}
dta_analysis_A {
Apol_Analysis_tra::display_dta_info \
$tra_listbox \
$tra_info_text \
[$tra_listbox itemcget $selected_item -data] \
$Apol_Analysis_tra::typeA
}
dta_analysis_B {
Apol_Analysis_tra::display_dta_info \
$tra_listbox \
$tra_info_text \
[$tra_listbox itemcget $selected_item -data] \
$Apol_Analysis_tra::typeB
}
default {
if {[$tra_listbox parent $selected_item] == "unique_objects:typeA" ||
[$tra_listbox parent $selected_item] == "unique_objects:typeB"} {
set idx [string length "unique_objects:"]
set node [string range $selected_item $idx [expr [string length $selected_item] - 1]]
Apol_Analysis_tra::display_unique_object_info \
$tra_listbox \
$tra_info_text \
$node \
[$tra_listbox itemcget $selected_item -data]
} elseif {[$tra_listbox parent $selected_item] == "common_objects"} {
set idx [string length "common_objects:"]
set node [string range $selected_item $idx [expr [string length $selected_item] - 1]]
Apol_Analysis_tra::display_common_object_info \
$tra_listbox \
$tra_info_text \
$node \
[$tra_listbox itemcget $selected_item -data]
} else {
puts "Invalid listbox item element $selected_item"
return -1
}
}
}
ApolTop::makeTextBoxReadOnly $tra_info_text
$tra_listbox selection set $selected_item
Apol_Analysis_tra::formatInfoText $Apol_Analysis_tra::tra_info_text
return 0
}
###########################################################################
# ::formatInfoText
#
proc Apol_Analysis_tra::formatInfoText { tb } {
$tb tag configure $Apol_Analysis_tra::title_tag -font {Helvetica 12 bold}
$tb tag configure $Apol_Analysis_tra::title_type_tag -foreground blue -font {Helvetica 12 bold}
$tb tag configure $Apol_Analysis_tra::subtitle_tag -font {Helvetica 11 bold}
$tb tag configure $Apol_Analysis_tra::rules_tag -font $ApolTop::text_font
$tb tag configure $Apol_Analysis_tra::counters_tag -foreground blue -font {Helvetica 11 bold}
$tb tag configure $Apol_Analysis_tra::types_tag -font $ApolTop::text_font
$tb tag configure $Apol_Analysis_tra::disabled_rule_tag -foreground red
# Configure hyperlinking to policy.conf file
Apol_PolicyConf::configure_HyperLinks $tb
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::display_common_attribs
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::display_common_attribs {tra_listbox tra_info_text header_txt data} {
if { $data == "" } {
$tra_info_text configure -state disabled
return 0
}
set num [lindex $data 0]
set start_idx [$tra_info_text index insert]
$tra_info_text insert end "$header_txt ($num):\n\n"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_tag $start_idx $end_idx
if {$num} {
set itemlist [lrange $data 1 end]
foreach item $itemlist {
$tra_info_text insert end "$item\n"
}
}
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::display_rules
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::display_rules {tra_listbox tra_info_text header_txt data} {
if { $data == "" } {
$tra_info_text configure -state disabled
return 0
}
set i 0
set num [lindex $data $i]
set start_idx [$tra_info_text index insert]
$tra_info_text insert end "$header_txt ($num):\n\n"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_tag $start_idx $end_idx
set curr_idx [expr $i + 1]
for {set x 0} {$x < $num} {incr x} {
Apol_Analysis_tra::print_rule $tra_info_text $data $curr_idx 0
incr curr_idx
}
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::print_rule
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::print_rule {tra_info_text data curr_idx indent} {
if {$indent} {
$tra_info_text insert end " "
}
set startIdx [$tra_info_text index insert]
set rule [lindex $data $curr_idx]
# Get the line number only
set end_link_idx [string first "\]" [string trim $rule] 0]
set lineno [string range [string trim [string range $rule 0 $end_link_idx]] 1 end-1]
set lineno [string trim $lineno]
set rule [string range $rule [expr $end_link_idx + 1] end]
# Only display line number hyperlink if this is not a binary policy.
if {![ApolTop::is_binary_policy]} {
$tra_info_text insert end "\[$lineno\]"
Apol_PolicyConf::insertHyperLink $tra_info_text "$startIdx wordstart + 1c" "$startIdx wordstart + [expr [string length $lineno] + 1]c"
}
set startIdx [$tra_info_text index insert]
$tra_info_text insert end "$rule\n"
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::rules_tag $startIdx $endIdx
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::display_common_object_info
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::display_common_object_info {tra_listbox tra_info_text node data} {
variable typeA
variable typeB
if { $data == "" } {
$tra_info_text configure -state disabled
return 0
}
set startIdx [$tra_info_text index insert]
$tra_info_text insert end "$typeA"
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_type_tag $startIdx $endIdx
set startIdx [$tra_info_text index insert]
$tra_info_text insert end " accesses "
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_tag $startIdx $endIdx
set startIdx [$tra_info_text index insert]
$tra_info_text insert end "$node"
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_type_tag $startIdx $endIdx
set startIdx [$tra_info_text index insert]
$tra_info_text insert end ":\n\n"
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_tag $startIdx $endIdx
set i 0
set num_comm_rules_A [lindex $data $i]
for { set p 0 } { $p < $num_comm_rules_A } { incr p } {
incr i
Apol_Analysis_tra::print_rule $tra_info_text $data $i 0
}
set startIdx [$tra_info_text index insert]
$tra_info_text insert end "\n$typeB"
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_type_tag $startIdx $endIdx
set startIdx [$tra_info_text index insert]
$tra_info_text insert end " accesses "
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_tag $startIdx $endIdx
set startIdx [$tra_info_text index insert]
$tra_info_text insert end "$node"
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_type_tag $startIdx $endIdx
set startIdx [$tra_info_text index insert]
$tra_info_text insert end ":\n\n"
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_tag $startIdx $endIdx
incr i
set num_comm_rules_B [lindex $data $i]
for { set p 0 } { $p < $num_comm_rules_B } { incr p } {
incr i
Apol_Analysis_tra::print_rule $tra_info_text $data $i 0
}
return 0
}
proc Apol_Analysis_tra::destroy_progressDlg {} {
variable progressDlg
if {[winfo exists $progressDlg]} {
destroy $progressDlg
}
return 0
}
proc Apol_Analysis_tra::display_progressDlg {} {
variable progressDlg
set Apol_Analysis_tra::progressmsg "Performing types relationship analysis..."
set progressBar [ProgressDlg $progressDlg \
-parent $ApolTop::mainframe \
-textvariable Apol_Analysis_tra::progressmsg \
-variable Apol_Analysis_tra::progress_indicator \
-maximum 3 \
-width 45]
update
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::display_unique_object_info
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::display_unique_object_info {tra_listbox tra_info_text node data} {
if { $data == "" } {
$tra_info_text configure -state disabled
return 0
}
set i 0
set type [lindex $data $i]
set start_idx [$tra_info_text index insert]
$tra_info_text insert end "$type"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_type_tag $start_idx $end_idx
set start_idx [$tra_info_text index insert]
$tra_info_text insert end " accesses "
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_tag $start_idx $end_idx
set start_idx [$tra_info_text index insert]
$tra_info_text insert end "$node"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_type_tag $start_idx $end_idx
set start_idx [$tra_info_text index insert]
$tra_info_text insert end ":\n\n"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_tag $start_idx $end_idx
incr i
set num_rules_A [lindex $data $i]
for { set p 0 } { $p < $num_rules_A } { incr p } {
incr i
Apol_Analysis_tra::print_rule $tra_info_text $data $i 0
}
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::display_direct_flows
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::display_direct_flows {tra_listbox tra_info_text data} {
variable typeA
variable typeB
if { $data == "" } {
$tra_info_text configure -state disabled
return 0
}
set start_type $typeA
set i 0
# Get # of target types
set num_target_types [lindex $data $i]
if {$num_target_types == 0} {
set start_idx [$tra_info_text index insert]
$tra_info_text insert end "No direct information flows"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_tag $start_idx $end_idx
} else {
incr i
set cur_end_type [lindex $data $i]
incr i
set flow_dir [lindex $data $i]
incr i
set num_objs [lindex $data $i]
incr i
set curIdx $i
set startIdx [$tra_info_text index insert]
$tra_info_text insert end "Information flows both into and out of "
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_tag $startIdx $endIdx
set startIdx [$tra_info_text index insert]
$tra_info_text insert end $start_type
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_type_tag $startIdx $endIdx
set startIdx [$tra_info_text index insert]
$tra_info_text insert end " - \[from/to\] "
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_tag $startIdx $endIdx
set startIdx [$tra_info_text index insert]
$tra_info_text insert end $cur_end_type
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_type_tag $startIdx $endIdx
set startIdx $endIdx
# If there are any target types then format and display the data
for { set x 0 } { $x < $num_target_types } { incr x } {
if {$flow_dir == "both"} {
# Print label for in flows
$tra_info_text insert end "\n\nObject classes for "
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::subtitle_tag $startIdx $endIdx
set startIdx $endIdx
$tra_info_text insert end "\[IN/OUT\]"
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_type_tag $startIdx $endIdx
set startIdx $endIdx
$tra_info_text insert end " flows:"
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::subtitle_tag $startIdx $endIdx
set startIdx $endIdx
# Then te inflows
for {set i 0} {$i<$num_objs} {incr i} {
if {[lindex $data $curIdx] == "1"} {
incr curIdx
$tra_info_text insert end "\n\t"
# This should be the object name
$tra_info_text insert end [lindex $data $curIdx]
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::subtitle_tag $startIdx $endIdx
incr curIdx
set num_rules [lindex $data $curIdx]
for {set j 0} {$j<$num_rules} {incr j} {
$tra_info_text insert end "\n\t"
set startIdx [$tra_info_text index insert]
incr curIdx
set rule [lindex $data $curIdx]
# Get the line number only
set end_link_idx [string first "\]" [string trim $rule] 0]
set lineno [string range [string trim [string range $rule 0 $end_link_idx]] 1 end-1]
set lineno [string trim $lineno]
set rule [string range $rule [expr $end_link_idx + 1] end]
# Only display line number hyperlink if this is not a binary policy.
if {![ApolTop::is_binary_policy]} {
$tra_info_text insert end "\[$lineno\]"
Apol_PolicyConf::insertHyperLink $tra_info_text "$startIdx wordstart + 1c" "$startIdx wordstart + [expr [string length $lineno] + 1]c"
}
set startIdx [$tra_info_text index insert]
$tra_info_text insert end " $rule"
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::rules_tag $startIdx $endIdx
incr curIdx
# The next element should be the enabled boolean flag.
if {[lindex $data $curIdx] == 0} {
$tra_info_text insert end " "
set startIdx [$tra_info_text index insert]
$tra_info_text insert end "\[Disabled\]"
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::disabled_rule_tag $startIdx $endIdx
}
set startIdx [$tra_info_text index insert]
}
}
incr curIdx
}
} else {
$tra_info_text insert end "\n\nObject classes for "
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::subtitle_tag $startIdx $endIdx
set startIdx $endIdx
set flow_dir [string toupper $flow_dir]
$tra_info_text insert end $flow_dir
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_type_tag $startIdx $endIdx
set startIdx $endIdx
$tra_info_text insert end " flows:"
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::subtitle_tag $startIdx $endIdx
set startIdx $endIdx
for {set i 0} {$i<$num_objs} {incr i} {
if { [lindex $data $curIdx] == "1" } {
incr curIdx
$tra_info_text insert end "\n\t"
# This should be the object name
$tra_info_text insert end [lindex $data $curIdx]
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::subtitle_tag $startIdx $endIdx
incr curIdx
set num_rules [lindex $data $curIdx]
for {set j 0} {$j<$num_rules} {incr j} {
$tra_info_text insert end "\n\t"
set startIdx [$tra_info_text index insert]
incr curIdx
set rule [lindex $data $curIdx]
# Get the line number only
set end_link_idx [string first "\]" [string trim $rule] 0]
set lineno [string range [string trim [string range $rule 0 $end_link_idx]] 1 end-1]
set lineno [string trim $lineno]
set rule [string range $rule [expr $end_link_idx + 1] end]
# Only display line number hyperlink if this is not a binary policy.
if {![ApolTop::is_binary_policy]} {
$tra_info_text insert end "\[$lineno\]"
Apol_PolicyConf::insertHyperLink $tra_info_text "$startIdx wordstart + 1c" "$startIdx wordstart + [expr [string length $lineno] + 1]c"
}
set startIdx [$tra_info_text index insert]
$tra_info_text insert end " $rule"
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::rules_tag $startIdx $endIdx
incr curIdx
# The next element should be the enabled boolean flag.
if {[lindex $data $curIdx] == 0} {
$tra_info_text insert end " "
set startIdx [$tra_info_text index insert]
$tra_info_text insert end "\[Disabled\]"
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::disabled_rule_tag $startIdx $endIdx
}
set startIdx [$tra_info_text index insert]
}
}
incr curIdx
}
}
}
}
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::display_transitive_flows
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::display_transitive_flows {tra_listbox tra_info_text data start_type} {
if { $data == "" } {
$tra_info_text configure -state disabled
return 0
}
set i 0
# Get # of target types
set num_target_types [lindex $data $i]
if {$num_target_types} {
incr i
set end_type [lindex $data $i]
set startIdx [$tra_info_text index insert]
$tra_info_text insert end "Information flows from "
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_tag $startIdx $endIdx
set startIdx [$tra_info_text index insert]
$tra_info_text insert end $start_type
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_type_tag $startIdx $endIdx
set startIdx [$tra_info_text index insert]
$tra_info_text insert end " to "
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_tag $startIdx $endIdx
set startIdx [$tra_info_text index insert]
$tra_info_text insert end $end_type
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_type_tag $startIdx $endIdx
set startIdx $endIdx
} else {
set start_idx [$tra_info_text index insert]
$tra_info_text insert end "No transitive information flows from $start_type"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_tag $start_idx $end_idx
}
# If there are any target types then format and display the data
for { set x 0 } { $x < $num_target_types } { incr x } {
# the number of paths
incr i
set currentIdx $i
set num_paths [lindex $data $currentIdx]
$tra_info_text insert end "\n\nApol found the following number of information flows: "
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::subtitle_tag $startIdx $endIdx
set startIdx $endIdx
$tra_info_text insert end $num_paths
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::counters_tag $startIdx $endIdx
for {set j 0} {$j < $num_paths} {incr j} {
set startIdx [$tra_info_text index insert]
$tra_info_text insert end "\n\nFlow"
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::subtitle_tag $startIdx $endIdx
set startIdx $endIdx
$tra_info_text insert end " [expr $j+1] "
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::counters_tag $startIdx $endIdx
set startIdx $endIdx
$tra_info_text insert end "requires "
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::subtitle_tag $startIdx $endIdx
set startIdx $endIdx
# Increment to the number of flows
incr currentIdx
set num_flows [lindex $data $currentIdx]
$tra_info_text insert end $num_flows
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::counters_tag $startIdx $endIdx
set startIdx $endIdx
$tra_info_text insert end " step(s)."
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::subtitle_tag $startIdx $endIdx
for {set k 0} {$k < $num_flows} {incr k} {
# First print the flow number
$tra_info_text insert end "\n\n\tStep "
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::subtitle_tag $startIdx $endIdx
set startIdx $endIdx
$tra_info_text insert end [expr $k + 1]
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::counters_tag $startIdx $endIdx
set startIdx $endIdx
$tra_info_text insert end ": "
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::subtitle_tag $startIdx $endIdx
set startIdx $endIdx
$tra_info_text insert end "from "
# increment to the start type for the flow
incr currentIdx
$tra_info_text insert end [lindex $data $currentIdx]
$tra_info_text insert end " to "
# Increment to the end type for the flow
incr currentIdx
$tra_info_text insert end [lindex $data $currentIdx]
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::subtitle_tag $startIdx $endIdx
set startIdx $endIdx
# Increment to the # of object classes
incr currentIdx
set num_classes [lindex $data $currentIdx]
for {set l 0} {$l < $num_classes} {incr l} {
# Increment to the first object class
incr currentIdx
$tra_info_text insert end "\n\t[lindex $data $currentIdx]"
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::subtitle_tag $startIdx $endIdx
set startIdx $endIdx
# Increment to the # of object class rules
incr currentIdx
set num_rules [lindex $data $currentIdx]
for {set m 0} {$m < $num_rules} {incr m} {
# Increment to the next rule for the object
incr currentIdx
set rule [lindex $data $currentIdx]
$tra_info_text insert end "\n\t"
set startIdx [$tra_info_text index insert]
# Get the line number only
set end_link_idx [string first "\]" [string trim $rule] 0]
set lineno [string range [string trim [string range $rule 0 $end_link_idx]] 1 end-1]
set lineno [string trim $lineno]
set rule [string range $rule [expr $end_link_idx + 1] end]
# Only display line number hyperlink if this is not a binary policy.
if {![ApolTop::is_binary_policy]} {
$tra_info_text insert end "\[$lineno\]"
Apol_PolicyConf::insertHyperLink $tra_info_text "$startIdx wordstart + 1c" "$startIdx wordstart + [expr [string length $lineno] + 1]c"
}
set startIdx [$tra_info_text index insert]
$tra_info_text insert end " $rule"
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::rules_tag $startIdx $endIdx
incr currentIdx
# The next element should be the enabled boolean flag.
if {[lindex $data $currentIdx] == 0} {
$tra_info_text insert end " "
set startIdx [$tra_info_text index insert]
$tra_info_text insert end "\[Disabled\]"
set endIdx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::disabled_rule_tag $startIdx $endIdx
}
set startIdx [$tra_info_text index insert]
}
}
}
}
}
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::display_dta_info
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::display_dta_info {tra_listbox tra_info_text data start_type} {
if { $data == "" } {
$tra_info_text configure -state disabled
return 0
}
set idx 0
# Get # of target types
set num_target_types [lindex $data $idx]
if {![string is integer $num_target_types]} {
puts "Number of target types is not an integer: $num_target_types"
return
}
if {$num_target_types} {
incr idx
set end_type [lindex $data $idx]
set start_idx [$tra_info_text index insert]
$tra_info_text insert end "Domain transition from "
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_tag $start_idx $end_idx
set start_idx [$tra_info_text index insert]
$tra_info_text insert end $start_type
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_type_tag $start_idx $end_idx
set start_idx [$tra_info_text index insert]
$tra_info_text insert end " to "
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_tag $start_idx $end_idx
set start_idx [$tra_info_text index insert]
$tra_info_text insert end $end_type
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_type_tag $start_idx $end_idx
} else {
set start_idx [$tra_info_text index insert]
$tra_info_text insert end "No domain transitions"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::title_tag $start_idx $end_idx
}
# are any target types then format and display the data
for { set x 0 } { $x < $num_target_types } { incr x } {
incr idx
# (# of pt rules)
$tra_info_text insert end "\n\n"
set start_idx [$tra_info_text index insert]
set num_pt [lindex $data $idx]
if {![string is integer $num_pt]} {
puts "Number of allow rules is not an integer: $num_pt"
return
}
$tra_info_text insert end "TE Allow Rules: "
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::subtitle_tag $start_idx $end_idx
set start_idx $end_idx
$tra_info_text insert end "$num_pt\n"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::counters_tag $start_idx $end_idx
for { set i 0 } { $i < $num_pt } { incr i } {
incr idx
set rule [lindex $data $idx]
incr idx
set lineno [lindex $data $idx]
$tra_info_text insert end "\t"
set start_idx [$tra_info_text index insert]
# Only display line number hyperlink if this is not a binary policy.
if {![ApolTop::is_binary_policy]} {
$tra_info_text insert end "($lineno) "
set end_idx [$tra_info_text index insert]
Apol_PolicyConf::insertHyperLink $tra_info_text "$start_idx wordstart + 1c" "$start_idx wordstart + [expr [string length $lineno] + 1]c"
set start_idx $end_idx
}
$tra_info_text insert end "$rule"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::rules_tag $start_idx $end_idx
incr idx
# The next element should be the enabled boolean flag.
if {[lindex $data $idx] == 0} {
$tra_info_text insert end " "
set startIdx [$tra_info_text index insert]
$tra_info_text insert end "\[Disabled\]\n"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::disabled_rule_tag $start_idx $end_idx
} else {
$tra_info_text insert end "\n"
}
}
incr idx
# (# of file types)
set num_types [lindex $data $idx]
if {![string is integer $num_types]} {
puts "Number of file types is not an integer: $num_types"
return
}
set start_idx $end_idx
$tra_info_text insert end "\nEntry Point File Types: "
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::subtitle_tag $start_idx $end_idx
set start_idx $end_idx
$tra_info_text insert end "$num_types\n"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::counters_tag $start_idx $end_idx
for {set i 0} { $i < $num_types } { incr i } {
incr idx
# (file type)
set type [lindex $data $idx]
set start_idx $end_idx
$tra_info_text insert end "\t$type\n"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::types_tag $start_idx $end_idx
incr idx
set num_ep [lindex $data $idx]
if {![string is integer $num_ep]} {
puts "Number of entrypoint access rules is not an integer: $num_ep"
return
}
set start_idx $end_idx
$tra_info_text insert end "\t\tFile Entrypoint Rules: "
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::subtitle_tag $start_idx $end_idx
set start_idx $end_idx
$tra_info_text insert end "$num_ep\n"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::counters_tag $start_idx $end_idx
for {set j 0} {$j < $num_ep} {incr j} {
incr idx
set rule [lindex $data $idx]
incr idx
set lineno [lindex $data $idx]
$tra_info_text insert end "\t\t"
set start_idx [$tra_info_text index insert]
# Only display line number hyperlink if this is not a binary policy.
if {![ApolTop::is_binary_policy]} {
$tra_info_text insert end "($lineno) "
set end_idx [$tra_info_text index insert]
Apol_PolicyConf::insertHyperLink $tra_info_text "$start_idx wordstart + 1c" "$start_idx wordstart + [expr [string length $lineno] + 1]c"
set start_idx $end_idx
}
$tra_info_text insert end "$rule"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::rules_tag $start_idx $end_idx
incr idx
# The next element should be the enabled boolean flag.
if {[lindex $data $idx] == 0} {
$tra_info_text insert end " "
set startIdx [$tra_info_text index insert]
$tra_info_text insert end "\[Disabled\]\n"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::disabled_rule_tag $start_idx $end_idx
} else {
$tra_info_text insert end "\n"
}
}
incr idx
set num_ex [lindex $data $idx]
if {![string is integer $num_ex]} {
puts "Number of execute access rules is not an integer: $num_ex"
return
}
set start_idx $end_idx
$tra_info_text insert end "\n\t\tFile Execute Rules: "
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::subtitle_tag $start_idx $end_idx
set start_idx $end_idx
$tra_info_text insert end "$num_ex\n"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::counters_tag $start_idx $end_idx
for { set j 0 } { $j < $num_ex } { incr j } {
incr idx
set rule [lindex $data $idx]
incr idx
set lineno [lindex $data $idx]
$tra_info_text insert end "\t\t"
set start_idx [$tra_info_text index insert]
# Only display line number hyperlink if this is not a binary policy.
if {![ApolTop::is_binary_policy]} {
$tra_info_text insert end "($lineno) "
set end_idx [$tra_info_text index insert]
Apol_PolicyConf::insertHyperLink $tra_info_text "$start_idx wordstart + 1c" "$start_idx wordstart + [expr [string length $lineno] + 1]c"
set start_idx $end_idx
}
$tra_info_text insert end "$rule"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::rules_tag $start_idx $end_idx
incr idx
# The next element should be the enabled boolean flag.
if {[lindex $data $idx] == 0} {
$tra_info_text insert end " "
set startIdx [$tra_info_text index insert]
$tra_info_text insert end "\[Disabled\]\n"
set end_idx [$tra_info_text index insert]
$tra_info_text tag add $Apol_Analysis_tra::disabled_rule_tag $start_idx $end_idx
} else {
$tra_info_text insert end "\n"
}
}
}
}
$tra_info_text configure -state disabled
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::create_results_list_structure
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::create_results_list_structure {tra_listbox results_list} {
variable comm_attribs_sel
variable comm_roles_sel
variable comm_users_sel
variable comm_access_sel
variable unique_access_sel
variable dta_AB_sel
variable dta_BA_sel
variable trans_flow_AB_sel
variable trans_flow_BA_sel
variable dir_flow_sel
variable te_rules_sel
variable tt_rule_sel
# Parse the list and add the list elements as we parse
# get type strings
set typeA [lindex $results_list 0]
set typeB [lindex $results_list 1]
set i 2
set parent "root"
# Get # of common attributes
set num_common_attribs [lindex $results_list $i]
set start_idx $i
# If there are common attribs...
for { set x 0 } { $x < $num_common_attribs } { incr x } {
incr i
}
# Insert item into listbox
if {$comm_attribs_sel} {
$tra_listbox insert end $parent common_attribs \
-text "Common Attributes" \
-open 0 \
-drawcross auto \
-data [lrange $results_list $start_idx $i]
}
# Get # of common roles
incr i
set num_common_roles [lindex $results_list $i]
set start_idx $i
# If there are common roles...
for { set x 0 } { $x < $num_common_roles } { incr x } {
incr i
}
# Insert item into listbox
if {$comm_roles_sel} {
$tra_listbox insert end $parent common_roles \
-text "Common Roles" \
-open 0 \
-drawcross auto \
-data [lrange $results_list $start_idx $i]
}
# Get # of common users
incr i
set num_common_users [lindex $results_list $i]
set start_idx $i
# If there are common users...
for { set x 0 } { $x < $num_common_users } { incr x } {
incr i
}
# Insert item into listbox
if {$comm_users_sel} {
$tra_listbox insert end $parent common_users \
-text "Common Users" \
-open 0 \
-drawcross auto \
-data [lrange $results_list $start_idx $i]
}
# Get # of other type transition rules
incr i
set num_other_tt_rules [lindex $results_list $i]
set start_idx $i
# If there are type transition rules...
for { set x 0 } { $x < $num_other_tt_rules } { incr x } {
incr i
}
# Insert item into listbox
if {$tt_rule_sel} {
$tra_listbox insert end $parent tt_rules \
-text "Type Transition/Change Rules" \
-open 0 \
-drawcross auto \
-data [lrange $results_list $start_idx $i]
}
# Get # of other te rules
incr i
set num_te_rules [lindex $results_list $i]
set start_idx $i
# If there are te rules...
for { set x 0 } { $x < $num_te_rules } { incr x } {
incr i
}
# Insert item into listbox
if {$te_rules_sel} {
$tra_listbox insert end $parent te_rules \
-text "TE Allow Rules" \
-open 0 \
-drawcross auto \
-data [lrange $results_list $start_idx $i]
}
# Get # common objects
incr i
set num_comm_objs [lindex $results_list $i]
set start_idx $i
# Insert item into listbox
if {$comm_access_sel} {
$tra_listbox insert end $parent common_objects \
-text "Common access to resources" \
-open 0 \
-drawcross auto \
-data $num_comm_objs
}
for { set x 0 } { $x < $num_comm_objs } { incr x } {
# Get object type string
incr i
set type [lindex $results_list $i]
incr i
set start_idx $i
# Next item should be number of rules for type A
set num_rules_A [lindex $results_list $i]
incr i $num_rules_A
# Increment to number of rules for type B
incr i
set num_rules_b [lindex $results_list $i]
incr i $num_rules_b
$tra_listbox insert end common_objects "common_objects:$type" \
-text $type \
-open 0 \
-drawcross auto \
-data [lrange $results_list $start_idx $i]
}
# Get # uniqe objects types for A
incr i
set num_uniqe_objs_A [lindex $results_list $i]
# Insert item into listbox
if {$unique_access_sel} {
$tra_listbox insert end $parent unique_objects \
-text "Dissimilar access to resources" \
-open 0 \
-drawcross auto
$tra_listbox insert end unique_objects unique_objects:typeA \
-text $typeA \
-open 0 \
-drawcross auto -data $num_uniqe_objs_A
}
for { set x 0 } { $x < $num_uniqe_objs_A } { incr x } {
# Get object type string
incr i
set type [lindex $results_list $i]
incr i
set start_idx $i
# Next item should be number of rules
set num_rules_A [lindex $results_list $i]
incr i $num_rules_A
if {$unique_access_sel} {
set data [concat $typeA [lrange $results_list $start_idx $i]]
$tra_listbox insert end "unique_objects:typeA" "unique_objects:$type" \
-text $type \
-open 0 \
-drawcross auto \
-data $data
}
}
# Get unique rules
incr i
set num_uniqe_objs_B [lindex $results_list $i]
if {$unique_access_sel} {
$tra_listbox insert end unique_objects unique_objects:typeB \
-text $typeB \
-open 0 \
-drawcross auto -data $num_uniqe_objs_B
}
for { set x 0 } { $x < $num_uniqe_objs_B } { incr x } {
# Get object type string
incr i
set type [lindex $results_list $i]
incr i
set start_idx $i
# Next item should be number of rules
set num_rules_B [lindex $results_list $i]
incr i $num_rules_B
if {$unique_access_sel} {
set data [concat $typeB [lrange $results_list $start_idx $i]]
$tra_listbox insert end "unique_objects:typeB" "unique_objects:$type" \
-text $type \
-open 0 \
-drawcross auto \
-data $data
}
}
# Parse dirflow data
# Get # of target types
incr i
set start_idx $i
set num_dirflow_target_types [lindex $results_list $i]
# This should be the end type
set currentIdx [expr $i + 1]
for { set x 0 } { $x < $num_dirflow_target_types } { incr x } {
set nextIdx [Apol_Analysis_dirflow::parseList_get_index_next_node $currentIdx $results_list]
if {$nextIdx == -1} {
return -code error "Error parsing results. See stdout for more information."
}
set currentIdx $nextIdx
}
# This should be the index of the next item.
set i $currentIdx
# Insert item into listbox
if {$dir_flow_sel} {
$tra_listbox insert end $parent dir_flows \
-text "Direct Flows Between A and B" \
-open 0 \
-drawcross auto \
-data [lrange $results_list $start_idx $i]
}
set start_idx $i
set num_transflow_types_A [lindex $results_list $i]
set currentIdx [expr $i + 1]
for { set x 0 } { $x < $num_transflow_types_A } { incr x } {
set nextIdx [Apol_Analysis_fulflow::parseList_get_index_next_node $currentIdx $results_list]
if {$nextIdx == -1} {
return -code error "Error parsing Transitive Flow results"
}
set currentIdx $nextIdx
}
# This should be the index of the next item.
set i $currentIdx
# Insert item into listbox
if {$trans_flow_AB_sel} {
$tra_listbox insert end $parent trans_flows_A \
-text "Transitive Flows A->B" \
-open 0 \
-drawcross auto \
-data [lrange $results_list $start_idx $i]
}
set start_idx $i
set num_transflow_types_B [lindex $results_list $i]
set currentIdx [expr $i + 1]
for { set x 0 } { $x < $num_transflow_types_B } { incr x } {
set nextIdx [Apol_Analysis_fulflow::parseList_get_index_next_node $currentIdx $results_list]
if {$nextIdx == -1} {
return -code error "Error parsing Transitive Flow results"
}
set currentIdx $nextIdx
}
# This should be the index of the next item.
set i $currentIdx
# Insert item into listbox
if {$trans_flow_BA_sel} {
$tra_listbox insert end $parent trans_flows_B \
-text "Transitive Flows B->A" \
-open 0 \
-drawcross auto \
-data [lrange $results_list $start_idx $i]
}
set start_idx $i
set num_dta_types_A [lindex $results_list $i]
set currentIdx [expr $i + 1]
for { set x 0 } { $x < $num_dta_types_A } { incr x } {
set end_idx [Apol_Analysis_dta::get_target_type_data_end_idx $results_list $currentIdx]
if {$end_idx == -1} {
# Print error
return -code error "Error parsing results for type [lindex $results_list $currentIdx].\nSee stdout for more information."
}
set currentIdx [expr $end_idx + 1]
}
# This should be the index of the next item.
set i $currentIdx
# Insert item into listbox
if {$dta_AB_sel} {
$tra_listbox insert end $parent dta_analysis_A \
-text "Domain Transitions A->B" \
-open 0 \
-drawcross auto \
-data [lrange $results_list $start_idx $i]
}
set start_idx $i
set num_dta_types_B [lindex $results_list $i]
set currentIdx [expr $i + 1]
for { set x 0 } { $x < $num_dta_types_B } { incr x } {
set end_idx [Apol_Analysis_dta::get_target_type_data_end_idx $results_list $currentIdx]
if {$end_idx == -1} {
# Print error
return -code error "Error parsing results for type [lindex $results_list $currentIdx].\nSee stdout for more information."
}
set currentIdx [expr $end_idx + 1]
}
# This should be the index of the next item.
set i $currentIdx
# Insert item into listbox
if {$dta_BA_sel} {
$tra_listbox insert end $parent dta_analysis_B \
-text "Domain Transitions B->A" \
-open 0 \
-drawcross auto \
-data [lrange $results_list $start_idx $i]
}
$tra_listbox configure -redraw 1
Apol_Analysis_tra::listSelect $Apol_Analysis_tra::tra_listbox \
$Apol_Analysis_tra::tra_info_text \
[$tra_listbox nodes $parent 0]
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::close
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::close { } {
Apol_Analysis_tra::reset_variables
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::open
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::open { } {
variable attribA
variable attribB
variable combo_typeA
variable combo_typeB
variable combo_attribA
variable combo_attribB
variable cb_attribA
variable cb_attribB
Apol_Analysis_tra::populate_ta_list
Apol_Analysis_tra::initialize_widgets_state
Apol_Analysis_tra::change_types_list $combo_typeA $combo_attribA 1
Apol_Analysis_tra::change_types_list $combo_typeB $combo_attribB 1
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::display_mod_options
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::display_mod_options { opts_frame } {
Apol_Analysis_tra::reset_variables
Apol_Analysis_tra::create_options $opts_frame
Apol_Analysis_tra::populate_ta_list
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::get_analysis_info
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::get_analysis_info {} {
return $Apol_Analysis_tra::descriptive_text
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::get_results_raised_tab
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::get_results_raised_tab {} {
return $Apol_Analysis_tra::tra_info_text
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::parse_query_options
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::parse_query_options_list {query_options curr_idx parentDlg} {
# Analysis variables
variable attribA
variable attribB
variable attribA_sel
variable attribB_sel
variable typeA
variable typeB
variable comm_attribs_sel
variable comm_roles_sel
variable comm_users_sel
variable comm_access_sel
variable unique_access_sel
variable dta_AB_sel
variable dta_BA_sel
variable trans_flow_AB_sel
variable trans_flow_BA_sel
variable dir_flow_sel
variable te_rules_sel
variable tt_rule_sel
# Global widget identifiers
variable combo_typeA
variable combo_typeB
variable combo_attribA
variable combo_attribB
variable cb_attribA
variable cb_attribB
Apol_Analysis_tra::reset_variables
set i $curr_idx
while {$i != [llength $query_options]} {
set tmp [string trim [lindex $query_options $i] "\{\}"]
# name:value pairs.
switch -exact -- $tmp {
"typeA" {
incr i
if {[lindex $query_options $i] != "\{\}"} {
set tmp [string trim [lindex $query_options $i] "\{\}"]
set typeA $tmp
}
}
"typeB" {
incr i
if {[lindex $query_options $i] != "\{\}"} {
set tmp [string trim [lindex $query_options $i] "\{\}"]
set typeB $tmp
}
}
"attribA_sel" {
incr i
set attribA_sel [lindex $query_options $i]
}
"attribB_sel" {
incr i
set attribB_sel [lindex $query_options $i]
}
"attribA" {
incr i
if {[lindex $query_options $i] != "\{\}"} {
set tmp [string trim [lindex $query_options $i] "\{\}"]
set attribA $tmp
}
}
"attribB" {
incr i
if {[lindex $query_options $i] != "\{\}"} {
set tmp [string trim [lindex $query_options $i] "\{\}"]
set attribB $tmp
}
}
"comm_attribs_sel" {
incr i
set comm_attribs_sel [lindex $query_options $i]
}
"comm_roles_sel" {
incr i
set comm_roles_sel [lindex $query_options $i]
}
"comm_users_sel" {
incr i
set comm_users_sel [lindex $query_options $i]
}
"comm_access_sel" {
incr i
set comm_access_sel [lindex $query_options $i]
}
"unique_access_sel" {
incr i
set unique_access_sel [lindex $query_options $i]
}
"dta_AB_sel" {
incr i
set dta_AB_sel [lindex $query_options $i]
}
"dta_BA_sel" {
incr i
set dta_BA_sel [lindex $query_options $i]
}
"trans_flow_AB_sel" {
incr i
set trans_flow_AB_sel [lindex $query_options $i]
}
"trans_flow_BA_sel" {
incr i
set trans_flow_BA_sel [lindex $query_options $i]
}
"dir_flow_sel" {
incr i
set dir_flow_sel [lindex $query_options $i]
}
"te_rules_sel" {
incr i
set te_rules_sel [lindex $query_options $i]
}
"tt_rule_sel" {
incr i
set tt_rule_sel [lindex $query_options $i]
}
default {
puts "Error: Unknown query option name encountered ([lindex $query_options $i])."
}
}
incr i
}
Apol_Analysis_tra::config_attrib_comboBox_state \
$cb_attribA $combo_attribA $combo_typeA 0
Apol_Analysis_tra::config_attrib_comboBox_state \
$cb_attribB $combo_attribB $combo_typeB 0
Apol_Analysis_tra::change_types_list $combo_typeA $combo_attribA 0
Apol_Analysis_tra::change_types_list $combo_typeB $combo_attribB 0
return $i
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::load_query_options
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::load_query_options { file_channel parentDlg } {
# Analysis variables
variable attribA
variable attribB
variable attribA_sel
variable attribB_sel
variable typeA
variable typeB
variable comm_attribs_sel
variable comm_roles_sel
variable comm_users_sel
variable comm_access_sel
variable unique_access_sel
variable dta_AB_sel
variable dta_BA_sel
variable trans_flow_AB_sel
variable trans_flow_BA_sel
variable dir_flow_sel
variable te_rules_sel
variable tt_rule_sel
# Global widget identifiers
variable combo_typeA
variable combo_typeB
variable combo_attribA
variable combo_attribB
variable cb_attribA
variable cb_attribB
set query_options_tmp ""
set query_options ""
while {[eof $file_channel] != 1} {
gets $file_channel line
set tline [string trim $line]
# Skip empty lines
if {$tline == ""} {
continue
}
set query_options_tmp [lappend query_options_tmp $tline]
}
if {$query_options_tmp == ""} {
return -code error "No query parameters were found."
}
# Re-format the query options list into a string where all elements are seperated
# by a single space. Then split this string into a list using space and colon characters
# as the delimeters.
set query_options_tmp [split [join $query_options_tmp " "] " :"]
set query_options [ApolTop::strip_list_of_empty_items $query_options_tmp]
if {$query_options == ""} {
return -code error "No query parameters were found."
}
# Parse the list starting from the beginning index 0.
Apol_Analysis_tra::parse_query_options_list $query_options 0 $parentDlg
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::get_search_options_list
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::get_search_options_list {} {
# Analysis variables
variable attribA
variable attribB
variable attribA_sel
variable attribB_sel
variable typeA
variable typeB
variable comm_attribs_sel
variable comm_roles_sel
variable comm_users_sel
variable comm_access_sel
variable unique_access_sel
variable dta_AB_sel
variable dta_BA_sel
variable trans_flow_AB_sel
variable trans_flow_BA_sel
variable dir_flow_sel
variable te_rules_sel
variable tt_rule_sel
set options [list \
"typeA:" \
$typeA \
"typeB:" \
$typeB \
"attribA:" \
$attribA \
"attribB:" \
$attribB \
"attribA_sel:" \
$attribA_sel \
"attribB_sel:" \
$attribB_sel \
"comm_attribs_sel:" \
$comm_attribs_sel \
"comm_roles_sel:" \
$comm_roles_sel \
"comm_users_sel:" \
$comm_users_sel \
"comm_access_sel:" \
$comm_access_sel \
"unique_access_sel:" \
$unique_access_sel \
"dta_AB_sel:" \
$dta_AB_sel \
"dta_BA_sel:" \
$dta_BA_sel \
"trans_flow_AB_sel:" \
$trans_flow_AB_sel \
"trans_flow_BA_sel:" \
$trans_flow_BA_sel \
"dir_flow_sel:" \
$dir_flow_sel \
"te_rules_sel:" \
$te_rules_sel \
"tt_rule_sel:" \
$tt_rule_sel]
return $options
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::save_query_options
# - module_name - name of the analysis module
# - file_channel - file channel identifier of the query file to write to.
# - file_name - name of the query file
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::save_query_options {module_name file_channel file_name} {
set options [Apol_Analysis_tra::get_search_options_list]
puts $file_channel "$module_name"
puts $file_channel "$options"
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::get_current_results_state
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::get_current_results_state { } {
variable tra_listbox
variable tra_info_text
set options [Apol_Analysis_tra::get_search_options_list]
set options [linsert $options 0 $tra_listbox $tra_info_text]
return $options
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::set_display_to_results_state
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::set_display_to_results_state {query_options} {
variable tra_listbox
variable tra_info_text
# The trick is to configure the list to look like we have read it in from a file
# as we do when loading a saved query file.
foreach item $query_options {
set query_options_tmp [lappend query_options_tmp [concat $item]]
}
set query_options_tmp [list $query_options_tmp]
# Re-format the query options list into a string where all elements are seperated
# by a single space. Then split this string into a list using space and colon characters
# as the delimeters.
set query_options_tmp [split [join $query_options_tmp " "] " :"]
set query_options_formatted [ApolTop::strip_list_of_empty_items $query_options_tmp]
set parentDlg [ApolTop::get_toplevel_dialog]
# widget variables
set tra_listbox [lindex $query_options_formatted 0]
set tra_info_text [lindex $query_options_formatted 1]
# Parse the list starting from the index 2.
Apol_Analysis_tra::parse_query_options_list $query_options_formatted 2 $parentDlg
Apol_Analysis_tra::configure_tab_label $Apol_Analysis_tra::basic_TabID
Apol_Analysis_tra::configure_tab_label $Apol_Analysis_tra::analysis_TabID
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::free_results_data
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::free_results_data {query_options} {
set tra_listbox [lindex $query_options 0]
set tra_info_text [lindex $query_options 1]
if {[winfo exists $tra_listbox]} {
$tra_listbox delete [$tra_listbox nodes root]
destroy $tra_listbox
}
if {[winfo exists $tra_info_text]} {
$tra_info_text delete 0.0 end
destroy $tra_info_text
}
return 0
}
#################################################################################
##
## The rest of these procs are not interface procedures, but rather internal
## functions to this analysis.
##
#################################################################################
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::reset_variables
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::reset_variables { } {
set Apol_Analysis_tra::attribA_sel 0
set Apol_Analysis_tra::attribB_sel 0
set Apol_Analysis_tra::typeA ""
set Apol_Analysis_tra::typeB ""
set Apol_Analysis_tra::attribA ""
set Apol_Analysis_tra::attribB ""
set Apol_Analysis_tra::comm_attribs_sel 1
set Apol_Analysis_tra::comm_roles_sel 1
set Apol_Analysis_tra::comm_users_sel 1
set Apol_Analysis_tra::comm_access_sel 0
set Apol_Analysis_tra::unique_access_sel 0
set Apol_Analysis_tra::dta_AB_sel 0
set Apol_Analysis_tra::dta_BA_sel 0
set Apol_Analysis_tra::trans_flow_AB_sel 0
set Apol_Analysis_tra::trans_flow_BA_sel 0
set Apol_Analysis_tra::dir_flow_sel 0
set Apol_Analysis_tra::te_rules_sel 0
set Apol_Analysis_tra::tt_rule_sel 0
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::change_types_list
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::change_types_list {type_cmbox attrib_cmbox clear_type} {
upvar #0 [$attrib_cmbox cget -textvariable] attrib
if {$attrib != ""} {
if {$clear_type} {
$type_cmbox configure -text ""
}
set rt [catch {set attrib_typesList [apol_GetAttribTypesList $attrib]} err]
if {$rt != 0} {
tk_messageBox -icon error -type ok -title "Error" -message "$err"
return
}
set attrib_typesList [lsort $attrib_typesList]
set idx [lsearch -exact $attrib_typesList "self"]
if {$idx != -1} {
set attrib_typesList [lreplace $attrib_typesList $idx $idx]
}
$type_cmbox configure -values $attrib_typesList
} else {
set attrib_typesList $Apol_Types::typelist
set idx [lsearch -exact $attrib_typesList "self"]
if {$idx != -1} {
set attrib_typesList [lreplace $attrib_typesList $idx $idx]
}
$type_cmbox configure -values $attrib_typesList
}
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::populate_ta_list
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::populate_ta_list { } {
variable combo_typeA
variable combo_typeB
variable combo_attribA
variable combo_attribB
set attrib_typesList $Apol_Types::typelist
set idx [lsearch -exact $attrib_typesList "self"]
if {$idx != -1} {
set attrib_typesList [lreplace $attrib_typesList $idx $idx]
}
$combo_typeA configure -values $attrib_typesList
$combo_attribA configure -values $Apol_Types::attriblist
$combo_typeB configure -values $attrib_typesList
$combo_attribB configure -values $Apol_Types::attriblist
return 0
}
proc Apol_Analysis_tra::configure_tab_label {tab} {
variable notebook
variable basic_TabID
variable analysis_TabID
variable comm_attribs_sel
variable comm_roles_sel
variable comm_users_sel
variable comm_access_sel
variable unique_access_sel
variable dta_AB_sel
variable dta_BA_sel
variable trans_flow_AB_sel
variable trans_flow_BA_sel
variable dir_flow_sel
variable te_rules_sel
variable tt_rule_sel
if { $tab == $basic_TabID } {
# Reset the tab text to the initial value and then get the raised tab.
$notebook itemconfigure $basic_TabID -text $Apol_Analysis_tra::tab1_label
set txt [$notebook itemcget $basic_TabID -text]
if {$comm_attribs_sel || $comm_roles_sel || $comm_users_sel || \
$comm_access_sel || $unique_access_sel || $te_rules_sel || $tt_rule_sel} {
append txt " *"
$notebook itemconfigure $basic_TabID -text $txt
} else {
$notebook itemconfigure $basic_TabID -text $Apol_Analysis_tra::tab1_label
}
} else {
# Reset the tab text to the initial value and then get the raised tab.
$notebook itemconfigure $analysis_TabID -text $Apol_Analysis_tra::tab2_label
set txt [$notebook itemcget $analysis_TabID -text]
if {$dta_AB_sel || $dta_BA_sel || $trans_flow_AB_sel || $trans_flow_BA_sel || $dir_flow_sel} {
append txt " *"
$notebook itemconfigure $analysis_TabID -text $txt
} else {
$notebook itemconfigure $analysis_TabID -text $Apol_Analysis_tra::tab2_label
}
}
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::config_attrib_comboBox_state
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::config_attrib_comboBox_state {checkbttn attrib_cbox type_cbox change_list} {
upvar #0 [$checkbttn cget -variable] cb_val
upvar #0 [$attrib_cbox cget -textvariable] attrib_val
upvar #0 [$type_cbox cget -textvariable] type_val
if {$cb_val} {
$attrib_cbox configure -state normal -entrybg white
if {$change_list} {
Apol_Analysis_tra::change_types_list $type_cbox $attrib_cbox 1
}
} else {
$attrib_cbox configure -state disabled -entrybg $ApolTop::default_bg_color
set attrib_typesList $Apol_Types::typelist
set idx [lsearch -exact $attrib_typesList "self"]
if {$idx != -1} {
set attrib_typesList [lreplace $attrib_typesList $idx $idx]
}
$type_cbox configure -values $attrib_typesList
}
return 0
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::create_resultsDisplay
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::create_resultsDisplay {results_frame} {
variable tra_listbox
variable tra_info_text
# set up paned window
set pw [PanedWindow $results_frame.pw -side top]
set pw_tree [$pw add]
set pw_info [$pw add -weight 5]
# title frames
set frm_tree [TitleFrame [$pw getframe 0].frm_tree -text "Types Relationship Results"]
set frm_info [TitleFrame [$pw getframe 1].frm_info -text "Types Relationship Information"]
set sw_lbox [ScrolledWindow [$frm_tree getframe].sw_lbox -auto none]
set sw_info [ScrolledWindow [$frm_info getframe].sw_info -auto none]
# tree window
set tra_listbox [Tree [$sw_lbox getframe].tra_listbox \
-relief flat -borderwidth 0 -highlightthickness 0 \
-redraw 0 -bg white -showlines 1 -padx 0]
$sw_lbox setwidget $tra_listbox
# info window
set tra_info_text [text [$sw_info getframe].tra_info_text \
-wrap none -bg white -font $ApolTop::text_font]
$sw_info setwidget $tra_info_text
bind $tra_info_text <Enter> {focus %W}
pack $pw -fill both -expand yes -anchor nw
pack $frm_tree -fill both -expand yes -anchor nw
pack $frm_info -fill both -expand yes
pack $sw_lbox -fill both -expand yes
pack $sw_info -fill both -expand yes
$tra_listbox bindText <ButtonPress-1> {Apol_Analysis_tra::listSelect \
$Apol_Analysis_tra::tra_listbox \
$Apol_Analysis_tra::tra_info_text}
$tra_listbox bindText <Double-ButtonPress-1> {Apol_Analysis_tra::listSelect \
$Apol_Analysis_tra::tra_listbox \
$Apol_Analysis_tra::tra_info_text}
return $tra_listbox
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::deselect_all_cbs
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::deselect_all_cbs { tab } {
variable basic_TabID
variable analysis_TabID
variable comm_attribs_sel
variable comm_roles_sel
variable comm_users_sel
variable comm_access_sel
variable unique_access_sel
variable dta_AB_sel
variable dta_BA_sel
variable trans_flow_AB_sel
variable trans_flow_BA_sel
variable dir_flow_sel
variable te_rules_sel
variable tt_rule_sel
if { $tab == $basic_TabID } {
set comm_attribs_sel 0
set comm_roles_sel 0
set comm_users_sel 0
set comm_access_sel 0
set unique_access_sel 0
set te_rules_sel 0
set tt_rule_sel 0
} else {
set dta_AB_sel 0
set dta_BA_sel 0
set trans_flow_AB_sel 0
set trans_flow_BA_sel 0
set dir_flow_sel 0
}
Apol_Analysis_tra::configure_tab_label $tab
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::select_all_cbs
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::select_all_cbs { tab } {
variable basic_TabID
variable analysis_TabID
variable comm_attribs_sel
variable comm_roles_sel
variable comm_users_sel
variable comm_access_sel
variable unique_access_sel
variable dta_AB_sel
variable dta_BA_sel
variable trans_flow_AB_sel
variable trans_flow_BA_sel
variable dir_flow_sel
variable te_rules_sel
variable tt_rule_sel
if { $tab == $basic_TabID } {
set comm_attribs_sel 1
set comm_roles_sel 1
set comm_users_sel 1
set comm_access_sel 1
set unique_access_sel 1
set te_rules_sel 1
set tt_rule_sel 1
} else {
set dta_AB_sel 1
set dta_BA_sel 1
set trans_flow_AB_sel 1
set trans_flow_BA_sel 1
set dir_flow_sel 1
}
Apol_Analysis_tra::configure_tab_label $tab
}
# ------------------------------------------------------------------------------
# Command Apol_Analysis_tra::create_options
# ------------------------------------------------------------------------------
proc Apol_Analysis_tra::create_options { options_frame } {
variable combo_typeA
variable combo_typeB
variable combo_attribA
variable combo_attribB
variable cb_attribA
variable cb_attribB
variable notebook
variable basic_TabID
variable analysis_TabID
set entry_frame [frame $options_frame.entry_frame]
set top_frame [TitleFrame $entry_frame.left_frame \
-text "Required parameters"]
set top [$top_frame getframe]
set types_f [frame $top.types_f]
set ckbttns_f [frame $top.ckbttns_f]
set typeA_frame [frame $types_f.typeA_frame]
set typeB_frame [frame $types_f.typeB_frame]
set type_frame_1 [frame $typeA_frame.type_frame_1]
set type_frame_2 [frame $typeB_frame.type_frame_2]
set attrib_frame_1 [frame $typeA_frame.ckbttns_frame_2]
set attrib_frame_2 [frame $typeB_frame.ckbttns_frame_2]
set notebook [NoteBook $ckbttns_f.nb]
set basic_info_tab [$notebook insert end $basic_TabID -text "Basic"]
set analysis_info_tab [$notebook insert end $analysis_TabID -text "Analysis"]
# Labels
set lbl_typeA [Label $type_frame_1.lbl_typeA -text "Type A:"]
set lbl_typeB [Label $type_frame_2.lbl_typeB -text "Type B:"]
set lbl_ckbttns [Label $ckbttns_f.lbl_ckbttns \
-text "Search for the following associations between the two types:"]
# TypeA and TypeB comboboxes
set combo_typeA [ComboBox $type_frame_1.combo_typeA \
-editable 1 \
-textvariable Apol_Analysis_tra::typeA \
-entrybg white]
set combo_typeB [ComboBox $type_frame_2.combo_typeB \
-editable 1 \
-textvariable Apol_Analysis_tra::typeB \
-entrybg white]
# Attribute boxes for selecting type by attribute
set combo_attribA [ComboBox $attrib_frame_1.combo_attribA \
-editable 1 \
-textvariable Apol_Analysis_tra::attribA \
-entrybg white \
-state disabled]
$combo_attribA configure -modifycmd {Apol_Analysis_tra::change_types_list \
$Apol_Analysis_tra::combo_typeA $Apol_Analysis_tra::combo_attribA 1}
set combo_attribB [ComboBox $attrib_frame_2.combo_attribB \
-editable 1 \
-textvariable Apol_Analysis_tra::attribB \
-entrybg white \
-state disabled]
$combo_attribB configure -modifycmd {Apol_Analysis_tra::change_types_list \
$Apol_Analysis_tra::combo_typeB $Apol_Analysis_tra::combo_attribB 1}
# Checkbuttons for enabling disabling attribute comboboxes
set cb_attribA [checkbutton $attrib_frame_1.cb_attribA \
-text "Filter types to select using attrib:" \
-variable Apol_Analysis_tra::attribA_sel \
-offvalue 0 -onvalue 1]
$cb_attribA configure \
-command "Apol_Analysis_tra::config_attrib_comboBox_state \
$cb_attribA $combo_attribA $combo_typeA 1"
set cb_attribB [checkbutton $attrib_frame_2.cb_attribB \
-text "Filter types to select using attrib:" \
-variable Apol_Analysis_tra::attribB_sel \
-offvalue 0 -onvalue 1]
$cb_attribB configure \
-command "Apol_Analysis_tra::config_attrib_comboBox_state \
$cb_attribB $combo_attribB $combo_typeB 1"
set tab1_frame [$notebook getframe $basic_TabID]
set tab2_frame [$notebook getframe $analysis_TabID]
set tab1_topf [frame $tab1_frame.tab1_topf]
set tab1_botf [frame $tab1_frame.tab1_botf]
set tab2_topf [frame $tab2_frame.tab2_topf]
set tab2_botf [frame $tab2_frame.tab2_botf]
set tab1_lframe [frame $tab1_topf.tab1_lframe]
set tab1_rframe [frame $tab1_topf.tab1_rframe]
set tab2_lframe [frame $tab2_topf.tab2_lframe]
set tab2_rframe [frame $tab2_topf.tab2_rframe]
pack $tab1_lframe $tab1_rframe $tab2_lframe $tab2_rframe -side left -fill both -expand yes -anchor nw
pack $tab1_botf $tab2_botf -side bottom -anchor center
pack $tab1_topf $tab2_topf -side top -anchor nw -fill both -expand yes
set tab1_button1 [Button $tab1_botf.tab1_button1 -text "Select All" \
-helptext "Select All Options" -width 8 \
-command "Apol_Analysis_tra::select_all_cbs $basic_TabID"]
set tab1_button2 [Button $tab1_botf.tab1_button2 -text "Deselect All" \
-helptext "Deselect All Selected Options" -width 8 \
-command "Apol_Analysis_tra::deselect_all_cbs $basic_TabID"]
set tab2_button1 [Button $tab2_botf.tab2_button1 -text "Select All" \
-helptext "Select All Options" -width 8 \
-command "Apol_Analysis_tra::select_all_cbs $analysis_TabID"]
set tab2_button2 [Button $tab2_botf.tab2_button2 -text "Deselect All" \
-helptext "Deselect All Selected Options" -width 8 \
-command "Apol_Analysis_tra::deselect_all_cbs $analysis_TabID"]
# Query-related checkbuttons
set comm_attribs_cb [checkbutton $tab1_lframe.comm_attribs_cb \
-text "Common Attributes" \
-variable Apol_Analysis_tra::comm_attribs_sel \
-command "Apol_Analysis_tra::configure_tab_label $basic_TabID"]
set comm_roles_cb [checkbutton $tab1_lframe.comm_roles_cb \
-text "Common Roles" \
-variable Apol_Analysis_tra::comm_roles_sel \
-command "Apol_Analysis_tra::configure_tab_label $basic_TabID"]
set comm_users_cb [checkbutton $tab1_lframe.comm_users_cb \
-text "Common Users" \
-variable Apol_Analysis_tra::comm_users_sel \
-command "Apol_Analysis_tra::configure_tab_label $basic_TabID"]
set comm_access_cb [checkbutton $tab1_lframe.comm_access_cb \
-text "Common access to resources" \
-variable Apol_Analysis_tra::comm_access_sel \
-command "Apol_Analysis_tra::configure_tab_label $basic_TabID"]
set unique_access_cb [checkbutton $tab1_rframe.unique_access_cb \
-text "Dissimilar access to resources" \
-variable Apol_Analysis_tra::unique_access_sel \
-command "Apol_Analysis_tra::configure_tab_label $basic_TabID"]
set te_rules_cb [checkbutton $tab1_rframe.te_rules_cb \
-text "TE Allow Rules" \
-variable Apol_Analysis_tra::te_rules_sel \
-command "Apol_Analysis_tra::configure_tab_label $basic_TabID"]
set tt_rules_cb [checkbutton $tab1_rframe.tt_rules_cb \
-text "Type Transition/Change Rules" \
-variable Apol_Analysis_tra::tt_rule_sel \
-command "Apol_Analysis_tra::configure_tab_label $basic_TabID"]
set dta_AB_cb [checkbutton $tab2_rframe.dta_AB_cb \
-text "Domain Transitions A->B" \
-variable Apol_Analysis_tra::dta_AB_sel \
-command "Apol_Analysis_tra::configure_tab_label $analysis_TabID"]
set dta_BA_cb [checkbutton $tab2_rframe.dta_BA_cb \
-text "Domain Transitions B->A" \
-variable Apol_Analysis_tra::dta_BA_sel \
-command "Apol_Analysis_tra::configure_tab_label $analysis_TabID"]
set trans_flow_AB_cb [checkbutton $tab2_lframe.trans_flow_AB_cb \
-text "Transitive Flows A->B" \
-variable Apol_Analysis_tra::trans_flow_AB_sel \
-command "Apol_Analysis_tra::configure_tab_label $analysis_TabID"]
set trans_flow_BA_cb [checkbutton $tab2_lframe.trans_flow_BA_cb \
-text "Transitive Flows B->A" \
-variable Apol_Analysis_tra::trans_flow_BA_sel \
-command "Apol_Analysis_tra::configure_tab_label $analysis_TabID"]
set dir_flow_cb [checkbutton $tab2_lframe.dir_flow_cb \
-text "Direct Flows Between A and B" \
-variable Apol_Analysis_tra::dir_flow_sel \
-command "Apol_Analysis_tra::configure_tab_label $analysis_TabID"]
# pack all the widgets
pack $tab1_button1 $tab1_button2 $tab2_button1 $tab2_button2 -anchor nw -side left -fill both -expand yes -padx 2 -pady 2
pack $lbl_typeA $lbl_typeB -side top -anchor nw -padx 2
pack $cb_attribA $cb_attribB -side top -anchor sw -padx 10
pack $combo_typeA $combo_typeB -side left -anchor nw -fill x -expand yes -padx 5
pack $combo_attribA $combo_attribB -side top -anchor sw -padx 10 -fill x -expand yes
pack $notebook -side bottom -anchor nw -fill both -expand yes
pack $entry_frame -side left -anchor nw -fill both -padx 5 -expand yes
pack $top_frame -side left -anchor nw -fill both -padx 5 -expand yes
pack $top -fill both -side top -anchor nw -expand yes
pack $types_f -side top -anchor nw -fill x -expand yes -pady 4
pack $ckbttns_f -side bottom -anchor nw -fill both -pady 8 -expand yes
pack $comm_attribs_cb $comm_roles_cb $comm_users_cb $te_rules_cb $tt_rules_cb \
$comm_access_cb $unique_access_cb -side top -anchor nw -padx 2
pack $dir_flow_cb $trans_flow_AB_cb $trans_flow_BA_cb \
$dta_AB_cb $dta_BA_cb -side top -anchor nw -padx 2
pack $typeA_frame $typeB_frame -side left -anchor nw -expand yes
pack $type_frame_1 $type_frame_2 -side top -anchor nw -fill x -expand yes
pack $attrib_frame_1 $attrib_frame_2 -side bottom -anchor nw -fill x -expand yes -pady 2
pack $lbl_ckbttns -side top -anchor nw -pady 2
# Set binding for the embedded entrybox within the BWidget combobox
bindtags $combo_typeA.e [linsert [bindtags $combo_typeA.e] 3 combo_typeA_Tag]
bind combo_typeA_Tag <KeyPress> \
{ApolTop::_create_popup $Apol_Analysis_tra::combo_typeA %W %K}
bindtags $combo_typeB.e [linsert [bindtags $combo_typeB.e] 3 combo_typeB_Tag]
bind combo_typeB_Tag <KeyPress> \
{ApolTop::_create_popup $Apol_Analysis_tra::combo_typeB %W %K}
bindtags $combo_attribA.e [linsert [bindtags $combo_attribA.e] 3 combo_attribA_Tag]
bind combo_attribA_Tag <KeyPress> \
{ApolTop::_create_popup $Apol_Analysis_tra::combo_attribA %W %K}
bindtags $combo_attribB.e [linsert [bindtags $combo_attribB.e] 3 combo_attribB_Tag]
bind combo_attribB_Tag <KeyPress> \
{ApolTop::_create_popup $Apol_Analysis_tra::combo_attribB %W %K}
Apol_Analysis_tra::initialize_widgets_state
return 0
}
|