提交 e3b1ad34 编写于 作者: W weijun

7111579: klist starttime, renewtill, ticket etype

Reviewed-by: mullan
上级 26dc4a05
...@@ -223,6 +223,10 @@ public class Credentials { ...@@ -223,6 +223,10 @@ public class Credentials {
cname, sname, key, flags, authtime, starttime, endtime, renewTill, caddr); cname, sname, key, flags, authtime, starttime, endtime, renewTill, caddr);
} }
public KerberosTime getStartTime() {
return starttime;
}
public KerberosTime getAuthTime() { public KerberosTime getAuthTime() {
return authtime; return authtime;
} }
...@@ -231,6 +235,10 @@ public class Credentials { ...@@ -231,6 +235,10 @@ public class Credentials {
return endtime; return endtime;
} }
public KerberosTime getRenewTill() {
return renewTill;
}
public TicketFlags getTicketFlags() { public TicketFlags getTicketFlags() {
return flags; return flags;
} }
...@@ -238,4 +246,8 @@ public class Credentials { ...@@ -238,4 +246,8 @@ public class Credentials {
public int getEType() { public int getEType() {
return key.getEType(); return key.getEType();
} }
public int getTktEType() {
return ticket.encPart.getEType();
}
} }
...@@ -207,7 +207,7 @@ public class Klist { ...@@ -207,7 +207,7 @@ public class Klist {
} }
if (options[2] == 't') { if (options[2] == 't') {
System.out.println("\t Time stamp: " + System.out.println("\t Time stamp: " +
reformat(entries[i].getTimeStamp().toDate().toString())); format(entries[i].getTimeStamp()));
} }
} }
} }
...@@ -234,30 +234,39 @@ public class Klist { ...@@ -234,30 +234,39 @@ public class Klist {
System.out.println("\nDefault principal: " + System.out.println("\nDefault principal: " +
defaultPrincipal + ", " + defaultPrincipal + ", " +
creds.length + " entries found.\n"); creds.length + " entries found.\n");
String starttime = null;
String endtime = null;
String servicePrincipal = null;
String etype = null;
if (creds != null) { if (creds != null) {
for (int i = 0; i < creds.length; i++) { for (int i = 0; i < creds.length; i++) {
try { try {
starttime = String starttime;
reformat(creds[i].getAuthTime().toDate().toString()); String endtime;
endtime = String renewTill;
reformat(creds[i].getEndTime().toDate().toString()); String servicePrincipal;
if (creds[i].getStartTime() != null) {
starttime = format(creds[i].getStartTime());
} else {
starttime = format(creds[i].getAuthTime());
}
endtime = format(creds[i].getEndTime());
servicePrincipal = servicePrincipal =
creds[i].getServicePrincipal().toString(); creds[i].getServicePrincipal().toString();
System.out.println("[" + (i + 1) + "] " + System.out.println("[" + (i + 1) + "] " +
" Service Principal: " + " Service Principal: " +
servicePrincipal); servicePrincipal);
System.out.println(" Valid starting: " + starttime); System.out.println(" Valid starting: " + starttime);
System.out.println(" Expires: " + endtime); System.out.println(" Expires: " + endtime);
if (creds[i].getRenewTill() != null) {
renewTill = format(creds[i].getRenewTill());
System.out.println(
" Renew until: " + renewTill);
}
if (options[0] == 'e') { if (options[0] == 'e') {
etype = EType.toString(creds[i].getEType()); String eskey = EType.toString(creds[i].getEType());
System.out.println(" Encryption type: " + etype); String etkt = EType.toString(creds[i].getTktEType());
System.out.println(" EType (skey, tkt): "
+ eskey + ", " + etkt);
} }
if (options[1] == 'f') { if (options[1] == 'f') {
System.out.println(" Flags: " + System.out.println(" Flags: " +
creds[i].getTicketFlags().toString()); creds[i].getTicketFlags().toString());
} }
if (options[2] == 'a') { if (options[2] == 'a') {
...@@ -312,13 +321,14 @@ public class Klist { ...@@ -312,13 +321,14 @@ public class Klist {
* and yyyy is the year. * and yyyy is the year.
* @param date the string form of Date object. * @param date the string form of Date object.
*/ */
String reformat(String date) { private String format(KerberosTime kt) {
String date = kt.toDate().toString();
return (date.substring(4, 7) + " " + date.substring(8, 10) + return (date.substring(4, 7) + " " + date.substring(8, 10) +
", " + date.substring(24) ", " + date.substring(24)
+ " " + date.substring(11, 16)); + " " + date.substring(11, 19));
} }
/** /**
* Printes out the help information. * Prints out the help information.
*/ */
void printHelp() { void printHelp() {
System.out.println("\nUsage: klist " + System.out.println("\nUsage: klist " +
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册