17c478bd9Sstevel@tonic-gate /*
2*159d09a2SMark Phalan * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
356a424ccSmp153739 * 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] "
24d51f1d33Smp153739 "[-s admin_server[:port]] [[-c ccache]|[-k [-t keytab]]"
25d51f1d33Smp153739 "|[-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)
477c478bd9Sstevel@tonic-gate int argc;
487c478bd9Sstevel@tonic-gate char *argv[];
497c478bd9Sstevel@tonic-gate {
5056a424ccSmp153739 static char *privs[] = {"GET", "ADD", "MODIFY", "DELETE", "LIST", "CHANGE"};
517c478bd9Sstevel@tonic-gate krb5_error_code retval;
527c478bd9Sstevel@tonic-gate int i;
537c478bd9Sstevel@tonic-gate long plist;
547c478bd9Sstevel@tonic-gate
557c478bd9Sstevel@tonic-gate if (argc != 1) {
567c478bd9Sstevel@tonic-gate fprintf(stderr, "%s: get_privs\n", gettext("usage"));
577c478bd9Sstevel@tonic-gate return;
587c478bd9Sstevel@tonic-gate }
597c478bd9Sstevel@tonic-gate retval = kadm5_get_privs(handle, &plist);
607c478bd9Sstevel@tonic-gate if (retval) {
617c478bd9Sstevel@tonic-gate com_err("get_privs", retval,
627c478bd9Sstevel@tonic-gate gettext("while retrieving privileges"));
637c478bd9Sstevel@tonic-gate return;
647c478bd9Sstevel@tonic-gate }
657c478bd9Sstevel@tonic-gate printf(gettext("current privileges:"));
667c478bd9Sstevel@tonic-gate for (i = 0; i < sizeof (privs) / sizeof (char *); i++) {
677c478bd9Sstevel@tonic-gate if (plist & 1 << i)
687c478bd9Sstevel@tonic-gate printf(" %s", gettext(privs[i]));
697c478bd9Sstevel@tonic-gate }
707c478bd9Sstevel@tonic-gate printf("\n");
717c478bd9Sstevel@tonic-gate }
72