1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
4 * Copyright 1991 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.
32 void krb5_klog_syslog(void);
35 make_princ(krb5_context ctx, const char *str, const char *prog)
40 if(!(ret = (krb5_principal) malloc(sizeof(krb5_principal_data)))) {
41 com_err(prog, ENOMEM, "while allocating principal data");
44 memset(ret, 0, sizeof(krb5_principal_data));
46 /* We do not include the null... */
47 if(!(dat = (char *) malloc(strlen(str)))) {
48 com_err(prog, ENOMEM, "while allocating principal realm data");
51 memcpy(dat, str, strlen(str));
52 krb5_princ_set_realm_data(ctx, ret, dat);
53 krb5_princ_set_realm_length(ctx, ret, strlen(str));
59 main(int argc, char **argv)
63 krb5_principal tgs, cl, sv;
65 kdc_realm_t kdc_realm;
68 fprintf(stderr, "not enough args\n");
74 kret = krb5int_init_context_kdc(&kdc_realm.realm_context);
76 com_err(argv[0], kret, "while getting krb5 context");
79 /* Needed so kdc_context will work */
80 kdc_active_realm = &kdc_realm;
85 otrans.length = strlen(argv[1]);
87 otrans.data = (char *) malloc(otrans.length);
90 memcpy(otrans.data,argv[1], otrans.length);
92 tgs = make_princ(kdc_context, argv[2], argv[0]);
93 cl = make_princ(kdc_context, argv[3], argv[0]);
94 sv = make_princ(kdc_context, argv[4], argv[0]);
96 add_to_transited(&otrans,&ntrans,tgs,cl,sv);
98 printf("%s\n",ntrans.data);
100 /* Free up all memory so we can profile for leaks */
105 krb5_free_principal(kdc_realm.realm_context, tgs);
106 krb5_free_principal(kdc_realm.realm_context, cl);
107 krb5_free_principal(kdc_realm.realm_context, sv);
108 krb5_free_context(kdc_realm.realm_context);
113 void krb5_klog_syslog(void) {}
114 kdc_realm_t *find_realm_data (char *rname, krb5_ui_4 rsize) { return 0; }