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