17c478bdstevel@tonic-gate#pragma ident	"%Z%%M%	%I%	%E% SMI"
27c478bdstevel@tonic-gate
37c478bdstevel@tonic-gate/*
47c478bdstevel@tonic-gate * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
57c478bdstevel@tonic-gate *
67c478bdstevel@tonic-gate *	Openvision retains the copyright to derivative works of
77c478bdstevel@tonic-gate *	this source code.  Do *NOT* create a derivative of this
87c478bdstevel@tonic-gate *	source code before consulting with your legal department.
97c478bdstevel@tonic-gate *	Do *NOT* integrate *ANY* of this source code into another
107c478bdstevel@tonic-gate *	product before consulting with your legal department.
117c478bdstevel@tonic-gate *
127c478bdstevel@tonic-gate *	For further information, read the top-level Openvision
137c478bdstevel@tonic-gate *	copyright which is contained in the top-level MIT Kerberos
147c478bdstevel@tonic-gate *	copyright.
157c478bdstevel@tonic-gate *
167c478bdstevel@tonic-gate * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
177c478bdstevel@tonic-gate *
187c478bdstevel@tonic-gate */
197c478bdstevel@tonic-gate
207c478bdstevel@tonic-gate
217c478bdstevel@tonic-gate/*
227c478bdstevel@tonic-gate * Copyright 1994 by the Massachusetts Institute of Technology.
237c478bdstevel@tonic-gate * All Rights Reserved.
247c478bdstevel@tonic-gate *
257c478bdstevel@tonic-gate * Export of this software from the United States of America may
267c478bdstevel@tonic-gate *   require a specific license from the United States Government.
277c478bdstevel@tonic-gate *   It is the responsibility of any person or organization contemplating
287c478bdstevel@tonic-gate *   export to obtain such a license before exporting.
2956a424cmp *
307c478bdstevel@tonic-gate * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
317c478bdstevel@tonic-gate * distribute this software and its documentation for any purpose and
327c478bdstevel@tonic-gate * without fee is hereby granted, provided that the above copyright
337c478bdstevel@tonic-gate * notice appear in all copies and that both that copyright notice and
347c478bdstevel@tonic-gate * this permission notice appear in supporting documentation, and that
357c478bdstevel@tonic-gate * the name of M.I.T. not be used in advertising or publicity pertaining
367c478bdstevel@tonic-gate * to distribution of the software without specific, written prior
377c478bdstevel@tonic-gate * permission.  Furthermore if you modify this software you must label
387c478bdstevel@tonic-gate * your software as modified software and not distribute it in such a
397c478bdstevel@tonic-gate * fashion that it might be confused with the original M.I.T. software.
407c478bdstevel@tonic-gate * M.I.T. makes no representations about the suitability of
417c478bdstevel@tonic-gate * this software for any purpose.  It is provided "as is" without express
427c478bdstevel@tonic-gate * or implied warranty.
4356a424cmp *
447c478bdstevel@tonic-gate *
457c478bdstevel@tonic-gate * ss wrapper for kadmin
467c478bdstevel@tonic-gate */
477c478bdstevel@tonic-gate
487c478bdstevel@tonic-gate#include <krb5.h>
497c478bdstevel@tonic-gate#include <ss/ss.h>
507c478bdstevel@tonic-gate#include <stdio.h>
517c478bdstevel@tonic-gate#include <string.h>
527c478bdstevel@tonic-gate#include <libintl.h>
537c478bdstevel@tonic-gate#include <locale.h>
5456a424cmp#include "kadmin.h"
557c478bdstevel@tonic-gate
567c478bdstevel@tonic-gateextern ss_request_table kadmin_cmds;
577c478bdstevel@tonic-gateextern int exit_status;
587c478bdstevel@tonic-gateextern char *whoami;
597c478bdstevel@tonic-gate
6056a424cmpint main(argc, argv)
6156a424cmp    int argc;
6256a424cmp    char *argv[];
637c478bdstevel@tonic-gate{
6456a424cmp    char *request;
6556a424cmp    krb5_error_code retval;
6656a424cmp    int sci_idx, code = 0;
677c478bdstevel@tonic-gate
6856a424cmp    whoami = ((whoami = strrchr(argv[0], '/')) ? whoami+1 : argv[0]);
697c478bdstevel@tonic-gate
707c478bdstevel@tonic-gate	(void) setlocale(LC_ALL, "");
717c478bdstevel@tonic-gate
727c478bdstevel@tonic-gate#if !defined(TEXT_DOMAIN)  /* Should be defined by cc -D */
737c478bdstevel@tonic-gate#define	TEXT_DOMAIN	"SYS_TEST"	/* Use this only if it weren't */
747c478bdstevel@tonic-gate#endif
757c478bdstevel@tonic-gate
767c478bdstevel@tonic-gate	(void) textdomain(TEXT_DOMAIN);
777c478bdstevel@tonic-gate
7856a424cmp    request = kadmin_startup(argc, argv);
7956a424cmp    sci_idx = ss_create_invocation(whoami, "5.0", (char *) NULL,
8056a424cmp				   &kadmin_cmds, &retval);
8156a424cmp    if (retval) {
8256a424cmp	ss_perror(sci_idx, retval, gettext("creating invocation"));
8356a424cmp	exit(1);
8456a424cmp    }
857c478bdstevel@tonic-gate
867c478bdstevel@tonic-gate	(void) setlocale(LC_ALL, "");
877c478bdstevel@tonic-gate	(void) textdomain(TEXT_DOMAIN);
887c478bdstevel@tonic-gate
8956a424cmp    if (request) {
9056a424cmp	    code = ss_execute_line(sci_idx, request);
9156a424cmp	    if (code != 0) {
9256a424cmp		    ss_perror(sci_idx, code, request);
9356a424cmp		    exit_status++;
9456a424cmp	    }
9556a424cmp    } else
9656a424cmp            retval = ss_listen(sci_idx);
9756a424cmp    return quit() ? 1 : exit_status;
987c478bdstevel@tonic-gate}
99