17c478bd9Sstevel@tonic-gate /*
2*c54c769dSwillf * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
3*c54c769dSwillf * Use is subject to license terms.
47c478bd9Sstevel@tonic-gate */
57c478bd9Sstevel@tonic-gate
67c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI"
77c478bd9Sstevel@tonic-gate
87c478bd9Sstevel@tonic-gate /*
97c478bd9Sstevel@tonic-gate * Contains kadmin.local specific code.
107c478bd9Sstevel@tonic-gate */
117c478bd9Sstevel@tonic-gate
127c478bd9Sstevel@tonic-gate #include <stdio.h>
137c478bd9Sstevel@tonic-gate #include <stdlib.h>
147c478bd9Sstevel@tonic-gate #include <libintl.h>
157c478bd9Sstevel@tonic-gate #include <db.h>
167c478bd9Sstevel@tonic-gate #include <krb5.h>
177c478bd9Sstevel@tonic-gate
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] "
247c478bd9Sstevel@tonic-gate "[-d dbname] [-e \"enc:salt ...\"] [-m] [-D]\n",
257c478bd9Sstevel@tonic-gate gettext("Usage"), whoami);
267c478bd9Sstevel@tonic-gate exit(1);
277c478bd9Sstevel@tonic-gate }
287c478bd9Sstevel@tonic-gate
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gate /*
317c478bd9Sstevel@tonic-gate * Debugging function
327c478bd9Sstevel@tonic-gate * Turns on low level debugging in db module
337c478bd9Sstevel@tonic-gate * Requires that db library be compiled with -DDEBUG_DB flag
347c478bd9Sstevel@tonic-gate */
357c478bd9Sstevel@tonic-gate /* ARGSUSED */
367c478bd9Sstevel@tonic-gate void
debugEnable(int displayMsgs)377c478bd9Sstevel@tonic-gate debugEnable(int displayMsgs)
387c478bd9Sstevel@tonic-gate {
397c478bd9Sstevel@tonic-gate
407c478bd9Sstevel@tonic-gate #if DEBUG_DB
417c478bd9Sstevel@tonic-gate debugDisplayDB(displayMsgs);
427c478bd9Sstevel@tonic-gate #endif
437c478bd9Sstevel@tonic-gate
447c478bd9Sstevel@tonic-gate #if DEBUG
45*c54c769dSwillf /* Solaris Kerberos: not supported */
46*c54c769dSwillf /* debugDisplaySS(displayMsgs); */
477c478bd9Sstevel@tonic-gate #endif
487c478bd9Sstevel@tonic-gate
497c478bd9Sstevel@tonic-gate }
507c478bd9Sstevel@tonic-gate
517c478bd9Sstevel@tonic-gate void
kadmin_getprivs(argc,argv)527c478bd9Sstevel@tonic-gate kadmin_getprivs(argc, argv)
537c478bd9Sstevel@tonic-gate int argc;
547c478bd9Sstevel@tonic-gate char *argv[];
557c478bd9Sstevel@tonic-gate {
567c478bd9Sstevel@tonic-gate static char *privs[] = {"GET", "ADD", "MODIFY", "DELETE", "LIST",
577c478bd9Sstevel@tonic-gate "CHANGEPW"};
587c478bd9Sstevel@tonic-gate krb5_error_code retval;
597c478bd9Sstevel@tonic-gate int i;
607c478bd9Sstevel@tonic-gate long plist;
617c478bd9Sstevel@tonic-gate
627c478bd9Sstevel@tonic-gate /* for kadmin.local return all privilages */
637c478bd9Sstevel@tonic-gate
647c478bd9Sstevel@tonic-gate printf(gettext("current privileges:"));
657c478bd9Sstevel@tonic-gate for (i = 0; i < sizeof (privs) / 4; i++) {
667c478bd9Sstevel@tonic-gate printf(" %s", gettext(privs[i]));
677c478bd9Sstevel@tonic-gate }
687c478bd9Sstevel@tonic-gate printf("\n");
697c478bd9Sstevel@tonic-gate }
70