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
|
/*
* Copyright (c) 2002 Andrew J. Korty
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: Admin.xs,v 1.23 2007/01/05 23:41:38 ajk Exp $
*/
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include <krb5.h>
#include <krb5/krb5.h>
#include <kadm5/admin.h>
#include <com_err.h>
#include "ppport.h"
static krb5_context
context(void)
{
dSP;
int count;
krb5_context context;
SV *sv;
PUSHMARK(SP);
count = call_pv("Authen::Krb5::init_context", G_SCALAR);
SPAGAIN;
if (count != 1)
croak("Authen::Krb5::init_context returned something unexpected.");
sv = POPs;
if (!sv_derived_from(sv, "Authen::Krb5::Context"))
croak("Authen::Krb5::init_context did not return a Context object.");
context = (krb5_context) SvIV(SvRV(sv));
PUTBACK;
return context;
}
static int
not_here(char *s)
{
croak("%s not implemented on this architecture", s);
return -1;
}
static double
constant(char *name, int arg)
{
errno = 0;
switch (*name) {
case 'E':
if (strEQ(name, "ENCTYPE_NULL"))
#ifdef ENCTYPE_NULL
return ENCTYPE_NULL;
#else
goto not_there;
#endif
if (strEQ(name, "ENCTYPE_DES_CBC_CRC"))
#ifdef ENCTYPE_DES_CBC_CRC
return ENCTYPE_DES_CBC_CRC;
#else
goto not_there;
#endif
if (strEQ(name, "ENCTYPE_DES_CBC_MD4"))
#ifdef ENCTYPE_DES_CBC_MD4
return ENCTYPE_DES_CBC_MD4;
#else
goto not_there;
#endif
if (strEQ(name, "ENCTYPE_DES_CBC_MD5"))
#ifdef ENCTYPE_DES_CBC_MD5
return ENCTYPE_DES_CBC_MD5;
#else
goto not_there;
#endif
if (strEQ(name, "ENCTYPE_DES_CBC_RAW"))
#ifdef ENCTYPE_DES_CBC_RAW
return ENCTYPE_DES_CBC_RAW;
#else
goto not_there;
#endif
if (strEQ(name, "ENCTYPE_DES_HMAC_SHA1"))
#ifdef ENCTYPE_DES_HMAC_SHA1
return ENCTYPE_DES_HMAC_SHA1;
#else
goto not_there;
#endif
if (strEQ(name, "ENCTYPE_DES3_CBC_RAW"))
#ifdef ENCTYPE_DES3_CBC_RAW
return ENCTYPE_DES3_CBC_RAW;
#else
goto not_there;
#endif
if (strEQ(name, "ENCTYPE_DES3_CBC_SHA"))
#ifdef ENCTYPE_DES3_CBC_SHA
return ENCTYPE_DES3_CBC_SHA;
#else
goto not_there;
#endif
if (strEQ(name, "ENCTYPE_DES3_CBC_SHA1"))
#ifdef ENCTYPE_DES3_CBC_SHA1
return ENCTYPE_DES3_CBC_SHA1;
#else
goto not_there;
#endif
if (strEQ(name, "ENCTYPE_LOCAL_DES3_HMAC_SHA1"))
#ifdef ENCTYPE_LOCAL_DES3_HMAC_SHA1
return ENCTYPE_LOCAL_DES3_HMAC_SHA1;
#else
goto not_there;
#endif
if (strEQ(name, "ENCTYPE_UNKNOWN"))
#ifdef ENCTYPE_UNKNOWN
return ENCTYPE_UNKNOWN;
#else
goto not_there;
#endif
break;
case 'K':
if (strEQ(name, "KADM5_API_VERSION_1"))
#ifdef KADM5_API_VERSION_1
return KADM5_API_VERSION_1;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_API_VERSION_2"))
#ifdef KADM5_API_VERSION_2
return KADM5_API_VERSION_2;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_API_VERSION_MASK"))
#ifdef KADM5_API_VERSION_MASK
return KADM5_API_VERSION_MASK;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_ATTRIBUTES"))
#ifdef KADM5_ATTRIBUTES
return KADM5_ATTRIBUTES;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_AUTH_ADD"))
#ifdef KADM5_AUTH_ADD
return KADM5_AUTH_ADD;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_AUTH_CHANGEPW"))
#ifdef KADM5_AUTH_CHANGEPW
return KADM5_AUTH_CHANGEPW;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_AUTH_DELETE"))
#ifdef KADM5_AUTH_DELETE
return KADM5_AUTH_DELETE;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_AUTH_GET"))
#ifdef KADM5_AUTH_GET
return KADM5_AUTH_GET;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_AUTH_INSUFFICIENT"))
#ifdef KADM5_AUTH_INSUFFICIENT
return KADM5_AUTH_INSUFFICIENT;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_AUTH_LIST"))
#ifdef KADM5_AUTH_LIST
return KADM5_AUTH_LIST;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_AUTH_MODIFY"))
#ifdef KADM5_AUTH_MODIFY
return KADM5_AUTH_MODIFY;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_AUTH_SETKEY"))
#ifdef KADM5_AUTH_SETKEY
return KADM5_AUTH_SETKEY;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_AUX_ATTRIBUTES"))
#ifdef KADM5_AUX_ATTRIBUTES
return KADM5_AUX_ATTRIBUTES;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_BAD_API_VERSION"))
#ifdef KADM5_BAD_API_VERSION
return KADM5_BAD_API_VERSION;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_BAD_AUX_ATTR"))
#ifdef KADM5_BAD_AUX_ATTR
return KADM5_BAD_AUX_ATTR;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_BAD_CLASS"))
#ifdef KADM5_BAD_CLASS
return KADM5_BAD_CLASS;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_BAD_CLIENT_PARAMS"))
#ifdef KADM5_BAD_CLIENT_PARAMS
return KADM5_BAD_CLIENT_PARAMS;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_BAD_DB"))
#ifdef KADM5_BAD_DB
return KADM5_BAD_DB;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_BAD_HISTORY"))
#ifdef KADM5_BAD_HISTORY
return KADM5_BAD_HISTORY;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_BAD_HIST_KEY"))
#ifdef KADM5_BAD_HIST_KEY
return KADM5_BAD_HIST_KEY;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_BAD_LENGTH"))
#ifdef KADM5_BAD_LENGTH
return KADM5_BAD_LENGTH;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_BAD_MASK"))
#ifdef KADM5_BAD_MASK
return KADM5_BAD_MASK;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_BAD_MIN_PASS_LIFE"))
#ifdef KADM5_BAD_MIN_PASS_LIFE
return KADM5_BAD_MIN_PASS_LIFE;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_BAD_PASSWORD"))
#ifdef KADM5_BAD_PASSWORD
return KADM5_BAD_PASSWORD;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_BAD_POLICY"))
#ifdef KADM5_BAD_POLICY
return KADM5_BAD_POLICY;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_BAD_PRINCIPAL"))
#ifdef KADM5_BAD_PRINCIPAL
return KADM5_BAD_PRINCIPAL;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_BAD_SERVER_HANDLE"))
#ifdef KADM5_BAD_SERVER_HANDLE
return KADM5_BAD_SERVER_HANDLE;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_BAD_SERVER_NAME"))
#ifdef KADM5_BAD_SERVER_NAME
return KADM5_BAD_SERVER_NAME;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_BAD_SERVER_PARAMS"))
#ifdef KADM5_BAD_SERVER_PARAMS
return KADM5_BAD_SERVER_PARAMS;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_BAD_STRUCT_VERSION"))
#ifdef KADM5_BAD_STRUCT_VERSION
return KADM5_BAD_STRUCT_VERSION;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_BAD_TL_TYPE"))
#ifdef KADM5_BAD_TL_TYPE
return KADM5_BAD_TL_TYPE;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_CONFIG_ACL_FILE"))
#ifdef KADM5_CONFIG_ACL_FILE
return KADM5_CONFIG_ACL_FILE;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_CONFIG_ADBNAME"))
#ifdef KADM5_CONFIG_ADBNAME
return KADM5_CONFIG_ADBNAME;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_CONFIG_ADB_LOCKFILE"))
#ifdef KADM5_CONFIG_ADB_LOCKFILE
return KADM5_CONFIG_ADB_LOCKFILE;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_CONFIG_ADMIN_KEYTAB"))
#ifdef KADM5_CONFIG_ADMIN_KEYTAB
return KADM5_CONFIG_ADMIN_KEYTAB;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_CONFIG_ADMIN_SERVER"))
#ifdef KADM5_CONFIG_ADMIN_SERVER
return KADM5_CONFIG_ADMIN_SERVER;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_CONFIG_AUTH_NOFALLBACK"))
#ifdef KADM5_CONFIG_AUTH_NOFALLBACK
return KADM5_CONFIG_AUTH_NOFALLBACK;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_CONFIG_DBNAME"))
#ifdef KADM5_CONFIG_DBNAME
return KADM5_CONFIG_DBNAME;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_CONFIG_DICT_FILE"))
#ifdef KADM5_CONFIG_DICT_FILE
return KADM5_CONFIG_DICT_FILE;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_CONFIG_ENCTYPE"))
#ifdef KADM5_CONFIG_ENCTYPE
return KADM5_CONFIG_ENCTYPE;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_CONFIG_ENCTYPES"))
#ifdef KADM5_CONFIG_ENCTYPES
return KADM5_CONFIG_ENCTYPES;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_CONFIG_EXPIRATION"))
#ifdef KADM5_CONFIG_EXPIRATION
return KADM5_CONFIG_EXPIRATION;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_CONFIG_FLAGS"))
#ifdef KADM5_CONFIG_FLAGS
return KADM5_CONFIG_FLAGS;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_CONFIG_KADMIND_PORT"))
#ifdef KADM5_CONFIG_KADMIND_PORT
return KADM5_CONFIG_KADMIND_PORT;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_CONFIG_KPASSWD_PORT"))
#ifdef KADM5_CONFIG_KPASSWD_PORT
return KADM5_CONFIG_KPASSWD_PORT;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_CONFIG_MAX_LIFE"))
#ifdef KADM5_CONFIG_MAX_LIFE
return KADM5_CONFIG_MAX_LIFE;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_CONFIG_MAX_RLIFE"))
#ifdef KADM5_CONFIG_MAX_RLIFE
return KADM5_CONFIG_MAX_RLIFE;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_CONFIG_MKEY_FROM_KBD"))
#ifdef KADM5_CONFIG_MKEY_FROM_KBD
return KADM5_CONFIG_MKEY_FROM_KBD;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_CONFIG_MKEY_NAME"))
#ifdef KADM5_CONFIG_MKEY_NAME
return KADM5_CONFIG_MKEY_NAME;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_CONFIG_NO_AUTH"))
#ifdef KADM5_CONFIG_NO_AUTH
return KADM5_CONFIG_NO_AUTH;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_CONFIG_OLD_AUTH_GSSAPI"))
#ifdef KADM5_CONFIG_OLD_AUTH_GSSAPI
return KADM5_CONFIG_OLD_AUTH_GSSAPI;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_CONFIG_PROFILE"))
#ifdef KADM5_CONFIG_PROFILE
return KADM5_CONFIG_PROFILE;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_CONFIG_REALM"))
#ifdef KADM5_CONFIG_REALM
return KADM5_CONFIG_REALM;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_CONFIG_STASH_FILE"))
#ifdef KADM5_CONFIG_STASH_FILE
return KADM5_CONFIG_STASH_FILE;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_DUP"))
#ifdef KADM5_DUP
return KADM5_DUP;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_FAILURE"))
#ifdef KADM5_FAILURE
return KADM5_FAILURE;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_FAIL_AUTH_COUNT"))
#ifdef KADM5_FAIL_AUTH_COUNT
return KADM5_FAIL_AUTH_COUNT;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_GSS_ERROR"))
#ifdef KADM5_GSS_ERROR
return KADM5_GSS_ERROR;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_INIT"))
#ifdef KADM5_INIT
return KADM5_INIT;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_KEY_DATA"))
#ifdef KADM5_KEY_DATA
return KADM5_KEY_DATA;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_KVNO"))
#ifdef KADM5_KVNO
return KADM5_KVNO;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_LAST_FAILED"))
#ifdef KADM5_LAST_FAILED
return KADM5_LAST_FAILED;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_LAST_PWD_CHANGE"))
#ifdef KADM5_LAST_PWD_CHANGE
return KADM5_LAST_PWD_CHANGE;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_LAST_SUCCESS"))
#ifdef KADM5_LAST_SUCCESS
return KADM5_LAST_SUCCESS;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_MASK_BITS"))
#ifdef KADM5_MASK_BITS
return KADM5_MASK_BITS;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_MAX_LIFE"))
#ifdef KADM5_MAX_LIFE
return KADM5_MAX_LIFE;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_MAX_RLIFE"))
#ifdef KADM5_MAX_RLIFE
return KADM5_MAX_RLIFE;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_MISSING_CONF_PARAMS"))
#ifdef KADM5_MISSING_CONF_PARAMS
return KADM5_MISSING_CONF_PARAMS;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_MKVNO"))
#ifdef KADM5_MKVNO
return KADM5_MKVNO;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_MOD_NAME"))
#ifdef KADM5_MOD_NAME
return KADM5_MOD_NAME;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_MOD_TIME"))
#ifdef KADM5_MOD_TIME
return KADM5_MOD_TIME;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_NEW_LIB_API_VERSION"))
#ifdef KADM5_NEW_LIB_API_VERSION
return KADM5_NEW_LIB_API_VERSION;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_NEW_SERVER_API_VERSION"))
#ifdef KADM5_NEW_SERVER_API_VERSION
return KADM5_NEW_SERVER_API_VERSION;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_NEW_STRUCT_VERSION"))
#ifdef KADM5_NEW_STRUCT_VERSION
return KADM5_NEW_STRUCT_VERSION;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_NOT_INIT"))
#ifdef KADM5_NOT_INIT
return KADM5_NOT_INIT;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_NO_RENAME_SALT"))
#ifdef KADM5_NO_RENAME_SALT
return KADM5_NO_RENAME_SALT;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_NO_SRV"))
#ifdef KADM5_NO_SRV
return KADM5_NO_SRV;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_OK"))
#ifdef KADM5_OK
return KADM5_OK;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_OLD_LIB_API_VERSION"))
#ifdef KADM5_OLD_LIB_API_VERSION
return KADM5_OLD_LIB_API_VERSION;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_OLD_SERVER_API_VERSION"))
#ifdef KADM5_OLD_SERVER_API_VERSION
return KADM5_OLD_SERVER_API_VERSION;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_OLD_STRUCT_VERSION"))
#ifdef KADM5_OLD_STRUCT_VERSION
return KADM5_OLD_STRUCT_VERSION;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_PASS_Q_CLASS"))
#ifdef KADM5_PASS_Q_CLASS
return KADM5_PASS_Q_CLASS;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_PASS_Q_DICT"))
#ifdef KADM5_PASS_Q_DICT
return KADM5_PASS_Q_DICT;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_PASS_Q_TOOSHORT"))
#ifdef KADM5_PASS_Q_TOOSHORT
return KADM5_PASS_Q_TOOSHORT;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_PASS_REUSE"))
#ifdef KADM5_PASS_REUSE
return KADM5_PASS_REUSE;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_PASS_TOOSOON"))
#ifdef KADM5_PASS_TOOSOON
return KADM5_PASS_TOOSOON;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_POLICY"))
#ifdef KADM5_POLICY
return KADM5_POLICY;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_POLICY_CLR"))
#ifdef KADM5_POLICY_CLR
return KADM5_POLICY_CLR;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_POLICY_REF"))
#ifdef KADM5_POLICY_REF
return KADM5_POLICY_REF;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_PRINCIPAL"))
#ifdef KADM5_PRINCIPAL
return KADM5_PRINCIPAL;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_PRINCIPAL_NORMAL_MASK"))
#ifdef KADM5_PRINCIPAL_NORMAL_MASK
return KADM5_PRINCIPAL_NORMAL_MASK;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_PRINC_EXPIRE_TIME"))
#ifdef KADM5_PRINC_EXPIRE_TIME
return KADM5_PRINC_EXPIRE_TIME;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_PRIV_ADD"))
#ifdef KADM5_PRIV_ADD
return KADM5_PRIV_ADD;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_PRIV_DELETE"))
#ifdef KADM5_PRIV_DELETE
return KADM5_PRIV_DELETE;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_PRIV_GET"))
#ifdef KADM5_PRIV_GET
return KADM5_PRIV_GET;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_PRIV_MODIFY"))
#ifdef KADM5_PRIV_MODIFY
return KADM5_PRIV_MODIFY;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_PROTECT_PRINCIPAL"))
#ifdef KADM5_PROTECT_PRINCIPAL
return KADM5_PROTECT_PRINCIPAL;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_PW_EXPIRATION"))
#ifdef KADM5_PW_EXPIRATION
return KADM5_PW_EXPIRATION;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_PW_HISTORY_NUM"))
#ifdef KADM5_PW_HISTORY_NUM
return KADM5_PW_HISTORY_NUM;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_PW_MAX_LIFE"))
#ifdef KADM5_PW_MAX_LIFE
return KADM5_PW_MAX_LIFE;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_PW_MIN_CLASSES"))
#ifdef KADM5_PW_MIN_CLASSES
return KADM5_PW_MIN_CLASSES;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_PW_MIN_LENGTH"))
#ifdef KADM5_PW_MIN_LENGTH
return KADM5_PW_MIN_LENGTH;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_PW_MIN_LIFE"))
#ifdef KADM5_PW_MIN_LIFE
return KADM5_PW_MIN_LIFE;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_REF_COUNT"))
#ifdef KADM5_REF_COUNT
return KADM5_REF_COUNT;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_RPC_ERROR"))
#ifdef KADM5_RPC_ERROR
return KADM5_RPC_ERROR;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_SECURE_PRINC_MISSING"))
#ifdef KADM5_SECURE_PRINC_MISSING
return KADM5_SECURE_PRINC_MISSING;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_SETKEY3_ETYPE_MISMATCH"))
#ifdef KADM5_SETKEY3_ETYPE_MISMATCH
return KADM5_SETKEY3_ETYPE_MISMATCH;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_SETKEY_DUP_ENCTYPES"))
#ifdef KADM5_SETKEY_DUP_ENCTYPES
return KADM5_SETKEY_DUP_ENCTYPES;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_SETV4KEY_INVAL_ENCTYPE"))
#ifdef KADM5_SETV4KEY_INVAL_ENCTYPE
return KADM5_SETV4KEY_INVAL_ENCTYPE;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_STRUCT_VERSION"))
#ifdef KADM5_STRUCT_VERSION
return KADM5_STRUCT_VERSION;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_STRUCT_VERSION_1"))
#ifdef KADM5_STRUCT_VERSION_1
return KADM5_STRUCT_VERSION_1;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_STRUCT_VERSION_MASK"))
#ifdef KADM5_STRUCT_VERSION_MASK
return KADM5_STRUCT_VERSION_MASK;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_TL_DATA"))
#ifdef KADM5_TL_DATA
return KADM5_TL_DATA;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_UNK_POLICY"))
#ifdef KADM5_UNK_POLICY
return KADM5_UNK_POLICY;
#else
goto not_there;
#endif
if (strEQ(name, "KADM5_UNK_PRINC"))
#ifdef KADM5_UNK_PRINC
return KADM5_UNK_PRINC;
#else
goto not_there;
#endif
if (strEQ(name, "KRB5_KDB_DISALLOW_ALL_TIX"))
#ifdef KRB5_KDB_DISALLOW_ALL_TIX
return KRB5_KDB_DISALLOW_ALL_TIX;
#else
goto not_there;
#endif
if (strEQ(name, "KRB5_KDB_DISALLOW_DUP_SKEY"))
#ifdef KRB5_KDB_DISALLOW_DUP_SKEY
return KRB5_KDB_DISALLOW_DUP_SKEY;
#else
goto not_there;
#endif
if (strEQ(name, "KRB5_KDB_DISALLOW_FORWARDABLE"))
#ifdef KRB5_KDB_DISALLOW_FORWARDABLE
return KRB5_KDB_DISALLOW_FORWARDABLE;
#else
goto not_there;
#endif
if (strEQ(name, "KRB5_KDB_DISALLOW_POSTDATED"))
#ifdef KRB5_KDB_DISALLOW_POSTDATED
return KRB5_KDB_DISALLOW_POSTDATED;
#else
goto not_there;
#endif
if (strEQ(name, "KRB5_KDB_DISALLOW_PROXIABLE"))
#ifdef KRB5_KDB_DISALLOW_PROXIABLE
return KRB5_KDB_DISALLOW_PROXIABLE;
#else
goto not_there;
#endif
if (strEQ(name, "KRB5_KDB_DISALLOW_RENEWABLE"))
#ifdef KRB5_KDB_DISALLOW_RENEWABLE
return KRB5_KDB_DISALLOW_RENEWABLE;
#else
goto not_there;
#endif
if (strEQ(name, "KRB5_KDB_DISALLOW_SVR"))
#ifdef KRB5_KDB_DISALLOW_SVR
return KRB5_KDB_DISALLOW_SVR;
#else
goto not_there;
#endif
if (strEQ(name, "KRB5_KDB_DISALLOW_TGT_BASED"))
#ifdef KRB5_KDB_DISALLOW_TGT_BASED
return KRB5_KDB_DISALLOW_TGT_BASED;
#else
goto not_there;
#endif
if (strEQ(name, "KRB5_KDB_NEW_PRINC"))
#ifdef KRB5_KDB_NEW_PRINC
return KRB5_KDB_NEW_PRINC;
#else
goto not_there;
#endif
if (strEQ(name, "KRB5_KDB_REQUIRES_HW_AUTH"))
#ifdef KRB5_KDB_REQUIRES_HW_AUTH
return KRB5_KDB_REQUIRES_HW_AUTH;
#else
goto not_there;
#endif
if (strEQ(name, "KRB5_KDB_REQUIRES_PRE_AUTH"))
#ifdef KRB5_KDB_REQUIRES_PRE_AUTH
return KRB5_KDB_REQUIRES_PRE_AUTH;
#else
goto not_there;
#endif
if (strEQ(name, "KRB5_KDB_REQUIRES_PWCHANGE"))
#ifdef KRB5_KDB_REQUIRES_PWCHANGE
return KRB5_KDB_REQUIRES_PWCHANGE;
#else
goto not_there;
#endif
if (strEQ(name, "KRB5_KDB_SALTTYPE_AFS3"))
#ifdef KRB5_KDB_SALTTYPE_AFS3
return KRB5_KDB_SALTTYPE_AFS3;
#else
goto not_there;
#endif
if (strEQ(name, "KRB5_KDB_SALTTYPE_NOREALM"))
#ifdef KRB5_KDB_SALTTYPE_NOREALM
return KRB5_KDB_SALTTYPE_NOREALM;
#else
goto not_there;
#endif
if (strEQ(name, "KRB5_KDB_SALTTYPE_NORMAL"))
#ifdef KRB5_KDB_SALTTYPE_NORMAL
return KRB5_KDB_SALTTYPE_NORMAL;
#else
goto not_there;
#endif
if (strEQ(name, "KRB5_KDB_SALTTYPE_ONLYREALM"))
#ifdef KRB5_KDB_SALTTYPE_ONLYREALM
return KRB5_KDB_SALTTYPE_ONLYREALM;
#else
goto not_there;
#endif
if (strEQ(name, "KRB5_KDB_SALTTYPE_SPECIAL"))
#ifdef KRB5_KDB_SALTTYPE_SPECIAL
return KRB5_KDB_SALTTYPE_SPECIAL;
#else
goto not_there;
#endif
if (strEQ(name, "KRB5_KDB_SALTTYPE_V4"))
#ifdef KRB5_KDB_SALTTYPE_V4
return KRB5_KDB_SALTTYPE_V4;
#else
goto not_there;
#endif
if (strEQ(name, "KRB5_KDB_SUPPORT_DESMD5"))
#ifdef KRB5_KDB_SUPPORT_DESMD5
return KRB5_KDB_SUPPORT_DESMD5;
#else
goto not_there;
#endif
break;
}
errno = EINVAL;
return 0;
not_there:
errno = ENOENT;
return 0;
}
static kadm5_ret_t err;
/*
* Some Kerberos data objects contain others, so we don't always want
* to free an object when the Perl program is done with it. For
* example, kadm5_principal_ent_rec contains a couple of
* krb5_principals, but we don't necessarily want them freed when the
* SVs referring to them go out of scope because we still have the
* kadm5_principal_ent_rec pointing to them.
*
* Authen::Krb5 solves this by remembering every independently created
* object so that no contained objects are freed. Unfortunately, this
* approach causes all child objects to become invalid once the parent
* is destroyed. So instead, create meta-structures containing, in
* addition to the Kerberos data itself, pointers to SVs to which we
* return references. We account for the parent's dependency on the
* child in the reference count of the SV. When it's time to destroy
* a parent object, we decrease the reference counts, and we don't use
* the Kerberos free functions.
*
* The policy and principal methods keep track of the mask in the
* meta-struct so the user doesn't have to. They assume that if the
* user set the value, it should be changed.
*/
struct kadm5_policy_mit {
kadm5_policy_ent_rec policy;
long mask;
};
struct kadm5_principal_mit {
kadm5_principal_ent_rec kadm5_princ;
SV **key_data;
SV *krb5_princ;
SV *krb5_princ_mod;
long mask;
};
/* for zeroing structs */
static struct kadm5_policy_mit kadm5_policy_mit_init;
static struct kadm5_principal_mit kadm5_principal_mit_init;
static kadm5_config_params kadm5_config_params_init;
static krb5_key_data krb5_key_data_init;
typedef kadm5_config_params *Authen__Krb5__Admin__Config;
typedef krb5_ccache Authen__Krb5__Ccache;
typedef krb5_key_data *Authen__Krb5__Admin__Key;
typedef krb5_keyblock *Authen__Krb5__Keyblock;
typedef krb5_principal Authen__Krb5__Principal;
typedef struct kadm5_policy_mit *Authen__Krb5__Admin__Policy;
typedef struct kadm5_principal_mit *Authen__Krb5__Admin__Principal;
typedef void *Authen__Krb5__Admin;
/*
* The Authen::Krb5::Admin object is just the void * returned by the
* init functions, init_with_{creds,password,skey}, which are this
* package's constructors.
*/
MODULE = Authen::Krb5::Admin PACKAGE = Authen::Krb5::Admin PREFIX = kadm5_
double
constant(name, arg)
char *name
int arg
void
kadm5_chpass_principal(handle, princ, pw)
Authen::Krb5::Admin handle
Authen::Krb5::Principal princ
char *pw
CODE:
err = kadm5_chpass_principal(handle, princ, pw);
if (err)
XSRETURN_UNDEF;
XSRETURN_YES;
void
kadm5_create_policy(handle, policy)
Authen::Krb5::Admin handle
Authen::Krb5::Admin::Policy policy
CODE:
err = kadm5_create_policy(handle, &policy->policy, policy->mask);
if (err)
XSRETURN_UNDEF;
XSRETURN_YES;
void
kadm5_create_principal(handle, princ, pw = "")
Authen::Krb5::Admin handle
Authen::Krb5::Admin::Principal princ
char *pw
CODE:
err = kadm5_create_principal(handle, &princ->kadm5_princ,
princ->mask & ~(KADM5_POLICY_CLR | KADM5_FAIL_AUTH_COUNT), pw);
if (err)
XSRETURN_UNDEF;
XSRETURN_YES;
void
kadm5_delete_policy(handle, name)
Authen::Krb5::Admin handle
char *name
CODE:
err = kadm5_delete_policy(handle, name);
if (err)
XSRETURN_UNDEF;
XSRETURN_YES;
void
kadm5_delete_principal(handle, princ)
Authen::Krb5::Admin handle
Authen::Krb5::Principal princ
CODE:
err = kadm5_delete_principal(handle, princ);
if (err)
XSRETURN_UNDEF;
XSRETURN_YES;
void
kadm5_error(e = 0)
kadm5_ret_t e;
CODE:
if (e)
ST(0) = sv_2mortal(newSVpv((char *)error_message(e), 0));
else {
ST(0) = sv_2mortal(newSVpv((char *)error_message(err), 0));
SvUPGRADE(ST(0), SVt_PVIV);
SvIVX(ST(0)) = err;
SvIOK_on(ST(0));
}
Authen::Krb5::Admin::Policy
kadm5_get_policy(handle, name = "default")
Authen::Krb5::Admin handle
char *name
CODE:
New(0, RETVAL, 1, struct kadm5_policy_mit);
*RETVAL = kadm5_policy_mit_init;
err = kadm5_get_policy(handle, name, &RETVAL->policy);
if (err)
XSRETURN_UNDEF;
OUTPUT:
RETVAL
void
kadm5_get_policies(handle, exp = NULL)
Authen::Krb5::Admin handle
char *exp
PREINIT:
char **pols;
int count;
int i;
PPCODE:
err = kadm5_get_policies(handle, exp, &pols, &count);
if (err)
XSRETURN_EMPTY;
EXTEND(sp, count);
for (i = 0; i < count; i++)
PUSHs(sv_2mortal(newSVpv(pols[i], 0)));
kadm5_free_name_list(handle, pols, count);
XSRETURN(count);
Authen::Krb5::Admin::Principal
kadm5_get_principal(handle, krb5_princ, mask = KADM5_PRINCIPAL_NORMAL_MASK)
Authen::Krb5::Admin handle
Authen::Krb5::Principal krb5_princ
long mask
PREINIT:
char *tmp_policy;
int i;
STRLEN len;
CODE:
New(0, RETVAL, 1, struct kadm5_principal_mit);
*RETVAL = kadm5_principal_mit_init;
err = kadm5_get_principal(handle, krb5_princ, &RETVAL->kadm5_princ, mask);
if (err)
XSRETURN_UNDEF;
if (RETVAL->kadm5_princ.n_key_data) {
New(0, RETVAL->key_data, RETVAL->kadm5_princ.n_key_data, SV *);
for (i = 0; i < RETVAL->kadm5_princ.n_key_data; i++) {
krb5_key_data *p;
New(0, p, 1, krb5_key_data);
Copy(&RETVAL->kadm5_princ.key_data[i], p, 1, krb5_key_data);
RETVAL->key_data[i] = newSViv(PTR2IV(p));
}
}
RETVAL->krb5_princ = newSViv(PTR2IV(RETVAL->kadm5_princ.principal));
RETVAL->krb5_princ_mod =
newSViv(PTR2IV(RETVAL->kadm5_princ.mod_name));
/*
* When kadm5_get_principal() builds a kadm5_principal_ent_rec, it
* malloc()s space for a policy name if the principal is
* associated with one. But when we build a
* kadm5_principal_ent_rec (e.g., with Policy->name()), we use
* New(), not malloc(). In DESTROY(), we don't want to Safefree()
* memory not allocated with New(), so here we copy the policy
* name to memory allocated with New() and free() what we were
* handed by kadm5_get_principal().
*/
if (RETVAL->kadm5_princ.policy) {
len = strlen(RETVAL->kadm5_princ.policy);
New(0, tmp_policy, len + 1, char);
Copy(RETVAL->kadm5_princ.policy, tmp_policy, len + 1, char);
free(RETVAL->kadm5_princ.policy);
RETVAL->kadm5_princ.policy = tmp_policy;
}
OUTPUT:
RETVAL
void
kadm5_get_principals(handle, exp = NULL)
Authen::Krb5::Admin handle
char *exp
PREINIT:
char **princs;
int count;
int i;
PPCODE:
err = kadm5_get_principals(handle, exp, &princs, &count);
if (err)
XSRETURN_EMPTY;
EXTEND(sp, count);
for (i = 0; i < count; i++)
PUSHs(sv_2mortal(newSVpv(princs[i], 0)));
kadm5_free_name_list(handle, princs, count);
XSRETURN(count);
void
kadm5_get_privs(handle)
Authen::Krb5::Admin handle
PREINIT:
long privs;
CODE:
err = kadm5_get_privs(handle, &privs);
ST(0) = err ? &PL_sv_undef : sv_2mortal(newSViv(privs));
Authen::Krb5::Admin
kadm5_init_with_creds(CLASS, client, cc, service = KADM5_ADMIN_SERVICE, config = NULL, struct_version = KADM5_STRUCT_VERSION, api_version = KADM5_API_VERSION_2)
char *CLASS
char *client
Authen::Krb5::Ccache cc
char *service
Authen::Krb5::Admin::Config config
krb5_ui_4 struct_version
krb5_ui_4 api_version
CODE:
#ifdef KRB5_PLUGIN_NO_HANDLE /* hack to test for 1.5 */
err = kadm5_init_with_creds(context(), client, cc, service, config, struct_version,
api_version, NULL, &RETVAL);
#else
err = kadm5_init_with_creds(client, cc, service, config, struct_version,
api_version, &RETVAL);
#endif
if (err)
XSRETURN_UNDEF;
OUTPUT:
RETVAL
Authen::Krb5::Admin
kadm5_init_with_password(CLASS, client, pw = NULL, service = KADM5_ADMIN_SERVICE, config = NULL, struct_version = KADM5_STRUCT_VERSION, api_version = KADM5_API_VERSION_2)
char *CLASS
char *client
char *pw
char *service
Authen::Krb5::Admin::Config config
krb5_ui_4 struct_version
krb5_ui_4 api_version
CODE:
#ifdef KRB5_PLUGIN_NO_HANDLE /* hack to test for 1.5 */
err = kadm5_init_with_password(context(), client, pw, service, config, struct_version,
api_version, NULL, &RETVAL);
#else
err = kadm5_init_with_password(client, pw, service, config, struct_version,
api_version, &RETVAL);
#endif
if (err)
XSRETURN_UNDEF;
OUTPUT:
RETVAL
Authen::Krb5::Admin
kadm5_init_with_skey(CLASS, client, keytab = NULL, service = KADM5_ADMIN_SERVICE, config = NULL, struct_version = KADM5_STRUCT_VERSION, api_version = KADM5_API_VERSION_2)
char *CLASS
char *client
char *keytab
char *service
Authen::Krb5::Admin::Config config
krb5_ui_4 struct_version
krb5_ui_4 api_version
CODE:
#ifdef KRB5_PLUGIN_NO_HANDLE /* hack to test for 1.5 */
err = kadm5_init_with_skey(context(), client, keytab, service, config, struct_version,
api_version, NULL, &RETVAL);
#else
err = kadm5_init_with_skey(client, keytab, service, config, struct_version,
api_version, &RETVAL);
#endif
if (err)
XSRETURN_UNDEF;
OUTPUT:
RETVAL
void
kadm5_modify_policy(handle, policy)
Authen::Krb5::Admin handle
Authen::Krb5::Admin::Policy policy
CODE:
err = kadm5_modify_policy(handle, &policy->policy,
policy->mask & ~KADM5_POLICY);
if (err)
XSRETURN_UNDEF;
XSRETURN_YES;
void
kadm5_modify_principal(handle, princ)
Authen::Krb5::Admin handle
Authen::Krb5::Admin::Principal princ
CODE:
err = kadm5_modify_principal(handle, &princ->kadm5_princ,
princ->mask & ~KADM5_PRINCIPAL);
if (err)
XSRETURN_UNDEF;
XSRETURN_YES;
void
kadm5_randkey_principal(handle, princ)
Authen::Krb5::Admin handle
Authen::Krb5::Principal princ
PREINIT:
krb5_keyblock *keys;
int count, i;
PPCODE:
err = kadm5_randkey_principal(handle, princ, &keys, &count);
if (err)
XSRETURN_EMPTY;
EXTEND(sp, count);
for (i = 0; i < count; i++) {
ST(i) = sv_newmortal();
sv_setref_pv(ST(i), "Authen::Krb5::Keyblock", &keys[i]);
}
XSRETURN(count);
void
kadm5_rename_principal(handle, source, target)
Authen::Krb5::Admin handle
Authen::Krb5::Principal source
Authen::Krb5::Principal target
CODE:
err = kadm5_rename_principal(handle, source, target);
if (err)
XSRETURN_UNDEF;
XSRETURN_YES;
void
DESTROY(handle)
Authen::Krb5::Admin handle
CODE:
err = kadm5_destroy(handle);
if (err)
XSRETURN_UNDEF;
XSRETURN_YES;
#
# kadm5_config_params class
#
MODULE = Authen::Krb5::Admin PACKAGE = Authen::Krb5::Admin::Config
Authen::Krb5::Admin::Config
new(CLASS)
char *CLASS
CODE:
New(0, RETVAL, 1, kadm5_config_params);
*RETVAL = kadm5_config_params_init;
OUTPUT:
RETVAL
char *
admin_server(config, ...)
Authen::Krb5::Admin::Config config
PROTOTYPE: $;$
PREINIT:
STRLEN len;
CODE:
if (items > 1) {
char *admin_server;
admin_server = SvPV(ST(1), len);
if (config->admin_server) {
Safefree(config->admin_server);
config->admin_server = NULL;
}
New(0, config->admin_server, len + 1, char);
Copy(admin_server, config->admin_server, len + 1, char);
config->mask |= KADM5_CONFIG_ADMIN_SERVER;
}
ST(0) = config->admin_server
? sv_2mortal(newSVpv(config->admin_server, 0))
: &PL_sv_undef;
long
kadmind_port(config, ...)
Authen::Krb5::Admin::Config config
PROTOTYPE: $;$
CODE:
if (items > 1) {
config->kadmind_port = SvIV(ST(1));
config->mask |= KADM5_CONFIG_KADMIND_PORT;
}
RETVAL = config->kadmind_port;
OUTPUT:
RETVAL
long
kpasswd_port(config, ...)
Authen::Krb5::Admin::Config config
PROTOTYPE: $;$
CODE:
if (items > 1) {
config->kpasswd_port = SvIV(ST(1));
config->mask |= KADM5_CONFIG_KPASSWD_PORT;
}
RETVAL = config->kpasswd_port;
OUTPUT:
RETVAL
long
mask(config, ...)
Authen::Krb5::Admin::Config config
PROTOTYPE: $;$
CODE:
if (items > 1)
config->mask = SvIV(ST(1));
RETVAL = config->mask;
OUTPUT:
RETVAL
#ifdef KADM5_CONFIG_PROFILE
char *
profile(config, ...)
Authen::Krb5::Admin::Config config
PROTOTYPE: $;$
PREINIT:
STRLEN len;
CODE:
if (items > 1) {
char *profile;
profile = SvPV(ST(1), len);
if (config->profile) {
Safefree(config->profile);
config->profile = NULL;
}
New(0, config->profile, len + 1, char);
Copy(profile, config->profile, len + 1, char);
config->mask |= KADM5_CONFIG_PROFILE;
}
ST(0) = config->profile
? sv_2mortal(newSVpv(config->profile, 0))
: &PL_sv_undef;
#endif
char *
realm(config, ...)
Authen::Krb5::Admin::Config config
PROTOTYPE: $;$
PREINIT:
STRLEN len;
CODE:
if (items > 1) {
char *realm;
realm = SvPV(ST(1), len);
if (config->realm) {
Safefree(config->realm);
config->realm = NULL;
}
New(0, config->realm, len + 1, char);
Copy(realm, config->realm, len + 1, char);
config->mask |= KADM5_CONFIG_REALM;
}
ST(0) = config->realm
? sv_2mortal(newSVpv(config->realm, 0))
: &PL_sv_undef;
void
DESTROY(config)
Authen::Krb5::Admin::Config config
CODE:
if (config) {
#ifdef KADM5_CONFIG_PROFILE
if (config->profile)
Safefree(config->profile);
#endif
if (config->dbname)
Safefree(config->dbname);
if (config->mkey_name)
Safefree(config->mkey_name);
if (config->stash_file)
Safefree(config->stash_file);
if (config->keysalts)
Safefree(config->keysalts);
if (config->admin_server)
Safefree(config->admin_server);
if (config->admin_keytab)
Safefree(config->admin_keytab);
if (config->dict_file)
Safefree(config->dict_file);
if (config->acl_file)
Safefree(config->acl_file);
if (config->realm)
Safefree(config->realm);
}
Safefree(config);
#
# krb5_key_data class--for key data returned by get_principal
#
MODULE = Authen::Krb5::Admin PACKAGE = Authen::Krb5::Admin::Key
Authen::Krb5::Admin::Key
new(CLASS)
char *CLASS
CODE:
New(0, RETVAL, 1, krb5_key_data);
*RETVAL = krb5_key_data_init;
OUTPUT:
RETVAL
krb5_octet *
_contents(key, ...)
Authen::Krb5::Admin::Key key
ALIAS:
key_contents = 0
salt_contents = 1
PROTOTYPE: $;$
CODE:
if (key->key_data_ver > ix) {
if (items > 1) {
if (key->key_data_contents[ix]) {
memset(key->key_data_contents[ix], 0,
key->key_data_length[ix]);
Safefree(key->key_data_contents[ix]);
}
New(0, key->key_data_contents[ix], key->key_data_length[ix],
krb5_octet);
Copy(INT2PTR(void *, SvIV(ST(1))), key->key_data_contents[ix],
key->key_data_length[ix], krb5_octet);
}
ST(0) = key->key_data_contents[ix]
? sv_2mortal(newSVpv(key->key_data_contents[ix],
key->key_data_length[ix]))
: &PL_sv_undef;
} else
ST(0) = &PL_sv_undef;
krb5_int16
_type(key, ...)
Authen::Krb5::Admin::Key key
ALIAS:
enc_type = 0
key_type = 0
salt_type = 1
PROTOTYPE: $;$
CODE:
if (key->key_data_ver > ix) {
if (items > 1)
key->key_data_type[ix] = SvIV(ST(1));
RETVAL = key->key_data_type[ix];
} else {
RETVAL = -1;
}
OUTPUT:
RETVAL
krb5_int16
kvno(key, ...)
Authen::Krb5::Admin::Key key
PROTOTYPE: $;$
CODE:
if (items > 1)
key->key_data_kvno = SvIV(ST(1));
RETVAL = key->key_data_kvno;
OUTPUT:
RETVAL
krb5_int16
ver(key, ...)
Authen::Krb5::Admin::Key key
PROTOTYPE: $;$
CODE:
if (items > 1)
key->key_data_ver = SvIV(ST(1));
RETVAL = key->key_data_ver;
OUTPUT:
RETVAL
void
DESTROY(key)
Authen::Krb5::Admin::Key key
PREINIT:
int i, n;
CODE:
n = key->key_data_ver == 1 ? 1 : 2;
for (i = 0; i < n; i++)
if (key->key_data_contents[i]) {
memset(key->key_data_contents[i], 0, key->key_data_length[i]);
Safefree(key->key_data_contents[i]);
}
Safefree(key);
#
# kadm5_policy_ent_rec class--uses kadm5_policy_mit meta-struct
#
MODULE = Authen::Krb5::Admin PACKAGE = Authen::Krb5::Admin::Policy
Authen::Krb5::Admin::Policy
new(CLASS)
char *CLASS
CODE:
New(0, RETVAL, 1, struct kadm5_policy_mit);
*RETVAL = kadm5_policy_mit_init;
OUTPUT:
RETVAL
long
mask(policy, ...)
Authen::Krb5::Admin::Policy policy
PROTOTYPE: $;$
CODE:
if (items > 1)
policy->mask = SvIV(ST(1));
RETVAL = policy->mask;
OUTPUT:
RETVAL
void
name(policy, ...)
Authen::Krb5::Admin::Policy policy
PROTOTYPE: $;$
PREINIT:
STRLEN len;
CODE:
if (items > 1) {
char *source;
source = SvPV(ST(1), len);
if (policy->policy.policy) {
Safefree(policy->policy.policy);
policy->policy.policy = NULL;
}
New(0, policy->policy.policy, len + 1, char);
Copy(source, policy->policy.policy, len + 1, char);
policy->mask |= KADM5_POLICY;
}
ST(0) = policy->policy.policy
? sv_2mortal(newSVpv(policy->policy.policy, 0))
: &PL_sv_undef;
long
pw_history_num(policy, ...)
Authen::Krb5::Admin::Policy policy
PROTOTYPE: $;$
CODE:
if (items > 1) {
policy->policy.pw_history_num = SvIV(ST(1));
policy->mask |= KADM5_PW_HISTORY_NUM;
}
RETVAL = policy->policy.pw_history_num;
OUTPUT:
RETVAL
long
pw_max_life(policy, ...)
Authen::Krb5::Admin::Policy policy
PROTOTYPE: $;$
CODE:
if (items > 1) {
policy->policy.pw_max_life = SvIV(ST(1));
policy->mask |= KADM5_PW_MAX_LIFE;
}
RETVAL = policy->policy.pw_max_life;
OUTPUT:
RETVAL
long
pw_min_classes(policy, ...)
Authen::Krb5::Admin::Policy policy
PROTOTYPE: $;$
CODE:
if (items > 1) {
policy->policy.pw_min_classes = SvIV(ST(1));
policy->mask |= KADM5_PW_MIN_CLASSES;
}
RETVAL = policy->policy.pw_min_classes;
OUTPUT:
RETVAL
long
pw_min_length(policy, ...)
Authen::Krb5::Admin::Policy policy
PROTOTYPE: $;$
CODE:
if (items > 1) {
policy->policy.pw_min_length = SvIV(ST(1));
policy->mask |= KADM5_PW_MIN_LENGTH;
}
RETVAL = policy->policy.pw_min_length;
OUTPUT:
RETVAL
long
pw_min_life(policy, ...)
Authen::Krb5::Admin::Policy policy
PROTOTYPE: $;$
CODE:
if (items > 1) {
policy->policy.pw_min_life = SvIV(ST(1));
policy->mask |= KADM5_PW_MIN_LIFE;
}
RETVAL = policy->policy.pw_min_life;
OUTPUT:
RETVAL
long
policy_refcnt(policy, ...)
Authen::Krb5::Admin::Policy policy
PROTOTYPE: $;$
CODE:
if (items > 1)
policy->policy.policy_refcnt = SvIV(ST(1));
RETVAL = policy->policy.policy_refcnt;
OUTPUT:
RETVAL
void
DESTROY(policy)
Authen::Krb5::Admin::Policy policy
CODE:
if (policy->policy.policy) {
Safefree(policy->policy.policy);
policy->policy.policy = NULL;
}
Safefree(policy);
#
# kadm5_principal_ent_rec class--uses kadm5_principal_mit meta-struct
#
MODULE = Authen::Krb5::Admin PACKAGE = Authen::Krb5::Admin::Principal
Authen::Krb5::Admin::Principal
new(CLASS)
char *CLASS
CODE:
New(0, RETVAL, 1, struct kadm5_principal_mit);
*RETVAL = kadm5_principal_mit_init;
if (!RETVAL)
XSRETURN_UNDEF;
OUTPUT:
RETVAL
krb5_flags
attributes(princ, ...)
Authen::Krb5::Admin::Principal princ
PROTOTYPE: $;$
CODE:
if (items > 1) {
princ->kadm5_princ.attributes = SvIV(ST(1));
princ->mask |= KADM5_ATTRIBUTES;
}
RETVAL = princ->kadm5_princ.attributes;
OUTPUT:
RETVAL
long
aux_attributes(princ, ...)
Authen::Krb5::Admin::Principal princ
PROTOTYPE: $;$
CODE:
if (items > 1)
princ->kadm5_princ.aux_attributes = SvIV(ST(1));
RETVAL = princ->kadm5_princ.aux_attributes;
OUTPUT:
RETVAL
krb5_kvno
fail_auth_count(princ, ...)
Authen::Krb5::Admin::Principal princ
PROTOTYPE: $;$
CODE:
if (items > 1) {
princ->kadm5_princ.fail_auth_count = SvIV(ST(1));
princ->mask |= KADM5_FAIL_AUTH_COUNT;
}
RETVAL = princ->kadm5_princ.fail_auth_count;
OUTPUT:
RETVAL
void
key_data(princ, ...)
Authen::Krb5::Admin::Principal princ
PROTOTYPE: $;$
PREINIT:
SV **p;
int n;
PPCODE:
n = princ->kadm5_princ.n_key_data;
if (items > 1) {
for (p = princ->key_data; n--; p++)
SvREFCNT_dec(*p);
Renew(princ->key_data, items - 1, SV *);
Renew(princ->kadm5_princ.key_data, items - 1, krb5_key_data);
for (n = 0; n < items - 1; n++) {
krb5_key_data *p;
New(0, p, 1, krb5_key_data);
Copy(INT2PTR(void *, SvIV(SvRV(ST(n + 1)))), p, 1, krb5_key_data);
princ->key_data[n] = newSViv(PTR2IV(p));
Copy(p, &princ->kadm5_princ.key_data[n], 1, krb5_key_data);
}
princ->kadm5_princ.n_key_data = items - 1;
princ->mask |= KADM5_KEY_DATA;
}
n = princ->kadm5_princ.n_key_data;
if (n > 0) {
EXTEND(sp, n);
for (p = princ->key_data; n--; p++)
PUSHs(sv_2mortal(sv_bless(newRV_inc(*p),
gv_stashpv("Authen::Krb5::Admin::Key", 0))));
}
krb5_kvno
kvno(princ, ...)
Authen::Krb5::Admin::Principal princ
PROTOTYPE: $;$
CODE:
if (items > 1) {
princ->kadm5_princ.kvno = SvUV(ST(1));
princ->mask |= KADM5_KVNO;
}
RETVAL = princ->kadm5_princ.kvno;
OUTPUT:
RETVAL
krb5_timestamp
last_failed(princ, ...)
Authen::Krb5::Admin::Principal princ
PROTOTYPE: $;$
CODE:
if (items > 1)
princ->kadm5_princ.last_failed = SvIV(ST(1));
RETVAL = princ->kadm5_princ.last_failed;
OUTPUT:
RETVAL
krb5_timestamp
last_pwd_change(princ, ...)
Authen::Krb5::Admin::Principal princ
PROTOTYPE: $;$
CODE:
if (items > 1)
princ->kadm5_princ.last_pwd_change = SvIV(ST(1));
RETVAL = princ->kadm5_princ.last_pwd_change;
OUTPUT:
RETVAL
krb5_timestamp
last_success(princ, ...)
Authen::Krb5::Admin::Principal princ
PROTOTYPE: $;$
CODE:
if (items > 1)
princ->kadm5_princ.last_success = SvIV(ST(1));
RETVAL = princ->kadm5_princ.last_success;
OUTPUT:
RETVAL
long
mask(princ, ...)
Authen::Krb5::Admin::Principal princ
PROTOTYPE: $;$
CODE:
if (items > 1)
princ->mask = SvIV(ST(1));
RETVAL = princ->mask;
OUTPUT:
RETVAL
krb5_deltat
max_life(princ, ...)
Authen::Krb5::Admin::Principal princ
PROTOTYPE: $;$
CODE:
if (items > 1) {
princ->kadm5_princ.max_life = SvIV(ST(1));
princ->mask |= KADM5_MAX_LIFE;
}
RETVAL = princ->kadm5_princ.max_life;
OUTPUT:
RETVAL
krb5_deltat
max_renewable_life(princ, ...)
Authen::Krb5::Admin::Principal princ
PROTOTYPE: $;$
CODE:
if (items > 1) {
princ->kadm5_princ.max_renewable_life = SvIV(ST(1));
princ->mask |= KADM5_MAX_RLIFE;
}
RETVAL = princ->kadm5_princ.max_renewable_life;
OUTPUT:
RETVAL
krb5_kvno
mkvno(princ, ...)
Authen::Krb5::Admin::Principal princ
PROTOTYPE: $;$
CODE:
if (items > 1)
princ->kadm5_princ.mkvno = SvUV(ST(1));
RETVAL = princ->kadm5_princ.mkvno;
OUTPUT:
RETVAL
krb5_timestamp
mod_date(princ, ...)
Authen::Krb5::Admin::Principal princ
PROTOTYPE: $;$
CODE:
if (items > 1)
princ->kadm5_princ.mod_date = SvIV(ST(1));
RETVAL = princ->kadm5_princ.mod_date;
OUTPUT:
RETVAL
void
mod_name(princ, ...)
Authen::Krb5::Admin::Principal princ
PROTOTYPE: $;$
CODE:
if (items > 1) {
if (princ->krb5_princ_mod && SvIOK(princ->krb5_princ_mod))
SvREFCNT_dec(princ->krb5_princ_mod);
princ->krb5_princ_mod = SvRV(ST(1));
princ->kadm5_princ.principal =
INT2PTR(krb5_principal, SvIV(princ->krb5_princ_mod));
SvREFCNT_inc(princ->krb5_princ_mod);
}
ST(0) = sv_2mortal(sv_bless(newRV_inc(princ->krb5_princ_mod),
gv_stashpv("Authen::Krb5::Principal", 0)));
char *
policy(princ, ...)
Authen::Krb5::Admin::Principal princ
PROTOTYPE: $;$
PREINIT:
STRLEN len;
CODE:
if (items > 1) {
char *policy;
policy = SvPV(ST(1), len);
if (princ->kadm5_princ.policy) {
Safefree(princ->kadm5_princ.policy);
princ->kadm5_princ.policy = NULL;
}
New(0, princ->kadm5_princ.policy, len + 1, char);
Copy(policy, princ->kadm5_princ.policy, len + 1, char);
princ->mask |= KADM5_POLICY;
princ->mask &= ~KADM5_POLICY_CLR;
}
ST(0) = princ->kadm5_princ.policy
? sv_2mortal(newSVpv(princ->kadm5_princ.policy, 0))
: &PL_sv_undef;
void
policy_clear(princ)
Authen::Krb5::Admin::Principal princ
CODE:
if (princ->kadm5_princ.policy) {
Safefree(princ->kadm5_princ.policy);
princ->kadm5_princ.policy = NULL;
}
princ->mask &= ~KADM5_POLICY;
princ->mask |= KADM5_POLICY_CLR;
krb5_timestamp
princ_expire_time(princ, ...)
Authen::Krb5::Admin::Principal princ
PROTOTYPE: $;$
CODE:
if (items > 1) {
princ->kadm5_princ.princ_expire_time = SvIV(ST(1));
princ->mask |= KADM5_PRINC_EXPIRE_TIME;
}
RETVAL = princ->kadm5_princ.princ_expire_time;
OUTPUT:
RETVAL
void
principal(princ, ...)
Authen::Krb5::Admin::Principal princ
PROTOTYPE: $;$
CODE:
if (items > 1) {
if (princ->krb5_princ && SvIOK(princ->krb5_princ))
SvREFCNT_dec(princ->krb5_princ);
princ->krb5_princ = SvRV(ST(1));
princ->kadm5_princ.principal =
INT2PTR(krb5_principal, SvIV(princ->krb5_princ));
SvREFCNT_inc(princ->krb5_princ);
princ->mask |= KADM5_PRINCIPAL;
}
ST(0) = sv_2mortal(sv_bless(newRV_inc(princ->krb5_princ),
gv_stashpv("Authen::Krb5::Principal", 0)));
krb5_timestamp
pw_expiration(princ, ...)
Authen::Krb5::Admin::Principal princ
PROTOTYPE: $;$
CODE:
if (items > 1) {
princ->kadm5_princ.pw_expiration = SvIV(ST(1));
princ->mask |= KADM5_PW_EXPIRATION;
}
RETVAL = princ->kadm5_princ.pw_expiration;
OUTPUT:
RETVAL
void
DESTROY(princ)
Authen::Krb5::Admin::Principal princ
PREINIT:
SV **p;
krb5_key_data *key;
CODE:
if (princ->key_data) {
for (p = princ->key_data; princ->kadm5_princ.n_key_data--; p++)
SvREFCNT_dec(*p);
Safefree(princ->key_data);
}
if (princ->krb5_princ && SvIOK(princ->krb5_princ))
SvREFCNT_dec(princ->krb5_princ);
if (princ->krb5_princ_mod && SvROK(princ->krb5_princ_mod))
SvREFCNT_dec(princ->krb5_princ_mod);
if (princ->kadm5_princ.policy) {
Safefree(princ->kadm5_princ.policy);
princ->kadm5_princ.policy = NULL;
}
if (princ->kadm5_princ.tl_data) {
krb5_tl_data *tl;
while (princ->kadm5_princ.tl_data) {
tl = princ->kadm5_princ.tl_data->tl_data_next;
free(princ->kadm5_princ.tl_data->tl_data_contents);
free(princ->kadm5_princ.tl_data);
princ->kadm5_princ.tl_data = tl;
}
}
Safefree(princ);
|