1 /*
2 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
4 */
5
6 #pragma ident "@(#)kadmin.c 1.13 04/09/08 SMI"
7
8 /*
9 * Copyright 1994 by the Massachusetts Institute of Technology.
10 * All Rights Reserved.
11 *
12 * Export of this software from the United States of America may
13 * require a specific license from the United States Government.
14 * It is the responsibility of any person or organization contemplating
15 * export to obtain such a license before exporting.
16 *
17 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
18 * distribute this software and its documentation for any purpose and
19 * without fee is hereby granted, provided that the above copyright
20 * notice appear in all copies and that both that copyright notice and
21 * this permission notice appear in supporting documentation, and that
22 * the name of M.I.T. not be used in advertising or publicity pertaining
23 * to distribution of the software without specific, written prior
24 * permission. Furthermore if you modify this software you must label
25 * your software as modified software and not distribute it in such a
26 * fashion that it might be confused with the original M.I.T. software.
469 if (retval = krb5_cc_close(context, cc)) {
470 com_err(whoami, retval, gettext("while closing ccache %s"),
471 ccache_name);
472 exit(1);
473 }
474 /* register the WRFILE keytab type and set it as the default */
475 if (retval = krb5_kt_register(context, &krb5_ktf_writable_ops)) {
476 com_err(whoami, retval,
477 gettext("while registering writable key table functions"));
478 exit(1);
479 }
480 {
481 /*
482 * XXX krb5_defkeyname is an internal library global and
483 * should go away
484 */
485 extern char *krb5_defkeyname;
486
487 krb5_defkeyname = DEFAULT_KEYTAB;
488 }
489 /* Solaris kerberos: fix memory leak */
490 if (kadmin_princ)
491 free(kadmin_princ);
492
493 return (query);
494 }
495
496 static char *
497 find_component(const char *principal, char sep)
498 {
499 char *p = strchr(principal, sep);
500
501 for(p = strchr(principal, sep); p; p = strchr(p, sep))
502 if (p != principal && *(p - 1) != '\\')
503 break;
504 return (p);
505 }
506
507 static char *
508 trim_principal(char *principal)
|
1 /*
2 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
4 */
5
6 #pragma ident "@(#)kadmin.c 1.12 04/08/19 SMI"
7
8 /*
9 * Copyright 1994 by the Massachusetts Institute of Technology.
10 * All Rights Reserved.
11 *
12 * Export of this software from the United States of America may
13 * require a specific license from the United States Government.
14 * It is the responsibility of any person or organization contemplating
15 * export to obtain such a license before exporting.
16 *
17 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
18 * distribute this software and its documentation for any purpose and
19 * without fee is hereby granted, provided that the above copyright
20 * notice appear in all copies and that both that copyright notice and
21 * this permission notice appear in supporting documentation, and that
22 * the name of M.I.T. not be used in advertising or publicity pertaining
23 * to distribution of the software without specific, written prior
24 * permission. Furthermore if you modify this software you must label
25 * your software as modified software and not distribute it in such a
26 * fashion that it might be confused with the original M.I.T. software.
469 if (retval = krb5_cc_close(context, cc)) {
470 com_err(whoami, retval, gettext("while closing ccache %s"),
471 ccache_name);
472 exit(1);
473 }
474 /* register the WRFILE keytab type and set it as the default */
475 if (retval = krb5_kt_register(context, &krb5_ktf_writable_ops)) {
476 com_err(whoami, retval,
477 gettext("while registering writable key table functions"));
478 exit(1);
479 }
480 {
481 /*
482 * XXX krb5_defkeyname is an internal library global and
483 * should go away
484 */
485 extern char *krb5_defkeyname;
486
487 krb5_defkeyname = DEFAULT_KEYTAB;
488 }
489
490 if ((retval = kadm5_init_iprop(handle)) != 0) {
491 com_err(whoami, retval, gettext("while mapping update log"));
492 exit(1);
493 }
494
495 /* Solaris kerberos: fix memory leak */
496 if (kadmin_princ)
497 free(kadmin_princ);
498
499 return (query);
500 }
501
502 static char *
503 find_component(const char *principal, char sep)
504 {
505 char *p = strchr(principal, sep);
506
507 for(p = strchr(principal, sep); p; p = strchr(p, sep))
508 if (p != principal && *(p - 1) != '\\')
509 break;
510 return (p);
511 }
512
513 static char *
514 trim_principal(char *principal)
|