kadmin_rmt.c revision d51f1d338914fe15108ef3fb04d422a459cfdeda
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Contains remote client specific code.
*/
#include <stdio.h>
#include <stdlib.h>
#include <libintl.h>
#include <krb5.h>
#include <k5-int.h>
extern void *handle;
void
usage(char *whoami)
{
fprintf(stderr,
"%s: %s [-r realm] [-p principal] [-q query] "
"[-s admin_server[:port]] [[-c ccache]|[-k [-t keytab]]"
"|[-w password]]\n",
gettext("Usage"), whoami);
exit(1);
}
/*
* Debugging function - for remote admin client
*/
/* ARGSUSED */
void
debugEnable(int displayMsgs)
{
#ifdef DEBUG
debugDisplaySS(displayMsgs);
#endif
}
void kadmin_getprivs(argc, argv)
int argc;
char *argv[];
{
static char *privs[] = {"GET", "ADD", "MODIFY", "DELETE", "LIST", "CHANGE"};
krb5_error_code retval;
int i;
long plist;
if (argc != 1) {
fprintf(stderr, "%s: get_privs\n", gettext("usage"));
return;
}
retval = kadm5_get_privs(handle, &plist);
if (retval) {
com_err("get_privs", retval,
gettext("while retrieving privileges"));
return;
}
printf(gettext("current privileges:"));
for (i = 0; i < sizeof (privs) / sizeof (char *); i++) {
if (plist & 1 << i)
printf(" %s", gettext(privs[i]));
}
printf("\n");
return;
}