10Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI"
20Sstevel@tonic-gate
30Sstevel@tonic-gate /*
40Sstevel@tonic-gate * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
50Sstevel@tonic-gate *
60Sstevel@tonic-gate * Openvision retains the copyright to derivative works of
70Sstevel@tonic-gate * this source code. Do *NOT* create a derivative of this
80Sstevel@tonic-gate * source code before consulting with your legal department.
90Sstevel@tonic-gate * Do *NOT* integrate *ANY* of this source code into another
100Sstevel@tonic-gate * product before consulting with your legal department.
110Sstevel@tonic-gate *
120Sstevel@tonic-gate * For further information, read the top-level Openvision
130Sstevel@tonic-gate * copyright which is contained in the top-level MIT Kerberos
140Sstevel@tonic-gate * copyright.
150Sstevel@tonic-gate *
160Sstevel@tonic-gate * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
170Sstevel@tonic-gate *
180Sstevel@tonic-gate */
190Sstevel@tonic-gate
200Sstevel@tonic-gate
210Sstevel@tonic-gate /*
220Sstevel@tonic-gate * Copyright 1994 by the Massachusetts Institute of Technology.
230Sstevel@tonic-gate * All Rights Reserved.
240Sstevel@tonic-gate *
250Sstevel@tonic-gate * Export of this software from the United States of America may
260Sstevel@tonic-gate * require a specific license from the United States Government.
270Sstevel@tonic-gate * It is the responsibility of any person or organization contemplating
280Sstevel@tonic-gate * export to obtain such a license before exporting.
29*2881Smp153739 *
300Sstevel@tonic-gate * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
310Sstevel@tonic-gate * distribute this software and its documentation for any purpose and
320Sstevel@tonic-gate * without fee is hereby granted, provided that the above copyright
330Sstevel@tonic-gate * notice appear in all copies and that both that copyright notice and
340Sstevel@tonic-gate * this permission notice appear in supporting documentation, and that
350Sstevel@tonic-gate * the name of M.I.T. not be used in advertising or publicity pertaining
360Sstevel@tonic-gate * to distribution of the software without specific, written prior
370Sstevel@tonic-gate * permission. Furthermore if you modify this software you must label
380Sstevel@tonic-gate * your software as modified software and not distribute it in such a
390Sstevel@tonic-gate * fashion that it might be confused with the original M.I.T. software.
400Sstevel@tonic-gate * M.I.T. makes no representations about the suitability of
410Sstevel@tonic-gate * this software for any purpose. It is provided "as is" without express
420Sstevel@tonic-gate * or implied warranty.
43*2881Smp153739 *
440Sstevel@tonic-gate *
450Sstevel@tonic-gate * ss wrapper for kadmin
460Sstevel@tonic-gate */
470Sstevel@tonic-gate
480Sstevel@tonic-gate #include <krb5.h>
490Sstevel@tonic-gate #include <ss/ss.h>
500Sstevel@tonic-gate #include <stdio.h>
510Sstevel@tonic-gate #include <string.h>
520Sstevel@tonic-gate #include <libintl.h>
530Sstevel@tonic-gate #include <locale.h>
54*2881Smp153739 #include "kadmin.h"
550Sstevel@tonic-gate
560Sstevel@tonic-gate extern ss_request_table kadmin_cmds;
570Sstevel@tonic-gate extern int exit_status;
580Sstevel@tonic-gate extern char *whoami;
590Sstevel@tonic-gate
main(argc,argv)60*2881Smp153739 int main(argc, argv)
61*2881Smp153739 int argc;
62*2881Smp153739 char *argv[];
630Sstevel@tonic-gate {
64*2881Smp153739 char *request;
65*2881Smp153739 krb5_error_code retval;
66*2881Smp153739 int sci_idx, code = 0;
670Sstevel@tonic-gate
68*2881Smp153739 whoami = ((whoami = strrchr(argv[0], '/')) ? whoami+1 : argv[0]);
690Sstevel@tonic-gate
700Sstevel@tonic-gate (void) setlocale(LC_ALL, "");
710Sstevel@tonic-gate
720Sstevel@tonic-gate #if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
730Sstevel@tonic-gate #define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't */
740Sstevel@tonic-gate #endif
750Sstevel@tonic-gate
760Sstevel@tonic-gate (void) textdomain(TEXT_DOMAIN);
770Sstevel@tonic-gate
78*2881Smp153739 request = kadmin_startup(argc, argv);
79*2881Smp153739 sci_idx = ss_create_invocation(whoami, "5.0", (char *) NULL,
80*2881Smp153739 &kadmin_cmds, &retval);
81*2881Smp153739 if (retval) {
82*2881Smp153739 ss_perror(sci_idx, retval, gettext("creating invocation"));
83*2881Smp153739 exit(1);
84*2881Smp153739 }
850Sstevel@tonic-gate
860Sstevel@tonic-gate (void) setlocale(LC_ALL, "");
870Sstevel@tonic-gate (void) textdomain(TEXT_DOMAIN);
880Sstevel@tonic-gate
89*2881Smp153739 if (request) {
90*2881Smp153739 code = ss_execute_line(sci_idx, request);
91*2881Smp153739 if (code != 0) {
92*2881Smp153739 ss_perror(sci_idx, code, request);
93*2881Smp153739 exit_status++;
94*2881Smp153739 }
95*2881Smp153739 } else
96*2881Smp153739 retval = ss_listen(sci_idx);
97*2881Smp153739 return quit() ? 1 : exit_status;
980Sstevel@tonic-gate }
99