17c478bd9Sstevel@tonic-gate /*
2*159d09a2SMark Phalan  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
356a424ccSmp  * Use is subject to license terms.
47c478bd9Sstevel@tonic-gate  */
57c478bd9Sstevel@tonic-gate 
67c478bd9Sstevel@tonic-gate 
77c478bd9Sstevel@tonic-gate /*
87c478bd9Sstevel@tonic-gate  * Contains remote client specific code.
97c478bd9Sstevel@tonic-gate  */
107c478bd9Sstevel@tonic-gate 
117c478bd9Sstevel@tonic-gate #include <stdio.h>
127c478bd9Sstevel@tonic-gate #include <stdlib.h>
137c478bd9Sstevel@tonic-gate #include <libintl.h>
147c478bd9Sstevel@tonic-gate #include <k5-int.h>
15*159d09a2SMark Phalan #include <krb5.h>
167c478bd9Sstevel@tonic-gate 
177c478bd9Sstevel@tonic-gate extern void *handle;
187c478bd9Sstevel@tonic-gate 
197c478bd9Sstevel@tonic-gate void
usage(char * whoami)207c478bd9Sstevel@tonic-gate usage(char *whoami)
217c478bd9Sstevel@tonic-gate {
227c478bd9Sstevel@tonic-gate 	fprintf(stderr,
237c478bd9Sstevel@tonic-gate 	    "%s: %s [-r realm] [-p principal] [-q query] "
24d51f1d33Smp 	    "[-s admin_server[:port]] [[-c ccache]|[-k [-t keytab]]"
25d51f1d33Smp 	    "|[-w password]]\n",
267c478bd9Sstevel@tonic-gate 	    gettext("Usage"), whoami);
277c478bd9Sstevel@tonic-gate 	exit(1);
287c478bd9Sstevel@tonic-gate }
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate /*
327c478bd9Sstevel@tonic-gate  * Debugging function - for remote admin client
337c478bd9Sstevel@tonic-gate  */
347c478bd9Sstevel@tonic-gate /* ARGSUSED */
357c478bd9Sstevel@tonic-gate void
debugEnable(int displayMsgs)367c478bd9Sstevel@tonic-gate debugEnable(int displayMsgs)
377c478bd9Sstevel@tonic-gate {
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #ifdef DEBUG
40c54c769dSwillf 	/* Solaris Kerberos: not supported */
41c54c769dSwillf 	/* debugDisplaySS(displayMsgs); */
427c478bd9Sstevel@tonic-gate #endif
437c478bd9Sstevel@tonic-gate }
447c478bd9Sstevel@tonic-gate 
4554925bf6Swillf void
kadmin_getprivs(argc,argv)4654925bf6Swillf kadmin_getprivs(argc, argv)
4756a424ccSmp     int argc;
4856a424ccSmp     char *argv[];
497c478bd9Sstevel@tonic-gate {
5056a424ccSmp     static char *privs[] = {"GET", "ADD", "MODIFY", "DELETE", "LIST", "CHANGE"};
5156a424ccSmp     krb5_error_code retval;
5256a424ccSmp     int i;
5356a424ccSmp     long plist;
547c478bd9Sstevel@tonic-gate 
5556a424ccSmp     if (argc != 1) {
5656a424ccSmp 	fprintf(stderr, "%s: get_privs\n", gettext("usage"));
5756a424ccSmp 	return;
5856a424ccSmp     }
5956a424ccSmp     retval = kadm5_get_privs(handle, &plist);
6056a424ccSmp     if (retval) {
6156a424ccSmp 	com_err("get_privs", retval,
627c478bd9Sstevel@tonic-gate 		    gettext("while retrieving privileges"));
6356a424ccSmp 	return;
6456a424ccSmp     }
6556a424ccSmp     printf(gettext("current privileges:"));
6656a424ccSmp     for (i = 0; i < sizeof (privs) / sizeof (char *); i++) {
6756a424ccSmp 	if (plist & 1 << i)
6856a424ccSmp 	    printf(" %s", gettext(privs[i]));
6956a424ccSmp     }
7056a424ccSmp     printf("\n");
717c478bd9Sstevel@tonic-gate }
72