1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /* lib/krb5/ccache/t_memory.c */
4 * Copyright 1990 by the Massachusetts Institute of Technology.
7 * Export of this software from the United States of America may
8 * require a specific license from the United States Government.
9 * It is the responsibility of any person or organization contemplating
10 * export to obtain such a license before exporting.
12 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
13 * distribute this software and its documentation for any purpose and
14 * without fee is hereby granted, provided that the above copyright
15 * notice appear in all copies and that both that copyright notice and
16 * this permission notice appear in supporting documentation, and that
17 * the name of M.I.T. not be used in advertising or publicity pertaining
18 * to distribution of the software without specific, written prior
19 * permission. Furthermore if you modify this software you must label
20 * your software as modified software and not distribute it in such a
21 * fashion that it might be confused with the original M.I.T. software.
22 * M.I.T. makes no representations about the suitability of
23 * this software for any purpose. It is provided "as is" without express
24 * or implied warranty.
30 #define DATA "client1-comp1"
37 #define DATA "client1-comp2"
44 #define DATA "server1-comp1"
51 #define DATA "server1-comp2"
57 krb5_creds test_creds = {
74 #define TICKET "This is ticket 1"
80 #define TICKET "This is ticket 2"
90 test_creds.client = (krb5_principal) malloc(sizeof(krb5_data *)*3);
91 test_creds.client[0] = &client1;
92 test_creds.client[1] = &client2;
93 test_creds.client[2] = NULL;
95 test_creds.server = (krb5_principal) malloc(sizeof(krb5_data *)*3);
96 test_creds.server[0] = &server1;
97 test_creds.server[1] = &server2;
98 test_creds.server[2] = NULL;
101 #define CHECK(kret,msg) \
102 if (kret != KRB5_OK) { \
103 printf("%s returned %d\n", msg, kret); \
111 krb5_error_code kret;
112 krb5_cc_cursor cursor;
116 kret = krb5_mcc_resolve(context, &id, "/tmp/tkt_test");
117 CHECK(kret, "resolve");
118 kret = krb5_mcc_initialize(context, id, test_creds.client);
119 CHECK(kret, "initialize");
120 kret = krb5_mcc_store(context, id, &test_creds);
121 CHECK(kret, "store");
123 kret = krb5_mcc_start_seq_get(context, id, &cursor);
124 CHECK(kret, "start_seq_get");
126 while (kret != KRB5_CC_END) {
127 printf("Calling next_cred\n");
128 kret = krb5_mcc_next_cred(context, id, &cursor, &creds);
129 CHECK(kret, "next_cred");
131 kret = krb5_mcc_end_seq_get(context, id, &cursor);
132 CHECK(kret, "end_seq_get");
134 kret = krb5_mcc_destroy(context, id);
135 CHECK(kret, "destroy");
136 kret = krb5_mcc_close(context, id);
137 CHECK(kret, "close");