1 /*
2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
120 } else if (args[i].equals("-k")) {
121 useKeytab = true;
122 } else if (args[i].equals("-t")) {
123 if (ktabName != null) {
124 throw new IllegalArgumentException
125 ("-t option/keytab file name repeated");
126 } else if (i + 1 < args.length) {
127 ktabName = args[++i];
128 } else {
129 throw new IllegalArgumentException
130 ("-t option requires keytab file name");
131 }
132
133 useKeytab = true;
134 } else if (args[i].equals("-R")) {
135 action = 2;
136 } else if (args[i].equals("-l")) {
137 lifetime = getTime(Config.duration(args[++i]));
138 } else if (args[i].equals("-r")) {
139 renewable_lifetime = getTime(Config.duration(args[++i]));
140 } else if (args[i].equalsIgnoreCase("-help")) {
141 printHelp();
142 System.exit(0);
143 } else if (p == null) { // Haven't yet processed a "principal"
144 p = args[i];
145 try {
146 principal = new PrincipalName(p);
147 } catch (Exception e) {
148 throw new IllegalArgumentException("invalid " +
149 "Principal name: " + p +
150 e.getMessage());
151 }
152 } else if (this.password == null) {
153 // Have already processed a Principal, this must be a password
154 password = args[i].toCharArray();
155 } else {
156 throw new IllegalArgumentException("too many parameters");
157 }
158 }
159 // we should get cache name before getting the default principal name
160 if (cachename == null) {
|
1 /*
2 * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
120 } else if (args[i].equals("-k")) {
121 useKeytab = true;
122 } else if (args[i].equals("-t")) {
123 if (ktabName != null) {
124 throw new IllegalArgumentException
125 ("-t option/keytab file name repeated");
126 } else if (i + 1 < args.length) {
127 ktabName = args[++i];
128 } else {
129 throw new IllegalArgumentException
130 ("-t option requires keytab file name");
131 }
132
133 useKeytab = true;
134 } else if (args[i].equals("-R")) {
135 action = 2;
136 } else if (args[i].equals("-l")) {
137 lifetime = getTime(Config.duration(args[++i]));
138 } else if (args[i].equals("-r")) {
139 renewable_lifetime = getTime(Config.duration(args[++i]));
140 } else if (args[i].equalsIgnoreCase("-?") ||
141 args[i].equalsIgnoreCase("-h") ||
142 args[i].equalsIgnoreCase("--help") ||
143 // -help: legacy.
144 args[i].equalsIgnoreCase("-help")) {
145 printHelp();
146 System.exit(0);
147 } else if (p == null) { // Haven't yet processed a "principal"
148 p = args[i];
149 try {
150 principal = new PrincipalName(p);
151 } catch (Exception e) {
152 throw new IllegalArgumentException("invalid " +
153 "Principal name: " + p +
154 e.getMessage());
155 }
156 } else if (this.password == null) {
157 // Have already processed a Principal, this must be a password
158 password = args[i].toCharArray();
159 } else {
160 throw new IllegalArgumentException("too many parameters");
161 }
162 }
163 // we should get cache name before getting the default principal name
164 if (cachename == null) {
|