tcl support
authorTom Yu <tlyu@mit.edu>
Thu, 9 Jun 1994 15:34:12 +0000 (15:34 +0000)
committerTom Yu <tlyu@mit.edu>
Thu, 9 Jun 1994 15:34:12 +0000 (15:34 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3687 dc483132-0cff-0310-8789-dd5450dbe970

src/admin/edit/Imakefile
src/admin/edit/dump.c
src/admin/edit/kdb5_ed_ct.ct
src/admin/edit/kdb5_edit.c
src/admin/edit/kdb5_edit.h
src/admin/edit/ss_wrapper.c [new file with mode: 0644]
src/admin/edit/tcl_wrapper.c [new file with mode: 0644]

index 3ef08d9817516efee11cd9ad7fc1f6308a06a598..639bd2db552b956605ecb2e5c3c75835b0280bec 100644 (file)
 # 
 # 
 DEPLIBS = $(DEPKDBLIB) $(DEPKLIB)
-LOCAL_LIBRARIES = $(KDBLIB) $(KLIB) $(SSLIB)
-OBJS= kdb5_edit.o kdb5_ed_ct.o util.o dump.o
-SRCS= kdb5_edit.c kdb5_ed_ct.c util.c dump.c
+LOCAL_LIBRARIES = $(KDBLIB) $(KLIB)
 
+CTOBJS = kdb5_ed_ct.o
+CTSRCS = kdb5_ed_ct.c
+
+#if HasTcl
+MOSTOBJS = kdb5_edit.o util.o dump.o
+MOSTSRCS = kdb5_edit.c util.c dump.c
+TCLOBJS = tcl_wrapper.o
+TCLSRCS = tcl_wrapper.c
+SSOBJS = ss_wrapper.o $(CTOBJS)
+SSSRCS = ss_wrapper.c $(CTSRCS)
+OBJS = $(MOSTOBJS) $(TCLOBJS) $(SSOBJS)
+SRCS = $(MOSTSRCS) $(TCLSRCS) $(SSSRCS)
+#else
+OBJS = kdb5_edit.o util.o dump.o $(CTOBJS) ss_wrapper.o
+SRCS = kdb5_edit.c util.c dump.c $(CTSRCS) ss_wrapper.c
+#endif
+
+#if HasTcl
+all:: kdb5_edit.ss kdb5_edit.tcl
+#else
 all:: kdb5_edit
+#endif
 
 CmdTableObjectRule()
 
@@ -37,10 +56,22 @@ kdb5_ed_ct.o: kdb5_ed_ct.c
 clean::
        $(RM) kdb5_ed_ct.c
 
-NormalProgramTarget(kdb5_edit,$(OBJS),$(DEPLIBS),$(LOCAL_LIBRARIES),)
+#if HasTcl
+INCLUDES = $(TCLINCLUDES)
+NormalProgramTarget(kdb5_edit.ss,$(MOSTOBJS) $(SSOBJS),$(DEPLIBS),$(LOCAL_LIBRARIES) $(SSLIB),)
+NormalProgramTarget(kdb5_edit.tcl,$(MOSTOBJS) $(TCLOBJS),$(DEPLIBS),$(LOCAL_LIBRARIES) $(TCLLIBS),)
+#else
+NormalProgramTarget(kdb5_edit,$(OBJS),$(DEPLIBS),$(LOCAL_LIBRARIES) $(SSLIB),)
+#endif
+
 Krb5InstallAdminProgram(kdb5_edit)
 
+#if HasTcl
+SaberProgramTarget(kdb5_edit.ss,$(MOSTSRCS) $(CTSRCS),$(OBJS),$(LOCAL_LIBRARIES),)
+SaberProgramTarget(kdb5_edit.tcl,$(MOSTSRCS) $(TCLSRCS),$(OBJS),$(LOCAL_LIBRARIES),)
+#else
 SaberProgramTarget(kdb5_edit,$(SRCS),$(OBJS),$(LOCAL_LIBRARIES),)
+#endif
 
 depend:: kdb5_ed_ct.c
 
index 3a3e6b714fb653929b43bbbabaaf4854c5ff5031..75ffc3da2ffad39e3701177a5d7066b98ba59e22 100644 (file)
@@ -41,10 +41,9 @@ static char rcsid_kdb_edit_c[] =
 #include <krb5/func-proto.h>
 
 #include <com_err.h>
-#include <ss/ss.h>
 #include <stdio.h>
 
-#include "./kdb5_edit.h"
+#include "kdb5_edit.h"
 
 struct dump_record {
        char    *comerr_name;
index ed773d0dbdd48f0c8156abd7a417dc5fba6b4f49..45ddaf017b24c616a1ac12eba46640e695a8587a 100644 (file)
@@ -76,7 +76,7 @@ request change_working_dir, "Change working directory",
        change_working_directory, cwd, cd;
 
 request print_working_dir, "Print working directory",
-       print_working_direcotry, pwd;
+       print_working_directory, pwd;
 
 # list_requests is generic -- unrelated to Kerberos
 request        ss_list_requests, "List available requests.",
index 21227ff773696b6497009a8caea78f2ec3b883d7..09680607fc25507941657bf073a6698629697f09 100644 (file)
@@ -40,10 +40,9 @@ static char rcsid_kdb_edit_c[] =
 #include <krb5/ext-proto.h>
 
 #include <com_err.h>
-#include <ss/ss.h>
 #include <stdio.h>
 
-#include "./kdb5_edit.h"
+#include "kdb5_edit.h"
 
 struct mblock mblock = {                               /* XXX */
     KRB5_KDB_MAX_LIFE,
@@ -86,8 +85,6 @@ krb5_encrypt_block master_encblock;
 krb5_pointer master_random;
 int    valid_master_key = 0;
 
-extern ss_request_table kdb5_edit_cmds;
-
 extern char *krb5_default_pwd_prompt1, *krb5_default_pwd_prompt2;
 
 char *progname;
@@ -96,25 +93,9 @@ char *mkey_name = 0;
 krb5_boolean manual_mkey = FALSE;
 krb5_boolean dbactive = FALSE;
 
-void
-quit()
-{
-    krb5_error_code retval = krb5_db_fini();
-    if (valid_master_key)
-           memset((char *)master_keyblock.contents, 0,
-                  master_keyblock.length);
-    if (retval) {
-       com_err(progname, retval, "while closing database");
-       exit(1);
-    }
-    exit(0);
-}
-
-
-void
-main(argc, argv)
-int argc;
-char *argv[];
+char *kdb5_edit_Init(argc, argv)
+    int argc;
+    char *argv[];
 {
     extern char *optarg;       
     int optchar;
@@ -124,7 +105,6 @@ char *argv[];
     char *defrealm;
     int keytypedone = 0;
     krb5_enctype etype = DEFAULT_KDC_ETYPE;
-    int sci_idx, code;
     extern krb5_kt_ops krb5_ktf_writable_ops;
     char       *request = NULL;
 
@@ -199,14 +179,6 @@ char *argv[];
        exit(1);
     }
     krb5_use_cstype(&master_encblock, etype);
-
-    sci_idx = ss_create_invocation("kdb5_edit", "5.0", (char *) NULL,
-                                  &kdb5_edit_cmds, &retval);
-    if (retval) {
-       ss_perror(sci_idx, retval, "creating invocation");
-       exit(1);
-    }
-
     if (!cur_realm) {
        if (retval = krb5_get_default_realm(&defrealm)) {
            com_err(progname, retval, "while retrieving default realm name");
@@ -220,24 +192,7 @@ char *argv[];
        (void) strcpy(cur_realm, defrealm);
     }
     (void) set_dbname_help(progname, dbname);
-
-    if (request) {
-           (void) ss_execute_line(sci_idx, request, &code);
-           if (code != 0)
-                   ss_perror(sci_idx, code, request);
-    } else
-           ss_listen(sci_idx, &retval);
-    if (valid_master_key) {
-           (void) krb5_finish_key(&master_encblock);
-           (void) krb5_finish_random_key(&master_encblock, &master_random);
-    }
-    retval = krb5_db_fini();
-    memset((char *)master_keyblock.contents, 0, master_keyblock.length);
-    if (retval && retval != KRB5_KDB_DBNOTINITED) {
-       com_err(progname, retval, "while closing database");
-       exit(1);
-    }
-    exit(0);
+    return request;
 }
 
 #define        NO_PRINC ((krb5_kvno)-1)
@@ -360,11 +315,9 @@ OLDDECLARG(struct saltblock *, salt)
 }
 
 void
-set_dbname(argc, argv, sci_idx, infop)
+set_dbname(argc, argv)
 int argc;
 char *argv[];
-int sci_idx;
-krb5_pointer infop;
 {
     krb5_error_code retval;
 
@@ -395,10 +348,8 @@ krb5_pointer infop;
            free(cur_realm);
     cur_realm = malloc(strlen(argv[2])+1);
     if (!cur_realm) {
-       com_err(argv[0], 0, "Insufficient memory to proceed");
-       ss_quit(argc, argv, sci_idx, infop);
-       /*NOTREACHED*/
-       return;
+       (void)quit();
+       exit(1);                /* XXX */
     }
     (void) strcpy(cur_realm, argv[2]);
     (void) set_dbname_help(argv[0], argv[1]);
@@ -504,8 +455,8 @@ char *dbname;
 }
 
 void enter_master_key(argc, argv)
-       int     argc;
-       char    **argv;
+        int argc;
+        char *argv[];
 {
        char    *pname = argv[0];
        krb5_error_code retval;
@@ -560,10 +511,9 @@ static krb5_kt_ops *krb5_kt_dir_array[] = {
 
 krb5_kt_ops **krb5_kt_directory = krb5_kt_dir_array;
 
-void
-extract_srvtab(argc, argv)
-int argc;
-char *argv[];
+void extract_srvtab(argc, argv)
+    int argc;
+    char *argv[];
 {
     char ktname[MAXPATHLEN+sizeof("WRFILE:")+1];
     krb5_keytab ktid;
@@ -670,10 +620,9 @@ char *argv[];
     return;
 }
 
-void
-extract_v4_srvtab(argc, argv)
-int argc;
-char *argv[];
+int extract_v4_srvtab(argc, argv)
+    int argc;
+    char *argv[];
 {
     char ktname[MAXPATHLEN+1];
     FILE       *fout;
@@ -840,10 +789,9 @@ krb5_db_entry *entry;
 }
 
 /*ARGSUSED*/
-void
-list_db(argc, argv)
-int argc;
-char *argv[];
+void list_db(argc, argv)
+    int argc;
+    char *argv[];
 {
     struct list_iterator_struct lis;
     char *start;
@@ -893,10 +841,9 @@ char *argv[];
     (void) krb5_db_iterate(list_iterator, argv[0]);
 }
 
-void
-delete_entry(argc, argv)
-int argc;
-char *argv[];
+int delete_entry(argc, argv)
+    int argc;
+    char *argv[];
 {
     krb5_error_code retval;
     krb5_principal newprinc;
@@ -1057,26 +1004,23 @@ errout:
     return;
 }
 
-void
-add_rnd_key(argc, argv)
-int argc;
-char *argv[];
+void add_rnd_key(argc, argv)
+    int argc;
+    char *argv[];
 {
     enter_rnd_key(argc, argv, 0);
 }
 
-void
-change_rnd_key(argc, argv)
-int argc;
-char *argv[];
+void change_rnd_key(argc, argv)
+    int argc;
+    char *argv[];
 {
     enter_rnd_key(argc, argv, 1);
 }
 
-void
-add_new_key(argc, argv)
-int argc;
-char *argv[];
+void add_new_key(argc, argv)
+    int argc;
+    char *argv[];
 {
     krb5_error_code retval;
     krb5_principal newprinc;
@@ -1117,10 +1061,9 @@ char *argv[];
     return;
 }
 
-void
-add_v4_key(argc, argv)
-int argc;
-char *argv[];
+void add_v4_key(argc, argv)
+    int argc;
+    char *argv[];
 {
     krb5_error_code retval;
     krb5_principal newprinc;
@@ -1149,10 +1092,9 @@ char *argv[];
     return;
 }
 
-void
-change_pwd_key(argc, argv)
-int argc;
-char *argv[];
+void change_pwd_key(argc, argv)
+    int argc;
+    char *argv[];
 {
     krb5_error_code retval;
     krb5_principal newprinc;
@@ -1198,10 +1140,9 @@ char *argv[];
     return;
 }
 
-void
-change_v4_key(argc, argv)
-int argc;
-char *argv[];
+void change_v4_key(argc, argv)
+    int argc;
+    char *argv[];
 {
     krb5_error_code retval;
     krb5_principal newprinc;
@@ -1327,8 +1268,8 @@ OLDDECLARG(int, salttype)
  * XXX Still under construction....
  */
 void show_principal(argc, argv)
-    int        argc;
-    char **argv;
+    int argc;
+    char *argv[];
 {
     krb5_principal princ;
     int nprincs = 1;
@@ -1420,4 +1361,23 @@ void print_working_dir(argc, argv)
        puts(buf);
 }
 
+int quit()
+{
+    krb5_error_code retval;
+    static krb5_boolean finished = 0;
 
+    if (finished)
+       return 0;
+    if (valid_master_key) {
+           (void) krb5_finish_key(&master_encblock);
+           (void) krb5_finish_random_key(&master_encblock, &master_random);
+    }
+    retval = krb5_db_fini();
+    memset((char *)master_keyblock.contents, 0, master_keyblock.length);
+    finished = TRUE;
+    if (retval && retval != KRB5_KDB_DBNOTINITED) {
+       com_err(progname, retval, "while closing database");
+       return 1;
+    }
+    return 0;
+}
index 0a2b99c6d648d77132647f07b0bf775cf1c7ba98..7250163aaa66bddce1f9605d074c773c223e0747 100644 (file)
@@ -51,6 +51,4 @@ void enter_pwd_key PROTOTYPE((char *, char *, krb5_const_principal,
 int set_dbname_help PROTOTYPE((char *, char *));
 
 #include <krb5/narrow.h>
-
-
-
+char *kdb5_edit_Init PROTOTYPE((int, char **));
diff --git a/src/admin/edit/ss_wrapper.c b/src/admin/edit/ss_wrapper.c
new file mode 100644 (file)
index 0000000..0aea4da
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1990,1991 by the Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ *   require a specific license from the United States Government.
+ *   It is the responsibility of any person or organization contemplating
+ *   export to obtain such a license before exporting.
+ * 
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission.  M.I.T. makes no representations about the suitability of
+ * this software for any purpose.  It is provided "as is" without express
+ * or implied warranty.
+ * 
+ *
+ * ss wrapper for kdb5_edit
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_kdb_edit_c[] =
+"$Id$";
+#endif /* !lint & !SABER */
+#include <krb5/krb5.h>
+#include "kdb5_edit.h"
+#include <ss/ss.h>
+#include <stdio.h>
+
+extern ss_request_table kdb5_edit_cmds;
+
+int main(argc, argv)
+    int argc;
+    char *argv[];
+{
+    char *request;
+    krb5_error_code retval;
+    int sci_idx, code;
+
+    request = kdb5_edit_Init(argc, argv);
+    sci_idx = ss_create_invocation("kdb5_edit", "5.0", (char *) NULL,
+                                  &kdb5_edit_cmds, &retval);
+    if (retval) {
+       ss_perror(sci_idx, retval, "creating invocation");
+       exit(1);
+    }
+    if (request) {
+           (void) ss_execute_line(sci_idx, request, &code);
+           if (code != 0)
+                   ss_perror(sci_idx, code, request);
+    } else
+           ss_listen(sci_idx, &retval);
+    return quit();
+}
diff --git a/src/admin/edit/tcl_wrapper.c b/src/admin/edit/tcl_wrapper.c
new file mode 100644 (file)
index 0000000..0b5ddfa
--- /dev/null
@@ -0,0 +1,256 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1990,1991 by the Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ *   require a specific license from the United States Government.
+ *   It is the responsibility of any person or organization contemplating
+ *   export to obtain such a license before exporting.
+ * 
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission.  M.I.T. makes no representations about the suitability of
+ * this software for any purpose.  It is provided "as is" without express
+ * or implied warranty.
+ * 
+ *
+ * Tcl wrapper for kdb5_edit
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_kdb_edit_c[] =
+"$Id$";
+#endif /* !lint & !SABER */
+
+#include <krb5/krb5.h>
+#include "kdb5_edit.h"
+#include <tcl.h>
+
+#define CMDDECL(x) int x(DECLARG(ClientData, clientData),\
+                        DECLARG(Tcl_Interp, interp),\
+                        DECLARG(int, argc),\
+                        DECLARG(char **, argv))\
+OLDDECLARG(ClientData, clientData)\
+OLDDECLARG(Tcl_Interp *, interp)\
+OLDDECLARG(int, argc)\
+OLDDECLARG(char **, argv)
+#define CMDPROTO(x) int x PROTOTYPE((ClientData, Tcl_Interp,\
+                                    int, char **))
+#define MKCMD(name,cmd) Tcl_CreateCommand(interp, name, cmd,\
+                                        (ClientData)NULL,\
+                                        (Tcl_CmdDeleteProc *)NULL)
+
+extern int main();
+int *tclDummyMainPtr = (int *) main; /* force ld to suck in main()
+                                       from libtcl.a */
+extern Tcl_Interp *interp;     /* XXX yes, this is gross,
+                                  but we do need it for some things */
+
+void show_principal PROTOTYPE((int, char **));
+void add_new_key PROTOTYPE((int, char **));
+void change_pwd_key PROTOTYPE((int, char **));
+void add_rnd_key PROTOTYPE((int, char **));
+void change_rnd_key PROTOTYPE((int, char **));
+void add_v4_key PROTOTYPE((int, char **));
+void change_v4_key PROTOTYPE((int, char **));
+void delete_entry PROTOTYPE((int, char **));
+void extract_srvtab PROTOTYPE((int, char **));
+void extract_v4_srvtab PROTOTYPE((int, char **));
+void list_db PROTOTYPE((int, char **));
+void dump_db PROTOTYPE((int, char **));
+void load_db PROTOTYPE((int, char **));
+void set_dbname PROTOTYPE((int, char **));
+void enter_master_key PROTOTYPE((int, char **));
+
+/*
+ * this is mostly stolen from tcl_ExitCmd()
+ * we need to do a few extra things, though...
+ */
+int doquit(clientData, interp, argc, argv)
+    ClientData clientData;
+    Tcl_Interp *interp;
+    int argc;
+    char *argv[];
+{
+    int value;
+
+    if ((argc != 1) && (argc != 2)) {
+       Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
+               " ?returnCode?\"", (char *) NULL);
+       return TCL_ERROR;
+    }
+    if (argc == 1) {
+       if (quit())
+           exit(1);
+       else
+           exit(0);
+    }
+    if (Tcl_GetInt(interp, argv[1], &value) != TCL_OK) {
+       return TCL_ERROR;
+    }
+    (void)quit();
+    exit(value);
+    /*NOTREACHED*/
+    return TCL_OK;                     /* Better not ever reach this! */
+}
+
+int list_requests(clientData, interp, argc, argv)
+    ClientData clientData;
+    Tcl_Interp *interp;
+    int argc;
+    char *argv[];
+{
+    Tcl_SetResult(interp, "show_principal, show: Show the Kerberos database entry for a principal\nadd_new_key, ank: Add new entry to the Kerberos database (prompting for password\nchange_pwd_key, cpw: Change key of an entry in the Kerberos database (prompting for password)\nadd_rnd_key, ark: Add new entry to Kerberos database, using a random key\nchange_rnd_key, crk: Change key of an entry in the Kerberos database (select a random key)\nadd_v4_key, av4k: Add new entry to Kerberos database (using V4 string-to-key)\nchange_v4_key, cv4k: Change key of an entry in the Kerberos database (using V4 string-to-key)\ndelete_entry, delent: Delete an entry from the database\nextract_srvtab, xst, ex_st: Extract service key table\nextract_v4_srvtab, xst4: Extract service key table\nlist_db, ldb: List database entries\nset_dbname, sdbn: Change database name\nenter_master_key, emk: Enter the master key for a database\nchange_working_directory, cwd, cd: Change working directory\nprint_working_directory, pwd: Print working directory\nlist_requests, lr: List available requests\nquit, exit: Exit program", TCL_STATIC);
+    return TCL_OK;
+}
+
+int wrapper(func, interp, argc, argv)
+    void (*func)();
+    Tcl_Interp *interp;
+    int argc;
+    char *argv[];
+{
+    (*func)(argc, argv);
+    return TCL_OK;
+}
+
+int Tcl_AppInit(interp)
+    Tcl_Interp *interp;
+{
+    int argc;
+    char **argv, **mostly_argv;
+    char *interp_argv, *interp_argv0, *request;
+    Tcl_CmdInfo cmdInfo;
+
+    if (Tcl_Init(interp) == TCL_ERROR)
+       return TCL_ERROR;
+    /*
+     * the following is, admittedly, sorta gross, but the only way
+     * to grab the original argc, argv once the interpreter is running
+     */
+    interp_argv = Tcl_GetVar(interp, "argv", 0);
+    if (interp_argv == NULL)
+       return TCL_ERROR;
+    else if (Tcl_SplitList(interp, interp_argv,
+                          &argc, &mostly_argv) != TCL_OK)
+       return TCL_ERROR;
+    interp_argv0 = Tcl_GetVar(interp, "argv0", 0);
+    if (interp_argv0 == NULL)
+       return TCL_ERROR;
+    if ((argv = (char **)malloc((argc + 1) * sizeof (char *))) == NULL)
+       return TCL_ERROR;
+    argv[0] = interp_argv0;
+    memcpy(argv + 1, mostly_argv, argc++ * sizeof (char *));
+    /*
+     * set up a prompt
+     */
+    if (Tcl_SetVar(interp, "tcl_prompt1",
+                  "puts -nonewline \"kdb5_edit: \"", 0) == NULL)
+       return TCL_ERROR;
+    /*
+     * we don't want arbitrary programs to get exec'd by accident
+     */
+    if (Tcl_SetVar(interp, "auto_noexec", "{}", 0) == NULL)
+       return TCL_ERROR;
+    request = kdb5_edit_Init(argc, argv);
+    Tcl_CallWhenDeleted(interp, doquit,
+                       (ClientData)0);
+    Tcl_CreateCommand(interp, "quit", doquit,
+                     (ClientData)0,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "exit", doquit,
+                     (ClientData)0,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "list_requests", list_requests,
+                     (ClientData)0,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "lr", list_requests,
+                     (ClientData)0,
+                     (Tcl_CmdDeleteProc *)0);
+    if (Tcl_GetCommandInfo(interp, "cd", &cmdInfo)) {
+       Tcl_CreateCommand(interp, "cwd", cmdInfo.proc,
+                         (ClientData)0,
+                         (Tcl_CmdDeleteProc *)0);
+       Tcl_CreateCommand(interp, "change_working_directory", cmdInfo.proc,
+                         (ClientData)0,
+                         (Tcl_CmdDeleteProc *)0);
+    }
+    if (Tcl_GetCommandInfo(interp, "pwd", &cmdInfo)) {
+       Tcl_CreateCommand(interp, "print_working_directory", cmdInfo.proc,
+                         (ClientData)0,
+                         (Tcl_CmdDeleteProc *)0);
+    }
+    Tcl_CreateCommand(interp, "show_principal", wrapper, show_principal,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "show", wrapper, show_principal,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "add_new_key", wrapper, add_new_key,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "ank", wrapper, add_new_key,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "change_pwd_key", wrapper, change_pwd_key,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "cpw", wrapper, change_pwd_key,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "add_rnd_key", wrapper, add_rnd_key,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "ark", wrapper, add_rnd_key,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "change_rnd_key", wrapper, change_rnd_key,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "crk", wrapper, change_rnd_key,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "add_v4_key", wrapper, add_v4_key,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "av4k", wrapper, add_v4_key,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "change_v4_key", wrapper, change_v4_key,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "cv4k", wrapper, change_v4_key,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "delete_entry", wrapper, delete_entry,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "delent", wrapper, delete_entry,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "extract_srvtab", wrapper, extract_srvtab,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "xst", wrapper, extract_srvtab,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "ex_st", wrapper, extract_srvtab,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "extract_v4_srvtab", wrapper, extract_v4_srvtab,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "xv4st", wrapper, extract_v4_srvtab,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "list_db", wrapper, list_db,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "ldb", wrapper, list_db,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "dump_db", wrapper, dump_db,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "ddb", wrapper, dump_db,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "load_db", wrapper, load_db,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "lddb", wrapper, load_db,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "set_dbname", wrapper, set_dbname,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "sdbn", wrapper, set_dbname,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "enter_master_key", wrapper, enter_master_key,
+                     (Tcl_CmdDeleteProc *)0);
+    Tcl_CreateCommand(interp, "emk", wrapper, enter_master_key,
+                     (Tcl_CmdDeleteProc *)0);
+    if (request && (Tcl_Eval(interp, request) == TCL_ERROR))
+       return TCL_ERROR;
+    return TCL_OK;
+}