xref: /titanic_51/usr/src/cmd/krb5/kadmin/cli/kadmin_rmt.c (revision b9bd317cda1afb3a01f4812de73e8cec888cbbd7)
1 /*
2  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 #pragma ident	"%Z%%M%	%I%	%E% SMI"
7 
8 /*
9  * Contains remote client specific code.
10  */
11 
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <libintl.h>
15 #include <krb5.h>
16 #include <k5-int.h>
17 
18 extern void *handle;
19 
20 void
21 usage(char *whoami)
22 {
23 	fprintf(stderr,
24 	    "%s: %s [-r realm] [-p principal] [-q query] "
25 	    "[-s admin_server[:port]] [[-c ccache]|[-k [-t keytab]]"
26 	    "|[-w password]]\n",
27 	    gettext("Usage"), whoami);
28 	exit(1);
29 }
30 
31 
32 /*
33  * Debugging function - for remote admin client
34  */
35 /* ARGSUSED */
36 void
37 debugEnable(int displayMsgs)
38 {
39 
40 #ifdef DEBUG
41 	/* Solaris Kerberos: not supported */
42 	/* debugDisplaySS(displayMsgs); */
43 #endif
44 }
45 
46 void
47 kadmin_getprivs(argc, argv)
48     int argc;
49     char *argv[];
50 {
51     static char *privs[] = {"GET", "ADD", "MODIFY", "DELETE", "LIST", "CHANGE"};
52     krb5_error_code retval;
53     int i;
54     long plist;
55 
56     if (argc != 1) {
57 	fprintf(stderr, "%s: get_privs\n", gettext("usage"));
58 	return;
59     }
60     retval = kadm5_get_privs(handle, &plist);
61     if (retval) {
62 	com_err("get_privs", retval,
63 		    gettext("while retrieving privileges"));
64 	return;
65     }
66     printf(gettext("current privileges:"));
67     for (i = 0; i < sizeof (privs) / sizeof (char *); i++) {
68 	if (plist & 1 << i)
69 	    printf(" %s", gettext(privs[i]));
70     }
71     printf("\n");
72 }
73