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 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061
|
#!/usr/local/bin/perl
#
# Copyright (c) 1999 - 2003 Clif Harden. All Rights Reserved
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU GENERAL PUBLIC LICENSE.
#----------------------------------------------------------------------------
#
# This program was originally written by Clif Harden.
# Some of the software in the LDAP search subroutine was orginally
# written by Graham Barr. It is based on Graham Barr's PERL LDAP
# module and the PERL TK module.
# Both modules are available from the CPAN.org system.
#
# $Id: tklkup,v 2.47 2006/03/27 01:45:56 clif Exp $
#
# Purpose: This program is designed to retrieve data from a LDAP
# directory and display on the graphical user interface
# created by this program. This program can edit the data
# retrieved from the directory.
#
#
#
#
#----------------------------------------------------------------------------
#
use Carp;
use Data::Dumper;
use MIME::Base64;
#use Net::LDAP qw(:all);
use Net::LDAP;
use Net::LDAP::Filter;
use Net::LDAP::Util qw( ldap_explode_dn ldap_error_name ldap_error_text canonical_dn );
use Net::LDAP::Constant;
use Net::LDAP::DSML;
use Net::LDAP::LDIF;
use Getopt::Std;
use Tk;
use Tk::NoteBook;
use Tk::ErrorDialog;
use Tk::LabFrame;
use Tk::ROText;
use Tk::HList;
use Tk::Tree;
use Tk::Label;
use subs qw/ops_items/;
#
# Global variables, wish I did not have to use them
# but Tk forces me to.
#
my %Global = ();
my %Tree = ();
$Global{'jpeg'} = 1;
eval 'require Tk::JPEG';
$Global{'jpeg'} = 0 if ( $@ );
$Global{'splash'} = 1;
eval { require Tk::Splashscreen;
require Tie::Watch;
};
$Global{'splash'} = 0 if ( $@ );
#
# Window roots
#
$Global{'mainWindow'} = undef();
$Global{'schemaWindow'} = undef();
$Global{'histWindow'} = undef();
$Global{'portWindow'} = undef();
$Global{'bindWindow'} = undef();
my %schemaHash = ();
&init_schemaHash;
$Global{'LDAP_SERVER'} = "";
$Global{'ldap'} = undef;
$Global{'bindpw'} = "";
$Global{'binddn'} = "";
$Global{fref} = 0;
$Global{'adata'} = "";
$Global{'info'} = "";
$Global{'slist'} = 0;
$Global{'setVersion'} = 3; # set version 3 ldap
$Global{'sfile'} = 0;
$Global{'fdata'} = "";
$Global{'hand'} = 'left';
$Global{'horz'} = 200;
$Global{'vert'} = 20;
$Global{'Font'} = "{ MS Sans Serif} 10";
$Global{'CORE_SERVER'} = "";
$Global{'sclear'} = 0;
$Global{'limit'} = 100;
$Global{port} = 389;
$Global{nsslport} = 389;
$Global{sslport} = 636;
$Global{'platform'} = ($^O eq 'MSWin32') ? $^O : 'unix' ;
$Global{'max'} = 0;
$Global{'infoFilter'} = "equal";
$Global{'nismapname'} = 0;
$Global{'automountMapName'} = 0;
$Global{'records'} = 0;
$Global{'mwwidth'} = 600;
$Global{'mwheight'} = 520;
$Global{dirConnError} = undef();
$Global{'setSSL'} = 0;
my $sbbframe;
my $LDAP_SEARCH_BASE = "";
my $DN_BASE = "";
my @base = ();
my $base = "";
my $defaultPort = 389;
my $sepChar = "\f"; # formfeed separator
#--------------------------------------------------------
# Handle the command line parameter(s)
#--------------------------------------------------------
getopts( 'hnrd:i:' );
Usage() if ( $opt_h );
my $debug = $opt_n ? 1 : 0;
# Fork this process on start up.
#
# If not in debug mode;
# Fork a child process and kill the parent.
# (That sounds nasty)
#
if ( !$debug && $Global{'platform'} eq 'unix' ) {
FORK: {
if ( $pid = fork ) {
# this is parent process, so DIE
#
exit;
}
elsif ( defined $pid) {
# this is the child process, so keep on running
#
&MAIN_PROCESS();
} # End of elsif in FORK.
} # End of FORK block.
} # End of if.
else {
#
# in debug mode, so do not fork but continue to run.
#
&MAIN_PROCESS();
} # End of else
sub MAIN_PROCESS {
$Global{'mainWindow'} = MainWindow->new;
$splash = $Global{'mainWindow'}->Splashscreen(-milliseconds => 0)
if ( $Global{splash} );
$splframe = $splash->LabFrame(-label => "TKLKUP SPLASH SCREEN",
-labelside => "acrosstop")
->pack() if ( $Global{splash} );
$splashList = $splframe->Listbox( -height => 2, -width => 40 )
if ( $Global{splash} );
$splashList->pack()
if ( $Global{splash} );
$splash->Splash()
if ( $Global{splash} );
$splashList->insert("0", "Reading initialization file")
if ( $Global{splash} );
$splash->update()
if ( $Global{splash} );
&initializeProgram; # Read the dot file.
$Global{'mainWindow'}->geometry("$Global{'mwwidth'}x$Global{'mwheight'}+$Global{'horz'}+$Global{'vert'}");
$splash->update()
if ( $Global{splash} );
&createSearchBaseWindow();
$Global{'sbWindow'}->withdraw if Tk::Exists($Global{'sbWindow'});
&initializeBases;
$splashList->insert("0", "Setting tklkup GUI.")
if ( $Global{splash} );
$splash->update()
if ( $Global{splash} );
$Global{'mainWindow'}->title("TKLKUP");
#
# Create the Menubar
#
$Global{'mainWindow'}->configure(-menu => $Global{'menubar'} = $Global{'mainWindow'}->Menu);
$Global{'menubar'}->cascade(-label => "Directory ~OPS",
-menuitems => ops_items);
$Global{'menubar'}->command(-label => "Set ~Bind Credentials",
-command => \&BIND );
$Global{'menubar'}->command(-label => "Set DSA ~Port",
-command => \&PORT );
$Global{'menubar'}->command(-label => "E~XIT PROGRAM",
-command => sub{exit;} );
#
# Create process Exit button
#
$mwf = $Global{'mainWindow'} -> Frame() -> pack(-side => "top");
$mwf ->Label( -text => "DIRECTORY SERVER") ->pack (-side =>"left");
$Global{'slist'} = $mwf ->Listbox( -height => 1 );
$Global{'slist'}->pack( -side => "left", -padx => 2, -pady => 5 );
$Global{'slist'}->insert("end", $Global{'LDAP_SERVER'});
#
# Create directory server selection button
# This is where the user will select the directory server to
# query.
#
$smenu = $mwf -> Menubutton(-text => "SELECT SERVER",
-relief => "raised", -font => $Global{'Font'},
-borderwidth => 3 )
-> pack(-side => "left", -pady => 2, -padx => 5 );
#
# Create a LDAP version status label
#
$Versionstatus = $mwf -> Label -> pack(-side => "left", -anchor => "center" );
if ( $Global{setVersion} == 3 )
{
$Versionstatus->configure( -text => "LDAP V3", -font => $Global{Font});
}
else
{
$Versionstatus->configure( -text => "LDAP V2", -font => $Global{Font});
}
#
# Create a SSL status label
#
$SSLstatus = $mwf -> Label -> pack(-side => "left", -anchor => "center" );
if ( $Global{setSSL} )
{
$SSLstatus->configure( -text => "SSL", -font => $Global{Font});
}
else
{
$SSLstatus->configure( -text => "NON-SSL", -font => $Global{Font});
}
#
# Create a REF status label
#
$FRstatus = $mwf -> Label -> pack(-side => "left", -anchor => "center" );
if ( $Global{fref} )
{
$FRstatus->configure( -text => "REF", -font => $Global{Font});
}
else
{
$FRstatus->configure( -text => " ", -font => $Global{Font});
}
$Global{'mainWindow'}->update();
$Global{nb} = $Global{'mainWindow'}->NoteBook()
->pack(-expand => 1, -fill => 'both');
$Global{p2} = $Global{nb}->add('SEARCH',-label => 'SEARCH');
$Global{'mainWindow'}->update();
&initializeP2;
$Global{'mainWindow'}->update();
$Global{p3} = $Global{nb}->add('SEARCH DISPLAY',-label => 'SEARCH DISPLAY');
&initializeP3;
$Global{'mainWindow'}->update();
$Global{p4} = $Global{nb}->add('SCHEMA',-label => 'SCHEMA DATA');
&initializeP4;
$Global{'mainWindow'}->update();
$Global{p5} = $Global{nb}->add('CREATE ENTRY',-label => 'CREATE ENTRY');
&initializeP5;
$Global{'mainWindow'}->update();
$Global{p1} = $Global{nb}->add('INFO',-label => 'INFO');
&initializeP1;
$splash->Destroy() if ( $Global{splash} );
$splash = undef();
$Global{schema_timer} = $Global{mainWindow}->repeat(1000, \&update_schema);
#
# Run the Main loop looking for events.
#
MainLoop;
}
sub ops_items
{
[
[ 'command', 'Explore ~Root DSE', -accelerator => "Ctrl-r", -command => \&rootDse ],
"",
[ 'command', 'Set ~SSL', -accelerator => "Ctrl-s", -command => \&setSSL ],
"",
[ 'command', 'Set ~NON-SSL', -accelerator => "Ctrl-n", -command => \&nonSSL ],
"",
[ 'command', 'Toggle ~LDAP Version', -accelerator => "Ctrl-l", -command => \&toggleVersion ],
"",
[ 'command', 'Toggle ~Follow Referral', -accelerator => "Ctrl-f", -command => \&toggleRef ],
"",
[ 'command', 'E~xit', -accelerator => "Ctrl-x", -command => sub { exit;} ],
];
}# End of subroutine ops_items
sub update_schema
{
if ( $Global{schemaServer} ne $Global{CORE_SERVER} )
{
$Global{mainWindow} -> Busy(-recurse => 1); # window is busy
$Global{schema_timer}->cancel;
if ( $Global{schemaServer} ne $Global{CORE_SERVER} )
{
$currentPanel = $Global{nb} -> raised();
$Global{nb} -> raise('INFO');
&schema;
$Global{nb} -> raise($currentPanel);
}
$Global{schemaServer} = $Global{LDAP_SERVER};
$Global{schema_timer} = $Global{mainWindow}->repeat(1000, \&update_schema);
$Global{mainWindow} -> Unbusy; # window is not busy
}
} # End of subroutine update_schema
sub init_schemaHash
{
$schemaHash{ 'schema' } = undef();
$schemaHash{ 'obj' } = {};
$schemaHash{ 'tree' } = {};
$schemaHash{ 'atts' } = [];
$schemaHash{ 'ocs' } = [];
$schemaHash{ 'mrs' } = [];
$schemaHash{ 'nfm' } = [];
$schemaHash{ 'lsyn' } = [];
$schemaHash{ 'dits' } = [];
$schemaHash{ 'ditc' } = [];
$schemaHash{ 'mru' } = [];
} # End of subroutine init_schemaHash
sub setSSL
{
$Global{setSSL} = 1;
$Global{port} = $Global{sslport};
$SSLstatus->configure( -text => "SSL", -font => $Global{Font});
} # End of subroutine setSSL
sub nonSSL
{
$Global{setSSL} = 0;
$Global{port} = $Global{nsslport};
$SSLstatus->configure(-text => "NON-SSL", -font => $Global{Font});
} # End of subroutine nonSSL
sub toggleVersion
{
if ( $Global{setVersion} == 2 )
{
$Global{setVersion} = 3;
$Versionstatus->configure( -text => "LDAP V3", -font => $Global{Font});
}
else
{
$Global{setVersion} = 2;
$Versionstatus->configure( -text => "LDAP V2", -font => $Global{Font});
}
} # End of subroutine toggleVersion
sub toggleRef
{
if ( $Global{fref} == 0 )
{
$Global{fref} = 1;
$FRstatus->configure( -text => "REF", -font => $Global{Font});
}
else
{
$Global{fref} = 0;
$FRstatus->configure( -text => " ", -font => $Global{Font});
}
} # End of subroutine toggleRef
sub saveLdif
{
$Global{'saveLdifck'} -> select;
$Global{'saveXmlck'} -> deselect;
} # End of subroutine saveLdif
sub saveXml
{
$Global{'saveXmlck'} -> select;
$Global{'saveLdifck'} -> deselect;
} # End of subroutine saveXml
sub initializeProgram
{
#
# Check for dot file, use it to configure program.
#
if ( $Global{'platform'} eq 'unix' )
{
$ENV{'TMP'} = "/tmp";
}
else
{
$ENV{'TMP'} = "./";
}
@dotfile = ();
push(@dotfile,$opt_i) if $opt_i;
#
# Active State Perl does not always set ENV HOME.
#
if ( !$ENV{HOME} )
{
$ENV{"HOME"} = ".";
}
if ( !$ENV{PWD} )
{
$ENV{PWD} = ".";
}
push( @dotfile, "$ENV{HOME}/.tklkup");
push( @dotfile, "$ENV{PWD}/.tklkup");
foreach (@dotfile)
{
#
# first .tklkup file found is the one that will be used.
#
if ( -e $_ && -r $_ )
{
$dotfile = $_;
last;
}
}
if ( -e $dotfile && -r $dotfile )
{
open(DOT, "<$dotfile");
@Input = <DOT>;
foreach (@Input)
{
my @data = ();
if ( /^#/ || /^\s+$/ ) { next; }
chomp();
@data = split(/:/);
$data[1] =~ s/^\s*//;
$data[1] =~ s/\s+$//;
$data[2] =~ s/^\s*// if ( defined($data[2]) );
$data[2] =~ s/\s+$// if ( defined($data[2]) );
$_ = $data[0];
TYPE: {
/^followref/i && do {
$Global{fref} = 1;
last TYPE; };
/^binddn/i && do {
$Global{binddn} = $data[1];
last TYPE; };
/^hand/i && do {
$Global{'hand'} = $data[1];
last TYPE; };
/^port/i && do {
$Global{port} = $data[1];
$Global{nsslport} = $data[1];
last TYPE; };
/^sslport/i && do {
$Global{sslport} = $data[1];
last TYPE; };
/^limit/i && do {
if (defined($data[1]) )
{
$Global{'limit'} = $data[1];
}
else
{
$Global{'limit'} = 100;
}
last TYPE; };
/^attribute/i && do {
push(@attribute, $data[1]);
last TYPE; };
/^server/i && do {
push(@server, $data[1]);
if ( defined($data[2]) )
{
$server{$data[1]} = $data[2];
}
last TYPE; };
/^font/i && do {
$Global{'Font'} = $data[1];
last TYPE; };
/^nismapname/i && do {
$Global{'nismapname'} = 1;
last TYPE; };
/^automountMapName/i && do {
$Global{'nismapname'} = 1;
last TYPE; };
/^mwwidth/i && do {
$Global{'mwwidth'} = $data[1];
last TYPE; };
/^mwheight/i && do {
$Global{'mwheight'} = $data[1];
last TYPE; };
my $error = "Parsing configuration file found an undefined type: $_";
ERROR(\$error);
} # End of case TYPE
}
close(DOT);
}
#
# Default is for left hand people!
# Over ride the dot file if the -r command line
# option is used.
#
if ( defined($opt_r) ) {
$Global{'hand'} = $opt_r ? 'right' : 'left';
# my $Global{'hand'} = $opt_r ? 'left' : 'right'; # uncomment this for right hand def.
}
#
# Default directory search attributes.
#
if ( $#attribute < 1 )
{
@attribute = qw/ uid sn cn rfc822mailbox telephonenumber
facsimiletelephonenumber gidnumber uidnumber/;
}
push(@attribute,"Filter"); # put roll your on filter at the end
} # End of subroutine initializeProgram
sub initializeBases
{
#
# Default directory server.
#
if ( @server < 1 )
{
$server[0] = "ldap.umich.edu";
}
$Global{'LDAP_SERVER'} = $server[0];
$Global{'CORE_SERVER'} = $Global{'LDAP_SERVER'};
#
# Default directory search base.
#
$error = &dirConn(); # connect and bind to the directory.
if ( !$error )
{
#
# Find the branches of the directory.
#
if ( !$error || $Global{setVersion} )
{
if ( defined($server{$server[0]}) )
{
# user defined base
my $t1 = [];
push(@$t1, getBases($Global{'LDAP_SERVER'}, $server{$server[0]}));
$ncbase =~ tr/[A-Z]/[a-z]/;
$Tree{$ncbase} = $t1;
$BASEDN{$ncbase} = $ncbase;
}
else
{
my $error = 0;
my $entry;
my $mesg;
# use root_dse to find the bases
@base = ();
$entry = $Global{ldap}->root_dse();
if ( defined($entry) )
{
my $attr = $entry->get_value('namingContexts', asref => 1);
if ( defined($attr) )
{
foreach my $ncbase ( @$attr )
{
$splashList->insert("1", "Searching $ncbase")
if ( $Global{splash} );
$splash->update()
if ( $Global{splash} );
my $t1 = [];
push(@$t1, getBases($Global{'LDAP_SERVER'}, $ncbase));
$ncbase =~ tr/[A-Z]/[a-z]/;
$Tree{$ncbase} = $t1;
$BASEDN{$ncbase} = $ncbase;
}
}
}
}
}
&initTree();
}
else
{
if ( defined($Global{dirConnError}) )
{
ERROR(\$Global{dirConnError});
}
else
{
ERROR($error);
}
}
@NcKeys = sort(keys(%Tree));
if ( @NcKeys )
{
$LDAP_SEARCH_BASE = $NcKeys[0];
$DN_BASE = $NcKeys[0];
}
else
{
$LDAP_SEARCH_BASE = "";
$DN_BASE = "";
}
} # End of subroutine initializeBases
#
# Initialize panel 1
#
sub initializeP1
{
$dsaframe = $Global{p1}->Frame()
->pack( -fill => "both", -side => "top" );
#
# Set up the select directory server radio buttons.
#
foreach (@server)
{
$smenu->radiobutton( -label => $_, -variable => \$Global{'LDAP_SERVER'},
-value => $_, -command => \&server, -font => $Global{'Font'} );
}
$dsads = $dsaframe ->LabFrame( -labelside => "acrosstop",
-label => "DIRECTORY SERVER") ->pack (-side =>"left");
$Global{dsadsls} = $dsads->Listbox( -height => 1 );
$Global{dsadsls}->pack( -side => "top", -padx => 2, -pady => 5 );
$Global{dsadsls}->insert("end", $Global{'LDAP_SERVER'});
$dsasb = $dsaframe ->LabFrame( -labelside => "acrosstop",
-label => "SEARCH BASE") ->pack (-side =>"left");
$Global{dsasbls} = $dsasb->Listbox( -height => 1);
$Global{dsasbls}->pack( -side => "left", -padx => 2, -pady => 5 );
$Global{dsasbls}->insert("end", $LDAP_SEARCH_BASE);
$dsapt = $dsaframe ->LabFrame( -labelside => "acrosstop",
-label => "PORT") ->pack (-side =>"left");
$Global{dsaptls} = $dsapt->Listbox( -height => 1 );
$Global{dsaptls}->pack( -side => "left", -padx => 2, -pady => 5 );
$Global{dsaptls}->insert("end", $Global{port});
$attframe = $Global{p1}->Frame()
->pack( -fill => "both", -side => "bottom");
$msgframe = $attframe->LabFrame(-label => "Process Messages",
-labelside => "acrosstop" )
->pack( -fill => "both", -side => "top", -padx => 1, -pady => 1 );
$splashList->insert("0", "Creating root dse and attribute buttons.")
if ( $Global{splash} );
$splash->update()
if ( $Global{splash} );
$msgbox = $msgframe ->Scrolled('Listbox', -scrollbars => 's',
-width => 50, -height => 10 );
$msgbox->pack( -side => "left" );
#
# Allow mainWindow to update
#
$Global{'mainWindow'}->update;
} # End of subroutine initializeP1
#
# Initialize panel 2
#
sub initializeP2
{
$tpframe = $Global{p2} ->Frame(-borderwidth => 2,-relief => "raised") ->pack(-side => "top", -fill => "x");
$bmframe = $Global{p2} ->Frame ->pack(-side => "bottom", -fill => "x");
$hlframe = $tpframe ->Frame(-borderwidth => 2,-relief => "raised") ->pack( -side => "right");
#
# Create search base list box.
#
$sbbframe = $hlframe->LabFrame(-label => "DIRECTORY SEARCH BASE",
-labelside => "acrosstop")
->pack( -side => "top", -anchor => "e");
#
# Create the Attributes and Save to frame
#
$ltframe = $tpframe ->Frame()
->pack( -side => "left", -fill => "both");
#
# Create the Attributes frame
#
$aframe = $ltframe ->LabFrame(-label => "FILTER\nATTRIBUTES",
-labelside => "acrosstop",
-relief => "raised")
->pack( -side => "top", -fill => "both");
#
# Create the Save to frame
#
$fmtframe = $ltframe ->LabFrame( -label => "SAVE FORMAT",
-labelside => "acrosstop",
-relief => "raised")
->pack( -side => "top", -fill => "both");
#
# Create a ldif Checkbutton that will set up a ldif variable
#
#
$Global{saveLdifck} = $fmtframe -> Checkbutton(
-text => "LDIF", -command => \&saveLdif,
-variable => \$Global{ldif}, -onvalue => 1,
-offvalue => 0, -font => $Global{'Font'} )
-> pack(-side => "bottom", -anchor => "w" );
$Global{saveLdifck}->select();
#
# Create a ldif Checkbutton that will set up a ldif variable
#
#
$Global{saveXmlck} = $fmtframe -> Checkbutton(
-text => "XML", -command => \&saveXml,
-variable => \$Global{xml}, -onvalue => 1,
-offvalue => 0, -font => $Global{'Font'} )
-> pack(-side => "left", -anchor => "w" );
$Global{saveXmlck} -> deselect;
$btframe = $tpframe ->Frame(-borderwidth => 2,
-relief => "raised")
->pack( -side => "left", -fill => "both");
#
# Create the search base box
#
$sbblist = $sbbframe ->Listbox( -width => 40, -font => $Global{'Font'},
-height => 1 );
$sbblist->pack(-side => $Global{hand});
$sbblist->insert("end", $LDAP_SEARCH_BASE);
$Global{dsasbls}->insert(0, $LDAP_SEARCH_BASE)
if ( $Global{dsasbls} );
#
# Create directory server search base button.
# This is the point from which the search operation
# will start from.
#
$sbmenu = $sbbframe->Button( -text => " SELECT\nBASE",
-command => \&sbHlist, -font => $Global{'Font'},
-borderwidth => 3 )
-> pack(-side => "top", -anchor => "w",
-padx => 1, -pady => 1 )
if ( !Exists($sbmenu));
#
# Create Hierarchial DN list box, this is where the DN data
# tree will be displayed.
#
$Global{'searchHList'} = $hlframe ->Scrolled('HList',
-font => $Global{'Font'},
-scrollbars => 'se',
-width => 50,
-height => 13,
-itemtype => 'text',
-separator => $sepChar,
-selectmode => 'single',
-browsecmd => sub {
#
my $objects = shift; # get base and the dn
&ldapAction($objects);
} # End of subroutine browsecmd
); # End of Scrolled HList.
#$Global{'searchHList'}->add($LDAP_SEARCH_BASE, -text=>$LDAP_SEARCH_BASE);
$Global{'searchHList'}->pack(-side => "right");
#
# Create additional attributes selection button
# This is where the user will select any special attribute to
# search on.
#
$amenu = $aframe -> Menubutton(-text => " SELECT\n ADDITIONAL\n ATTRIBUTES",
-relief => "raised", -font => $Global{'Font'},
-borderwidth => 3 )
-> pack( -side => "top", -anchor => "w" );
#
# First set up the 4 main attribute Radio buttons.
#
#
# If there are other attribute after the first 4 then set them
# up inside the select additional attributes button.
#
#
if ( $#attribute > 4 )
{
my $sptr = 0;
while ( $sptr <= 3 )
{
$_ = shift(@attribute);
$rbsn = $aframe -> Radiobutton(-text => "$_", -variable => \$Global{'info'}, -value => "$_", -font => $Global{'Font'} )
-> pack( -side => "top", -anchor => 'w');
if ( !$sptr ) { $rbsn->select(); } # select first attribute
++$sptr;
}
} # End of if ( $#attribute > 4 )
else
{
#
# Less than 4 attributes in user create initialization
# file, this is valid if that is what the user wants.
#
my $sptr = 0;
while ( @attribute )
{
$_ = shift(@attribute);
$rbsn = $aframe -> Radiobutton(-text => "$_",
-variable => \$Global{'info'},
-value => "$_", -font => $Global{'Font'} )
-> pack( -side => "top", -anchor => "w");
if ( !$sptr ) { $rbsn->select(); } # select first attribute
++$sptr;
}
}
#
# Create radio buttons in attributes selection box.
#
#
foreach (@attribute)
{
$amenu->radiobutton( -label => $_, -variable => \$Global{'info'},
-value => $_, -font => $Global{'Font'});
} # End of foreach (@attribute)
#
# Create ldap display button
#
$Global{actionDisplay} = $btframe->Button( -text => "DISPLAY",
-command => \&ldapActionDisplay,
-font => $Global{'Font'}, -borderwidth => 3 )
-> pack(-side => "top", -anchor => "w", -padx => 1, -pady => 1 )
if ( !Exists($Global{actionDisplay}));
#
# Create save to ldif button
#
$Global{actionLdif} = $btframe->Button(-text => "SAVE TO",
-command => \&ldapActionSaveToLdif,
-font => $Global{'Font'}, -borderwidth => 3)
-> pack(-side => "top", -anchor => "w", -padx => 1 )
if ( !Exists($Global{actionLdif}));
#
# Create ldap rename button
#
$Global{actionRename} = $btframe->Button( -text => "RENAME ",
-command => \&getRenameData,
-font => $Global{'Font'}, -borderwidth => 3 )
-> pack(-side => "top", -anchor => "w", -padx => 1, -pady => 1 )
if ( !Exists($Global{actionRename}));
#
# Create ldap edit button
#
$Global{actionEdit} = $btframe->Button(-text => " EDIT ",
-command => \&ldapActionEdit,
-font => $Global{'Font'}, -borderwidth => 3)
-> pack(-side => "top", -anchor => "w", -padx => 1 )
if ( !Exists($Global{actionEdit}));
#
# Create ldap delete button
#
$Global{actionDelete} = $btframe->Button(-text => "DELETE ",
-command => \&questionAction,
-font => $Global{'Font'}, -borderwidth => 3,
-activeforeground => 'red')
-> pack(-side => "top", -anchor => "w", -padx => 1, -pady => 1 )
if ( !Exists($Global{actionDelete}));
#
# Create process cancel button
#
$Global{actionCancel} = $btframe->Button(-text => "CANCEL ",
-command => \&ldapActionCancel,
-font => $Global{'Font'}, -borderwidth => 3)
-> pack(-side => "top", -anchor => "w", -padx => 1 )
if ( !Exists($Global{actionCancel}));
#
# Create save all to ldif button
#
$Global{actionLdifAll} = $btframe->Button( -text => "SAVE ALL\nTO",
-command => \&ldapActionMultiSaveToLdif,
-font => $Global{'Font'}, -borderwidth => 3 )
-> pack(-side => "left", -anchor => "w", -padx => 1 )
if ( !Exists($Global{actionLdifAll}));
$bmlframe = $bmframe ->LabFrame(-label => "File Name",
-labelside => "acrosstop")
->pack(-side => "bottom", -fill => "x");
#
# Create Text Entry list box.
#
$bmlframe->Entry(-textvariable => \$Global{'ldifFile'},
-width => 40 )
-> pack(-side => "left", -anchor => "w", -fill => 'x');
$splashList->insert("0", "Creating cascading search base menus.")
if ( $Global{splash} );
$splash->update()
if ( $Global{splash} );
#
# Create Bottom Attribute frame.
# This is where the user will enter data to be
# searched for.
#
$tframe = $bmframe->LabFrame(-label => "FILTER DATA",
-labelside => "acrosstop")
->pack( -fill => "both", -side => "bottom" , -anchor => "w");
#
# Create Text Entry list box.
#
$tframe_text = $tframe->Entry(-textvariable => \$Global{'adata'}, -width => 27 )
-> pack(-side => "left",-anchor => "w", );
$tframe_text->bind('<Key-Return>' => \&search );
#
# Create Clear Attribute Data and Search Directory buttons
#
$tframe -> Button(-text => "CLEAR FILTER DATA", -command => \&AClear,
-font => $Global{'Font'}, -borderwidth => 5 )
-> pack( -side => "left", -anchor => "w", -pady => 2, -padx => 2 );
#
# Create get Filter selection menu button.
#
$sfcmenu = $tframe -> Menubutton(-text => "SET FILTER\nCONDITON",
-relief => "raised", -font => $Global{'Font'},
-borderwidth => 5 )
-> pack(-side => "left", -anchor => "w",
-pady => 2, -padx => 2 );
$flclist = $tframe ->Listbox( -width => 11, -height => 1 );
$flclist->pack(-side => 'top', -anchor => "w" );
$flclist->insert(0, $Global{'infoFilter'});
#
# Set up the filter type radio buttons.
#
$rbsf = $sfcmenu -> radiobutton(-label => "equal",
-variable => \$Global{'infoFilter'},
-value => "equal", -command => \&setFilter );
$rbsf = $sfcmenu -> radiobutton(-label => "begins with",
-variable => \$Global{'infoFilter'},
-value => "begins with", -command => \&setFilter );
$rbsf = $sfcmenu -> radiobutton(-label => "ends with",
-variable => \$Global{'infoFilter'},
-value => "ends with", -command => \&setFilter );
$rbsf = $sfcmenu -> radiobutton(-label => "contains",
-variable => \$Global{'infoFilter'},
-value => "contains", -command => \&setFilter );
#
# Create Search Directory button
#
$bmframe -> Button(-text => "SEARCH THE DIRECTORY",
-command => \&search,
-font => $Global{'Font'}, -borderwidth => 5 )
-> pack( -side => "bottom", -fill => "both");
#$Global{'searchHList'}->delete('all');
$Global{actionDelete}->configure( -state => 'disable');
$Global{actionDisplay}->configure( -state => 'disable');
$Global{actionEdit}->configure( -state => 'disable');
$Global{actionRename}->configure( -state => 'disable');
$Global{actionLdif}->configure( -state => 'disable');
$Global{actionCancel}->configure( -state => 'disable');
#
# Allow mainWindow to update
#
$Global{'mainWindow'}->update;
} # End of subroutine initializeP2
#
# Initialize panel 3
#
sub initializeP3
{
my $cframe;
my $lframe;
my $rbclear;
#
# Create frame for clear buttons.
#
$cframe = $Global{p3}->Frame()
->pack( -fill => "both", -side => "bottom", -padx => 5, -pady => 2);
#
# Create Clear Data
#
$cframe -> Button(-text => " CLEAR DATA ",
-command => \&display_clear, -font => $Global{'Font'},
-borderwidth => 3 )
->pack( -fill => 'both' );
#
# Create list frame.
#
$lframe = $Global{p3}->LabFrame(-label => "DIRECTORY DATA",
-labelside => "acrosstop" )
->pack( -fill => "both", -side => "top", -padx => 5, -pady => 2,
-expand => 1);
#
# Create a Clear Data Radiobutton that will execute subroutine clear
# to clear the List box before each directory query.
#
$rbclear = $lframe -> Checkbutton(-text => "CLEAR DIRECTORY DATA ON EACH QUERY",
-variable => \$display_clear, -onvalue => 1, -offvalue => 0,
-font => $Global{'Font'} )
-> pack(-anchor => 'sw' );
$rbclear->select();
#
# Create a ROText Box that will actually contain the
# returned directory data.
#
$list = $lframe ->Scrolled('ROText', -scrollbars => 'se',
-width => 80, -height => 20, -wrap => 'none',
-font => $Global{'Font'} );
$list->pack(-fill => "both", -expand => 1 );
#
# Allow mainWindow to update
#
$Global{'mainWindow'}->update;
} # End of subroutine initializeP3
#
# Initialize panel 4
#
sub initializeP4
{
#
# Search the directory for schema data
#
my $srbclear;
my $srbfile;
my $srbfilelabel;
my $slframe;
my $ssframe;
my $sbbframe;
my $aframe;
my $tframe;
my $sbframe;
#
# Create bottom Search Directory frame
#
$sbframe = $Global{'p4'}->Frame( -borderwidth => 2,
-relief => "raised")->pack(
-fill => "both", -side => "bottom",
-padx => 2);
#
# Create Search Directory button
#
$sbframe -> Button(-text => "RETRIEVE DIRECTORY SCHEMA",
-command => \&schema, -font => $Global{'Font'}, -borderwidth => 3 )
-> pack( -fill => "both");
$srbfilelabel = $Global{'p4'}->LabFrame(-label => "SCHEMA DUMP TO FILE",
-labelside => "acrosstop")
->pack( -fill => "both", -anchor => "w", -padx => 2);
$srbfile = $srbfilelabel -> Checkbutton(
-text => "Write schema data to file, enter file name in text box below this line. ",
-variable => \$Global{'sfile'}, -onvalue => 1, -offvalue => 0,
-font => $Global{'Font'} )
-> pack(-anchor => "w" );
$srbfilelabel -> Checkbutton(
-text => "Write schema data to file in DSML XML format.",
-variable => \$Global{'xml'}, -onvalue => 1, -offvalue => 0,
-font => $Global{'Font'} )
-> pack(-anchor => "w" );
#
# Create Text Entry list box.
#
$srbfilelabel->Entry(-textvariable => \$Global{'fdata'}, -width => 25 )
-> pack(-fill => 'x');
#
# Create list frame.
#
$slframe = $Global{'p4'}->LabFrame(-label => "DIRECTORY SCHEMA DATA",
-labelside => "acrosstop")
->pack( -fill => "both", -side => "top",
-expand => 1);
#
# Create a Clear Data Radiobutton that will execute subroutine clear
# to clear the List box before each directory query.
#
$selframe = $slframe -> LabFrame(-label => "DISPLAY SELECTED OBJECTS",
-labelside => "acrosstop" )
->pack( -side => $Global{'hand'},
-expand => 1, -fill => "both" );
$sellframe = $selframe->Frame( -borderwidth => 0,
-relief => "raised")->pack(
-fill => "both", -side => "top",
-padx => 0, -pady => 0);
$sellAll = $sellframe -> Checkbutton(-text => "ALL",
-variable => \$selectAll, -onvalue => 1, -offvalue => 0,
-font => $Global{'Font'} )
-> pack(-side => "top", -anchor => 'w' );
$sellAll->select();
$sellObj = $sellframe -> Checkbutton(-text => "objectClasses",
-variable => \$selectObj, -onvalue => 1, -offvalue => 0,
-font => $Global{'Font'} )
-> pack(-side => "top", -anchor => 'w' );
$sellMatch = $sellframe -> Checkbutton(-text => "matchingRules",
-variable => \$selectMatch, -onvalue => 1, -offvalue => 0,
-font => $Global{'Font'} )
-> pack(-side => "top", -anchor => 'w' );
$sellAtt = $sellframe -> Checkbutton(-text => "attributeType",
-variable => \$selectAtt, -onvalue => 1, -offvalue => 0,
-font => $Global{'Font'} )
-> pack(-side => "top", -anchor => 'w' );
$sellsyn = $sellframe -> Checkbutton(-text => "ldapsyntaxes",
-variable => \$selectSyn, -onvalue => 1, -offvalue => 0,
-font => $Global{'Font'} )
-> pack(-side => "top", -anchor => 'w' );
$sellnf = $sellframe -> Checkbutton(-text => "nameforms",
-variable => \$selectNf, -onvalue => 1, -offvalue => 0,
-font => $Global{'Font'} )
-> pack(-side => "top", -anchor => 'w' );
$selldsr = $sellframe -> Checkbutton(-text => "ditstructurerules",
-variable => \$selectDsr, -onvalue => 1, -offvalue => 0,
-font => $Global{'Font'} )
-> pack(-side => "top", -anchor => 'w' );
$selldcr = $sellframe -> Checkbutton(-text => "ditcontentrules",
-variable => \$selectDcr, -onvalue => 1, -offvalue => 0,
-font => $Global{'Font'} )
-> pack(-side => "top", -anchor => 'w' );
$sellmru = $sellframe -> Checkbutton(-text => "matchingruleuse",
-variable => \$selectMru, -onvalue => 1, -offvalue => 0,
-font => $Global{'Font'} )
-> pack(-side => "top", -anchor => 'w' );
$sellframe -> Button(-text => "SHOW HIERARCHIAL\nOBJECTCLASS TREE",
-command => \&Hierarchial, -font => $Global{'Font'},
-borderwidth => 3 )
-> pack(-side => "bottom" );
#
# Create Clear Attribute Data and Search Directory buttons
#
$slframe ->Button(-text => " CLEAR DATA ",
-command => \&schema_clear, -font => $Global{'Font'},
-borderwidth => 3 )
-> pack(-side => "bottom", -fill => "both", -padx => 5 );
#
# Create a ROText Box that will actually contain the
# returned directory data.
#
$schema_list = $slframe ->Scrolled('ROText', -scrollbars => 'se',
-width => 50, -height => 20, -wrap => 'none',
-font => $Global{'Font'} );
$schema_list->pack( -side => "bottom" );
#
# Allow mainWindow to update
#
$Global{'mainWindow'}->update;
} # End of subroutine initializeP4
#
# Initialize panel 5
#
sub initializeP5
{
$ldifframe = $Global{p5} ->LabFrame(-label => "LDIF FILE NAME")
->pack(-side => "top", -fill => "x");
#
# Create Text Entry list box.
#
$ldifframe->Entry(-textvariable => \$Global{'createLdifFile'},
-width => 25 )
-> pack(-fill => 'x');
#
# Create Create Ldif Entry button
#
$Global{createLdifEntry} = $ldifframe->Button(
-text => "CREATE/MODIFY ENTRY FROM LDIF FILE",
-command => \&ldapActionCreateLdifEntry,
-font => $Global{'Font'}, -borderwidth => 3 )
-> pack(-side => "top", -anchor => "w", -padx => 5, -pady => 5 )
if ( !Exists($Global{createLdifEntry}));
$eframe = $Global{p5} ->Frame(-borderwidth => 2,-relief => "raised")
->pack(-side => "top", -anchor => 'e');
$cteframe = $eframe ->LabFrame(-label => "MANUALLY CREATE ENTRY")
->pack(-side => "top", -anchor => 'e');
#
# Create dn base button.
#
$dnmenu = $cteframe->Button( -text => " SELECT\nDN BASE",
-command => \&sbHlist, -font => $Global{'Font'},
-borderwidth => 3 )
-> pack(-side => "right", -anchor => "e",
-padx => 5, -pady => 5 )
if ( !Exists($dnmenu));
#
# Create the search base box
#
$dnblist = $cteframe ->Listbox( -width => 40, -font => $Global{'Font'},
-height => 1 );
$dnblist->pack(-side => "right", -anchor => 'e', -padx => 5, -pady => 5 );
$dnblist->insert("end", $DN_BASE);
#
# create attribute action button
#
$cteframe->Button(-text => "Create The\nEntry",
-font => $Global{'Font'},
-borderwidth => 3,
-command => \&getObjectAttributes,
-relief => 'raised' ) ->pack();
} # End of subroutine initializeP5
#
# Initialize panel 5a
#
sub initializeP5a
{
my $ocs = $schemaHash{'ocs'};
my $obj = $schemaHash{'obj'};
my $tree = $schemaHash{'tree'};
my $schema = $schemaHash{'schema'};
my @tmpKeys;
my @must;
my @may;
my $colist;
$Global{ceObject} = {};
my $optr = 0;
#
# Create Hierarchial list box, this is where the objectclass data
# tree will be displayed.
#
$Global{'olist'} = $eframe->Scrolled('HList',
-font => $Global{'Font'},
-scrollbars => 'se',
-width => $Global{'max'},
-height => 20,
-itemtype => 'text',
-separator => $sepChar,
-selectmode => 'single',
-browsecmd => sub {
#
my $objects = shift;
my $oid;
my $colist;
my $ab;
#my @objectclasses = ();
my $objectclasses = [];
@$objectclasses = split(/$sepChar/,$objects);
$schema = $schemaHash{'schema'};
$colist = $Global{'colist'};
$obj = $schemaHash{'obj'};
$Global{entryData} = {};
$Global{entryData}->{objectClass} = [];
$Global{entryData}->{may} = [];
$Global{entryData}->{must} = [];
my $var = $$objectclasses[-1];
# foreach my $var (@var)
# {
if ( !(exists($Global{ceObject}->{$var})) )
{
#
# create attribute action button
#
$ab = $colist->Button(-text => $var,
-font => $Global{'Font'},
-borderwidth => 3,
-relief => 'raised' );
$Global{ceObject}->{$var} = [];
$Global{ceObject}->{$var}->[0] = $ab;
$Global{ceObject}->{$var}->[1] = $objects;
$colist->windowCreate("end", -window => $ab );
$ab->configure( -command => [ \&deleteObjectclass, \$ab, $var ] );
# position to the next row.
$colist->insert("end", "\n");
}
# }
} # End of subroutine browsecmd
) -> pack( -side => "top", -anchor => 'e')
if ( !Tk::Exists($Global{'olist'}) ) ; # End of Scrolled HList.
#
# Create a ROText Box that will contain the selected objectclass(s)
# for the new entry.
#
$Global{'colist'} = $eframe ->Scrolled('Text', -scrollbars => 'se',
-width => $Global{'max'}, -height => 20, -wrap => 'none',
-font => $Global{'Font'} )
->pack( -side => "top", -anchor => 'e' )
if ( !Tk::Exists($Global{'colist'}) ) ; # End of Scrolled HList.
#
# Create Hierarchial list box, this is where the objectclass data
# tree will be displayed.
#
#
#$Global{'colist'} = $eframe ->Listbox( -width => $Global{'max'},
# -height => 20 )
# -> pack( -side => "top", -anchor => 'e')
# if ( !Tk::Exists($Global{'colist'}) ) ; # End of Scrolled HList.
@tmpKeys = sort(keys(%$tree));
my $base;
$base = "";
#
# Create Hierarchial list box data tree,
# and display data.
#
eval{
foreach ( @tmpKeys )
{
if ( $$tree{$_} ->[0] == 0 )
{
$$tree{$_} ->[0] = 1;
$Global{'olist'}->add($_, -text=>$_); # do the base.
}
$base = $_;
$array = $$tree{$_};
$ptr = 0;
foreach my $var ( @$array )
{
if ( !$ptr )
{
$ptr = 1;
next;
}
$_ = $base . $sepChar . $var;
$Global{'olist'}->add($_, -text => $var);
if ( defined($$tree{$_}) )
{
$$tree{$_}->[0] = 1;
}
}
}
$Global{'olist'}->pack(-side => "right");
};
print "$@" if ( defined($@));
@tmpKeys = sort(keys(%$tree));
#
# Reset objectClass array.
#
foreach ( @tmpKeys )
{
if ( defined($$tree{$_}) )
{
$$tree{$_}->[0] = 0;
}
}
} # End of subroutine initializeP5a
sub histSearch_clear {
#
# Clear out text in List Box
#
$Global{'searchList'}->delete("1.0", "end");
} # End of clear subroutine
sub histSearch_cancel{
$Global{'searchList'}->destroy if Tk::Exists($Global{'searchList'});
$Global{'searchHList'}->destroy if Tk::Exists($Global{'searchHList'});
} # End of cancel subroutine
sub deleteObjectclass
{
my ($aba, $var) = @_;
my $ab;
my $colist = $Global{colist};
$ab = $Global{ceObject}->{$var}->[0];
$ab->destroy;
delete($Global{ceObject}->{$var});
#
# if no objects, clear the ROTEXT box.
#
$Global{colist}->delete("1.0","end")
if ( !(keys(%{$Global{ceObject}})) );
}
#
# Create the Search base window to display the
# search base tree.
#
sub createSearchBaseWindow
{
&globalPos();
my $x = $Global{'horz'} + 150;
my $y = $Global{'vert'} + 150;
#
# Create Main Bind Window
#
$Global{'sbWindow'} = MainWindow->new;
$Global{'sbWindow'}->title("Select Search Base");
$Global{'sbWindow'}->geometry("+$x+$y");
#
# Create process accept button
#
$Global{'sbWindow'}->Button( -text => "ACCEPT SELECTED DN", -command => \&sbaccept,
-font => $Global{'Font'}, -borderwidth => 3 )
-> pack(-side => "bottom", -padx => 5, -pady => 5 ) ;
#
# Create process cancel button
#
$Global{'sbWindow'}->Button(-text => "CANCEL BASE CHANGE",
-command => \&sbcancel,
-font => $Global{'Font'}, -borderwidth => 3)
-> pack(-side => "top", -padx => 5, -pady => 5 ) ;
my $sbdnframe = $Global{'sbWindow'}->Frame()
->pack( -fill => "both", -side => "top", -padx => 5, -pady => 5 );
$Global{sbtree} = $sbdnframe->Scrolled("Tree",
-width => 50,
-height => 20,
-separator => $sepChar,
-indent => 35,
-scrollbars => 'sw',
-selectmod => 'single',
-browsecmd => sub {
my $objects = shift;
my %tree = %BASEDN;
$Global{SelectedDN} = $tree{$objects};
}
)->pack(-fill => "both", -expand => 1);
sub sbcancel
{
$Global{'sbWindow'}->withdraw if Tk::Exists($Global{'sbWindow'});
} # End of cancel subroutine
sub sbaccept
{
if ( exists($Global{SelectedDN}) )
{
$LDAP_SEARCH_BASE = $Global{SelectedDN};
$DN_BASE = $LDAP_SEARCH_BASE;
$sbblist->insert(0 , $LDAP_SEARCH_BASE);
$dnblist->insert(0 , $LDAP_SEARCH_BASE);
$Global{dsasbls}->insert(0, $LDAP_SEARCH_BASE)
if ( $Global{dsasbls} );
delete($Global{SelectedDN});
$Global{'sbWindow'}->withdraw if Tk::Exists($Global{'sbWindow'});
}
} # End of sbaccept subroutine
sub sbHlist
{
if (Tk::Exists($Global{'sbWindow'}))
{
$Global{'sbWindow'}->deiconify();
$Global{mainWindow}->update;
#$Global{'sbWindow'}->raise();
$Global{mainWindow}->update;
}
else
{
&createSearchBaseWindow();
&initTree();
}
}
} # End of createSearchBaseWindow subroutine
sub initTree
{
my $onvar;
my $bvar;
my $cvar;
my $t1v;
my $t1;
my $t2;
my $t2K;
my @t2Keys;
my $path;
my $size;
my $wack;
my $nvar;
my @keys = sort(keys(%Tree));
foreach $nvar (@keys)
{
$onvar = $nvar;
$t1v = $Tree{$nvar};
# print "t1 : " ,Dumper($t1v), "\n";
$Global{sbtree}->add($nvar, -text => $nvar);
foreach $bvar (@$t1v)
{
$cvar = canonical_dn($bvar, casefold => "lower" );
$adn = $cvar;
$cvar =~ s/$nvar//;
chop($cvar) if ($cvar =~ /,$/);
# print $bvar,"\n";
# print $cvar,"\n";
$path = "$nvar" . $sepChar;
$t1 = ldap_explode_dn($cvar, casefold => "lower" );
$size = @$t1;
# print "t1 size == $size\n";
while ($size > 1)
{
$t2 = pop(@$t1);
@t2Keys = keys(%$t2);
while (@t2Keys)
{
$t2K = shift( @t2Keys);
$t2size = @t2Keys;
$path .= "$t2K=$$t2{$t2K}";
$path .= "+" if ($t2size > 0 );
}
$path .= $sepChar;
$size = @$t1;
}
# chop($path) if ( $path =~ /\|$/ );
$text = "";
$t2 = pop(@$t1);
@t2Keys = keys(%$t2);
while (@t2Keys)
{
$wack = shift(@t2Keys);
$t2size = @$t2Keys;
$text .= "$wack=$$t2{$wack}";
$text .= "+" if ($t2size > 0 );
}
$path .= $text;
# print "path == $path\n";
# print "text == $text\n";
$path = $text if ( !length($path)) ;
$BASEDN{$path} = $adn;
$Global{sbtree}->add($path, -text => $text);
}
$Global{sbtree}->setmode($onvar,'close');
$Global{sbtree}->close($onvar);
}
$Global{sbtree}->autosetmode();
} # End of subroutine initTree
sub destroyTree
{
}
#
# Get the attributes of the selected objectClasses
#
sub getObjectAttributes
{
my $oid;
my $ahash;
my $alArray;
my @objectclasses = ();
my @tmp;
my $hash = $Global{ceObject};
my @hashKeys = keys(%$hash);
foreach my $hvar ( @hashKeys)
{
@tmp = split(/$sepChar/,$Global{ceObject}->{$hvar}->[1]);
foreach my $nvar (@tmp)
{
if ( !(grep(/$nvar/,@objectclasses)) )
{
push(@objectclasses,$nvar);
}
}
}
return if (!@objectclasses); # can not create an entry with no objectclass.
#
# If this is a posixAccount or shadowAccount, automatically put
# posixAccount, shadowAccount, and account as objectclasses for
# the new entry.
#
push(@objectclasses, "posixAccount")
if ( grep(/shadowAccount/,@objectclasses) &&
!( grep(/posixAccount/,@objectclasses) ) );
push(@objectclasses, "shadowAccount")
if ( grep(/posixAccount/,@objectclasses) &&
!( grep(/shadowAccount/,@objectclasses) ) );
push(@objectclasses, "account")
if ( grep(/shadowAccount/,@objectclasses) &&
grep(/posixAccount/,@objectclasses) &&
!( grep(/account/,@objectclasses) ) );
my $schema = $schemaHash{'schema'};
$obj = $schemaHash{'obj'};
$Global{entryData} = {};
$Global{entryData}->{objectClass} = [];
$Global{entryData}->{may} = [];
$Global{entryData}->{must} = [];
foreach my $var (@objectclasses)
{
$Global{mainWindow}->update;
$oid = $$obj{$var}->[0];
#
# Get the various other items associated with
# this objectclass.
#
my $ahash = $schema->objectclass( $oid );
#
# Get the objectclass name.
#
push( @{$Global{entryData}->{objectClass}},$$ahash{'name'});
if ( $$ahash{must} )
{
$alArray = $$ahash{must};
if ( ref($alArray) eq 'ARRAY' )
{
my $aMust = $Global{entryData}->{must};
foreach my $avar ( @$alArray )
{
push(@{$Global{entryData}->{must}}, $avar )
if ( !(grep(/$avar/,@$aMust)) );
}
}
else
{
push(@{$Global{entryData}->{must}}, $alArray )
if ( !(grep(/$alArray/,@{$Global{entryData}})) );
}
}
if ( $$ahash{may} )
{
$alArray = $$ahash{may};
if ( ref($alArray) eq 'ARRAY' )
{
my $aMay = $Global{entryData}->{may};
foreach my $avar ( @$alArray )
{
push(@{$Global{entryData}->{may}}, $avar )
if ( !(grep(/$avar/,@$aMay)) );
}
}
else
{
push(@{$Global{entryData}->{may}}, $alArray )
if ( !(grep(/$alArray/,@{$Global{entryData}})) );
}
}
}
&makeTheEntry;
} # End of subroutine getObjectAttributes
#
# Search the directory for data
#
sub search
{
my $mesg;
my $error;
my %opt = (
'd' => 0
);
$Global{mainWindow} -> Busy(-recurse => 1); # window is busy
#
# Destroy the dn history list if it exists.
#
$Global{'searchHList'}->delete('all') if Tk::Exists($Global{'searchHList'});
#
# Parameter(s) to return
#
if ( $Global{'setVersion'} == 3 )
{
#
# Default to return everything.
#
$Global{att_wanted} = [ "*",
"aci",
"createTimeStamp",
"modifyTimeStamp",
"creatorsName",
"modifiersName" ];
}
else
{
#
#
# If you have only version 2 ldap servers you will need to
# to add the attributes that you want data returned for to
# this list.
#
#
$Global{att_wanted} = [ "cn" ,
"sn",
"mail",
"modifyTimeStamp",
"creatorsName",
"modifiersName" ];
}
#
# Set Filter options.
#
if ( $Global{'info'} eq "Filter" )
{
$match = $Global{'adata'};
}
else
{
if ( $Global{'infoFilter'} =~ /^equal$/ )
{
$match = "(" . $Global{'info'} . '=' . $Global{'adata'} . ")";
}
elsif ( $Global{'infoFilter'} =~ /^begins with$/ )
{
$match = "(" . $Global{'info'} . '=' . $Global{'adata'} . "*)";
}
elsif ( $Global{'infoFilter'} =~ /^ends with$/ )
{
$match = "(" . $Global{'info'} . '=*' . $Global{'adata'} . ")";
}
elsif ( $Global{'infoFilter'} =~ /^contains$/ )
{
$match = "(" . $Global{'info'} . '=*' . $Global{'adata'} . "*)";
}
else
{
$match = "(" . $Global{'info'} . '=' . $Global{'adata'} . ")";
}
}
$error = 0; # initialize error flag.
$Global{filter} = Net::LDAP::Filter->new($match) or $error = 1;
if ( $error == 1 )
{
$error = "Bad filter $match.";
ERROR(\$error);
$Global{mainWindow} -> Unbusy; # window is busy
return;
}
if ( !defined($Global{ldap}) )
{
$error = dirConn();
if ( $error == 1 )
{
if ( defined($Global{dirConnError}) )
{
$error = "search $Global{dirConnError}";
ERROR(\$error);
}
else
{
ERROR($error);
}
$Global{mainWindow} -> Unbusy; # window is busy
return;
}
}
#
# Display the DN search results list box.
#
$msgbox->delete("0.0", "end");
$msgbox->update;
$Global{'records'} = 0; # initialize record count.
$Global{'searchResults'} = {}; # initialize results hash.
$mesg = $Global{ldap}->search(
base => $LDAP_SEARCH_BASE,
filter => $Global{filter},
attrs => $Global{att_wanted},
callback => \&print_entry,
);
if ( $mesg->code && $mesg->code != 48 )
{
ERROR($mesg->code);
}
#
# Create Hierarchial DN list box data tree,
# and display data.
#
eval
{
#
# Create the base point.
#
$Global{'searchHList'}->add($LDAP_SEARCH_BASE, -text=>$LDAP_SEARCH_BASE);
$results = $Global{'searchResults'};
@dnKeys = sort(keys(%$results));
#
# build the hierachical list using the DN
#
foreach my $dnvar ( @dnKeys )
{
$var = $$results{$dnvar}; # get entry data array
$shbase = $LDAP_SEARCH_BASE . $sepChar . $$var[0]; # create new leaf
$Global{'searchHList'}->add($shbase, -text => $$var[0]); # add leaf to tree.
}
$Global{'searchHList'}->pack(-side => "right");
}; # End of eval
ERROR( \$@ ) if ( $@ );
#
# Get and print out the record attributes.
#
sub print_entry {
my($mesg,$entry) = @_;
my @ref = ();
my $dn;
my $max;
my $data = [];
my $information = {};
if ( !defined($entry) )
{
return;
}
$dn = $entry->dn; # store the entry dn
++$Global{'records'};
$msgbox->delete("0.0", "end")
if ( !($Global{'records'} % 10 ));
$msgbox->update if ( !($Global{'records'} % 10 ));
$msgbox->insert("0.0", "Entries found: $Global{'records'}")
if ( !($Global{'records'} % 10 ));
$msgbox->update if ( !($Global{'records'} % 10 ));
#
#
#
@ref = $mesg->referrals();
if ( @ref )
{
foreach (@ref )
{
my $rvar = "LDAP Referral: $_";
ERROR(\$rvar);
}
}
else
{
#
# Get a list of record attributes
#
my @attrs = sort $entry->attributes;
$max = 0;
#
# Calculate each attribute`s text length.
# We use this to create a pretty print out in the
# List Box
#
foreach (@attrs) { $max = length($_) if length($_) > $max }
#
# Get attribute`s data
#
foreach (@attrs) {
# my $attr = $entry->get_value($_, asref => 1);
my $attr = [];
@$attr = $entry->get_value($_);
next unless $attr;
if ( /^jpegPhoto/i )
{
#
# record jpegPhoto data.
#
$encoded = encode_base64(@$attr[0]);
$$information{$_} = $encoded;
next;
}
$$information{$_} = $attr; # record ldap data
next;
}
}
push(@$data, $dn); # dn of entry
push(@$data, $max); # max attribute string lenght
push(@$data, $information);
${$Global{'searchResults'}}{$dn} = $data;
}
$Global{mainWindow} -> Unbusy; # window is not busy
} # End of search subroutine
sub AClear {
#
# Clear out text in Attribute Box
#
$Global{'adata'} = "";
} # End of AClear subroutine
#
# Change to a new directory server.
#
sub server
{
my $widget;
my $ptr;
my $mesg;
my $error;
$error = 0;
$currentPanel = $Global{nb} -> raised();
$Global{nb} -> raise('INFO');
$Global{ldap}->unbind if ( defined($Global{ldap}) );
$Global{ldap} = undef if ( defined($Global{ldap}) );
#
# Put directory server name in list box
#
$Global{'slist'}->insert(0 , $Global{'LDAP_SERVER'});
$sslist->insert(0 , $Global{'LDAP_SERVER'}) if ( Exists($sslist) ) ;
$Global{dsadsls}->insert(0, $Global{'LDAP_SERVER'})
if ( $Global{dsadsls} );
#
# Destroy the dn history list if it exists.
#
$Global{'searchHList'}->delete('all') if Tk::Exists($Global{'searchHList'});
$Global{mainWindow} -> Busy(-recurse => 1); # window is busy
$Global{mainWindow} -> update; # Allow Tk to update
$ptr = 1;
%Tree = (); # Delete the old stuff.
%BASEDN = (); # Delete the old stuff.
@NcKeys = (); # Delete the old stuff.
$Global{'sbtree'}->delete("all");
$msgbox->delete("0.0", "end");
$msgbox->update();
$error = dirConn();
if ( !$error )
{
if ( $Global{'CORE_SERVER'} ne $Global{'LDAP_SERVER'} && defined($server{$Global{'LDAP_SERVER'}} ) )
{
# user defined base
my $t1 = [];
push(@$t1, getBases($Global{'LDAP_SERVER'}, $server{$Global{'LDAP_SERVER'}}));
$ncbase =~ tr/[A-Z]/[a-z]/;
$Tree{$ncbase} = $t1;
$BASEDN{$ncbase} = $ncbase;
}
elsif ( $Global{setVersion} == 3 )
{
my $entry;
# use root_dse to find the bases
$entry = $Global{ldap}->root_dse();
if ( defined($entry) )
{
my $attr = $entry->get_value('namingContexts', asref => 1);
if ( defined($attr) )
{
foreach my $ncbase ( @$attr )
{
$Global{mainWindow}->update;
my $t1 = [];
push(@$t1, getBases($Global{'LDAP_SERVER'}, $ncbase));
$ncbase =~ tr/[A-Z]/[a-z]/;
$Tree{$ncbase} = $t1;
$BASEDN{$ncbase} = $ncbase;
}
}
}
}
#
# Create the search base tree
#
&initTree();
@NcKeys = sort(keys(%Tree));
}
else
{
if ( defined($Global{dirConnError}) )
{
ERROR(\$Global{dirConnError});
$msgbox->insert("1", "$Global{dirConnError}");
$msgbox->update;
}
else
{
ERROR($error);
}
}
if ( @NcKeys)
{
$LDAP_SEARCH_BASE = shift (@NcKeys);
$DN_BASE = $LDAP_SEARCH_BASE;
}
else
{
$LDAP_SEARCH_BASE = "";
$DN_BASE = "";
}
$sbblist->insert(0 , $LDAP_SEARCH_BASE);
$dnblist->insert(0 , $LDAP_SEARCH_BASE);
$Global{dsasbls}->insert(0, $LDAP_SEARCH_BASE)
if ( $Global{dsasbls} );
$Global{'CORE_SERVER'} = $Global{'LDAP_SERVER'};
$Global{mainWindow} -> update; #
$Global{mainWindow} -> Unbusy; # window is not busy
$Global{nb} -> raise($currentPanel);
} # End of server subroutine
sub base {
#
# Put directory server search base into the list box.
#
$sbblist->insert(0 , $LDAP_SEARCH_BASE);
$Global{dsasbls}->insert(0, $LDAP_SEARCH_BASE)
if ( $Global{dsasbls} );
} # End of base subroutine
sub dnbase {
# Put dn base into the list box.
$dnblist->insert(0 , $DN_BASE);
} # End of dnbase subroutine
sub setFilter {
#
# Put search filter conditions into the list box.
#
$flclist->insert(0 , $Global{'infoFilter'});
} # End of setFilter subroutine
#
# Make the correction and bind to the directory server.
#
sub dirConn
{
my $error;
$error = 0;
$Global{dirConnError} = undef();
#
# Make the connection to the directory server
#
if ( $Global{port} == 636 || $Global{'setSSL'} )
{
$bindcommand = 'require Net::LDAPS; new Net::LDAPS( $Global{LDAP_SERVER}, timeout => 1, port => $Global{port}, debug => $opt{d} ) ';
if ( $Global{'platform'} eq 'MSWin32')
{
$error = "This program currently does not support SSL on Microsoft Windows systems.";
ERROR(\$error);
return 1;
}
$Global{ldap} = eval $bindcommand;
if ($@)
{
$msgbox->insert("0.0", $@) if ($@ && Tk::Exists($msgbox)) ;
return -1;
}
if ( !($Global{ldap}->isa('Net::LDAPS') ) )
{
$Global{dirConnError} = "LDAPS connection error to $Global{'LDAP_SERVER'}.";
return -1;
}
}
else
{
$Global{ldap} = new Net::LDAP( $Global{'LDAP_SERVER'},
timeout => 1,
port => $Global{port},
debug => $opt_d,
) or $error = 1;
if ( $error )
{
$Global{dirConnError} = "LDAP connection error to $Global{'LDAP_SERVER'}.";
return 1;
}
}
$mesg = $Global{ldap}->bind( password => "$Global{'bindpw'}",
dn => "$Global{'binddn'}",
version => $Global{'setVersion'},
);
if ( $mesg->code && $mesg->code != 48 )
{
# $errstr = $mesg->code;
# ERROR($errstr);
return $mesg->code;
}
return 0;
} # End of subroutine dirConn
#
# Connect and bind to the referral directory server
#
sub dirRConn
{
my ($url) = @_;
my $error;
$error = 0;
$Global{dirConnError} = undef();
#
# Make the connection to the directory server
#
if ( $Global{port} == 636 || $Global{'setSSL'} )
{
$bindcommand = 'require Net::LDAPS; new Net::LDAPS( $url, timeout => 1, debug => $opt{d} ) ';
if ( $Global{'platform'} eq 'MSWin32')
{
$error = "This program currently does not support SSL on Microsoft Windows systems.";
ERROR(\$error);
return 1;
}
$Global{rldap} = eval $bindcommand;
if ($@)
{
$msgbox->insert("0.0", $@) if ($@ && Tk::Exists($msgbox)) ;
return -1;
}
if ( !($Global{rldap}->isa('Net::LDAPS') ) )
{
$Global{dirConnError} = "LDAPS connection error to $url.";
return -1;
}
}
else
{
$Global{rldap} = new Net::LDAP( $url,
timeout => 1,
debug => $opt_d,
) or $error = 1;
if ( $error )
{
$Global{dirConnError} = "LDAP connection error to $url.";
return 1;
}
}
$mesg = $Global{rldap}->bind( password => "$Global{'bindpw'}",
dn => "$Global{'binddn'}",
version => $Global{'setVersion'},
);
if ( $mesg->code && $mesg->code != 48 )
{
# $errstr = $mesg->code;
# ERROR($errstr);
return $mesg->code;
}
return 0;
} # End of subroutine dirRConn
#
# Disconnect from the directory server.
#
sub dirRUConn
{
$Global{rldap}->disconnect;
delete($Global{rldap});
return 0;
} # End of subroutine dirRUConn
#
# Detect and record the sub-bases, or branches, of the directory.
#
sub getBases()
{
my $mesg;
my ( $host, $base ) = @_;
my @base = ();
my $ptr;
my $match;
my $error = 0; # initialize error flag.
if ( $Global{'nismapname'} )
{
#
# Solaris Native LDAP enabled
#
#$match = "(|(ou=*)(nismapname=*)(objectClass=organizationalUnit))"; #search only for ou entries.
$match = "(|(objectClass=nisMap)(objectClass=organizationalUnit)(objectClass=automountMap))"; #search only for ou entries.
}
else
{
$match = "(objectClass=organizationalUnit)"; #search only for ou entries.
}
my $f = Net::LDAP::Filter->new($match) or $error = 1;
if ( $error )
{
$error = "getBases subroutine Bad filter $match";
ERROR(\$error);
return @base;
}
$base[0] = $base;
$ptr = 0;
while ( $ptr < @base )
{
if ( @base < $Global{'limit'} )
{
$splashList->insert("1", "Searching $base")
if ( defined( $splash) );
$splash->update()
if ( defined( $splash) );
$msgbox->insert("0", "Searching $base")
if ( defined( $msgbox) );
$msgbox->update()
if ( defined( $msgbox) );
my @new_base = calBase($base, $f );
push(@base, @new_base);
}
$base = $base[++$ptr];
}
shift(@base); # get rid of the namingContext entry
return @base;
} # End of subroutine getBases()
sub calBase()
{
my ( $base, $f ) = @_;
my $mesg;
my $entry;
my $errstr;
my $error = 0;
my @new_base = ();
$mesg = $Global{ldap}->search(
base => $base,
filter => $f,
attrs => [ "cn","nismapname","automountMapName" ],
scope => "one",
);
#
# Check for an error on search
# Search call work, but there was an ldap error.
#
if ( $mesg->code && $mesg->code != 11 )
{
$errstr = $mesg->code;
ERROR($errstr);
return @new_base;
}
else
{
$entry = $mesg->entry;
return @new_base unless defined($entry);
$count = $mesg->count();
for($i = 0 ; $i < $count ; $i++)
{
my $entry = $mesg->entry($i);
$dn = $entry->dn;
$dn = canonical_dn($dn,casefold => "lower");
$dn =~ tr/[A-Z]/[a-z]/;
$_ = $dn;
#
# Record only dn that start with ou=, or in some cases nismapname.
# Normal entrys can be mixed in with these objects.
#
if ( $Global{'nismapname'} && ( /^ou=/ || /^nismapname/i || /^automountMapName/i ) )
{
push(@new_base, $dn); # record only dn that start with ou=
}
elsif ( /^ou=/ )
{
push(@new_base, $dn); # record only dn that start with ou=
}
}
return @new_base;
}
} # End of subroutine calBase()
#
# Determine new mainWindow position.
#
sub globalPos
{
my @pos;
@pos = split(/\+/,$Global{'mainWindow'}->geometry());
$Global{'horz'} = $pos[1];
$Global{'vert'} = $pos[2];
} # End of subrountine globalPos
sub root_cancel
{
$Global{'rootWindow'}->destroy if Tk::Exists($Global{'rootWindow'});
} # End of subrountine root_cancel
#
# Display jpegPhoto in separate window if Tk::JPEG is used.
#
sub displayPhoto
{
my ($picture, $dn) = @_;
my $jpegFile = $ENV{'TMP'} ."/jpegfile.$$";
#
# Store the jpeg data to a temp file.
#
open(TMP, "+>$jpegFile");
$| = 1;
print TMP $picture;
close(TMP);
if ( !-e "$jpegFile" )
{
my $str = "Could not create temporary jpeg file $jpegFile";
ERROR( \$str );
return;
}
#
# Create a TK window to display the jpeg picture.
#
my $mw = MainWindow->new();
$mw->title("JPEG PHOTO DISPLAY");
my $list = $mw ->Listbox( -height => 1, width => length($dn) );
$list->pack( -side => "top" );
$list->insert("end", $dn);
my $image = $mw->Photo(-file => $jpegFile, -format => "jpeg" );
$mw->Label(-image => $image)->pack(-expand => 1, -fill => 'both');
$mw->Button(-text => 'CLOSE WINDOW', -command => [destroy => $mw])->pack;
MainLoop;
unlink $jpegFile;
} # End of displayPhoto
#
# Create Main Error Window
#
sub ERROR {
my ($errcode ) = @_;
my $errmsg;
return if ($errcode == 48 && $Global{'setVersion'} == 3 ); # Anonymous bind error, not really an error.
my $x = $Global{'horz'} + 150;
my $y = $Global{'vert'} + 150;
if ( ref($errcode) )
{
$errmsg = $$errcode;
}
else {
$errmsg = ldap_error_text($errcode);
}
my @errmsg = split(/\n/,$errmsg);
#
# Create Main Error Window
#
if ( ! Exists($Global{'errorWindow'} ) )
{
$Global{'errorWindow'} = MainWindow->new;
$Global{'errorWindow'}->title("ERROR MESSAGES");
$Global{'errorWindow'}->geometry("+$x+$y");
#
# Create process dismiss button
#
$Global{'errorWindow'}->Button( -text => "DISMISS", -command => \&dismiss,
-font => $Global{'Font'}, -borderwidth => 3 )
-> pack(-side => "bottom", -padx => 5, -pady => 5 ) ;
$errlist = $Global{'errorWindow'} ->Scrolled(Listbox, -scrollbars => 'se',
-width => 70, -height => 10 );
$errlist->pack(-fill => "both", -expand => 1 );
}
$errlist->insert("end", "Error Code: $errcode") if ( !ref($errcode) );
$errlist->insert("end", "") if ( !ref($errcode) );
foreach my $msg ( @errmsg )
{
$errlist->insert("end", $msg);
}
sub dismiss{
$Global{'errorWindow'}->destroy() if Tk::Exists($Global{'errorWindow'});
$errlist = undef();
} # End of dismiss subroutine
} # End of ERROR subroutine
#
# LDAP Error check, some return codes are not really errors.
# You can retry the ldap action after waiting a while.
#
sub CheckError {
my ( $error ) = @_;
#
# Check for DSA busy or internal error
#
if ( $Global{loopCount} > 61 ) {
return 0; # return an error condition.
}
++$Global{loopCount}; # Increment the loop counter.
if ( $error =~ /too busy/ ||
$error =~ /Server encountered an internal error/ )
{
#
# DSA Busy.
#
sleep 1;
return 1; # No error, try again
}
else {
#
# DSA did not return "DSA busy" message
#
return 0; # error
}
} # End of subrountine CheckError
#
# Create Main Bind Window
#
sub BIND {
$dn_data = "";
$pw_data = "";
&globalPos();
my $x = $Global{'horz'} + 150;
my $y = $Global{'vert'} + 150;
if ( !Tk::Exists( $Global{'bindWindow'} ) )
{
#
# Create Main Bind Window
#
$Global{'bindWindow'} = MainWindow->new;
$Global{'bindWindow'}->title("SET BIND CREDENTIALS");
$Global{'bindWindow'}->geometry("+$x+$y");
#
# Create process accept button
#
$Global{'bindWindow'}->Button( -text => "ACCEPT", -command => \&accept,
-font => $Global{'Font'}, -borderwidth => 3 )
-> pack(-side => "bottom", -padx => 5, -pady => 5 ) ;
#
# Create process cancel button
#
$Global{'bindWindow'}->Button(-text => "CANCEL", -command => \&cancel,
-font => $Global{'Font'}, -borderwidth => 3)
-> pack(-side => "top", -padx => 5, -pady => 5 ) ;
my $binddnframe = $Global{'bindWindow'}->LabFrame(-label => "DN",
-labelside => "acrosstop")
->pack( -fill => "both", -side => "top", -padx => 5, -pady => 5 );
#
# Create DN Entry text box.
#
$dn_data = $Global{binddn} if ( length($Global{binddn}) );
$binddnframe->Entry(-textvariable => \$dn_data, -width => 25 )
-> pack(-fill => 'x');
my $bindpwframe = $Global{'bindWindow'}->LabFrame(-label => "PASSWORD",
-labelside => "acrosstop")
->pack( -fill => "both", -side => "top", -padx => 5, -pady => 5 );
#
# Create Password Entry text box.
#
$bindpwdata = $bindpwframe->Entry(-show => '*', -textvariable => \$pw_data,
-width => 25, -font => $Global{'Font'} )
-> pack(-fill => 'x');
$bindpwdata->bind('<Key-Return>' => \&accept );
sub cancel{
$Global{'bindWindow'}->destroy() if Tk::Exists($Global{'bindWindow'});
$Global{'bindWindow'} = undef();
} # End of cancel subroutine
sub accept{
my $mesg;
if (defined($Global{ldap}) )
{
#
# Connect to directory server
#
$mesg = $Global{ldap}->bind( password => "$pw_data",
dn => "$dn_data",
version => $Global{'setVersion'},
);
if ( $mesg->code && $mesg->code != 48 )
{
$errstr = $mesg->code;
ERROR($errstr);
}
else
{
$Global{'bindWindow'}->Busy(-recurse => 1);
$Global{'binddn'} = $dn_data;
$Global{'bindpw'} = $pw_data;
&server;
$Global{'bindWindow'}->Unbusy;
}
}
$Global{'bindWindow'}->destroy() if Tk::Exists($Global{'bindWindow'});
$Global{'bindWindow'} = undef();
} # End of accept subroutine
}
} # End of BIND subroutine
#
# Create Main Port Window
#
sub PORT {
$port_data = $Global{port};
&globalPos();
my $x = $Global{'horz'} + 150;
my $y = $Global{'vert'} + 150;
#
# Create Main Port Window
#
$Global{'portWindow'} = MainWindow->new;
$Global{'portWindow'}->title("DIRECTORY PORT");
$Global{'portWindow'}->geometry("+$x+$y");
#
# Create process accept button
#
$Global{'portWindow'}->Button( -text => "ACCEPT", -command => \&portAccept,
-font => $Global{'Font'}, -borderwidth => 3 )
-> pack(-side => "bottom", -padx => 5, -pady => 5 ) ;
#
# Create process cancel button
#
$Global{'portWindow'}->Button(-text => "CANCEL", -command => \&portCancel,
-font => $Global{'Font'}, -borderwidth => 3)
-> pack(-side => "top", -padx => 5, -pady => 5 ) ;
$Global{'portWindow'}->Label(-text => "Port 389 default")
->pack( -side => "top", -anchor => 'w', -pady => 1 );
$Global{'portWindow'}->Label(-text => "Port 636 ssl default")
->pack( -side => "top", -anchor => 'w', -pady => 1 );
#
# Create a ssl Checkbutton that will set up ssl variable
# to set ssl if not port 636.
#
#$Global{'portWindow'} -> Checkbutton(
# -text => "SSL connection",
# -variable => \$Global{'setSSL'},
# -font => $Global{'Font'} )
# -> pack(-side => "top", -anchor => "w" );
$PSSLstatus = $Global{'portWindow'} -> Label -> pack(-side => "top", -anchor => "w" );
if ( $Global{setSSL} )
{
$PSSLstatus->configure( -text => "SSL", -font => $Global{Font});
}
else
{
$PSSLstatus->configure(-text => "NON-SSL", -font => $Global{Font});
}
my $portframe = $Global{'portWindow'}->LabFrame(-label => "PORT",
-labelside => "acrosstop")
->pack( -fill => "both", -side => "top", -padx => 5, -pady => 5 );
#
# Create Port Entry text box.
#
$portframe->Entry(-textvariable => \$port_data, -width => 10 )
-> pack(-fill => 'x');
sub portCancel{
$Global{'portWindow'}->destroy() if Tk::Exists($Global{'portWindow'});
$Global{'portWindow'} = undef();
} # End of cancel subroutine
sub portAccept{
$Global{port} = $port_data;
if ( $Global{setSSL} ) { $Global{sslport} = $port_data;}
else { $Global{nsslport} = $port_data;}
$Global{dsaptls}->insert(0, $Global{port});
$Global{'portWindow'}->destroy() if Tk::Exists($Global{'portWindow'});
$Global{'portWindow'} = undef();
} # End of accept subroutine
} # End of PORT subroutine
#
# Create Schema Display Window
#
sub print_loop()
{
my $list = shift;
my $ocs = shift;
my $Title = shift;
#my $method = shift;
my $asize;
my $ahash;
my $var;
foreach $ahash ( @$ocs)
{
$list->insert("end", "$Title\n");
#
# Get and display the data for this object
#
my @hkeys = keys(%$ahash);
foreach $var (@hkeys)
{
# Step thru the hash keys
next if ( $var =~ /type/); # do not care about type
$alArray = $$ahash{$var};
if ( ref($alArray) eq 'ARRAY' )
{
# it is a n array pointer so there is probably a list.
my $asize = @$alArray; # get the size of the list.
#
# if the array has size then print the array
# else ignore the array.
#
if ( $asize )
{
# Okay, there is something in the array.
$list->insert("end", "\t$var: ");
foreach $a ( @$alArray )
{
$list->insert("end", "$a ");
}
$list->insert("end", "\n");
}
}
else
{
# There is not an array
if ( $alArray == 1)
{
# it is just information attribute for the object
$list->insert("end", "\t$var\n");
}
else
{
$list->insert("end", "\t$var: $alArray\n");
}
}
}
}
} # End of subroutine print_loop
sub schema_clear {
#
# Clear out text in List Box
#
$schema_list->delete("1.0", "end");
} # End of clear subroutine
#
#
# Get the directory schema
#
sub schema
{
my $mesg;
my $error = 0;
$schemaHash{'obj'} = {};
$schemaHash{'tree'} = {};
$msgbox->insert("0.0", "Retrieving schema information.");
$msgbox->update;
&schema_clear();
$Global{'max'} = 0; # Reset objectclass name lenght.
my $dt = "/tmp/schema.dat.$$";
if ( ! defined($Global{ldap}) )
{
#
# Connect to directory server
#
$error = dirConn();
if ( $error == 1 )
{
if ( defined($Global{dirConnError}) )
{
$schema_list->insert("end", "$Global{dirConnError}\n");
}
else
{
ERROR($error);
}
return;
}
}
#
# Get the schema, tries to read rootdse, if unable assumes cn=schema.
# This is NOT always the case.
#
$schema = undef();
my @items;
my @item;
my $dsml;
$schemaHash{'schema'} = $Global{ldap}->schema();
if ( defined($schemaHash{'schema'}) )
{
if ( $Global{'sfile'} && defined($schemaHash{'schema'}) )
{
if ( $Global{'xml'} )
{
#
# write XML text to file instead of text box
#
# @xml_data = ();
# $dsml = Net::LDAP::DSML->new( output => \@xml_data, pretty_print => 1 );
open(FXML, ">$Global{'fdata'}");
$dsml = Net::LDAP::DSML->new( output => *FXML, pretty_print => 1 );
$dsml->write_schema($schemaHash{'schema'});
$dsml->end_dsml;
close(FXML);
}
else
{
#
# write straight text to file instead of text box
#
$schemaHash{'schema'}->dump( $Global{'fdata'} );
}
$schema_list->insert("end",
"Schema data written to file: $Global{'fdata'}\n");
$Global{'sfile'} = 0;
$Global{'fdata'} = "";
$Global{'xml'} = 0;
return;
}
#
# Allow mainWindow to update
#
$Global{'mainWindow'}->update;
$ra_atts = [];
#
# Get the attributes
#
@$ra_atts = $schemaHash{'schema'}->all_attributes();
$schemaHash{'atts'} = $ra_atts;
#
# Display the attributes
#
if ( $selectAll || $selectAtt )
{
&print_loop($schema_list, $schemaHash{'atts'}, "attributeType")
if ( defined($schemaHash{'atts'}) );
}
$ra_atts = [];
#
# Get the schema objectclasses
#
@$ra_atts = $schemaHash{'schema'}->all_objectclasses();
$schemaHash{'ocs'} = $ra_atts;
#
# Calculate the text length of each objectclass string.
#
foreach my $var (@$ra_atts)
{
$Global{'max'} = length($$var{'name'})
if length($$var{'name'}) > $Global{'max'} ;
}
#
# Add 6 to the max objectclass string size,
# got to allow for graphics information.
#
$Global{'max'} += 6;
#
# Display the objectclasses
#
if ( $selectAll || $selectObj )
{
&print_loop($schema_list, $schemaHash{'ocs'}, "objectClasses")
if ( defined($schemaHash{'ocs'}) );
}
#
# Get the schema matchingrules
#
$ra_atts = [];
@$ra_atts = $schemaHash{'schema'}->all_matchingrules();
$schemaHash{'mrs'} = $ra_atts;
#
# Display the matchingrules
#
if ( $selectAll || $selectMatch )
{
&print_loop($schema_list, $schemaHash{'mrs'}, "matchingRules" )
if ( defined($schemaHash{'mrs'}) );
}
#
# Get the schema matchingruleuse
#
$ra_atts = [];
@$ra_atts = $schemaHash{'schema'}->all_matchingruleuses();
$schemaHash{'mru'} = $ra_atts;
#
# Display the matchingruleuse
#
if ( $selectAll || $selectMru )
{
&print_loop($schema_list, $schemaHash{'mru'}, "matchingRuleUse" )
if ( defined($schemaHash{'mru'}) );
}
#
# Get the schema ldapsyntaxes
#
$ra_atts = [];
@$ra_atts = $schemaHash{'schema'}->all_syntaxes();
$schemaHash{'lsyn'} = $ra_atts;
#
# Display the ldapsyntaxes
#
if ( $selectAll || $selectSyn )
{
&print_loop($schema_list, $schemaHash{'lsyn'}, "ldapSyntax" )
if ( defined($schemaHash{'lsyn'}) );
}
#
# Get the schema nameForms
#
$ra_atts = [];
@$ra_atts = $schemaHash{'schema'}->all_nameforms();
$schemaHash{'nfm'} = $ra_atts;
#
# Display the nameForms
#
if ( $selectAll || $selectNf )
{
&print_loop($schema_list, $schemaHash{'nfm'}, "nameForms" )
if ( defined($schemaHash{'nfm'}) );
}
#
# Get the schema ditstructurerules
#
$ra_atts = [];
@$ra_atts = $schemaHash{'schema'}->all_ditstructurerules();
$schemaHash{'dits'} = $ra_atts;
#
# Display the ditstructurerules
#
if ( $selectAll || $selectDsr )
{
&print_loop($schema_list, $schemaHash{'dits'}, "ditstructurerules" )
if ( defined($schemaHash{'dits'}) );
}
#
# Get the schema ditcontentrules
#
$ra_atts = [];
@$ra_atts = $schemaHash{'schema'}->all_ditcontentrules();
$schemaHash{'ditc'} = $ra_atts;
#
# Display the ditcontentrules
#
if ( $selectAll || $selectDcr )
{
&print_loop($schema_list, $schemaHash{'ditc'}, "ditcontentrules" )
if ( defined($schemaHash{'ditc'}) );
}
$Global{'max'} = 50 if ( $Global{'max'} > 50 );
&objTree(); # Create the objectClass tree
$Global{'olist'}->delete('all') if Tk::Exists($Global{'olist'});
$Global{mainWindow} -> update; # Allow Tk to update
&initializeP5a(); # Finish making panel 5
} # End of if ( defined($schema) )
else
{
$schema_list->insert("end", "The schema object was return undefined.\n");
$schema_list->insert("end", "There are several problems that can cause\n");
$schema_list->insert("end", "this situation.\n");
$schema_list->insert("end", "1. Your server may require you to be bound\n");
$schema_list->insert("end", " to the directory as the directory\n");
$schema_list->insert("end", " administrator. Bind to the directory\n");
$schema_list->insert("end", " as the directory administrator and \n");
$schema_list->insert("end", " retry pulling the schema data.\n");
$schema_list->insert("end", "\n");
$schema_list->insert("end", "2. Your server is a version 2 LDAP server\n");
$schema_list->insert("end", " or the version 3 LDAP radio button is in\n");
$schema_list->insert("end", " the version 2 position. Version 2 LDAP\n");
$schema_list->insert("end", " servers will not return schema data.\n");
}
} # End of schema subroutine
sub objTree
{
my $ocs = $schemaHash{'ocs'};
my $obj = $schemaHash{'obj'};
#$schemaHash{'tree'} = {};
my $tree = $schemaHash{'tree'};
my $schema = $schemaHash{'schema'};
my @tmpKeys;
my $size;
my $Path;
my $done;
my @sup;
my @name;
my $name;
my $SUP;
my $array;
if ( !defined($ocs) || !defined($tree) ||
!defined($obj) || !defined($schema) )
{
#
# No schema data available
#
my $error = "LDAP Schema data is not available.";
ERROR(\$error);
return;
}
#
# Get the schema objectClasses
#
foreach my $aobj ( @$ocs)
{
#
# Get the oid number of the objectclass.
#
my $oid;
undef($oid);
$oid = $$aobj{'oid'};
next if ( !defined($oid) );
@sup = $$aobj{'sup'}[0];
@name = $$aobj{'name'};
$$obj{"$name[0]"} = [ "$oid", "$sup[0]" ]; # store data
}
#
# get objectclass hash keys.
#
@tmpKeys = sort(keys(%$obj)) if (defined($$obj{'top'}));
$$tree{'top'} = [0,]; # pre-load top objectclass.
foreach (@tmpKeys)
{
next if ( $_ eq "" || $_ eq "top" );
$done = 0; # initialize done flag
$Path = ""; # initialize objectclass Path
$name = $_;
while ( !$done )
{
$SUP = $$obj{$_}->[1]; # get current objectclass's superior
$SUP = "top" if ( $SUP eq "" ); # on null superior, make top superior
if ( $Path eq "" )
{
$Path = $SUP; # Start objectclass path.
}
else
{
$Path = $SUP . $sepChar . $Path; # add new objectclass to path.
}
$done = 1 if ( $SUP eq 'top' ) ; # when we reach objectclass top we are done.
$_ = $SUP; # walk back up the chain
}
if ( defined($$tree{$Path}) )
{
#
# Path key has already been initialized, add current objectclass
# to list.
#
$array = $$tree{$Path};
push(@$array,$name);
}
else
{
#
# Path key needs to be initialized, add current objectclass
# to list.
#
$$tree{$Path} = [0, "$name"];
}
}
#
# Allow mainWindow to update
#
$Global{'mainWindow'}->update;
}
sub Hierarchial
{
&globalPos();
my $x = $Global{'horz'};
my $y = $Global{'vert'} + 200 ;
my $ocs = $schemaHash{'ocs'};
my $obj = $schemaHash{'obj'};
my $tree = $schemaHash{'tree'};
my $schema = $schemaHash{'schema'};
my @tmpKeys;
my $size;
my $Path;
my $done;
my @sup;
my @name;
my $name;
my $SUP;
my $array;
#
# Set up the Tk windows.
#
#
if ( ! Exists($Global{'histWindow'} ) )
{
eval
{
$Global{'histWindow'} = MainWindow->new();
$Global{'histWindow'}->title("HIERARCHICAL OBJECTCLASS DISPLAY WINDOW");
};
ERROR(\$@) if ( $@ );
}
else
{
my $wstate = $Global{'histWindow'}->state();
if ( $wstate =~ /iconic/ || $wstate =~ /withdrawn/ )
{
$Global{'histWindow'}->deiconify()
if Tk::Exists($Global{'histWindow'});
$Global{'histWindow'}->raise()
if Tk::Exists($Global{'histWindow'});
}
}
$Global{'histWindow'}->geometry("+$x+$y");
#
# Create label box
#
if ( !Exists($Global{'label'}) )
{
$Global{'label'} = $Global{'histWindow'}->Label()->pack;
}
$hbutton = $Global{'histWindow'}->Button(
-text => "CLOSE HIERARCHICAL DISPLAY WINDOW",
-command => \&hist_cancel, -font => $Global{'Font'},
-borderwidth => 5 )
-> pack(-fill => "both", -padx => 2, -pady => 2 )
if ( Exists($Global{'histWindow'} ) &&
!Exists($hbutton ) );
#
# Create list box, this is where the selected objectclass data will
# be displayed.
#
if ( !Exists($Global{'list'}) )
{
$Global{'list'} = $Global{'histWindow'}->Scrolled('ROText',
-scrollbars => 'se', -width=>50, -wrap => "none",
-font => $Global{'Font'}, -height => 20 )
->pack(-side => "left");
}
#
# Create Hierarchial list box, this is where the objectclass data
# tree will be displayed.
#
if ( !Exists($Global{'hlist'}) )
{
$Global{'hlist'} = $Global{'histWindow'}->Scrolled('HList',
-font => $Global{'Font'},
-scrollbars => 'se',
-width => $Global{'max'},
-height => 20,
-itemtype => 'text',
-separator => $sepChar,
-selectmode => 'single',
-browsecmd => sub {
#
my $objects = shift;
my $oid;
my @objectclasses = ();
@objectclasses = split(/$sepChar/,$objects);
$Global{'list'}->delete("1.0", "end");
$Global{'label'}->configure(-text=>$objects);
$Global{'list'}->insert("end", " \n");
foreach my $var (@objectclasses)
{
$Global{mainWindow}->update;
$oid = $$obj{$var}->[0];
#
# Get the various other items associated with
# this objectclass.
#
my $ahash = $schema->objectclass( $oid );
my @hkeys = sort(keys(%$ahash));
#
# Get and display the objectclass name.
#
$alArray = $$ahash{'name'};
$Global{'list'}->insert("end", "name: $alArray\n");
foreach $varr (@hkeys)
{
# Step thru the hash keys
next if ( $varr =~ /name/); # already done name.
next if ( $varr =~ /type/); # do not care about type
$alArray = $$ahash{$varr};
if ( ref($alArray) eq 'ARRAY' )
{
# it is a n array pointer so there is probably a list.
my $asize = @$alArray; # get the size of the list.
#
# if the array has size then print the array
# else ignore the array.
#
if ( $asize )
{
# Okay, there is something in the array.
$Global{'list'}->insert("end", "\t$varr: ");
foreach $a ( @$alArray )
{
$Global{'list'}->insert("end", "$a ");
}
$Global{'list'}->insert("end", "\n");
}
}
else
{
# It is not an array
if ( $alArray == 1)
{
# it is just and information attribute for the object
$Global{'list'}->insert("end", "\t$varr\n");
}
else
{
$Global{'list'}->insert("end", "\t$varr: $alArray\n");
}
}
}
$Global{'list'}->insert("end", " \n");
$Global{'list'}->insert("end", "--------------------------------------------------\n");
$Global{'list'}->insert("end", " \n");
}
} # End of subroutine browsecmd
); # End of Scrolled HList.
@tmpKeys = sort(keys(%$tree));
my $base;
$base = "";
#
# Create Hierarchial list box data tree,
# and display data.
#
eval{
foreach ( @tmpKeys )
{
if ( $$tree{$_} ->[0] == 0 )
{
$$tree{$_} ->[0] = 1;
$Global{'hlist'}->add($_, -text=>$_); # do the base.
}
$base = $_;
$array = $$tree{$_};
$ptr = 0;
foreach my $var ( @$array )
{
if ( !$ptr )
{
$ptr = 1;
next;
}
$_ = $base . $sepChar . $var;
$Global{'hlist'}->add($_, -text => $var);
if ( defined($$tree{$_}) )
{
$$tree{$_}->[0] = 1;
}
}
}
$Global{'hlist'}->pack(-side => "right");
};
print "$@" if ( defined($@));
@tmpKeys = sort(keys(%$tree));
#
# Reset objectClass array.
#
foreach ( @tmpKeys )
{
if ( defined($$tree{$_}) )
{
$$tree{$_}->[0] = 0;
}
}
}
sub hist_clear {
#
# Clear out text in List Box
#
$Global{'list'}->delete("1.0", "end");
} # End of clear subroutine
sub hist_cancel{
$Global{'list'}->destroy if Tk::Exists($Global{'list'});
$Global{'hlist'}->destroy if Tk::Exists($Global{'hlist'});
$Global{'histWindow'}->destroy if Tk::Exists($Global{'histWindow'});
} # End of cancel subroutine
} # End of subroutine Hierarchial
#
# Create Accept/Cancel Window
#
sub questionAction {
&globalPos();
my $x = $Global{'horz'} + 0;
my $y = $Global{'vert'} + 50;
#
# Create Main Window
#
$Global{'answerWindow'} = MainWindow->new;
$Global{'answerWindow'}->title("CONFIRM DECISION");
$Global{'answerWindow'}->geometry("+$x+$y");
#
# Create process accept button
#
$Global{'answerWindow'}->Button( -text => "ACCEPT", -command => \&doAction,
-font => $Global{'Font'}, -borderwidth => 3 )
-> pack(-side => "bottom", -padx => 5, -pady => 5 ) ;
#
# Create process cancel button
#
$Global{'answerWindow'}->Button(-text => "CANCEL", -command => \&cancelAction,
-font => $Global{'Font'}, -borderwidth => 3)
-> pack(-side => "top", -padx => 5, -pady => 5 ) ;
sub cancelAction{
$Global{'answerWindow'}->destroy() if Tk::Exists($Global{'answerWindow'});
delete($Global{'answerWindow'});
} # End of cancel subroutine
sub doAction{
$Global{'answerWindow'}->destroy() if Tk::Exists($Global{'answerWindow'});
delete($Global{'answerWindow'});
$Global{'searchHistWindow'}->destroy if Tk::Exists($Global{'searchHistWindow'});
$Global{'searchHistWindow'} = undef();
&ldapActionDelete; # Delete the entry from the directory
} # End of accept subroutine
} # End of questionAction subroutine
#
# Create ldapAction Window
#
sub ldapAction
{
$Global{'ldapActionDN'} = shift;
$Global{actionDelete}->configure( -state => 'normal');
$Global{actionDisplay}->configure( -state => 'normal');
$Global{actionEdit}->configure( -state => 'normal');
$Global{actionRename}->configure( -state => 'normal');
$Global{actionLdif}->configure( -state => 'normal');
$Global{actionCancel}->configure( -state => 'normal');
} # End of ldapAction subroutine
sub ldapActionCancel{
delete($Global{'ldapActionDN'});
$Global{actionDelete}->configure( -state => 'disable');
$Global{actionDisplay}->configure( -state => 'disable');
$Global{actionEdit}->configure( -state => 'disable');
$Global{actionRename}->configure( -state => 'disable');
$Global{actionLdif}->configure( -state => 'disable');
$Global{actionCancel}->configure( -state => 'disable');
} # End of cancel subroutine
sub ldapActionCreateEntry
{
if ( !Exists($Global{'olist'}) )
{
&initializeP5a(); # Finish making panel 5
}
} # End of subroutine ldapActionCreateEntry
sub makeTheEntry
{
&globalPos();
my $x = $Global{'horz'} + 100;
my $y = $Global{'vert'} + 100;
%Creation = ();
#
# Create Main Window
#
if (! Exists($Global{'createWindow'}) )
{
$Global{'createWindow'} = MainWindow->new;
$Global{'createWindow'}->title("CREATE DIRECTORY ENTRY");
$Global{'createWindow'}->geometry("+$x+$y");
#
# Create process Exit button
#
$createExit = $Global{'createWindow'}->Button(
-text => "CANCEL CREATE ENTRY DISPLAY",
-command => \&create_cancel, -font => $Global{'Font'},
-borderwidth => 5 )
-> pack(-fill => "both", -padx => 2, -pady => 2 ) ;
$Global{'createWindow'}->Label( -text => "Select a radiobutton to indicate the Naming Attribute and make sure your dn base is correct.")
->pack(-side => "top", -anchor => 'w');
$Global{'createWindow'}->Label( -text => "All attributes in red, or located above the objectClass attributes, must have data")
->pack(-side => "top", -anchor => 'w');
$Global{'createWindow'}->Label(-text => "entered for the attribute.")
->pack(-side => "top", -anchor => 'w');
#
# Create a ROText Box that will actually contain the
# returned directory data.
#
$createlist = $Global{'createWindow'} ->Scrolled('ROText',
-scrollbars => 'se',
-width => 100, -height => 20, -wrap => 'none',
-font => $Global{'Font'} );
$createlist->pack(-fill => "both", -expand => 1 );
$max = 0;
foreach ( @{$Global{entryData}->{must}} )
{
$max = length($_) if ( length($_) > $max );
}
foreach ( @{$Global{entryData}->{may}} )
{
$max = length($_) if ( length($_) > $max );
}
$Creation{dn} = [];
$Creation{dn}->[0] = "$DN_BASE";
$dnLabel = $createlist->Label(-text => "dn",
-font => $Global{'Font'},
-relief => 'groove',
-anchor => 'e',
# -foreground => 'red',
-width => ($max+7) );
$createlist->windowCreate("end", -window => $dnLabel );
$dnTxt = $createlist->Entry(-width => 65,
-textvariable => \$Creation{dn}->[0] );
$createlist->windowCreate("end", -window => $dnTxt );
$createlist->insert("end", "\n"); # position to the next row.
#
# create attribute label
#
#$tmpdn = "";
foreach ( @{$Global{entryData}->{must}} )
{
$Creation{$_} = [] if ( !/objectClass/ );
$Creation{$_}->[0] = "" if ( !/objectClass/ );
$NamingAttribute = "";
${$_} = $createlist->Radiobutton( -text => "", -anchor => 'w',
-variable => \$NamingAttribute, -value => "$_" )
if ( !/objectClass/ );
$createlist->windowCreate("end", -window => ${$_} );
${$_} = $createlist->Label(-text => "$_",
-font => $Global{'Font'},
-relief => 'groove',
-foreground => 'red',
-anchor => 'e',
-width => ($max+2) ) if ( !/objectClass/ );
$createlist->windowCreate("end", -window => ${$_} );
#
# create data entry window
#
${$_} = $createlist->Entry(-width => 65,
-textvariable => \$Creation{$_}->[0] )
if ( !/objectClass/ );
$createlist->windowCreate("end", -window => ${$_} ) if ( !/objectClass/ );
$createlist->insert("end", "\n") if ( !/objectClass/ );
}
$ptr = 0;
$Creation{objectClass} = [];
foreach ( @{$Global{entryData}->{objectClass}} )
{
$Creation{objectClass}->[$ptr] = "$_";
${$_} = $createlist->Label(-text => "objectClass",
-font => $Global{'Font'},
-relief => 'groove',
-anchor => 'e',
-width => ($max+7) );
$createlist->windowCreate("end", -window => ${$_} );
#
# create data entry window
#
${$_} = $createlist->Label(-width => 65, -anchor => 'w',
-text => $Creation{objectClass}->[$ptr]);
$createlist->windowCreate("end", -window => ${$_} );
$createlist->insert("end", "\n"); # position to the next row.
++$ptr;
}
$Global{'createWindow'} ->update;
foreach ( @{$Global{entryData}->{may}} )
{
$Creation{$_} = [];
$Creation{$_}->[0] = "";
${$_} = $createlist->Radiobutton( -text => "", -anchor => 'w',
-variable => \$NamingAttribute, -value => "$_" )
if ( !/objectClass/ );
$createlist->windowCreate("end", -window => ${$_} );
${$_} = $createlist->Label(-text => "$_",
-font => $Global{'Font'},
-relief => 'groove',
-anchor => 'e',
-width => ($max+2) )if ( !/objectClass/ );
$createlist->windowCreate("end", -window => ${$_} );
#
# create data entry window
#
${$_} = $createlist->Entry(-width => 65,
-textvariable => \$Creation{$_}->[0] );
$createlist->windowCreate("end", -window => ${$_} );
$createlist->insert("end", "\n"); # position to the next row.
}
#
# Create the Create button
#
$createMe = $Global{'createWindow'}->Button(
-text => "CREATE ENTRY",
-command => \&create_entry, -font => $Global{'Font'},
-borderwidth => 5 )
-> pack(-fill => "both", -padx => 2, -pady => 2 ) ;
}
} # End of subroutine makeTheEntry
sub create_cancel
{
$Global{ceObject} = undef();
$Global{colist}->delete("1.0","end");
$Global{'createWindow'}->destroy if Tk::Exists($Global{'createWindow'});
$Global{'createWindow'} = undef();
} # End of create_cancel subroutine
sub create_entry
{
my $error;
my $do_it;
my @add = ();
my $mesg;
my $rmesg;
my $DN;
push(@add, 'objectClass');
push(@add, $Creation{objectClass});
delete($Creation{objectClass});
if ( length($NamingAttribute) )
{
$DN = "$NamingAttribute=". $Creation{$NamingAttribute}[0] . "," . $Creation{dn}[0];
}
else
{
$DN = $Creation{dn}[0];
}
delete($Creation{dn});
my @attrs = keys( %Creation );
foreach $att ( @attrs )
{
if ( length($Creation{$att}->[0]) )
{
push(@add, $att);
push(@add, $Creation{$att});
}
}
$Global{ldap}->unbind if ( defined($Global{ldap}) );
$Global{ldap} = undef if ( defined($Global{ldap}) );
$error = 0;
$error = dirConn();
if ( $error == 1 )
{
if ( defined($Global{dirConnError}) )
{
$error = "Create Entry $Global{dirConnError}";
ERROR(\$error);
}
else
{
ERROR($error);
}
# %Creation = ();
# &create_cancel;
return;
}
$do_it = 1;
$Global{loopCount} = 0;
while ($do_it == 1 )
{
$mesg = $Global{ldap}->add($DN, attrs => \@add );
if ( $mesg->code )
{
if ( $mesg->code == 10 && $Global{fref} )
{
#
# Being refer'ed to another directory server.
#
@referral = $mesg->referrals();
foreach my $rref (@referral )
{
print "LDAP Referral: $rref \n" if $debug;
$rresult = &dirRConn($rref);
if ( $rresult != 0 )
{
print "Referral connect error, trying next now\n" if ( $debug );
next;
}
else
{
$rmesg = $Global{rldap}->add($DN, attrs => \@add );
if ( !$rmesg->code )
{
&dirRUConn();
$do_it = 0;
last;
}
}
} # End of foreach my $rref (@ref )
if ( $do_it )
{
#
# All referrals have been tried, there is a major error.
#
&dirRUConn();
$errstr = "There has been a major referral error creating this DN.";
$errstr .= "The following referrals were tried;\n";
foreach my $rref (@referral )
{
$errstr .= "$rref\n";
}
ERROR($errstr);
return;
} # End of if ( $do_it )
}
else
{
#
# There was an error, check for dsa busy
# error.
#
#
$errstr = $mesg->code;
$errstr = ldap_error_text($errstr);
#
# Check for server busy.
#
if ( !(CheckError($errstr) ) )
{
$errstr = $mesg->code;
ERROR($errstr);
return;
}
}
}
else
{
#
# There was no error
#
$do_it = 0;
}
}
%Creation = ();
&create_cancel;
} # End of subroutine create_entry
#
# Do LDAP entry data display.
#
sub ldapActionDisplay
{
my $dataArray;
my $blank = " ";
my $data;
my $dn;
my $max;
my $lb;
my $info;
my $text;
my @infoKeys;
my @DNs = ();
if ( !$Global{'ldapActionDN'} )
{
&ldapActionCancel;
return;
}
my $objects = $Global{'ldapActionDN'};
&ldapActionCancel;
#
# Display the DN search results list box.
#
$Global{nb}->raise("SEARCH DISPLAY");
delete($Global{'ldapActionDN'});
# clear the entry data display window.
if ( $display_clear ) { &display_clear(); }
#
# Format and display the data associcated with the dn
# passed to this subroutine.
#
@DNs = split(/$sepChar/,$objects); # split base from dn.
$dataArray = $Global{'searchResults'};
$data = $$dataArray{$DNs[1]}; # get data associated with this dn
$dn = $$data[0]; # get DN
$max = $$data[1]; # get max size of atttributes
$info = $$data[2]; # get data hash address.
@infoKeys = sort(keys(%$info)); # get a list of all attributes.
$text = sprintf "%${max}s: %s\n",'dn',$dn;
$list->insert("end", $text); # insert data
#
# For each attribute display it's data
#
foreach my $var (@infoKeys)
{
if ( $var =~ /^jpegPhoto/i )
{
#
# Display jpegPhoto in separate window if Tk::JPEG is used.
#
my $Value = decode_base64($$info{$var});
displayPhoto($Value, $dn ) if ( $Global{'jpeg'}) ;
$dstring = "JpegPhoto binary data is not being displayed.\n";
#
#
$text = sprintf "%${max}s: %s\n",$var,$dstring;
$list->insert("end", $text); # position to the next row.
next;
}
my $values = $$info{$var}; # get attribute data array.
foreach my $Value ( @$values)
{
#
# Format data and print data into Entry Box
#
if ( $var =~ /;binary$/ )
{
$encoded = encode_base64($Value);
$text = sprintf "%${max}s: %s\n",$var,$encoded;
}
else
{
$text = sprintf "%${max}s: %s\n",$var,$Value;
}
$list->insert("end", $text); # position to the next row.
}
}
# position to the next row.
$list->insert("end", "-----------------------------------------------------------------------------\n");
$list->insert("end", "\n");
}
#
# Do LDAP entry edit.
#
sub ldapActionEdit
{
my $dataArray;
my $editArray;
my $blank = " ";
my $data;
my $dn;
my $max;
my $lb;
my $info;
my @infoKeys;
my @DNs = ();
my @tmp1 = ();
#my $index;
my $indexCount;
my $text;
if ( !$Global{'ldapActionDN'} )
{
&ldapActionCancel();
return;
}
my $objects = $Global{'ldapActionDN'};
&ldapActionCancel();
return if Tk::Exists($Global{'editWindow'});
&displayEdit();
# clear the entry data display window.
#
# Format and display the data associcated with the dn
# passed to this subroutine.
#
@DNs = split(/$sepChar/,$objects); # split base from dn.
$dataArray = $Global{'searchResults'};
$data = $$dataArray{$DNs[1]}; # get data associated with this dn
$dn = $$data[0]; # get DN
my $tmpdn = $dn; # save DN
$Global{'entryDN'} = $dn; # save DN
$max = $$data[1]; # get max size of atttributes
$info = $$data[2]; # get data hash address.
@tmp1 = sort(keys(%$info)); # get a list of all attributes.
foreach my $attrKey ( @tmp1 )
{
#
# User can not edit these attributes, remove from the list of
# attributes to display.
#
if ( $attrKey =~ /createTimeStamp/i || $attrKey =~ /modifyTimeStamp/i ||
$attrKey =~ /creatorsName/i || $attrKey =~ /modifiersName/i )
{
next;
}
push( @infoKeys, $attrKey ); # get a list of all attributes.
}
#
# create attribute label
#
$text = sprintf "%${max}s",'DN';
$lb = $elist->Label(-text => $text,
-font => $Global{'Font'},
-relief => 'groove',
-anchor => 'e',
-width => ($max+2) );
$elist->windowCreate("end", -window => $lb );
#
# create data entry window
#
$lb = $elist->Entry(-width => 85,
-textvariable => \$tmpdn);
$elist->windowCreate("end", -window => $lb );
$elist->insert("end", "\n"); # position to the next row.
#
# For each attribute display it's data
#
my $sptr = 0;
foreach my $var (@infoKeys)
{
$$Global{'multi'}[$sptr] = 0;
$text = sprintf "%${max}s",$var;
my $values = $$info{$var}; # get attribute data array.
$$Global{'multi'}[$sptr] = 1 if (@$values > 1);
foreach my $Value ( @$values )
{
if ( $var =~ /;binary$/ ) { next; } # We do not do binary data, yet.
#
# create attribute action button
#
$ab = $elist->Button(-text => $text,
-font => $Global{'Font'},
-borderwidth => 3,
-relief => 'raised' );
$elist->windowCreate("end", -window => $ab );
#
# Format data and print data into Entry Box
#
$lb = $elist->Listbox(-width => 85, -height => 1 );
$elist->windowCreate("end", -window => $lb );
$lb->insert('end', $Value );
$ab->configure( -command => [ \&changeAttribute, \$ab, \$lb, \$Value, \$var, $sptr ] );
# position to the next row.
$elist->insert("end", "\n");
}
++$sptr;
}
$lb = $elist->Entry(-width => 85,
-textvariable => \$blank);
$elist->windowCreate("end", -window => $lb );
# position to the next row.
$elist->insert("end", "\n");
}
sub changeAttribute
{
my ( $ab, $lb, $Value, $attr, $mv ) = @_;
#
# Create change attribute Window
#
if (!Exists($Global{'changeWindow'}) )
{
&globalPos();
my $x = $Global{'horz'} + 75;
my $y = $Global{'vert'} + 75;
my $acframe;
my $alframe;
my $attribute;
$Global{'tmpADD'} = {};
$Global{'tmpDELETE'} = {};
$Global{'tmpREPLACE'} = {};
$Global{'changeWindow'} = MainWindow->new;
$Global{'changeWindow'}->title("ATTRIBUTE MODIFICATION WINDOW");
$Global{'changeWindow'}->geometry("+$x+$y");
#
# Create process Cancel button
#
$Global{'changeWindow'}->Button(-text => "CANCEL ATTRIBUTE EDIT",
-command => \&change_cancel,
-font => $Global{'Font'}, -borderwidth => 5 )
-> pack(-fill => "both", -padx => 2, -pady => 2 ) ;
#
# Create frame for clear buttons.
#
$acframe = $Global{'changeWindow'}->Frame()
->pack( -fill => "both", -side => "bottom", -padx => 5, -pady => 2);
#
# Create Clear Data
#
$acframe -> Button(-text => " ACCEPT DATA CHANGE ",
-command => \&makeChanges,
-font => $Global{'Font'},
-borderwidth => 3 )
->pack( -fill => 'both' );
#
# Create list frame.
#
$outerframe = $Global{'changeWindow'}->Frame()
->pack( -fill => "both", -side => "top", -padx => 5, -pady => 2,
-expand => 1);
#
# Create data frame.
#
$alframe = $outerframe->LabFrame(-label => "ATTRIBUTE DATA",
-labelside => "acrosstop" )
->pack( -fill => "both", -side => "top", -padx => 5, -pady => 2,
-expand => 1);
#
# Create a Text Box that will actually contain the
# returned directory data.
#
$attrlist = $alframe ->Text( -width => 80, -height => 1,
-wrap => 'none',
-font => $Global{'Font'} );
$attrlist->pack(-fill => "both", -expand => 1 );
$attrlist->insert('end', $$Value);
if ( $Global{'add_new_attribute'} )
{
#
# Create data frame.
#
$Global{'newAttributeFrame'} = $outerframe->LabFrame(
-label => "NEW ATTRBUTE NAME",
-labelside => "acrosstop" )
->pack( -fill => "both", -side => "top", -padx => 5, -pady => 2,
-expand => 1);
#
# Create a Text Box that will actually contain the
# returned directory data.
#
$Global{'newAttribute'} = $Global{'newAttributeFrame'}->Text(
-width => 80, -height => 1,
-wrap => 'none',
-font => $Global{'Font'} );
$Global{'newAttribute'}->pack(-fill => "both", -expand => 1 );
$Global{'newAttributeReady'} = 1 ;
}
#
# Create process Add button
#
$Global{'changeWindow'}->Button(-text => "ADD",
-command => [\&add_data, $attr, $Value, \$attrlist],
-font => $Global{'Font'}, -borderwidth => 5 )
-> pack(-side => $Global{'hand'},
-padx => 2, -pady => 2 ) ;
if ( !defined($Global{'add_new_attribute'}) )
{
#
# Create process Delete button
#
$Global{'changeWindow'}->Button(-text => "DELETE",
-command => [\&delete_data, $attr, $Value],
-font => $Global{'Font'}, -borderwidth => 5 )
-> pack(-side => $Global{'hand'},
-padx => 2, -pady => 2 ) ;
#
# Create process Replace button
#
$Global{'changeWindow'}->Button(-text => "REPLACE",
-command => [\&replace_data, $attr, $Value,\$attrlist, $mv],
-font => $Global{'Font'}, -borderwidth => 5 )
-> pack(-side => $Global{'hand'},
-padx => 2, -pady => 2 ) ;
$Global{'multi'} = [];
}
}
else { return; }
sub delete_data {
my ( $attr, $Value ) = @_;
#
#
#
$Global{'tmpDELETE'}{$$attr} = $$Value;
} # End of delete_data subroutine
sub replace_data {
my ( $attr, $Value, $tbox,$mv ) = @_;
#
# Replace this attributes value.
# But what if this is a multi-valued attribute.
#
if ( $$Global{'multi'}[$mv] )
{
#
# User says it is a multi-valued attribute.
#
# First I add the new data then delete the old data.
#
$Global{'tmpDELETE'}{$$attr} = $$Value;
$Global{'tmpADD'}{$$attr} = $$tbox->get('1.0','1.end');
}
else
{
$Global{'tmpREPLACE'}{$$attr} = $$tbox->get('1.0','1.end');
}
} # End of replace_data subroutine
sub add_data {
my ( $attr, $Value, $tbox ) = @_;
my $newAttribute;
if ( $Global{'newAttributeReady'} )
{
#
# add new attribute and it's value
#
$newAttribute = $Global{'newAttribute'}->get('1.0','1.end');
#print $newAttribute, "\n";
$Global{'tmpADD'}{$newAttribute} = $$tbox->get('1.0','1.end');
}
else
{
#
# add new value to attribute
#
$Global{'tmpADD'}{$$attr} = $$tbox->get('1.0','1.end');
}
} # End of add_data subroutine
sub makeChanges
{
my $tmp = $Global{'tmpADD'};
my @Keys = sort(keys(%$tmp));
if ( @Keys )
{
foreach my $var ( @Keys)
{
$Global{'add'}{$var} = $Global{'tmpADD'}{$var};
# print $var, " == ", $Global{'tmpADD'}{$var},"\n";
}
$Global{tmpADD} = {};
$Global{'newAttribute'}->destroy
if Tk::Exists($Global{'newAttribute'});
$Global{'newAttributeFrame'}->destroy
if Tk::Exists($Global{'newAttributeFrame'});
delete( $Global{'newAttributeReady'} )
if ( defined($Global{'newAttributeReady'} ));
delete( $Global{'newAttribute'})
if ( defined($Global{'newAttribute'} ));
delete( $Global{'newAttributeFrame'})
if ( defined($Global{'newAttributeFrame'} ));
}
$tmp = $Global{'tmpDELETE'};
@Keys = sort(keys(%$tmp));
if ( @Keys )
{
foreach my $var ( @Keys)
{
$Global{'delete'}{$var} = $Global{'tmpDELETE'}{$var};
# print $Global{'tmpDELETE'}{$var},"\n";
}
$Global{tmpDELETE} = {};
}
$tmp = $Global{'tmpREPLACE'};
@Keys = sort(keys(%$tmp));
if ( @Keys )
{
foreach my $var ( @Keys)
{
$Global{'replace'}{$var} = $Global{'tmpREPLACE'}{$var};
# print $Global{'tmpREPLACE'}{$var},"\n";
}
$Global{tmpREPLACE} = {};
}
$Global{'changeWindow'}->destroy if Tk::Exists($Global{'changeWindow'});
} # End of clear subroutine
sub change_cancel
{
$Global{tmpADD} = {};
$Global{tmpDELETE} = {};
$Global{tmpREPLACE} = {};
$Global{'multi'} = [];
$Global{'changeWindow'}->destroy if Tk::Exists($Global{'changeWindow'});
} # End of cancel subroutine
} # End of subroutine changeAttribute
#
# Do LDAP entry delete.
#
sub ldapActionDelete
{
my $error;
my $mesg;
my $rmesg;
my @DNs;
my $do_it;
my $okay;
my @referral;
my $rresult;
if ( !$Global{'ldapActionDN'} )
{
&ldapActionCancel();
return;
}
my $objects = $Global{'ldapActionDN'};
&ldapActionCancel();
@DNs = split(/$sepChar/,$objects); # split base from dn.
$error = 0;
if ( !defined($Global{ldap}) )
{
$error = dirConn();
if ( $error == 1 )
{
if ( defined($Global{dirConnError}) )
{
$error = "ldapActionDelete $Global{dirConnError}";
ERROR(\$error);
}
else
{
ERROR($error);
}
return;
}
}
$do_it = 1;
$Global{loopCount} = 0;
$okay = 0;
while ($do_it == 1 )
{
$mesg = $Global{ldap}->delete($DNs[1]);
if ( $mesg->code )
{
if ( $mesg->code == 10 && $Global{fref} )
{
#
# Being refer'ed to another directory server.
#
@referral = $mesg->referrals();
foreach my $rref (@referral )
{
print "LDAP Referral: $rref \n" if $debug;
$rresult = &dirRConn($rref);
if ( $rresult != 0 )
{
print "Referral connect error, trying next now\n" if ( $debug );
next;
}
else
{
$rmesg = $Global{rldap}->delete($DNs[1]);
if ( !$rmesg->code )
{
&dirRUConn();
$do_it = 0;
last;
}
}
} # End of foreach my $rref (@ref )
if ( $do_it )
{
#
# All referrals have been tried, there is a major error.
#
&dirRUConn();
$errstr = "There has been a major referral error deleteing this DN.";
$errstr .= "The following referrals were tried;\n";
foreach my $rref (@referral )
{
$errstr .= "$rref\n";
}
ERROR($errstr);
return;
} # End of if ( $do_it )
} # End of if ( $mesg->code == 10 && $Global{fref} )
else
{
print "Delete check busy now\n" if ( $debug );
#
# There was an error, check for dsa busy
# error.
#
#
$errstr = $mesg->code;
$errstr = ldap_error_text($errstr);
#
# Check for server busy.
#
if ( !(CheckError($errstr) ) )
{
$errstr = $mesg->code;
ERROR($errstr);
return;
}
} # End of else for if ( $mesg->code == 10 && $Global{fref} )
} # End of if ( $mesg->code )
else
{
#
# There was no error
#
$do_it = 0;
}
} # End of while ($do_it == 1 )
#
# Destroy the dn history list if it exists.
#
$Global{'searchHList'}->delete('all') if Tk::Exists($Global{'searchHList'});
$Global{nb}->raise('SEARCH');
} # End of ldapActionDelete subroutine
#
# Do create entry from ldif file.
#
sub ldapActionCreateLdifEntry
{
my $error;
my $mesg;
my $rmesg;
my $f;
my $ldif;
my @entry;
my $do_it;
my $type;
my $task;
my $rresult;
my @referral;
$error = 0;
if ( !defined($Global{ldap}) )
{
$error = dirConn();
if ( $error == 1 )
{
if ( defined($Global{dirConnError}) )
{
$error = "ldapActionCreateLdifEntry $Global{dirConnError}";
ERROR(\$error);
return;
}
else
{
ERROR($error);
return;
}
}
}
@entry = ();
if ( $Global{createLdifFile} && -f $Global{createLdifFile})
{
$ldif = Net::LDAP::LDIF->new( "$Global{createLdifFile}", "r",
onerror => 'undef' );
if ( $ldif->error() )
{
$mesg = "MESG create entry error msg: " . $ldif->error() . "\n";
$mesg .= "Error lines:\n" . $ldif->error_lines() . "\n";
ERROR(\$mesg);
}
while( not $ldif->eof() ) {
$entry = $ldif->read_entry();
if ( $ldif->error() )
{
$mesg = "LDIF create entry error msg: " . $ldif->error() . "\n";
$mesg .= "Error lines:\n" . $ldif->error_lines() . "\n";
ERROR(\$mesg);
}
else
{
$op = $$entry{changetype};
if ( $op =~ /add/)
{
$type = "add";
# $mesg = $Global{ldap}->add($entry);
$task = '$Global{ldap}->add($entry)';
}
else
{
$type = "change";
$op = $$entry{changes};
#$mesg = $Global{ldap}->modify($entry);
$task = '$entry->update($Global{ldap})';
}
$do_it = 1;
while ( $do_it )
{
$mesg = eval $task;
if ( $mesg->code )
{
if ( $mesg->code == 10 && $Global{fref} )
{
#
# Being refer'ed to another directory server.
#
@referral = $mesg->referrals();
foreach my $rref (@referral )
{
print "LDAP Referral: $rref \n" if $debug;
$rresult = &dirRConn($rref);
if ( $rresult != 0 )
{
print "Referral connect error, trying next now\n" if ( $debug );
next;
}
else
{
$task = '$entry->update($Global{rldap})';
$rmesg = eval $task;
if ( !$rmesg->code )
{
&dirRUConn();
$do_it = 0;
last;
}
}
} # End of foreach my $rref (@ref )
if ( $do_it )
{
#
# All referrals have been tried, there is a major error.
#
&dirRUConn();
$errstr = "There has been a major referral updating this DN.";
$errstr .= "The following referrals were tried;\n";
foreach my $rref (@referral )
{
$errstr .= "$rref\n";
}
ERROR($errstr);
return;
} # End of if ( $do_it )
} # End of if ( $mesg->code == 10 && $Global{fref} )
else
{
print "Delete check busy now\n" if ( $debug );
#
# There was an error, check for dsa busy
# error.
#
#
$errstr = $mesg->code;
$errstr = ldap_error_text($errstr);
#
# Check for server busy.
#
if ( !(CheckError($errstr) ) )
{
$errstr = $mesg->code;
ERROR($errstr);
return;
}
}
} # End of if ( $mesg->code )
else
{
#
# There was no error
#
$do_it = 0;
} # End of else for if ( $mesg->code == 10 && $Global{fref} )
} # End of while ( $do_it )
} # End of else for if ( $ldif->error() )
}
$ldif->done();
@entry = undef;
}
else
{
$msgbox->insert("0", "LDIF file not defined or does not exist.")
if ( defined( $msgbox) );
$msgbox->update()
if ( defined( $msgbox) );
$mesg = "LDIF file not defined or does not exist.";
ERROR(\$mesg);
}
$mesg = undef;
} # End of ldapActionCreateLdifEntry subroutine
#
# Do LDAP multi-entry save to ldif
#
sub ldapActionMultiSaveToLdif
{
my $error;
my $mesg;
my $f;
my $ldif;
my @entry;
my $do_it;
&ldapActionCancel();
$error = 0;
if ( !defined($Global{ldap}) )
{
$error = dirConn();
if ( $error == 1 )
{
if ( defined($Global{dirConnError}) )
{
$error = "ldapActionMultiSaveToLdif $Global{dirConnError}";
ERROR(\$error);
return;
}
else
{
ERROR($error);
return;
}
}
}
@entry = ();
$mesg = $Global{ldap}->search(
base => $LDAP_SEARCH_BASE,
filter => $Global{filter},
attrs => $Global{att_wanted},
);
if ( $mesg->code && $mesg->code != 48 )
{
ERROR($mesg->code);
}
if ( $mesg->count )
{
if ( $Global{ldifFile} )
{
@entry = $mesg->all_entries;
if ( $Global{ldif} )
{
$ldif = Net::LDAP::LDIF->new( "$Global{ldifFile}", "w",
onerror => 'undef' );
$ldif->write(@entry, -encode => "base64");
$ldif->done();
}
elsif ( $Global{xml} )
{
open(FXML, ">$Global{'ldifFile'}");
my $dsml = Net::LDAP::DSML->new(output => *FXML, pretty_print => 1);
$dsml->write_entry(@entry);
$dsml->end_dsml;
close(FXML);
}
else
{
print "saveldif ",$Global{ldif}, "\n";
print "saveXml ",$Global{xml}, "\n";
$msgbox->insert("0", "Neither LDIF or XML variable is defined.")
if ( defined( $msgbox) );
$msgbox->update()
if ( defined( $msgbox) );
}
@entry = undef;
}
else
{
$msgbox->insert("0", "LDIF file not defined.")
if ( defined( $msgbox) );
$msgbox->update()
if ( defined( $msgbox) );
}
$mesg = undef;
}
else
{
$msgbox->insert("0", "No entry found for ldif storage.")
if ( defined( $msgbox) );
$msgbox->update()
if ( defined( $msgbox) );
}
} # End of ldapActionMultiSaveToLdif subroutine
#
# Do single LDAP entry save to ldif
#
sub ldapActionSaveToLdif
{
my $error;
my $mesg;
my $f;
my $ldif;
my @entry;
my $do_it;
if ( !$Global{'ldapActionDN'} )
{
&ldapActionCancel();
return;
}
my $objects = $Global{'ldapActionDN'};
&ldapActionCancel();
@DNs = split(/$sepChar/,$objects); # split base from dn.
$error = 0;
if ( !defined($Global{ldap}) )
{
$error = dirConn();
if ( $error == 1 )
{
if ( defined($Global{dirConnError}) )
{
$error = "ldapActionSaveToLdif $Global{dirConnError}";
ERROR(\$error);
return;
}
else
{
ERROR($error);
return;
}
}
}
@entry = ();
$mesg = $Global{ldap}->search(
base => $LDAP_SEARCH_BASE,
filter => $Global{filter},
attrs => $Global{att_wanted},
);
if ( $mesg->code && $mesg->code != 48 )
{
ERROR($mesg->code);
}
if ( $mesg->count )
{
if ( $Global{ldifFile} )
{
@entry = $mesg->all_entries;
foreach $entry (@entry)
{
my $edn = $entry->dn;
if ( $DNs[1] eq $edn )
{
if ( $Global{ldif} )
{
$ldif = Net::LDAP::LDIF->new( "$Global{ldifFile}", "w",
onerror => 'undef' );
$ldif->write($entry, -encode => "base64");
$ldif->done();
}
elsif ( $Global{xml} )
{
open(FXML, ">$Global{'ldifFile'}");
my $dsml = Net::LDAP::DSML->new(output => *FXML, pretty_print => 1);
$dsml->write_entry($entry);
$dsml->end_dsml;
close(FXML);
}
else
{
print "saveldif ",$Global{ldif}, "\n";
print "saveXml ",$Global{xml}, "\n";
$msgbox->insert("0", "Neither LDIF or XML variable is defined.")
if ( defined( $msgbox) );
$msgbox->update()
if ( defined( $msgbox) );
}
}
else
{
$entry = undef;
}
}
}
else
{
$msgbox->insert("0", "LDIF file not defined.")
if ( defined( $msgbox) );
$msgbox->update()
if ( defined( $msgbox) );
}
$mesg = undef;
}
else
{
$msgbox->insert("0", "No entry found for ldif storage.")
if ( defined( $msgbox) );
$msgbox->update()
if ( defined( $msgbox) );
}
} # End of ldapActionSaveToLdif subroutine
#
# Do LDAP entry rename.
#
sub ldapActionRename
{
my $error;
my $mesg;
my $rmesg;
$error = 0;
my $do_it;
my $rresult;
my @referral;
if ( $Global{'Rename'} == -1 )
{
return;
}
if ( !defined($Global{ldap}) )
{
$error = dirConn();
if ( $error == 1 )
{
if ( defined($Global{dirConnError}) )
{
$error = "ldapActionRename $Global{dirConnError}";
ERROR(\$error);
return;
}
else
{
ERROR($error);
}
}
}
$do_it = 1;
$Global{loopCount} = 0;
while ($do_it == 1 )
{
$mesg = $Global{ldap}->moddn($Global{'RenameDN'},
newrdn => $Global{'newrdn'},
deleteoldrdn => $Global{'deleteoldrdn'},
newsuperior => $Global{'newsuperior'} );
if ( $mesg->code )
{
if ( $mesg->code == 10 && $Global{fref} )
{
#
# Being refer'ed to another directory server.
#
@referral = $mesg->referrals();
foreach my $rref (@referral )
{
print "LDAP Referral: $rref \n" if $debug;
$rresult = &dirRConn($rref);
if ( $rresult != 0 )
{
print "Rename referral connect error, trying next now\n" if ( $debug );
next;
}
else
{
$rmesg = $Global{rldap}->moddn($Global{'RenameDN'},
newrdn => $Global{'newrdn'},
deleteoldrdn => $Global{'deleteoldrdn'},
newsuperior => $Global{'newsuperior'} );
if ( !$rmesg->code )
{
&dirRUConn();
$do_it = 0;
last;
}
}
} # End of foreach my $rref (@ref )
if ( $do_it )
{
#
# All referrals have been tried, there is a major error.
#
&dirRUConn();
$errstr = "There has been a major referral error renaming this DN.";
$errstr .= "The following referrals were tried;\n";
foreach my $rref (@referral )
{
$errstr .= "$rref\n";
}
ERROR($errstr);
return;
} # End of if ( $do_it )
} # End of if ( $mesg->code == 10 && $Global{fref} )
else
{
#
# There was an error, check for dsa busy
# error.
#
#
$errstr = $mesg->code;
$errstr = ldap_error_text($errstr);
#
# Check for server busy.
#
if ( !(CheckError($errstr) ) )
{
$errstr = $mesg->code;
ERROR($errstr);
return;
}
}
} # End of if ( $mesg->code )
else
{
#
# There was no error
#
$do_it = 0;
}
} # End of while ($do_it == 1 )
#
# Destroy the dn history list if it exists.
#
$Global{'searchHList'}->delete('all') if Tk::Exists($Global{'searchHList'});
$Global{nb}->raise('SEARCH');
} # End of subroutine ldapActionRename
#
# Create Rename DATA Window
#
sub getRenameData
{
$Global{'newsuperior'} = "";
$Global{'newrdn'} = "";
$Global{'RenameDN'} = "";
$Global{'deleteoldrdn'} = 1;
&globalPos();
my $x = $Global{'horz'} + 0;
my $y = $Global{'vert'} + 50;
my @rdnData;
my $rdn;
my $super;
my $delrdn;
my @DNs;
if ( !$Global{'ldapActionDN'} )
{
&ldapActionCancel();
return;
}
my $objects = $Global{'ldapActionDN'};
&ldapActionCancel();
@DNs = split(/$sepChar/,$objects); # split base from dn.
$Global{'RenameDN'} = $DNs[1];
@rdnData = split(/,/,$DNs[1]);
$rdn = shift(@rdnData);
foreach my $var (@rdnData)
{
$super .= $var . ",";
}
chop($super); # get rid of trailing comma
#
# Create Data Window
#
$Global{'renameWindow'} = MainWindow->new;
$Global{'renameWindow'}->title("MODDN INFORMATION");
$Global{'renameWindow'}->geometry("+$x+$y");
#
# Create process accept button
#
$Global{'renameWindow'}->Button( -text => "ACCEPT", -command => \&rdnAccept,
-font => $Global{'Font'}, -borderwidth => 3 )
-> pack(-side => "bottom", -padx => 5, -pady => 5 ) ;
#
# Create process cancel button
#
$Global{'renameWindow'}->Button(-text => "CANCEL", -command => \&rdnCancel,
-font => $Global{'Font'}, -borderwidth => 3)
-> pack(-side => "top", -padx => 5, -pady => 5 ) ;
my $newrdnframe = $Global{'renameWindow'}->LabFrame(-label => "Newrdn",
-labelside => "acrosstop")
->pack( -fill => "both", -side => "top", -padx => 5, -pady => 5 );
#
# Create newrdn text box.
#
my $t1 = $newrdnframe->Entry(-textvariable => \$Global{'newrdn'}, -width => 25 )
-> pack(-fill => 'x');
$t1->insert("end", $rdn);
#
# Create a Deleteoldrdn Radiobutton that will execute subroutine clear
# to clear the List box before each directory query.
#
$delrdn = $Global{'renameWindow'} -> Checkbutton(-text => "DELETE OLD RDN DATA",
-variable => \$Global{'deleteoldrdn'}, -onvalue => 1, -offvalue => 0,
-font => $Global{'Font'} )
-> pack(-anchor => 'sw' );
$delrdn->select();
my $newsuperiorframe = $Global{'renameWindow'}->LabFrame(-label => "Newsuperior RDN",
-labelside => "acrosstop")
->pack( -fill => "both", -side => "top", -padx => 5, -pady => 5 );
#
# Create Password Entry text box.
#
my $t2 = $newsuperiorframe->Entry( -textvariable => \$Global{'newsuperior'},
-width => 25, -font => $Global{'Font'} )
-> pack(-fill => 'x');
$t2->insert("end", $super);
sub rdnCancel{
$Global{'renameWindow'}->destroy() if Tk::Exists($Global{'renameWindow'});
delete($Global{'renameWindow'});
delete( $Global{'newsuperior'});
delete( $Global{'newrdn'});
delete( $Global{'deleteoldrdn'} );
delete( $Global{'RenameDN'} );
} # End of cancel subroutine
sub rdnAccept{
#
# Clean up data and close windows, forces another search to
# get valid new data.
#
$Global{'renameWindow'}->destroy() if Tk::Exists($Global{'renameWindow'});
$Global{'searchHistWindow'}->destroy if Tk::Exists($Global{'searchHistWindow'});
$Global{'renameWindow'} = undef();
$Global{'searchHistWindow'} = undef();
&ldapActionRename(); # Rename the entry in the directory
delete( $Global{'newsuperior'});
delete( $Global{'newrdn'});
delete( $Global{'deleteoldrdn'} );
delete( $Global{'RenameDN'} );
delete($Global{'index'}) if ( defined($Global{'index'}));
} # End of accept subroutine
} # End of getRenameData subroutine
sub display_clear
{
#
# Clear out text in List Box
#
$list->delete("1.0", "end");
} # End of clear subroutine
sub displayEdit()
{
my $ecframe;
my $elframe;
my $erbclear;
&globalPos();
my $x = $Global{'horz'} + 75;
my $y = $Global{'vert'} + 75;
#
# Create Edit Window
#
if (!Exists($Global{'editWindow'}) )
{
$Global{'editWindow'} = MainWindow->new;
$Global{'editWindow'}->title("ENTRY EDIT DISPLAY");
$Global{'editWindow'}->geometry("+$x+$y");
#
# Create process Exit button
#
$Global{'editWindow'}->Button(-text => "CANCEL ENTRY EDIT",
-command => \&edit_cancel,
-font => $Global{'Font'}, -borderwidth => 5 )
-> pack(-fill => "both", -padx => 2, -pady => 2 ) ;
#
# Create frame for clear buttons.
#
$ecframe = $Global{'editWindow'}->Frame()
->pack( -fill => "both", -side => "bottom", -padx => 5, -pady => 2);
#
# Create Clear Data
#
$ecframe -> Button(-text => " CHANGE DATA ",
-command => \&changeEntry, -font => $Global{'Font'},
-borderwidth => 3 )
->pack( -fill => 'both' );
#
# Create list frame.
#
$elframe = $Global{'editWindow'}->LabFrame(-label => "ENTRY DATA",
-labelside => "acrosstop" )
->pack( -fill => "both", -side => "top", -padx => 5, -pady => 2,
-expand => 1);
#
# Create a ROText Box that will actually contain the
# returned directory data.
#
$elist = $elframe ->Scrolled('Text', -scrollbars => 'se',
-width => 80, -height => 20, -wrap => 'none',
-font => $Global{'Font'} );
$elist->pack(-fill => "both", -expand => 1 );
#
# Create process add new attribute button
#
$elframe->Button(-text => "ADD\nATTRIBUTE",
-command => \&add_new_attribute,
-font => $Global{'Font'}, -borderwidth => 5 )
-> pack(-side => $Global{'hand'},
-padx => 2, -pady => 2 ) ;
}
sub edit_cancel{
delete($Global{'add'});
delete($Global{'delete'});
delete($Global{'replace'});
$Global{'editWindow'}->destroy if Tk::Exists($Global{'editWindow'});
} # End of cancel subroutine
} # End of subroutine displayEdit
#
# Add new attribute to entry that is being edited.
#
sub add_new_attribute
{
$Global{'add_new_attribute'} = 1;
changeAttribute( 1,1,1,1);
delete($Global{'add_new_attribute'});
} # End of subroutine add_new_attribute
#
# Execute any LDAP add, delete, or replace changes.
#
sub changeEntry
{
my $errstr;
my $mesg;
my $rmesg;
my $error = 0; # initialize error flag.
my $do_it;
my $rresult;
my @referral;
if ( !defined($Global{ldap}) )
{
$error = dirConn();
if ( $error == 1 )
{
if ( defined($Global{dirConnError}) )
{
$error = "changeEntry $Global{dirConnError}";
ERROR(\$error);
}
else
{
ERROR($error);
}
return;
}
}
#
# Execute any LDAP add changes.
#
if ( defined($Global{'add'}) )
{
$do_it = 1;
$Global{loopCount} = 0;
while ($do_it == 1 )
{
$mesg = $Global{ldap}->modify( $Global{'entryDN'}, add => $Global{'add'});
if ( $mesg->code )
{
if ( $mesg->code == 10 && $Global{fref} )
{
#
# Being refer'ed to another directory server.
#
#
@referral = $mesg->referrals();
foreach my $rref (@referral )
{
print "LDAP Referral: $rref \n" if $debug;
$rresult = &dirRConn($rref);
if ( $rresult != 0 )
{
print "Referral connect error, trying next now\n" if ( $debug );
next;
}
else
{
$rmesg = $Global{rldap}->modify( $Global{'entryDN'}, add => $Global{'add'});
if ( !$rmesg->code )
{
&dirRUConn();
$do_it = 0;
last;
}
}
} # End of foreach my $rref (@ref )
if ( $do_it )
{
#
# All referrals have been tried, there is a major error.
#
&dirRUConn();
$errstr = "There has been a major referral error adding an attribute to this DN.";
$errstr .= "The following referrals were tried;\n";
foreach my $rref (@referral )
{
$errstr .= "$rref\n";
}
ERROR($errstr);
return;
} # End of if ( $do_it )
}
else
{
#
# There was an error, check for dsa busy
# error.
#
#
$errstr = $mesg->code;
$errstr = ldap_error_text($errstr);
#
# Check for server busy.
#
if ( !(CheckError($errstr) ) )
{
$errstr = $mesg->code;
ERROR($errstr);
return;
}
}
}
else
{
#
# There was no error
#
$do_it = 0;
}
}
delete( $Global{'add'} );
}
#
# Execute any delete changes.
#
if ( defined($Global{'delete'}) )
{
$do_it = 1;
$Global{loopCount} = 0;
while ($do_it == 1 )
{
$mesg = $Global{ldap}->modify( $Global{'entryDN'}, delete => $Global{'delete'});
if ( $mesg->code )
{
if ( $mesg->code == 10 && $Global{fref} )
{
#
# Being refer'ed to another directory server.
#
#
@referral = $mesg->referrals();
foreach my $rref (@referral )
{
$rresult = &dirRConn($rref);
if ( $rresult != 0 )
{
print "Referral connect error, trying next now\n" if ( $debug );
next;
}
else
{
$rmesg = $Global{rldap}->modify( $Global{'entryDN'}, delete => $Global{'delete'});
if ( !$rmesg->code )
{
&dirRUConn();
$do_it = 0;
last;
}
}
} # End of foreach my $rref (@ref )
if ( $do_it )
{
#
# All referrals have been tried, there is a major error.
#
&dirRUConn();
$errstr = "There has been a major referral error deleteing an attribute on this DN.";
$errstr .= "The following referrals were tried;\n";
foreach my $rref (@referral )
{
$errstr .= "$rref\n";
}
ERROR($errstr);
return;
} # End of if ( $do_it )
}
else
{
#
# There was an error, check for dsa busy
# error.
#
#
$errstr = $mesg->code;
$errstr = ldap_error_text($errstr);
#
# Check for server busy.
#
if ( !(CheckError($errstr) ) )
{
$errstr = $mesg->code;
ERROR($errstr);
return;
}
}
}
else
{
#
# There was no error
#
$do_it = 0;
}
}
delete( $Global{'delete'} );
}
#
# Execute any replace changes.
#
if ( defined($Global{'replace'}) )
{
$do_it = 1;
$Global{loopCount} = 0;
while ($do_it == 1 )
{
$mesg = $Global{ldap}->modify( $Global{'entryDN'}, replace => $Global{'replace'});
if ( $mesg->code )
{
if ( $mesg->code == 10 && $Global{fref} )
{
#
# Being refer'ed to another directory server.
#
#
@referral = $mesg->referrals();
foreach my $rref (@referral )
{
$rresult = &dirRConn($rref);
if ( $rresult != 0 )
{
print "Referral connect error, trying next now\n" if ( $debug );
next;
}
else
{
$rmesg = $Global{rldap}->modify( $Global{'entryDN'}, replace => $Global{'replace'});
if ( !$rmesg->code )
{
&dirRUConn();
$do_it = 0;
last;
}
}
} # End of foreach my $rref (@ref )
if ( $do_it )
{
#
# All referrals have been tried, there is a major error.
#
&dirRUConn();
$errstr = "There has been a major referral error replacing an attribute on this DN.";
$errstr .= "The following referrals were tried;\n";
foreach my $rref (@referral )
{
$errstr .= "$rref\n";
}
ERROR($errstr);
return;
} # End of if ( $do_it )
}
else
{
#
# There was an error, check for dsa busy
# error.
#
#
$errstr = $mesg->code;
$errstr = ldap_error_text($errstr);
#
# Check for server busy.
#
if ( !(CheckError($errstr) ) )
{
$errstr = $mesg->code;
ERROR($errstr);
return;
}
}
}
else
{
#
# There was no error
#
$do_it = 0;
}
}
delete( $Global{'replace'} );
}
#
# Clean up data and close windows, forces another search to
# get valid new data.
#
delete($Global{'index'}) if ( defined($Global{'index'}));
delete($Global{'tmpADD'}) if ( defined($Global{'tmpADD'}));
delete($Global{'tmpDELETE'}) if ( defined($Global{'tmpDELETE'}));
delete($Global{'tmpREPLACE'}) if ( defined($Global{'tmpREPLACE'}));
delete($Global{'add'}) if ( defined($Global{'add'}));
delete($Global{'delete'}) if ( defined($Global{'delete'}));
delete($Global{'replace'}) if ( defined($Global{'replace'}));
$Global{'editWindow'}->destroy if Tk::Exists($Global{'editWindow'});
$Global{'changeWindow'}->destroy if Tk::Exists($Global{'changeWindow'});
$Global{'searchHistWindow'}->destroy if Tk::Exists($Global{'searchHistWindow'});
#
# Destroy the dn history list if it exists.
#
$Global{'searchHList'}->delete('all') if Tk::Exists($Global{'searchHList'});
$Global{nb}->raise('SEARCH');
} # End of changeEntry subroutine
#
# Get and display the root dse entry.
#
sub rootDse
{
my $base;
&globalPos();
my $x = $Global{'horz'} + 150;
my $y = $Global{'vert'} + 150;
my $error;
my $mesg;
$error = 0;
if ( !defined($Global{ldap} ) )
{
$error = dirConn();
if ( $error )
{
if ( defined($Global{dirConnError}) )
{
$error = "rootDSE $Global{dirConnError}";
ERROR(\$error);
}
else
{
ERROR($error);
}
return;
}
}
my $root = $Global{ldap}->root_dse();
my @Attributes = ( qw(subschemaSubentry namingContexts supportedLDAPVersion
supportedControl supportedExtension altServer supportedSASLMechanisms) );
if ( !defined($root) )
{
my $error = "Root DSE entry could not be obtained.";
ERROR(\$error);
return;
}
#
# Set up the Tk windows.
#
#
if ( ! Exists($Global{'rootWindow'} ) )
{
$Global{'rootWindow'} = MainWindow->new();
$Global{'rootWindow'}->title("ROOT DSE ENTRY");
$Global{'rootWindow'}->geometry("+$x+$y");
}
#
# Create label box
#
#
if ( !Exists($Global{'labelDSE'}) )
{
$Global{'labelDSE'} = $Global{'rootWindow'}->Label()->pack;
}
#
# Create process Exit button
#
$Global{'ebuttonDSE'} = $Global{'rootWindow'}->Button(
-text => "CLOSE ROOT DSE DISPLAY WINDOW",
-command => \&root_cancel, -font => $Global{'Font'},
-borderwidth => 5 )
-> pack(-fill => "both", -padx => 2, -pady => 2 )
if ( Exists($Global{'rootWindow'} ) &&
!Exists($Global{'ebuttonDSE'} ) );
#
# Create list box, this is where the selected objectclass data will
# be displayed.
#
if ( !Exists($Global{'listDSE'}) )
{
$Global{'listDSE'} = $Global{'rootWindow'}->Scrolled('ROText',
-scrollbars => 'se', -width=>50, -wrap => "none",
-font => $Global{'Font'}, -height => 10 )
->pack();
}
else
{
#
# clear the list box
#
$Global{'listDSE'}->delete("1.0", "end");
}
foreach $attr (@Attributes)
{
$base = $root->get_value( $attr, asref => 1);
foreach (@$base)
{
$Global{'listDSE'}->insert("end", "$attr: $_\n");
}
}
} # End of subrountine rootDse
#----------------------------------------#
# Usage() - display simple usage message #
#----------------------------------------#
sub Usage
{
print( "Usage: [-h] | [-d <#> ] | [-n] | -i <file> \n" );
print( "\t-d Perl-LDAP debug mode. Display debug messages to stdout.\n" );
print( "\t Should be used with -n so that process will not fork a\n" );
print( "\t new process.\n" );
print( "\t Value: 0 - display tklkup messages only.\n" );
print( "\t Value: 1 - Show outgoing packets (using asn_hexdump).\n" );
print( "\t Value: 2 - Show incoming packets (using asn_hexdump).\n" );
print( "\t Value: 4 - Show outgoing packets (using asn_dump).\n" );
print( "\t Value: 8 - Show incoming packets (using asn_dump).\n" );
print( "\t These values can be add to display several functions.\n" );
print( "\t-h Help. Display this message.\n" );
print( "\t-i Use the named file as the initialization file.\n" );
print( "\t-n Tklkup debug mode. Display debug messages to stdout.\n" );
print( "\n" );
print( "\t Perldoc pod documentation is included in this script.\n" );
print( "\t To read the pod documentation do the following;\n" );
print( "\t perldoc <script name>\n" );
print( "\n" );
print( "\n" );
exit( 1 );
}
__END__
=head1 NAME
tklkup - A script to do LDAP directory lookups, edits, and displaying directory schema information.
=head1 SYNOPSIS
This script is used to lookup and edit information from a LDAP
directory server. It is GUI based with several buttons for
selecting directory servers, search bases, attributes and
for enabling the Directory Schema Search window.
This script has been tested on Solaris, RedHat 7.3 Linux,
Mandrake 6.5 Linux, ActiveState Perl 628 and 5.8.7, but should work with
any system that has PERL and the required modules installed in
it.
Execute tklkup -h to view the list of input options and their
usage.
The SSL connection has been tested on Solaris, RedHat 7.3, and
Mandrake 6.5 Linux. The SSL connection from a Microsoft Windows
system is not available at this time. If the user has SSL on
the Microsoft Windows system this can easily changed by
modifying the tklkup program, in subroutine dirConn comment out
the 6 lines of code that detects the platform type of MSWin32.
There are 2 files associated with the tklkup program in this
tar file; dot.tklkup, and tklkup.
About the files.
=over 4
=item dot.tklkup
dot.tklkup - This is the initialization file that should be put
into each users home directory as I<.tklkup>.
This file will have to be setup properly before the user
can expect the tklkup script to work properly. The odds of this
initialization file being setup correctly for anyone is I<ZERO>.
However the script can be run with this file to get a feel
for how the script will look.
It allows the user to customize how tklkup will look and
work for them.
If the .tklkup files does not exist in a users home
directory the program has a set of built-in defaults
that it will use.
To be used this file must have user read permission.
There are 10 commands that can be used with this file;
binddn -> string value: Bind DN.
followref -> no value needed. Setting this option will
activate following referrals on entry modification.
mwwidth -> numeric value: Default 600 main window width in
pixels, user may need to adjust this.
mwheight -> numeric value: Default is 430 main window height in
pixels, user may need to adjust this.
hand -> values: left or right. Defines where the
attribute label box will be place.
limit -> value: default is 100. Limits the number of
search base(s) detected.
port -> value: default is 389. User should set this
to match their needs.
nismapname -> Solaris Native LDAP uses nismapname to define
the automounter directory branches. Default
is to not use Solaris Native LDAP. Uncomment
this line in the dot.tklkup file to enable this
option.
attribute -> attribute upon which the data search will be
based. One attribute per line. There is one
additional attribute that is always listed without
any action by the user; Filter. This attribute
allows the user to enter the I<COMPLETE> filter
that will used to search for data.
server -> name of the directory server that you wish
to conduct the data search.
One server per line.
Each line can have one of two formats
server: server name
or
server: server name: base
The I<server: server name> format will try to use the
root_dse function to define the base.
It the root_dse returns the namingContexts attribute,
that information will be use to determine the search
base(s).
If the root_dse returns undefined or has no namingContexts
attribute, a null string will be the search base.
In this case the user will have to define a search base
in the server command of the .tklkup file.
The I<server: server name: base> format will
cause each of the defined servers to have it's
own special initial search base and use this initial
search base to find all of the other search bases.
This is an attempt to do auto search base detection.
Using this method has one I<draw back>, when changing
to a different directory server there is a possible
I<delay> on displaying the new server name and
search base. This is due to the fact that TK and
it's MainLoop() process are not multi-tasking.
The new search base has to be acquired and setup before
MainLoop() takes control of the process.
Depending on the number of search bases this time period
can be quite a few seconds.
When switching between servers with the same base, the
search base will I<not> be updated. This too can have
a I<draw back> if there are new search bases in the
new server but it saves time.
None of this is a problem if all of your servers have
the same DIT layouts. Just define them with the
same search base, there should be little or no delay
when switching to the new server.
=back
Now a word about directory branch, or search base, detection.
There are many things that can prevent this function from working
properly. Several version 2 LDAP servers that this was tested
on required that you be bound to the server.
None of the version 3 LDAP servers required this.
If this function does not work for you, provide a bind DN and
password. The normal mode of operation for this function is an
anonymous bind situation.
Some of the ldap servers I worked with would never return the
information I expected, auto detection never functioned on these
systems.
There is one college ldap server on the Internet that has so
many bases that it takes over an hour to figure out all the
search bases. The only way the operator knows that the
script is still working is because search limit exceeded messages
are displayed on the console that initiated the tklkup script.
Who wants to wait a hour while the script figures this out.
If you decide to use auto search base detection you will just have
to try it and hope it works.
-------------------------------------------------------------------
=head1 tklkup
tklkup - PERL executable file.
You may need to change the first line of the PERL tklkup script
to point to your file pathname of perl.
When executed tklkup will display a window on your
computer. The graphical user interface, GUI, has
several sections to it.
If tklkup is run on a HPUX, Sun, or Linux system the
tklkup process will fork and run in background mode.
If tklkup is run in debug mode or on a system that is not
listed above it will I<NOT> fork and will run in in
foreground mode.
During initial program initialization a "splash" screen will
be displayed telling the user what is going on. It is possible
that the user will never see the splash screen if tklkup
initializes quickly.
-------------------------------------------------------------------
=head1 Tklkup Menu Bar
At the top of the GUI is the main menu bar. It has 3 drop down
menus; "Directory OPS", "Set Bind Credentials", and
"Set DSA Port".
The I<DIRECTORY OPS> button will activate a drop down menu that
has 2 menu selections;
The I<EXPLORE ROOT DSE> menu will attempt to obtain the
root dse entry for the selected directory server. If the root
dse entry is obtained a separate window will be displayed that
will display the information obtained from the root dse entry.
If the root dse entry can not be obtained then an error message
window will be displayed. This menu has a "Hot" key, Ctrl-r.
The I<Set SSL> menu will set parameters for a SSL ldap connection.
This menu has a "Hot" key, Ctrl-s.
The I<Set NON-SSL> menu will set parameters for a non-SSL ldap
connection. This menu has a "Hot" key, Ctrl-n.
The I<Toggle LDAP Version> menu will toggle the ldap version
between version 2 and 3. This menu has a "Hot" key, Ctrl-l.
The I<Toggle Follow Referral> menu will toggle the flag that
determines whether a ldap modify follows a referral. This menu
has a "Hot" key, Ctrl-f.
The I<Exit> menu will exit the program. This menu has a
"Hot" key, Ctrl-x.
The I<SET BIND CREDENTIALS> button will activate a window
that is separate from the main window. This menu has a
"Hot" key, Alt-b.
The new window contains two buttons and two text boxes.
At the top of the window is a Cancel button, pressing
this button will cancel the operation of setting the
bind DN and password.
The DN text box is where the user will enter the DN
to bind with. If the user has the binddn option in the .tklkup
file, the binddn will be displayed in the DN text box.
The PASSWORD text box is where the user will enter the password
for the DN. Star "*" will be shown for the characters
as they are typed into the text box. If the user presses the
return key after entering the password, this will set the
bind DN and password and start the bind process.
At the bottom of the window is the Accept button, pressing
this button will set the bind DN and the password. Pressing the
accept button will cause the program to bind to the currently
selected directory server.
Having both the dn and password fields blank and pressing the
accept key will cause an anonymous bind to the directory.
The I<DIRECTORY PORT> button will activate a window
that is separate from the main window. This menu has a
"Hot" key, Alt-p.
The new window contains two buttons, and one text box. If the
user needs to change the TCP connection port, this is where it
is done.
At the top of the window is a Cancel button, pressing
this button will cancel the operation of setting the
port number.
The text box is where the user will enter the port
number to connect. Display in the text box is the
current port number.
At the bottom of the window is the Accept button, pressing
this button will set the port number. Changing the connection
port number will I<NOT> cause the program to issue a new
connection to the directory server. The user must re-select or
change to a new directory server.
I<EXIT PROGRAM> button. Just below the main menu bar is
the "Exit" button. When a mouse click is done on the "EXIT PROGRAM"
button the program will terminate. This menu has a "Hot" key, Alt-e.
-------------------------------------------------------------------
=head1 Tklkup GUI
Just below the Menu Bar is a section of the GUI that is displayed
at all time regardless of which panel is displayed.
The I<SELECT SERVER> button will activate a
drop down menu. From the menu the user will select the
"RadioButton" that corresponds to the directory server the
user wishes to use. When selected the "RadioButton" diamond
will turn red in color. This menu is a designed to be a
"I<tear off>" menu, selecting the "---------------" line will
cause the pull down menu to become a separate window that
is still somewhat controlled by the GUI. The
DIRECTORY SERVER text box will display the directory name
that is selected. If the GUI is icon-ed or exited, the tear
off window will follow the actions of the GUI. All other
actions like moving or closing just the torn off window
must be done by the user's window manager.
To the left of the I<SELECT SERVER> button are two text labels;
one for the LDAP version and one for the SSL connection type.
These labels will display information about the selected LDAP
version and SSL connection status.
At this point the tklkup GUI is made of five display and
control panels; SEARCH, SEARCH DISPLAY, SCHEMA DATA, CREATE ENTRY,
and INFO;
-------------------------------------------------------------------
=head1 SEARCH Panel
The I<SELECT BASE> button will activate a Select Search Base window
contains 2 buttons and a herical tree structure of the directory.
At the top of the Select Search Base window is the CANCEL BASE CHANGE
button. Pressing the button will cancel the search base change and
will close, or withdraw, the window. At the bottom of the Select Search
Base window is the ACCEPT BASE CHANGE button. Pressing the button
will change the search base to the highlighted directory branch and
will close, or withdraw, the window.
In the middle of the Select Search Base window is the hierarchical
list box where a tree type display of the directory branch structure
will be displayed. The directory namingContext(s) form the base of the
tree(s), to the left of each branch in the directory will be a small
box with a + or - sign in it, if the box has a + in it, clicking on
the box will expand the tree structure, if the box has a - in it,
clicking on the box will collapse the tree structure.
To select a search base, click on a branch, which will highlight the
branch, and press the ACCEPT BASE CHANGE button.
The I<SELECT ADDITIONAL ATTRIBUTES> button will activate a
drop down menu. From the menu the user will select the
"RadioButton" that corresponds to the attribute the
user wishes to use in the filter of the directory search. When
selected the "RadioButton" diamond will turn red in color. This
menu is a designed to be a "I<tear off>" menu, selecting the
"---------------" line will cause the pull down menu to
become a separate window that is still somewhat controlled
by the GUI. If the GUI is icon-ed or exited, the tear off
window will follow the actions of the GUI. All other
actions like moving or closing just the torn off window
must be done by the user's window manager.
The I<SAVE FORMAT> frame contains to check boxes.
If checkbox XML is select, the SAVE TO and SAVE ALL TO
buttons will save the select data in XML format.
If checkbox LDIF is select, the SAVE TO and SAVE ALL TO
buttons will save the select data in LDIF format.
Just under the I<SELECT BASE> button is the hierarchical text
box where the DN results of the directory search will be displayed.
If there were valid results returned from the search a list of DN
entry(s) will be displayed in the hierarchical list box. Selecting
a DN will cause the five LDAP Action buttons to the left of the
hierarchical text box to be put in the active state. It is with
these 5 buttons that the user can select to view, rename, edit,
save to a ldif file, or delete the corresponding DSA's directory
data.
=head1 LDAP ACTION BUTTONS
I<DISPLAY> - Will display the selected DN's information in the
Directory Data text box that is located in the SEARCH DISPLAY
panel. The SEARCH DISPLAY panel will be brought to the foreground
of the GUI.
I<RENAME> - Will display a MODDN INFORMATION window in which the
user will input the needed information for modifying an entry's
DN.
I<DELETE> - Will cause the selected DN to be deleted from the
directory. When this button has the focus, it's text will turn
red, letting the user know to use caution with this button.
I<EDIT> - Will cause a Entry Edit Display window with the
corresponding entry data in it. It is from this window that the
user can change directory data. This window is described in
detail later in this document.
I<SAVE TO> - Will cause the entry that is selected to be written
to the file specified in the FILE NAME text box. The data
format of this file will be whatever is selected in the
SAVE FORMAT frame.
I<CANCEL> - Will cancel the action request for the select DN.
I<SEARCH THE DIRECTORY> button. At the bottom of the GUI is
the "Search" button. When a mouse click is done on the
"SEARCH THE DIRECTORY" button the program will execute a ldap search
of the directory.
The I<FILTER DATA> text box is where the user will enter
the data to be searched for. The program will automatically
put the beginning and ending parenthesis around the data.
If the I<Filter> attribute is selected this is where the
I<COMPLETE> filter is entered, the program will not modify this
string in any way.
If the user presses the Enter key while the I<FILTER DATA> text box
has the key board focus, a ldap search for the filter data will be
executed. This action is the same as pressing the
I<SEARCH THE DIRECTORY> button.
The I<CLEAR FILTER DATA> button will clear out the text
that appears in the Attribute Data text box.
The I<SET FILTER CONDITION> button will activate a drop down menu.
From the menu the user will select the "RadioButton" that
corresponds to the filter conditions the user wishes to use
in the directory search. When selected the "RadioButton"
diamond will turn red in color. This menu is a designed
to be a "I<tear off>" menu, selecting the
"---------------" line will cause the pull down menu to
become a separate window that is still somewhat controlled
by the GUI. If the GUI is icon-ed or exited, the tear off
window will follow the actions of the GUI. All other
actions like moving or closing just the torn off window
must be done by the user's window manager.
The four filter conditions control how the search filter
will be created. Just to the side of the I<SET FILTER CONDITION>
button is a text box that displays the filter condition
that is selected.
=head1 SAVE ALL TO BUTTON
At the bottom of the SEARCH RESULTS panel is the SAVE ALL TO
button, pressing this button will cause the previous search to be
re-executed and all of the search results will be written to the
file specified in the FILE NAME text box. The data
format of this file will be whatever is selected in the
SAVE FORMAT frame.
-------------------------------------------------------------------
=head1 SEARCH DISPLAY PANEL
The I<SEARCH DISPLAY> is the panel where data for the
selected DN is displayed. Data is displayed in the read only
Directory Data text box. Associated with the Directory Data
text box is the "RadioButton" that determines how often the
data in the directory text box is cleared. If the "CheckButton"
is selected, colored red, the directory data text box will be
cleared out before each directory query. If the "CheckButton"
is not selected the directory data text box will NOT be cleared
out until the Clear Data button in clicked or the
CLEAR DIRECTORY DATA ON EACH QUERY "RadioButton" is selected.
The Directory Data text box is where the results of the
directory search will be displayed. With the cursor
in the Directory Data text box you have access to additional
functions when you depress the mouse "action" button.
When the "action" mouse button is depressed a small text box
with 4 additional functions will be displayed inside the
Directory Data text box. These 4 functions are;
File -> This function exits the window. You can not edit
the Directory Data text box because it is created
as a read only text box.
Edit -> This function gives the user 3 additional functions;
Copy -> I do not know what this function does.
Select All -> Highlights/Selects all of the text in
the Directory Data text box.
Unselect All -> Unselects all of the text in
the Directory Data text box.
Select/Unselect are used in-conjunction with the
Copy function.
Search -> This function gives the user 4 additional
functions.
Find, Find Next, Find Previous -> These functions
find text in the Directory Data text box.
Replace -> This function allows you to replace the
text that is selected. However this is just
a fake replacement as you can not edit the
Directory Data text box because it is created
as a read only text box.
View -> This function gives the user 3 additional
functions.
Goto Line -> When selected will prompt the
user for a line number, the line number being
the line number the user wishes to see.
What Line -> When selected will tell the user
what line number the cursor is on.
Wrap -> When selected will prompt the user
to choose how to do line wrapping in the
Directory Data text box.
The CLEAR DATA button will clear out the text that
appears in the Directory Data text box.
=head2 JPEG Photo Display.
If the Tk::JPEG module is installed in the user's Perl system,
when a jpegPhoto attribute is read a separate I<JPEG PHOTO DISPLAY>
window will be display. Inside this window will be the jpeg photo,
a list box containing the DN of the entry, and a I<CLOSE WINDOW> button.
If the Tk::JPEG module is I<NOT> installed in the user's Perl
system, nothing will be displayed for the jpegPhoto.
-------------------------------------------------------------------
=head1 MODDN INFORMATION WINDOW
The I<RENAME> button will activate a window that is separate from
the main window.
The new window contains two buttons, two text boxes and one
checkbutton.
The text boxes are initialized with data that corresponds the
DN that was selected in the Search Results window. It is in
these text boxes that the user will enter the data needed for the
modrdn operation to take place.
At the top of the window is a Cancel button, pressing
this button will cancel the operation of modifying the DN.
The Newrdn text box is where the user will enter the new RDN
for the selected entry.
The Newsuperior RDN text box is where the user will enter the new
superior RDN, or branch DN, for the selected entry.
At the bottom of the window is the Accept button, pressing
this button will set the new RDN and the superior RDN.
The I<DELETE OLD RDN DATA> check box controls whether the old
entry information is deleted or not deleted. When the check box
is selected, colored red, the old entry information will be deleted.
This is the default action for this button.
Unselecting the check box will cause the entry data to not be deleted.
-------------------------------------------------------------------
=head1 ENTRY EDIT DISPLAY Window.
It is from this window that the user can modify an entry's data.
There can only be one of these windows active at a time.
Attributes that contain I<binary> information can I<NOT> be modified
with this program.
At the top of the window is the I<CANCEL ENTRY EDIT> button. Pressing
this button will cancel all pending data changes for this entry. It
will also cause the window to be destroyed.
At the bottom of the window is the I<CHANGE DATA> button. Pressing
this button will cause all of the pending data changes to take
place.
Just above the I<CHANGE DATA> button is the I<ADD ATTRIBUTE> button.
Pressing this button gives the user the option of entering a new
attribute name and value so that this information can be put into
the entry.
In the middle of the window is the I<ENTRY DATA> box. In this box
is the all of the entry's current attributes along with their data.
Each line in the box is broken up into two parts; the attribute button and
the attribute data list box. There is one attribute and data pair per
line. Multi-valued attributes have one line per attribute value.
The first line in the I<ENTRY DATA> box will be the DN of the entry.
This line can not be edited.
To edit an attribute, press the button that has the attributes name on
it. This will cause a I<ATTRIBUTE MODIFICATION> window to be displayed.
This window is described in detail later in this documentation.
When the user has finished making changes, press the I<CHANGE DATA> button.
This will start the process of making the change(s) in the LDAP
directory. If any errors occur a error window will appear. After the
error window is dismissed the I<ENTRY EDIT DISPLAY> window will still
be active. The user can at this point do what ever it takes to correct
the problem.
If no errors occur the I<ENTRY EDIT DISPLAY> window and the
I<SEARCH RESULTS> windows will be destroyed. This is due to the fact
that the data in both windows is no longer valid. The user must
research the LDAP directory to get the new updated information.
-------------------------------------------------------------------
=head1 ATTRIBUTE MODIFICATION Window.
It is from this window that the user can modify an attribute's data.
There can only be one of these windows active at a time.
At the top of the window is the I<CANCEL ATTRIBUTE EDIT> button. Pressing
this button will cancel all pending data changes for this attribute. It
will also cause the window to be destroyed.
At the bottom of the window is the I<ACCEPT DATA CHANGE> button. Pressing
this button will cause all of the current data changes to be put into
the pending data change queue.
In the middle of the window is the attribute data text box. It is in
this text box that the user will find the current data for the attribute
the user selected. Depending on the operation the user wants to do the
user can change the data or leave the data as is.
Below the attribute data text box are three buttons, ADD, DELETE, and
REPLACE.
=head2 ADD operations.
If the user wishes to add a new value to an attribute; the user should
enter the new data in the attribute data text box and then press
the I<ADD> button.
=head2 DELETE operations.
If the user wishes to delete the value from an attribute; the user should
not bother the data in the attribute data text box and should press
the I<DELETE> button.
=head2 REPLACE operations.
The attribute value being replaced is a part of a multi-valued
attribute, the new value will be added to the attribute, then
the old value will be deleted. If the add operation has an error
code, the delete part of this operation will not take place.
If the attribute value being replace is a single valued attribute
this value will be replaced.
When the user done with the changes the user should press the
I<ACCEPT DATA CHANGES> button. This will move the data changes onto
the pending data change queue and close the window.
-------------------------------------------------------------------
=head1 DIRECTORY DELETE CONFIRM WINDOW.
When the DELETE button is selected, before the actual deletion
takes place, a window will be displayed with a Cancel and Accept
buttons. This gives the user a fail safe in case the user selects
the DELETE button by accident. Pressing the Cancel will cancel
the delete request, pressing the Accept button will cause the
directory entry to be deleted.
-------------------------------------------------------------------
=head1 SCHEMA DATA PANEL
This panel has schema information from a LDAP directory server.
This data is retrieved, with in one second, upon connection to the
selected directory server. This action takes place upon start up
of the program or when a new directory server is selected.
=head2 Directory Schema Display Window Operation
When the SCHEMA DATA panel tab is pressed, the SCHEMA DATA
panel is brought to the foreground of the GUI.
When the Write Data To File RadioButton is selected the
LDAP Schema data will be written to the file listed
in the text box below the RadioButton text. By selecting
the DSML XML RadionButton, the data will be written to the
file in XML format. Once the data has been written to the file a
message will be written to the DIRECTORY SCHEMA DATA text box
stating that the data has been written to a file and will list
the file name. Upon completion of the schema dump operation
the RadioButton and text in the file name text box will be reset.
At the bottom of the GUI is the "Retrieve Directory Schema" button.
When a mouse click is done on the "Retrieve Directory Schema"
button the script will query the directory server for schema information
and then write the information to the file.
Associated with the Directory Schema Data text box is a series of
"CheckButtons" that determines what of the schema objects will be
displayed. There are 9 Checkbuttons; ALL, objectClass, matchingRules,
attributeTypes, ldapsyntaxes, nameforms, ditstructurerules,
ditcontentrules, and matchingruleuse. If the "CheckButton" is
selected, colored red, then schema objects of that type will be
displayed in the Directory Schema Data text box.
If the "CheckButton" is not selected, gray in color, then schema
objects of this type will not be displayed in the Directory Schema
Data text box. By default the ALL CheckButton is select.
The Directory Schema Data text box is where the results of the
directory search will be displayed. With the cursor
in the Directory Data text box you have access to additional
functions when you depress the mouse "action" button.
When the "action" mouse button is depressed a small text box
with 4 additional functions will be displayed inside the
Directory Data text box. These 4 functions are;
File -> This function exits the window. You can not edit
the Directory Data text box because it is created
as a read only text box.
Edit -> This function gives the user 3 additional functions;
Copy -> I do not know what this function does.
Select All -> Highlights/Selects all of the text in
the Directory Data text box.
Unselect All -> Unselects all of the text in
the Directory Data text box.
Select/Unselect are used in-conjunction with the
Copy function.
Search -> This function gives the user 4 additional
functions.
Find, Find Next, Find Previous -> These functions
find text in the Directory Data text box.
Replace -> This function allows you to replace the
text that is selected. However this is just
a fake replacement as you can not edit the
Directory Data text box because it is created
as a read only text box.
View -> This function gives the user 3 additional
functions.
Goto Line -> When selected will prompt the
user for a line number, the line number being
the line number the user wishes to see.
What Line -> When selected will tell the user
what line number the cursor is on.
Wrap -> When selected will prompt the user
to choose how to do line wrapping in the
Directory Data text box.
The Clear Data button will clear out the text that
appears in the Directory Schema Data text box.
The I<SHOW HIERARCHICAL OBJECTCLASS TREE> will cause one of two
windows to be displayed. For information about these windows see
the HIERARCHICAL OBJECTCLASS section of the manual.
At the bottom of the GUI is the "Retrieve Directory Schema" button.
When a mouse click is done on the "Retrieve Directory Schema"
button the script will query the directory server for schema information.
=head1 HIERARCHICAL OBJECTCLASS Window
If no directory schema data has been obtained from the selected
directory server a error message window will be displayed stating
that no schema data is available.
If directory schema data has been obtained from the selected
directory server a separate window will be displayed.
The I<HIERARCHICAL OBJECTCLASS> window has two list boxes and
a I<CLOSE HIERARCHICAL DISPLAY WINDOW> button. The
I<CLOSE HIERARCHICAL DISPLAY WINDOW> button will destroy the
I<HIERARCHICAL OBJECTCLASS> window. In one of the list boxes will
be a hierarchical tree of all of the objectclasses obtained from the
directory server. Doing a mouse button select on one of the
objects in the tree will cause information about that objectclass
branch to be displayed in the adjacent list box. The most superior
ojectclass will be at the top of the listing, the leaf objectclass
will be at the bottom of the listing. Each objectclass is separated
by a dashed line. All information about each objectclass will be
displayed in that objectclass's section.
-------------------------------------------------------------------
=head1 CREATE ENTRY PANEL
=head2 Entry creation or modification from LDIF.
The user can create and modify an entry from a LDIF file.
When the user presses the "CREATE/MODIFY ENTRY FROM LDIF FILE"
button, the file listed in the "LDIF FILE NAME" text box will be used
to create or modify the entries listed in the ldif formatted file.
=head2 Manual entry creation using the objectClass as a template.
In the MANUALLY CREATE ENTRY frame the user can manually create
an entry using the objectClass list box as an entry template.
First thing the user should do is select the proper DN base from
the SELECT DN BASE button. This will setup part of the entry's
DN.
After selecting the DN base the user can find and select an objectclass,
or objectclasses from the list of objectClass(s). When the user selects,
by clicking the pointer on an objectClass, the objectclass will appear
in the window to the left of the objectclass list. The superior objectclass(s)
of the selected objectclass will also be displayed.
If the user adds a wrong objectclass, the user may remove the objectclass
by clicking the button with the objectclass name in it. Only that
class will be removed.
When the user is ready to create the entry, the user must click the
"Create The Entry" button and a CREATE DIRECTORY ENTRY window
will be displayed. It is from the CREATE DIRECTORY ENTRY window the
the user will finish entering data for the new entry.
If the user selects the posixAccount or shadowAccount, the
posixAccount, shadowAccount, and account objectclasses will be
include in the objectclasses for the new entry.
-------------------------------------------------------------------
=head1 CREATE DIRECTORY ENTRY WINDOW
At the top of the CREATE DIRECTORY ENTRY window is the
CANCEL CREATE ENTRY DISPLAY button. Pressing this button
will cancel the entry creation process.
Just below the CANCEL CREATE ENTRY DISPLAY button is a series of
information messages for the user about the Naming Attribute selection
and DN base.
In the middle of the window is the actual data list box, it is in
this list box that the user enters attribute information, selects
the Naming Attribute, or sets up a DN.
The data list box is for all practical purposes divided into 4
sections.
The DN text field is where the user can edit the DN base or
enter in a complete DN. If the user enters a complete DN the
user should B<NOT> select a Naming Attribute radionbutton.
Between the DN text field and the objectClass text fields will
be all of the B<MUST> attributes. The B<MUST> attribute names
will be colored red. These attributes must have information in
them for the entry to be accepted into the directory.
The objectClass text fields are read only fields that list the
objectClasses that will be used in the creation of the entry.
All attributes below the objectClass text fields are B<MAY>
attributes, the user does not have to supply information about
these attributes unless the attribute is selected to be the
Naming Attribute. If the attribute is selected to be the Naming
Attribute it B<MUST> have data associated with it.
The B<Naming Attribute> radiobutton are used to select the
attribute that will be used as the Naming Attribute. The
Naming Attribute is used to complete the entry DN. The user
does not have to use these buttons, but if one is selected,
due to the nature of radiobuttons, one of them must be used
as there is no way to deselect any of the radiobuttons.
At the bottom of the CREATE DIRECTORY ENTRY window is the
CREATE ENTRY button. Pressing this button will start the process
of putting the new entry into the directory.
If during the actual creation of the entry there is an error
detected, a error window will be displayed stating the error.
Once the error is acknowledged, the user can correct the error
and then re-click the CREATE ENTRY button will re-attempt to
create the entry in the directory. The CREATE DIRECTORY ENTRY
window will not be destroyed until either the user cancels the
action or the entry is created in the directory.
-------------------------------------------------------------------
=head1 INFO PANEL
This panel is mainly for information.
The I<Process Messages> text window is where process messages
will be displayed. The messages are indicators of what is
happening during the execution of the program. By selecting
a line of text and moving the cursor up or down, the user
can scroll thru the messages.
This panel can be considered to be under construction.
-------------------------------------------------------------------
=head1 REQUIREMENTS
To use this program you will need the following.
At least PERL version 5.004. You can get a stable version of PERL
from the following URL;
http://cpan.org/src/index.html
Perl Tk800.022 module. You can get this from the following URL;
ftp://ftp.duke.edu/pub/CPAN/modules/by-module/Tk/
If you wish to display a jpegPhoto attribute then you will need the
Perl Tk-JPEG-2.014 module. You can get this from the following URL;
ftp://ftp.duke.edu/pub/CPAN/modules/by-module/Tk/
Perl LDAP module. You can get this from the following URL;
ftp://ftp.duke.edu/pub/CPAN/modules/by-module/Net/
Perl Convert-ASN1 module. You can get this from the following URL;
ftp://ftp.duke.edu/pub/CPAN/modules/by-module/Convert/
Depending on the modules loaded in your PERL system, you may need to
load the following PERL module.
Perl Digest-MD5 module. You can get this from the following URL;
ftp://ftp.duke.edu/pub/CPAN/modules/by-module/MD5/
Bundled inside each PERL module is instructions on how to install the
module into your PERL system.
-------------------------------------------------------------------
=head1 INSTALLING THE SCRIPT
Install the tklkup script anywhere you wish, I suggest
/usr/local/bin/tklkup.
Install the dot.tklkup file in each users home directory
as .tklkup. It is possible to use a central copy and
create a link in the user home directory to the central copy.
-------------------------------------------------------------------
Since the script is in PERL, feel free to modify it if it does not
meet your needs. This is one of the main reasons I did it in PERL.
If you make an addition to the code that you feel other individuals
could use let me know about it. I may incorporate your code
into my code.
=head1 AUTHOR
Clif Harden <charden@pobox.com>
If you find any errors in the code please let me know at
charden@pobox.com.
=head1 COPYRIGHT
Copyright (c) 1999-2003 Clif Harden. All rights reserved. This program is
free software; you can redistribute it and/or modify it under the same
terms as Perl itself.
=cut
|