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