1 /*
2 * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
3 *
4 * Openvision retains the copyright to derivative works of
5 * this source code. Do *NOT* create a derivative of this
6 * source code before consulting with your legal department.
7 * Do *NOT* integrate *ANY* of this source code into another
8 * product before consulting with your legal department.
9 *
10 * For further information, read the top-level Openvision
11 * copyright which is contained in the top-level MIT Kerberos
12 * copyright.
13 *
14 * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
15 *
16 */
17
18
19 /*
20 * Copyright 1994 by the Massachusetts Institute of Technology.
21 * All Rights Reserved.
22 *
23 * Export of this software from the United States of America may
24 * require a specific license from the United States Government.
25 * It is the responsibility of any person or organization contemplating
26 * export to obtain such a license before exporting.
27 *
28 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
29 * distribute this software and its documentation for any purpose and
30 * without fee is hereby granted, provided that the above copyright
31 * notice appear in all copies and that both that copyright notice and
32 * this permission notice appear in supporting documentation, and that
33 * the name of M.I.T. not be used in advertising or publicity pertaining
34 * to distribution of the software without specific, written prior
35 * permission. Furthermore if you modify this software you must label
36 * your software as modified software and not distribute it in such a
37 * fashion that it might be confused with the original M.I.T. software.
38 * M.I.T. makes no representations about the suitability of
39 * this software for any purpose. It is provided "as is" without express
40 * or implied warranty.
41 *
42 *
43 * ss wrapper for kadmin
44 */
45
46 #include <krb5.h>
47 #include <ss/ss.h>
48 #include <stdio.h>
49 #include <string.h>
50 #include <libintl.h>
51 #include <locale.h>
52 #include "kadmin.h"
53
54 extern ss_request_table kadmin_cmds;
55 extern int exit_status;
56 extern char *whoami;
57
main(argc,argv)58 int main(argc, argv)
59 int argc;
60 char *argv[];
61 {
62 char *request;
63 krb5_error_code retval;
64 int sci_idx, code = 0;
65
66 whoami = ((whoami = strrchr(argv[0], '/')) ? whoami+1 : argv[0]);
67
68 (void) setlocale(LC_ALL, "");
69
70 #if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
71 #define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't */
72 #endif
73
74 (void) textdomain(TEXT_DOMAIN);
75
76 request = kadmin_startup(argc, argv);
77 sci_idx = ss_create_invocation(whoami, "5.0", (char *) NULL,
78 &kadmin_cmds, &retval);
79 if (retval) {
80 ss_perror(sci_idx, retval, gettext("creating invocation"));
81 exit(1);
82 }
83
84 (void) setlocale(LC_ALL, "");
85 (void) textdomain(TEXT_DOMAIN);
86
87 if (request) {
88 code = ss_execute_line(sci_idx, request);
89 if (code != 0) {
90 ss_perror(sci_idx, code, request);
91 exit_status++;
92 }
93 } else
94 retval = ss_listen(sci_idx);
95 return quit() ? 1 : exit_status;
96 }
97