new krb5_cc_cache_match
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23905 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -266,7 +266,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
ret = krb5_parse_name(context, client_string, &client);
|
ret = krb5_parse_name(context, client_string, &client);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
ret = krb5_cc_cache_match(context, client, NULL, &id);
|
ret = krb5_cc_cache_match(context, client, &id);
|
||||||
if (ret)
|
if (ret)
|
||||||
id = NULL;
|
id = NULL;
|
||||||
}
|
}
|
||||||
|
@@ -793,7 +793,7 @@ main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ret = krb5_cc_cache_match(context, principal, NULL, &ccache);
|
ret = krb5_cc_cache_match(context, principal, &ccache);
|
||||||
if (ret)
|
if (ret)
|
||||||
ret = krb5_cc_default (context, &ccache);
|
ret = krb5_cc_default (context, &ccache);
|
||||||
}
|
}
|
||||||
|
@@ -112,7 +112,7 @@ main (int argc, char **argv)
|
|||||||
if (ret)
|
if (ret)
|
||||||
krb5_err (context, 1, ret, "krb5_parse_name: %s", principal);
|
krb5_err (context, 1, ret, "krb5_parse_name: %s", principal);
|
||||||
|
|
||||||
ret = krb5_cc_cache_match(context, p, type, &id);
|
ret = krb5_cc_cache_match(context, p, &id);
|
||||||
if (ret)
|
if (ret)
|
||||||
krb5_err (context, 1, ret,
|
krb5_err (context, 1, ret,
|
||||||
N_("Did not find principal: %s", ""), principal);
|
N_("Did not find principal: %s", ""), principal);
|
||||||
|
@@ -137,7 +137,6 @@ static OM_uint32 acquire_initiator_cred
|
|||||||
if (handle->principal) {
|
if (handle->principal) {
|
||||||
kret = krb5_cc_cache_match (context,
|
kret = krb5_cc_cache_match (context,
|
||||||
handle->principal,
|
handle->principal,
|
||||||
NULL,
|
|
||||||
&ccache);
|
&ccache);
|
||||||
if (kret == 0) {
|
if (kret == 0) {
|
||||||
ret = GSS_S_COMPLETE;
|
ret = GSS_S_COMPLETE;
|
||||||
|
@@ -84,7 +84,7 @@ get_ccache(krb5_context context, int *destroy, krb5_ccache *id)
|
|||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
ret = krb5_cc_cache_match(context, principal, NULL, id);
|
ret = krb5_cc_cache_match(context, principal, id);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@@ -297,6 +297,7 @@ struct krb5_cc_ops;
|
|||||||
NULL)
|
NULL)
|
||||||
|
|
||||||
typedef void *krb5_cc_cursor;
|
typedef void *krb5_cc_cursor;
|
||||||
|
typedef struct krb5_cccol_cursor *krb5_cccol_cursor;
|
||||||
|
|
||||||
typedef struct krb5_ccache_data {
|
typedef struct krb5_ccache_data {
|
||||||
const struct krb5_cc_ops *ops;
|
const struct krb5_cc_ops *ops;
|
||||||
|
@@ -316,8 +316,7 @@ test_def_cc_name(krb5_context context)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_cache_find(krb5_context context, const char *type, const char *principal,
|
test_cache_find(krb5_context context, const char *principal, int find)
|
||||||
int find)
|
|
||||||
{
|
{
|
||||||
krb5_principal client;
|
krb5_principal client;
|
||||||
krb5_error_code ret;
|
krb5_error_code ret;
|
||||||
@@ -327,7 +326,7 @@ test_cache_find(krb5_context context, const char *type, const char *principal,
|
|||||||
if (ret)
|
if (ret)
|
||||||
krb5_err(context, 1, ret, "parse_name for %s failed", principal);
|
krb5_err(context, 1, ret, "parse_name for %s failed", principal);
|
||||||
|
|
||||||
ret = krb5_cc_cache_match(context, client, type, &id);
|
ret = krb5_cc_cache_match(context, client, &id);
|
||||||
if (ret && find)
|
if (ret && find)
|
||||||
krb5_err(context, 1, ret, "cc_cache_match for %s failed", principal);
|
krb5_err(context, 1, ret, "cc_cache_match for %s failed", principal);
|
||||||
if (ret == 0 && !find)
|
if (ret == 0 && !find)
|
||||||
@@ -378,6 +377,41 @@ test_cache_iter(krb5_context context, const char *type, int destroy)
|
|||||||
krb5_cc_cache_end_seq_get(context, cursor);
|
krb5_cc_cache_end_seq_get(context, cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_cache_iter_all(krb5_context context)
|
||||||
|
{
|
||||||
|
krb5_cccol_cursor cursor;
|
||||||
|
krb5_error_code ret;
|
||||||
|
krb5_ccache id;
|
||||||
|
|
||||||
|
ret = krb5_cccol_cursor_new (context, &cursor);
|
||||||
|
if (ret)
|
||||||
|
krb5_err(context, 1, ret, "krb5_cccol_cursor_new");
|
||||||
|
|
||||||
|
|
||||||
|
while ((ret = krb5_cccol_cursor_next (context, cursor, &id)) == 0) {
|
||||||
|
krb5_principal principal;
|
||||||
|
char *name;
|
||||||
|
|
||||||
|
if (debug_flag)
|
||||||
|
printf("name: %s\n", krb5_cc_get_name(context, id));
|
||||||
|
ret = krb5_cc_get_principal(context, id, &principal);
|
||||||
|
if (ret == 0) {
|
||||||
|
ret = krb5_unparse_name(context, principal, &name);
|
||||||
|
if (ret == 0) {
|
||||||
|
if (debug_flag)
|
||||||
|
printf("\tprincipal: %s\n", name);
|
||||||
|
free(name);
|
||||||
|
}
|
||||||
|
krb5_free_principal(context, principal);
|
||||||
|
}
|
||||||
|
krb5_cc_close(context, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
krb5_cccol_cursor_free(context, &cursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_copy(krb5_context context, const char *fromtype, const char *totype)
|
test_copy(krb5_context context, const char *fromtype, const char *totype)
|
||||||
{
|
{
|
||||||
@@ -548,6 +582,9 @@ main(int argc, char **argv)
|
|||||||
test_init_vs_destroy(context, &krb5_scc_ops);
|
test_init_vs_destroy(context, &krb5_scc_ops);
|
||||||
test_mcc_default();
|
test_mcc_default();
|
||||||
test_def_cc_name(context);
|
test_def_cc_name(context);
|
||||||
|
|
||||||
|
test_cache_iter_all(context);
|
||||||
|
|
||||||
test_cache_iter(context, "MEMORY", 0);
|
test_cache_iter(context, "MEMORY", 0);
|
||||||
{
|
{
|
||||||
krb5_principal p;
|
krb5_principal p;
|
||||||
@@ -558,8 +595,8 @@ main(int argc, char **argv)
|
|||||||
krb5_free_principal(context, p);
|
krb5_free_principal(context, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
test_cache_find(context, "MEMORY", "lha@SU.SE", 1);
|
test_cache_find(context, "lha@SU.SE", 1);
|
||||||
test_cache_find(context, "MEMORY", "hulabundulahotentot@SU.SE", 0);
|
test_cache_find(context, "hulabundulahotentot@SU.SE", 0);
|
||||||
|
|
||||||
test_cache_iter(context, "MEMORY", 0);
|
test_cache_iter(context, "MEMORY", 0);
|
||||||
test_cache_iter(context, "MEMORY", 1);
|
test_cache_iter(context, "MEMORY", 1);
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
HEIMDAL_KRB5_1.0 {
|
HEIMDAL_KRB5_2.0 {
|
||||||
global:
|
global:
|
||||||
krb524_convert_creds_kdc;
|
krb524_convert_creds_kdc;
|
||||||
krb524_convert_creds_kdc_ccache;
|
krb524_convert_creds_kdc_ccache;
|
||||||
|
Reference in New Issue
Block a user