klist.c (178826) | klist.c (233294) |
---|---|
1/* | 1/* |
2 * Copyright (c) 1995 - 2005 Kungliga Tekniska H�gskolan | 2 * Copyright (c) 1995 - 2005 Kungliga Tekniska H��gskolan |
3 * (Royal Institute of Technology, Stockholm, Sweden). 4 * All rights reserved. | 3 * (Royal Institute of Technology, Stockholm, Sweden). 4 * All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: | 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. | 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. |
12 * | 12 * |
13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. | 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. |
16 * | 16 * |
17 * 3. Neither the name of the Institute nor the names of its contributors 18 * may be used to endorse or promote products derived from this software 19 * without specific prior written permission. | 17 * 3. Neither the name of the Institute nor the names of its contributors 18 * may be used to endorse or promote products derived from this software 19 * without specific prior written permission. |
20 * | 20 * |
21 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT --- 14 unchanged lines hidden (view full) --- 43 krb5_timestamp sec; 44 45 krb5_timeofday (context, &sec); 46 47 if(cred->times.starttime) 48 krb5_format_time(context, cred->times.starttime, t1, sizeof(t1), 1); 49 else 50 krb5_format_time(context, cred->times.authtime, t1, sizeof(t1), 1); | 21 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT --- 14 unchanged lines hidden (view full) --- 43 krb5_timestamp sec; 44 45 krb5_timeofday (context, &sec); 46 47 if(cred->times.starttime) 48 krb5_format_time(context, cred->times.starttime, t1, sizeof(t1), 1); 49 else 50 krb5_format_time(context, cred->times.authtime, t1, sizeof(t1), 1); |
51 | 51 |
52 if(cred->times.endtime > sec) 53 krb5_format_time(context, cred->times.endtime, t2, sizeof(t2), 1); 54 else 55 strlcpy(t2, ">>>Expired<<<", sizeof(t2)); 56 57 ret = krb5_unparse_name (context, cred->server, &str); 58 if (ret) { 59 lreply(500, "krb5_unparse_name: %d", ret); --- 16 unchanged lines hidden (view full) --- 76 char *str; 77 78 ret = krb5_unparse_name (context, principal, &str); 79 if (ret) { 80 lreply(500, "krb5_unparse_name: %d", ret); 81 return 500; 82 } 83 | 52 if(cred->times.endtime > sec) 53 krb5_format_time(context, cred->times.endtime, t2, sizeof(t2), 1); 54 else 55 strlcpy(t2, ">>>Expired<<<", sizeof(t2)); 56 57 ret = krb5_unparse_name (context, cred->server, &str); 58 if (ret) { 59 lreply(500, "krb5_unparse_name: %d", ret); --- 16 unchanged lines hidden (view full) --- 76 char *str; 77 78 ret = krb5_unparse_name (context, principal, &str); 79 if (ret) { 80 lreply(500, "krb5_unparse_name: %d", ret); 81 return 500; 82 } 83 |
84 lreply(200, "%17s: %s:%s", | 84 lreply(200, "%17s: %s:%s", |
85 "Credentials cache", 86 krb5_cc_get_type(context, ccache), 87 krb5_cc_get_name(context, ccache)); 88 lreply(200, "%17s: %s", "Principal", str); 89 free (str); 90 91 ret = krb5_cc_start_seq_get (context, ccache, &cursor); 92 if (ret) { 93 lreply(500, "krb5_cc_start_seq_get: %d", ret); 94 return 500; 95 } 96 97 lreply(200, " Issued Expires Principal"); 98 99 while ((ret = krb5_cc_next_cred (context, 100 ccache, 101 &cursor, 102 &cred)) == 0) { 103 if (print_cred(context, &cred)) | 85 "Credentials cache", 86 krb5_cc_get_type(context, ccache), 87 krb5_cc_get_name(context, ccache)); 88 lreply(200, "%17s: %s", "Principal", str); 89 free (str); 90 91 ret = krb5_cc_start_seq_get (context, ccache, &cursor); 92 if (ret) { 93 lreply(500, "krb5_cc_start_seq_get: %d", ret); 94 return 500; 95 } 96 97 lreply(200, " Issued Expires Principal"); 98 99 while ((ret = krb5_cc_next_cred (context, 100 ccache, 101 &cursor, 102 &cred)) == 0) { 103 if (print_cred(context, &cred)) |
104 return 500; | 104 return 500; |
105 krb5_free_cred_contents (context, &cred); 106 } 107 if (ret != KRB5_CC_END) { 108 lreply(500, "krb5_cc_get_next: %d", ret); 109 return 500; 110 } 111 ret = krb5_cc_end_seq_get (context, ccache, &cursor); 112 if (ret) { --- 19 unchanged lines hidden (view full) --- 132 return 500; 133 } 134 135 if (k5ccname) 136 ret = krb5_cc_resolve(context, k5ccname, &ccache); 137 else 138 ret = krb5_cc_default (context, &ccache); 139 if (ret) { | 105 krb5_free_cred_contents (context, &cred); 106 } 107 if (ret != KRB5_CC_END) { 108 lreply(500, "krb5_cc_get_next: %d", ret); 109 return 500; 110 } 111 ret = krb5_cc_end_seq_get (context, ccache, &cursor); 112 if (ret) { --- 19 unchanged lines hidden (view full) --- 132 return 500; 133 } 134 135 if (k5ccname) 136 ret = krb5_cc_resolve(context, k5ccname, &ccache); 137 else 138 ret = krb5_cc_default (context, &ccache); 139 if (ret) { |
140 lreply(500, "krb5_cc_default: %d", ret); | 140 lreply(500, "krb5_cc_default: %d", ret); |
141 return 500; 142 } 143 144 ret = krb5_cc_get_principal (context, ccache, &principal); 145 if (ret) { 146 if(ret == ENOENT) 147 lreply(500, "No ticket file: %s", 148 krb5_cc_get_name(context, ccache)); 149 else 150 lreply(500, "krb5_cc_get_principal: %d", ret); 151 152 return 500; 153 } 154 exit_status = print_tickets (context, ccache, principal); 155 156 ret = krb5_cc_close (context, ccache); 157 if (ret) { | 141 return 500; 142 } 143 144 ret = krb5_cc_get_principal (context, ccache, &principal); 145 if (ret) { 146 if(ret == ENOENT) 147 lreply(500, "No ticket file: %s", 148 krb5_cc_get_name(context, ccache)); 149 else 150 lreply(500, "krb5_cc_get_principal: %d", ret); 151 152 return 500; 153 } 154 exit_status = print_tickets (context, ccache, principal); 155 156 ret = krb5_cc_close (context, ccache); 157 if (ret) { |
158 lreply(500, "krb5_cc_close: %d", ret); | 158 lreply(500, "krb5_cc_close: %d", ret); |
159 exit_status = 500; 160 } 161 162 krb5_free_principal (context, principal); 163 krb5_free_context (context); 164 return exit_status; 165} 166#endif --- 12 unchanged lines hidden --- | 159 exit_status = 500; 160 } 161 162 krb5_free_principal (context, principal); 163 krb5_free_context (context); 164 return exit_status; 165} 166#endif --- 12 unchanged lines hidden --- |