/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* (C) Copyright IBM Corp. 1999 All Rights Reserved.
* Copyright 1997 The Open Group Research Institute. All rights reserved.
*/
/**
* Maintains user-specific options or default settings when the user requests
* a KDC ticket using Kinit.
*
* @author Yanni Zhang
* @author Ram Marti
*/
class KinitOptions {
public boolean validate = false;
// forwardable and proxiable flags have two states:
// -1 - flag set to be not forwardable or proxiable;
// 1 - flag set to be forwardable or proxiable.
public boolean renew = false;
public boolean keytab;
// no args were specified in the command line;
// use default values
throw new RuntimeException("default cache name error");
}
}
realm = r;
}
return principal.getRealmString();
}
}
return null;
}
// currently we provide support for -f -p -c principal options
forwardable = 1;
proxiable = 1;
throw new IllegalArgumentException("input format " +
" not correct: " +
" -c option " +
"must be followed " +
"by the cache name");
}
};
includeAddresses = false;
useKeytab = true;
throw new IllegalArgumentException
} else {
throw new IllegalArgumentException
("-t option requires keytab file name");
}
useKeytab = true;
printHelp();
} else if (p == null) { // Haven't yet processed a "principal"
p = args[i];
try {
principal = new PrincipalName(p);
} catch (Exception e) {
throw new IllegalArgumentException("invalid " +
"Principal name: " + p +
e.getMessage());
}
"libdefaults");
} else throw new IllegalArgumentException("invalid " +
"Realm name");
}
// Have already processed a Principal, this must be a password
} else {
throw new IllegalArgumentException("too many parameters");
}
}
// we should get cache name before getting the default principal name
throw new RuntimeException("default cache name error");
}
}
}
}
try {
} catch (KrbException e) {
e.getMessage());
e.printStackTrace();
return null;
}
// get default principal name from the cachename if it is
// available.
try {
int version;
} else {
}
}
}
if (DEBUG) {
"the cache is :" + p);
}
return p;
} catch (IOException e) {
// ignore any exceptions; we will use the user name as the
// principal name
if (DEBUG) {
e.printStackTrace();
}
} catch (RealmException e) {
if (DEBUG) {
e.printStackTrace();
}
}
if (DEBUG) {
+ username);
}
try {
return p;
} catch (RealmException e) {
// ignore exception , return null
if (DEBUG) {
"name " + e.getMessage());
e.printStackTrace();
}
}
}
return null;
}
void printHelp() {
"[-A] [-f] [-p] [-c cachename] " +
"[[-k [-t keytab_file_name]] [principal] " +
"[password]");
"Kerberos 5 ticket request:");
"(i.e., FILE:\\d:\\myProfiles\\mykrb5cache)");
"(i.e., qweadf@ATHENA.MIT.EDU qweadf)");
"the principal's Kerberos password");
}
public boolean getAddressOption() {
return includeAddresses;
}
public boolean useKeytabFile() {
return useKeytab;
}
return ktabName;
}
return principal;
}
}