1679{
1680
1681
1682
1683
1684
1685 EPNAME(
"ProtocolpwdInit");
1686
1688 char *rc = (char *)"";
1689 char *cenv = 0;
1690
1691
1693
1694
1695
1696 if (mode == 'c') {
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1716
1717 cenv = getenv("XrdSecDEBUG");
1718 if (cenv)
1719 {
if (cenv[0] >= 49 && cenv[0] <= 51)
opts.debug = atoi(cenv);
1720 else {
PRINT(
"unsupported debug value from env XrdSecDEBUG: "<<cenv<<
" - setting to 1");
1722 }
1723 }
1724
1725
1726 cenv = getenv("XrdSecPWDVERIFYSRV");
1727 if (cenv)
1728 if (cenv[0] >= 48 && cenv[0] <= 49)
opts.verisrv = atoi(cenv);
1729
1730 cenv = getenv("XrdSecPWDSRVPUK");
1731 if (cenv)
1732 opts.srvpuk = strdup(cenv);
1733
1734 cenv = getenv("XrdSecPWDAUTOLOG");
1735 if (cenv)
1736 if (cenv[0] >= 48 && cenv[0] <= 50)
opts.alog = atoi(cenv);
1737
1738 cenv = getenv("XrdSecPWDALOGFILE");
1739 if (cenv)
1740 opts.alogfile = strdup(cenv);
1741
1742 cenv = getenv("XrdSecPWDMAXPROMPT");
1743 if (cenv) {
1744 opts.maxprompts = strtol(cenv, (
char **)0, 10);
1745 if (errno == ERANGE)
opts.maxprompts = -1;
1746 }
1747
1748
1750
1751
1752 if (!rc)
opts.debug = 1;
1754
1755
1756 if (
opts.srvpuk) free(
opts.srvpuk);
1757 if (
opts.alogfile) free(
opts.alogfile);
1758
1759
1760 return rc;
1761 }
1762
1763
1764 cenv = getenv("XRDDEBUG");
1765 if (cenv && !strcmp(cenv,
"1"))
opts.debug = 1;
1766
1767
1768
1769 if (parms) {
1770
1771
1772 char parmbuff[1024];
1773 strlcpy(parmbuff, parms,
sizeof(parmbuff));
1774
1775
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 int debug = -1;
1806 int areg = -1;
1807 int vc = -1;
1808 int upw = -1;
1809 int syspwd = -1;
1810 int lifetime = -1;
1811 int maxfail = -1;
1816 int keepcreds = -1;
1818 int expfmt = 0;
1819 char *op = 0;
1820 while (inParms.GetLine()) {
1821 while ((op = inParms.GetToken())) {
1822 if (!strncmp(op, "-upwd:",6)) {
1823 upw = atoi(op+6);
1824 } else if (!strncmp(op, "-dir:",5)) {
1825 dir = (const char *)(op+5);
1826 } else if (!strncmp(op, "-udir:",6)) {
1827 udir = (const char *)(op+6);
1828 } else if (!strncmp(op, "-c:",3)) {
1829 clist = (const char *)(op+3);
1830 } else if (!strncmp(op, "-d:",3)) {
1831 debug = atoi(op+3);
1832 } else if (!strncmp(op, "-a:",3)) {
1833 areg = atoi(op+3);
1834 } else if (!strncmp(op, "-vc:",4)) {
1835 vc = atoi(op+4);
1836 } else if (!strncmp(op, "-syspwd",7)) {
1837 syspwd = 1;
1838 } else if (!strncmp(op, "-lf:",4)) {
1840 } else if (!strncmp(op, "-maxfail:",9)) {
1841 maxfail = atoi(op+9);
1842 } else if (!strncmp(op, "-cryptfile:",11)) {
1843 cpass = (const char *)(op+11);
1844 } else if (!strncmp(op, "-keepcreds",10)) {
1845 keepcreds = 1;
1846 } else if (!strncmp(op, "-expcreds:",10)) {
1847 expcreds = (const char *)(op+10);
1848 } else if (!strncmp(op, "-expfmt:",8)) {
1849 expfmt = atoi(op+8);
1850 }
1851 }
1852
1853 areg = (areg >= 0 && areg <= 2) ? areg : 0;
1854 vc = (vc >= 0 && vc <= 2) ? vc : 2;
1855 }
1856
1857
1858
1859 opts.debug = (debug > -1) ? debug :
opts.debug;
1864 opts.syspwd = syspwd;
1865 opts.lifecreds = lifetime;
1866 opts.maxfailures = maxfail;
1867 opts.expfmt = expfmt;
1876 opts.keepcreds = keepcreds;
1877 if (expcreds.
length() > 0)
1878 opts.expcreds = (
char *)expcreds.
c_str();
1879
1880
1882
1883
1885 }
1886
1887
1889
1890
1892}}
int XrdSutParseTime(const char *tstr, int opt)
const char * c_str() const
static char * Init(pwdOptions o, XrdOucErrInfo *erp)
static XrdOucTrace * EnableTracing()