summaryrefslogtreecommitdiff
path: root/usr/src/lib/krb5/ss
diff options
context:
space:
mode:
authorstevel@tonic-gate <none@none>2005-06-14 00:00:00 -0700
committerstevel@tonic-gate <none@none>2005-06-14 00:00:00 -0700
commit7c478bd95313f5f23a4c958a745db2134aa03244 (patch)
treec871e58545497667cbb4b0a4f2daf204743e1fe7 /usr/src/lib/krb5/ss
downloadillumos-joyent-7c478bd95313f5f23a4c958a745db2134aa03244.tar.gz
OpenSolaris Launch
Diffstat (limited to 'usr/src/lib/krb5/ss')
-rw-r--r--usr/src/lib/krb5/ss/Makefile48
-rw-r--r--usr/src/lib/krb5/ss/Makefile.com72
-rw-r--r--usr/src/lib/krb5/ss/copyright.h21
-rw-r--r--usr/src/lib/krb5/ss/data.c23
-rw-r--r--usr/src/lib/krb5/ss/error.c106
-rw-r--r--usr/src/lib/krb5/ss/execute_cmd.c228
-rw-r--r--usr/src/lib/krb5/ss/help.c162
-rw-r--r--usr/src/lib/krb5/ss/i386/Makefile13
-rw-r--r--usr/src/lib/krb5/ss/invocation.c79
-rw-r--r--usr/src/lib/krb5/ss/list_rqs.c132
-rw-r--r--usr/src/lib/krb5/ss/listen.c183
-rw-r--r--usr/src/lib/krb5/ss/mit-sipb-copyright.h20
-rw-r--r--usr/src/lib/krb5/ss/mk_cmds.c103
-rw-r--r--usr/src/lib/krb5/ss/options.c34
-rw-r--r--usr/src/lib/krb5/ss/pager.c118
-rw-r--r--usr/src/lib/krb5/ss/parse.c144
-rw-r--r--usr/src/lib/krb5/ss/prompt.c35
-rw-r--r--usr/src/lib/krb5/ss/request_tbl.c72
-rw-r--r--usr/src/lib/krb5/ss/requests.c67
-rw-r--r--usr/src/lib/krb5/ss/sparc/Makefile13
-rw-r--r--usr/src/lib/krb5/ss/spec/Makefile9
-rw-r--r--usr/src/lib/krb5/ss/spec/Makefile.targ12
-rw-r--r--usr/src/lib/krb5/ss/spec/amd64/Makefile26
-rw-r--r--usr/src/lib/krb5/ss/spec/i386/Makefile23
-rw-r--r--usr/src/lib/krb5/ss/spec/sparc/Makefile25
-rw-r--r--usr/src/lib/krb5/ss/spec/sparcv9/Makefile27
-rw-r--r--usr/src/lib/krb5/ss/spec/ss.spec155
-rw-r--r--usr/src/lib/krb5/ss/spec/versions19
-rw-r--r--usr/src/lib/krb5/ss/ss.h70
-rw-r--r--usr/src/lib/krb5/ss/ss_err.h21
-rw-r--r--usr/src/lib/krb5/ss/ss_internal.h128
-rw-r--r--usr/src/lib/krb5/ss/std_rqs.c110
-rw-r--r--usr/src/lib/krb5/ss/utils.c139
33 files changed, 2437 insertions, 0 deletions
diff --git a/usr/src/lib/krb5/ss/Makefile b/usr/src/lib/krb5/ss/Makefile
new file mode 100644
index 0000000000..1f89b37fd5
--- /dev/null
+++ b/usr/src/lib/krb5/ss/Makefile
@@ -0,0 +1,48 @@
+#
+# Copyright (c) 1997-2001 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+#pragma ident "%Z%%M% %I% %E% SMI"
+#
+# lib/krb5/ss/Makefile
+
+include ../Makefile.lib
+
+SUBDIRS= spec $(MACH)
+
+all := TARGET= all
+clean := TARGET= clean
+clobber := TARGET= clobber
+install := TARGET= install
+lint := TARGET= lint
+
+LIBRARY= libss.a
+
+POFILE = $(LIBRARY:%.a=%.po)
+POFILES = generic.po
+
+.KEEP_STATE:
+
+all clean clobber install lint: $(SUBDIRS)
+
+$(MACH) spec: FRC
+ @cd $@; pwd; $(MAKE) $(TARGET)
+
+FRC:
+
+_msg: $(MSGDOMAIN) .WAIT $(POFILE)
+ $(RM) $(MSGDOMAIN)/$(POFILE)
+ $(CP) $(POFILE) $(MSGDOMAIN)
+
+$(POFILE): $(DERIVED_FILES) .WAIT $(POFILES)
+ $(RM) $@
+ $(CAT) $(POFILES) > $@
+
+generic.po: FRC
+ $(RM) messages.po
+ $(XGETTEXT) $(XGETFLAGS) `$(GREP) -l gettext *.[ch]`
+ $(SED) "/^domain/d" messages.po > $@
+ $(RM) messages.po
+
+$(MSGDOMAIN):
+ $(INS.dir)
diff --git a/usr/src/lib/krb5/ss/Makefile.com b/usr/src/lib/krb5/ss/Makefile.com
new file mode 100644
index 0000000000..95500fd3a2
--- /dev/null
+++ b/usr/src/lib/krb5/ss/Makefile.com
@@ -0,0 +1,72 @@
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+# lib/krb5/ss/Makefile.com
+#
+
+LIBRARY= libss.a
+VERS= .1
+
+SSOBJS= \
+ data.o \
+ error.o \
+ execute_cmd.o \
+ help.o \
+ invocation.o \
+ list_rqs.o \
+ listen.o \
+ pager.o \
+ parse.o \
+ prompt.o \
+ request_tbl.o \
+ requests.o \
+ std_rqs.o
+
+OBJECTS= $(SSOBJS)
+
+# include library definitions
+include ../../Makefile.lib
+
+SRCS= $(SSOBJS:%.o=../%.c)
+
+LIBS= $(DYNLIB)
+
+include $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5
+
+#override liblink
+INS.liblink= -$(RM) $@; $(SYMLINK) $(LIBLINKS)$(VERS) $@
+
+CPPFLAGS += -DHAVE_LIBSOCKET=1 -DHAVE_LIBNSL=1 -DHAS_STRDUP=1 \
+ -DUSE_DIRENT_H=1 -DWAIT_USES_INT=1 -DPOSIX_SIGNALS=1 \
+ -D_REENTRANT -DUSE_SIGPROCMASK=1 -DRETSIGTYPE=void \
+ -DHAVE_STDARG_H=1 -DHAVE_STDLIB_H=1 -DHAVE_COMPILE=1 \
+ -DHAVE_UNISTD_H=1 -DHAVE_UMASK=1 -DHAVE_SRAND48=1 \
+ -DHAVESRAND=1 -DHAVESRANDOM=1 -DHAVE_RE_COMP=1 \
+ -DHAVE_RE_EXEC=1 -DHAVE_REGCOMP=1 -DHAVE_REGEXEC=1 \
+ -I$(SRC)/lib/gss_mechs/mech_krb5/include \
+ -I$(SRC)/lib/krb5
+
+CFLAGS += $(CCVERBOSE) -I..
+
+DYNFLAGS += $(KRUNPATH) $(KMECHLIB)
+
+LDLIBS += -lc
+
+$(PICS) := CFLAGS += $(XFFLAG)
+
+.KEEP_STATE:
+
+all: $(LIBS)
+
+lint: lintcheck
+
+$(DYNLIB): $(MAPFILE)
+
+$(MAPFILE):
+ @cd $(MAPDIR); $(MAKE) mapfile
+
+# include library targets
+include ../../Makefile.targ
diff --git a/usr/src/lib/krb5/ss/copyright.h b/usr/src/lib/krb5/ss/copyright.h
new file mode 100644
index 0000000000..3a8663ae42
--- /dev/null
+++ b/usr/src/lib/krb5/ss/copyright.h
@@ -0,0 +1,21 @@
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+
+Copyright 1987, 1989 by the Student Information Processing Board
+ of the Massachusetts Institute of Technology
+
+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 names of M.I.T. and the M.I.T. S.I.P.B. not be
+used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+M.I.T. and the M.I.T. S.I.P.B. make no representations about
+the suitability of this software for any purpose. It is
+provided "as is" without express or implied warranty.
+
+*/
+
diff --git a/usr/src/lib/krb5/ss/data.c b/usr/src/lib/krb5/ss/data.c
new file mode 100644
index 0000000000..2bf27a5da2
--- /dev/null
+++ b/usr/src/lib/krb5/ss/data.c
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2000 by Sun Microsystems, Inc.
+ * All rights reserved.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * Copyright 1987, 1988, 1989 Massachusetts Institute of Technology
+ * (Student Information Processing Board)
+ *
+ * For copyright info, see copyright.h.
+ */
+
+#include <stdio.h>
+#include "ss_internal.h"
+#include "copyright.h"
+
+static const char copyright[] =
+ "Copyright 1987, 1988, 1989 by the Massachusetts Institute of Technology";
+
+ss_data **_ss_table = (ss_data **)NULL;
+char *_ss_pager_name = (char *)NULL;
diff --git a/usr/src/lib/krb5/ss/error.c b/usr/src/lib/krb5/ss/error.c
new file mode 100644
index 0000000000..a15a04378e
--- /dev/null
+++ b/usr/src/lib/krb5/ss/error.c
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2000 by Sun Microsystems, Inc.
+ * All rights reserved.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * Copyright 1987, 1988, 1989 by MIT Student Information Processing
+ * Board
+ *
+ * For copyright information, see copyright.h.
+ */
+
+#include <stdio.h>
+
+/*
+ * I'm assuming that com_err.h includes varargs.h, which it does
+ * (right now). There really ought to be a way for me to include the
+ * file without worrying about whether com_err.h includes it or not,
+ * but varargs.h doesn't define anything that I can use as a flag, and
+ * gcc will lose if I try to include it twice and redefine stuff.
+ */
+#if !defined(__STDC__) || !defined(ibm032) || !defined(NeXT)
+#define ss_error ss_error_external
+#endif
+
+#include "copyright.h"
+#include "com_err.h"
+#include "ss_internal.h"
+
+extern void com_err_va ();
+
+#undef ss_error
+
+char * ss_name(sci_idx)
+ int sci_idx;
+{
+ register char *ret_val;
+ register ss_data *infop;
+
+ infop = ss_info(sci_idx);
+ if (infop->current_request == (char const *)NULL) {
+ ret_val = malloc((unsigned)
+ (strlen(infop->subsystem_name)+1)
+ * sizeof(char));
+ if (ret_val == (char *)NULL)
+ return((char *)NULL);
+ strcpy(ret_val, infop->subsystem_name);
+ return(ret_val);
+ }
+ else {
+ register char *cp;
+ register char const *cp1;
+ ret_val = malloc((unsigned)sizeof(char) *
+ (strlen(infop->subsystem_name)+
+ strlen(infop->current_request)+
+ 4));
+ cp = ret_val;
+ cp1 = infop->subsystem_name;
+ while (*cp1)
+ *cp++ = *cp1++;
+ *cp++ = ' ';
+ *cp++ = '(';
+ cp1 = infop->current_request;
+ while (*cp1)
+ *cp++ = *cp1++;
+ *cp++ = ')';
+ *cp = '\0';
+ return(ret_val);
+ }
+}
+
+#ifdef HAVE_STDARG_H
+void ss_error (int sci_idx, long code, const char * fmt, ...)
+#else
+void ss_error (va_alist)
+ va_dcl
+#endif
+{
+ register char *whoami;
+ va_list pvar;
+#ifndef HAVE_STDARG_H
+ int sci_idx;
+ long code;
+ char * fmt;
+ va_start (pvar);
+ sci_idx = va_arg (pvar, int);
+ code = va_arg (pvar, long);
+ fmt = va_arg (pvar, char *);
+#else
+ va_start (pvar, fmt);
+#endif
+ whoami = ss_name (sci_idx);
+ com_err_va (whoami, code, fmt, pvar);
+ free (whoami);
+ va_end(pvar);
+}
+
+void ss_perror (sci_idx, code, msg) /* for compatibility */
+ int sci_idx;
+ long code;
+ char const *msg;
+{
+ ss_error (sci_idx, code, "%s", msg);
+}
diff --git a/usr/src/lib/krb5/ss/execute_cmd.c b/usr/src/lib/krb5/ss/execute_cmd.c
new file mode 100644
index 0000000000..ca6108cb49
--- /dev/null
+++ b/usr/src/lib/krb5/ss/execute_cmd.c
@@ -0,0 +1,228 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * Copyright 1987, 1988, 1989 by Massachusetts Institute of Technology
+ *
+ * For copyright info, see copyright.h.
+ */
+
+#include "ss_internal.h"
+#include "copyright.h"
+#include <stdio.h>
+
+
+/*
+ * get_request(tbl, idx)
+ *
+ * Function:
+ * Gets the idx'th request from the request table pointed to
+ * by tbl.
+ * Arguments:
+ * tbl (ss_request_table *)
+ * pointer to request table
+ * idx (int)
+ * index into table
+ * Returns:
+ * (ss_request_entry *)
+ * pointer to request table entry
+ * Notes:
+ * Has been replaced by a macro.
+ */
+
+#ifdef __SABER__
+/* sigh. saber won't deal with pointer-to-const-struct */
+static struct _ss_request_entry * get_request (tbl, idx)
+ ss_request_table * tbl;
+ int idx;
+{
+ struct _ss_request_table *tbl1 = (struct _ss_request_table *) tbl;
+ struct _ss_request_entry *e = (struct _ss_request_entry *) tbl1->requests;
+ return e + idx;
+}
+#else
+#define get_request(tbl,idx) ((tbl) -> requests + (idx))
+#endif
+
+/*
+ * check_request_table(rqtbl, argc, argv, sci_idx)
+ *
+ * Function:
+ * If the command string in argv[0] is in the request table, execute
+ * the commands and return error code 0. Otherwise, return error
+ * code ss_et_command_not_found.
+ * Arguments:
+ * rqtbl (ss_request_table *)
+ * pointer to request table
+ * argc (int)
+ * number of elements in argv[]
+ * argv (char *[])
+ * argument string array
+ * sci_idx (int)
+ * ss-internal index for subsystem control info structure
+ * Returns:
+ * (int)
+ * zero if command found, ss_et_command_not_found otherwise
+ * Notes:
+ */
+
+static int check_request_table (rqtbl, argc, argv, sci_idx)
+ register ss_request_table *rqtbl;
+ int argc;
+ char *argv[];
+ int sci_idx;
+{
+#ifdef __SABER__
+ struct _ss_request_entry *request;
+#else
+ register ss_request_entry *request;
+#endif
+ register ss_data *info;
+ register char const * const * name;
+ char *string = argv[0];
+ int i;
+
+ info = ss_info(sci_idx);
+ info->argc = argc;
+ info->argv = argv;
+ for (i = 0; (request = get_request(rqtbl, i))->command_names; i++) {
+ for (name = request->command_names; *name; name++)
+ if (!strcmp(*name, string)) {
+ info->current_request = request->command_names[0];
+ (request->function)(argc, (const char *const *) argv,
+ sci_idx,info->info_ptr);
+ info->current_request = (char *)NULL;
+ return(0);
+ }
+ }
+ return(SS_ET_COMMAND_NOT_FOUND);
+}
+
+/*
+ * really_execute_command(sci_idx, argc, argv)
+ *
+ * Function:
+ * Fills in the argc, argv values in the subsystem entry and
+ * call the appropriate routine.
+ * Arguments:
+ * sci_idx (int)
+ * ss-internal index for subsystem control info structure
+ * argc (int)
+ * number of arguments in argument list
+ * argv (char **[])
+ * pointer to parsed argument list (may be reallocated
+ * on abbrev expansion)
+ *
+ * Returns:
+ * (int)
+ * Zero if successful, ss_et_command_not_found otherwise.
+ * Notes:
+ */
+
+static int really_execute_command (sci_idx, argc, argv)
+ int sci_idx;
+ int argc;
+ char **argv[];
+{
+ register ss_request_table **rqtbl;
+ register ss_data *info;
+
+ info = ss_info(sci_idx);
+
+ for (rqtbl = info->rqt_tables; *rqtbl; rqtbl++) {
+ if (check_request_table (*rqtbl, argc, *argv, sci_idx) == 0)
+ return(0);
+ }
+ return(SS_ET_COMMAND_NOT_FOUND);
+}
+
+/*
+ * ss_execute_command(sci_idx, argv)
+ *
+ * Function:
+ * Executes a parsed command list within the subsystem.
+ * Arguments:
+ * sci_idx (int)
+ * ss-internal index for subsystem control info structure
+ * argv (char *[])
+ * parsed argument list
+ * Returns:
+ * (int)
+ * Zero if successful, ss_et_command_not_found otherwise.
+ * Notes:
+ */
+
+int
+ss_execute_command(sci_idx, argv)
+ int sci_idx;
+ register char *argv[];
+{
+ register int i, argc;
+ char **argp;
+
+ argc = 0;
+ for (argp = argv; *argp; argp++)
+ argc++;
+ argp = (char **)malloc((argc+1)*sizeof(char *));
+ for (i = 0; i <= argc; i++)
+ argp[i] = argv[i];
+ i = really_execute_command(sci_idx, argc, &argp);
+ free(argp);
+ return(i);
+}
+
+/*
+ * ss_execute_line(sci_idx, line_ptr)
+ *
+ * Function:
+ * Parses and executes a command line within a subsystem.
+ * Arguments:
+ * sci_idx (int)
+ * ss-internal index for subsystem control info structure
+ * line_ptr (char *)
+ * Pointer to command line to be parsed.
+ * Returns:
+ * (int)
+ * Error code.
+ * Notes:
+ */
+
+int ss_execute_line (sci_idx, line_ptr)
+ int sci_idx;
+ char *line_ptr;
+{
+ char **argv;
+ int argc;
+ int rc;
+
+ /* flush leading whitespace */
+ while (line_ptr[0] == ' ' || line_ptr[0] == '\t')
+ line_ptr++;
+
+ /* check if it should be sent to operating system for execution */
+ if (*line_ptr == '!') {
+ if (ss_info(sci_idx)->flags.escape_disabled)
+ return SS_ET_ESCAPE_DISABLED;
+ else {
+ line_ptr++;
+ system(line_ptr);
+ return 0;
+ }
+ }
+
+ /* parse it */
+ argv = ss_parse(sci_idx, line_ptr, &argc);
+ if (argc == 0)
+ return 0;
+
+ /* look it up in the request tables, execute if found */
+ rc = really_execute_command (sci_idx, argc, &argv);
+
+ free(argv);
+
+ return (rc);
+}
diff --git a/usr/src/lib/krb5/ss/help.c b/usr/src/lib/krb5/ss/help.c
new file mode 100644
index 0000000000..5979e45463
--- /dev/null
+++ b/usr/src/lib/krb5/ss/help.c
@@ -0,0 +1,162 @@
+/*
+ * Copyright 2000-2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * Copyright 1987, 1988 by MIT Student Information Processing Board
+ *
+ * For copyright info, see copyright.h.
+ */
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/file.h>
+#include <fcntl.h> /* just for O_* */
+#include <sys/wait.h>
+#include "ss_internal.h"
+#include "copyright.h"
+#include <libintl.h>
+#include <errno.h>
+
+extern void ss_list_requests();
+
+void ss_help (argc, argv, sci_idx, info_ptr)
+ int argc;
+ char const * const *argv;
+ int sci_idx;
+ pointer info_ptr;
+{
+ char buffer[MAXPATHLEN];
+ char const *request_name;
+ int code;
+ int fd, child;
+ register int idx;
+ register ss_data *info;
+
+ request_name = ss_current_request(sci_idx, &code);
+ if (code != 0) {
+ ss_perror(sci_idx, code, "");
+ return; /* no ss_abort_line, if invalid invocation */
+ }
+ if (argc == 1) {
+ ss_list_requests(argc, argv, sci_idx, info_ptr);
+ return;
+ }
+ else if (argc != 2) {
+ /* should do something better than this */
+ snprintf(buffer, sizeof (buffer), (char *)dgettext(TEXT_DOMAIN,
+ "usage:\n\t%s [topic|command]\nor\t%s\n"),
+ request_name, request_name);
+ ss_perror(sci_idx, 0, buffer);
+ return;
+ }
+ info = ss_info(sci_idx);
+ if (info->info_dirs == (char **)NULL) {
+ ss_perror(sci_idx, SS_ET_NO_INFO_DIR, (char *)NULL);
+ return;
+ }
+ if (info->info_dirs[0] == (char *)NULL) {
+ ss_perror(sci_idx, SS_ET_NO_INFO_DIR, (char *)NULL);
+ return;
+ }
+ for (idx = 0; info->info_dirs[idx] != (char *)NULL; idx++) {
+ (void) strcpy(buffer, info->info_dirs[idx]);
+ (void) strcat(buffer, "/");
+ (void) strcat(buffer, argv[1]);
+ (void) strcat(buffer, ".info");
+ if ((fd = open(&buffer[0], O_RDONLY)) >= 0) goto got_it;
+ }
+ if ((fd = open(&buffer[0], O_RDONLY)) < 0) {
+ char buf[MAXPATHLEN];
+ strcpy(buf, "No info found for ");
+ strcat(buf, argv[1]);
+ ss_perror(sci_idx, 0, buf);
+ return;
+ }
+got_it:
+ switch (child = fork()) {
+ case -1:
+ ss_perror(sci_idx, errno, "Can't fork for pager");
+ return;
+ case 0:
+ (void) dup2(fd, 0); /* put file on stdin */
+ ss_page_stdin();
+ default:
+ (void) close(fd); /* what can we do if it fails? */
+#ifdef WAIT_USES_INT
+ while (wait((int *)NULL) != child) {
+#else
+ while (wait((union wait *)NULL) != child) {
+#endif
+ /* do nothing if wrong pid */
+ };
+ }
+}
+
+#ifndef USE_DIRENT_H
+#include <sys/dir.h>
+#else
+#include <dirent.h>
+#endif
+
+void ss_add_info_dir(sci_idx, info_dir, code_ptr)
+ int sci_idx;
+ char *info_dir;
+ int *code_ptr;
+{
+ register ss_data *info;
+ DIR *d;
+ int n_dirs;
+ register char **dirs;
+
+ info = ss_info(sci_idx);
+ if (info_dir == NULL && *info_dir) {
+ *code_ptr = SS_ET_NO_INFO_DIR;
+ return;
+ }
+ if ((d = opendir(info_dir)) == (DIR *)NULL) {
+ *code_ptr = errno;
+ return;
+ }
+ closedir(d);
+ dirs = info->info_dirs;
+ for (n_dirs = 0; dirs[n_dirs] != (char *)NULL; n_dirs++)
+ ; /* get number of non-NULL dir entries */
+ dirs = (char **)realloc((char *)dirs,
+ (unsigned)(n_dirs + 2)*sizeof(char *));
+ if (dirs == (char **)NULL) {
+ info->info_dirs = (char **)NULL;
+ *code_ptr = errno;
+ return;
+ }
+ info->info_dirs = dirs;
+ dirs[n_dirs + 1] = (char *)NULL;
+ dirs[n_dirs] = malloc((unsigned)strlen(info_dir)+1);
+ strcpy(dirs[n_dirs], info_dir);
+ *code_ptr = 0;
+}
+
+void ss_delete_info_dir(sci_idx, info_dir, code_ptr)
+ int sci_idx;
+ char *info_dir;
+ int *code_ptr;
+{
+ register char **i_d;
+ register char **info_dirs;
+
+ info_dirs = ss_info(sci_idx)->info_dirs;
+ for (i_d = info_dirs; *i_d; i_d++) {
+ if (!strcmp(*i_d, info_dir)) {
+ while (*i_d) {
+ *i_d = *(i_d+1);
+ i_d++;
+ }
+ *code_ptr = 0;
+ return;
+ }
+ }
+ *code_ptr = SS_ET_NO_INFO_DIR;
+}
diff --git a/usr/src/lib/krb5/ss/i386/Makefile b/usr/src/lib/krb5/ss/i386/Makefile
new file mode 100644
index 0000000000..294b6be277
--- /dev/null
+++ b/usr/src/lib/krb5/ss/i386/Makefile
@@ -0,0 +1,13 @@
+#
+# Copyright (c) 1997-2001 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+#pragma ident "%Z%%M% %I% %E% SMI"
+#
+# lib/krb5/ss/i386/Makefile
+
+MAPDIR= ../spec/i386
+
+include ../Makefile.com
+
+install: all $(ROOTLIBDIR) $(ROOTLIBS) $(ROOTLINKS)
diff --git a/usr/src/lib/krb5/ss/invocation.c b/usr/src/lib/krb5/ss/invocation.c
new file mode 100644
index 0000000000..94b3de637f
--- /dev/null
+++ b/usr/src/lib/krb5/ss/invocation.c
@@ -0,0 +1,79 @@
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * Copyright 1987, 1988 by MIT Student Information Processing Board
+ *
+ * For copyright information, see copyright.h.
+ */
+#include "ss_internal.h"
+#include "copyright.h"
+#define size sizeof(ss_data *)
+
+
+int ss_create_invocation(subsystem_name, version_string, info_ptr,
+ request_table_ptr, code_ptr)
+ char *subsystem_name, *version_string;
+ char *info_ptr;
+ ss_request_table *request_table_ptr;
+ int *code_ptr;
+{
+ register int sci_idx;
+ register ss_data *new_table;
+ register ss_data **table;
+
+ *code_ptr = 0;
+ table = _ss_table;
+ new_table = (ss_data *) malloc(sizeof(ss_data));
+
+ if (table == (ss_data **) NULL) {
+ table = (ss_data **) malloc(2 * size);
+ table[0] = table[1] = (ss_data *)NULL;
+ }
+
+ for (sci_idx = 1; table[sci_idx] != (ss_data *)NULL; sci_idx++)
+ ;
+ table = (ss_data **) realloc((char *)table,
+ ((unsigned)sci_idx+2)*size);
+ table[sci_idx+1] = (ss_data *) NULL;
+ table[sci_idx] = new_table;
+
+ new_table->subsystem_name = subsystem_name;
+ new_table->subsystem_version = version_string;
+ new_table->argv = (char **)NULL;
+ new_table->current_request = (char *)NULL;
+ new_table->info_dirs = (char **)malloc(sizeof(char *));
+ *new_table->info_dirs = (char *)NULL;
+ new_table->info_ptr = info_ptr;
+ new_table->prompt = malloc((unsigned)strlen(subsystem_name)+4);
+ strcpy(new_table->prompt, subsystem_name);
+ strcat(new_table->prompt, ": ");
+#ifdef silly
+ new_table->abbrev_info = ss_abbrev_initialize("/etc/passwd", code_ptr);
+#else
+ new_table->abbrev_info = NULL;
+#endif
+ new_table->flags.escape_disabled = 0;
+ new_table->flags.abbrevs_disabled = 0;
+ new_table->rqt_tables =
+ (ss_request_table **) calloc(2, sizeof(ss_request_table *));
+ *(new_table->rqt_tables) = request_table_ptr;
+ *(new_table->rqt_tables+1) = (ss_request_table *) NULL;
+ _ss_table = table;
+ return(sci_idx);
+}
+
+void
+ss_delete_invocation(sci_idx)
+ int sci_idx;
+{
+ register ss_data *t;
+ int ignored_code;
+
+ t = ss_info(sci_idx);
+ free(t->prompt);
+ free((char *)t->rqt_tables);
+ while(t->info_dirs[0] != (char *)NULL)
+ ss_delete_info_dir(sci_idx, t->info_dirs[0], &ignored_code);
+ free((char *)t->info_dirs);
+ free((char *)t);
+}
diff --git a/usr/src/lib/krb5/ss/list_rqs.c b/usr/src/lib/krb5/ss/list_rqs.c
new file mode 100644
index 0000000000..53dc909d13
--- /dev/null
+++ b/usr/src/lib/krb5/ss/list_rqs.c
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2000 by Sun Microsystems, Inc.
+ * All rights reserved.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * Copyright 1987, 1988 by MIT Student Information Processing Board
+ *
+ * For copyright information, see copyright.h.
+ */
+#include "copyright.h"
+#include "ss_internal.h"
+#include <libintl.h>
+#include <signal.h>
+#include <setjmp.h>
+#include <sys/wait.h>
+
+#ifdef lint /* "lint returns a value which is sometimes ignored" */
+#define DONT_USE(x) x=x;
+#else /* !lint */
+#define DONT_USE(x) ;
+#endif /* lint */
+
+extern int ss_pager_create();
+
+static char const twentyfive_spaces[26] =
+ " ";
+static char const NL[2] = "\n";
+
+void
+ss_list_requests(argc, argv, sci_idx, info_ptr)
+ int argc;
+ char **argv;
+ int sci_idx;
+ pointer info_ptr;
+{
+ register ss_request_entry *entry;
+ register char const * const *name;
+ register int spacing;
+ register ss_request_table **table;
+
+ char buffer[BUFSIZ];
+ FILE *output;
+ int fd;
+#ifdef POSIX_SIGNALS
+ struct sigaction nsig, osig;
+ sigset_t nmask, omask;
+#else
+ int mask;
+ RETSIGTYPE (*func)();
+#endif
+#ifndef WAIT_USES_INT
+ union wait waitb;
+#else
+ int waitb;
+#endif
+
+ DONT_USE(argc);
+ DONT_USE(argv);
+
+#ifdef POSIX_SIGNALS
+ sigemptyset(&nmask);
+ sigaddset(&nmask, SIGINT);
+ sigprocmask(SIG_BLOCK, &nmask, &omask);
+
+ nsig.sa_handler = SIG_IGN;
+ sigemptyset(&nsig.sa_mask);
+ nsig.sa_flags = 0;
+ sigaction(SIGINT, &nsig, &osig);
+#else
+ mask = sigblock(sigmask(SIGINT));
+ func = signal(SIGINT, SIG_IGN);
+#endif
+
+ fd = ss_pager_create();
+ output = fdopen(fd, "w");
+
+#ifdef POSIX_SIGNALS
+ sigprocmask(SIG_SETMASK, &omask, (sigset_t *)0);
+#else
+ sigsetmask(mask);
+#endif
+
+ fprintf (output, dgettext(TEXT_DOMAIN, "Available %s requests:\n\n"),
+ ss_info (sci_idx) -> subsystem_name);
+
+ for (table = ss_info(sci_idx)->rqt_tables; *table; table++) {
+ entry = (*table)->requests;
+ for (; entry->command_names; entry++) {
+ spacing = -2;
+ buffer[0] = '\0';
+ if (entry->flags & SS_OPT_DONT_LIST)
+ continue;
+ for (name = entry->command_names; *name; name++) {
+ register int len = strlen(*name);
+ strncat(buffer, *name, len);
+ spacing += len + 2;
+ if (name[1]) {
+ strcat(buffer, ", ");
+ }
+ }
+ if (spacing > 23) {
+ strcat(buffer, NL);
+ fputs(buffer, output);
+ spacing = 0;
+ buffer[0] = '\0';
+ }
+ strncat(buffer, twentyfive_spaces, 25-spacing);
+
+ /*
+ * Due to libss not knowing what TEXT_DOMAIN
+ * the calling application is using for its info_string
+ * messages, we know require the callers (ktutil,kadmin)
+ * to L10N the messages before calling libss.
+ */
+ strcat(buffer, entry->info_string);
+ strcat(buffer, NL);
+ fputs(buffer, output);
+ }
+ }
+ fclose(output);
+#ifndef NO_FORK
+ wait(&waitb);
+#endif
+#ifdef POSIX_SIGNALS
+ sigaction(SIGINT, &osig, (struct sigaction *)0);
+#else
+ (void) signal(SIGINT, func);
+#endif
+}
diff --git a/usr/src/lib/krb5/ss/listen.c b/usr/src/lib/krb5/ss/listen.c
new file mode 100644
index 0000000000..5d4d88f2bd
--- /dev/null
+++ b/usr/src/lib/krb5/ss/listen.c
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2000 by Sun Microsystems, Inc.
+ * All rights reserved.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * Listener loop for subsystem library libss.a.
+ *
+ * util/ss/listen.c
+ *
+ * Copyright 1987, 1988 by MIT Student Information Processing Board
+ *
+ * For copyright information, see copyright.h.
+ */
+
+#include "copyright.h"
+#include "ss_internal.h"
+#include <stdio.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <libintl.h>
+#include <sys/param.h>
+#ifdef BSD
+#include <sgtty.h>
+#endif
+
+static ss_data *current_info;
+static jmp_buf listen_jmpb;
+
+static RETSIGTYPE print_prompt()
+{
+#ifdef BSD
+ /* put input into a reasonable mode */
+ struct sgttyb ttyb;
+ if (ioctl(fileno(stdin), TIOCGETP, &ttyb) != -1) {
+ if (ttyb.sg_flags & (CBREAK|RAW)) {
+ ttyb.sg_flags &= ~(CBREAK|RAW);
+ (void) ioctl(0, TIOCSETP, &ttyb);
+ }
+ }
+#endif
+ (void) fputs(current_info->prompt, stdout);
+ (void) fflush(stdout);
+}
+
+static RETSIGTYPE listen_int_handler(signo)
+ int signo;
+{
+ putc('\n', stdout);
+ longjmp(listen_jmpb, 1);
+}
+
+int ss_listen (sci_idx)
+ int sci_idx;
+{
+ register char *cp;
+ register ss_data *info;
+ char input[BUFSIZ];
+ char buffer[BUFSIZ];
+ char *end = buffer;
+ int code;
+ jmp_buf old_jmpb;
+ ss_data *old_info = current_info;
+#ifdef POSIX_SIGNALS
+ struct sigaction isig, csig, nsig, osig;
+ sigset_t nmask, omask;
+#else
+ register RETSIGTYPE (*sig_cont)();
+ RETSIGTYPE (*sig_int)(), (*old_sig_cont)();
+ int mask;
+#endif
+
+ current_info = info = ss_info(sci_idx);
+ info->abort = 0;
+
+#ifdef POSIX_SIGNALS
+ csig.sa_handler = (RETSIGTYPE (*)())0;
+ sigemptyset(&nmask);
+ sigaddset(&nmask, SIGINT);
+ sigprocmask(SIG_BLOCK, &nmask, &omask);
+#else
+ sig_cont = (RETSIGTYPE (*)())0;
+ mask = sigblock(sigmask(SIGINT));
+#endif
+
+ memcpy(old_jmpb, listen_jmpb, sizeof(jmp_buf));
+
+#ifdef POSIX_SIGNALS
+ nsig.sa_handler = listen_int_handler;
+ sigemptyset(&nsig.sa_mask);
+ nsig.sa_flags = 0;
+ sigaction(SIGINT, &nsig, &isig);
+#else
+ sig_int = signal(SIGINT, listen_int_handler);
+#endif
+
+ setjmp(listen_jmpb);
+
+#ifdef POSIX_SIGNALS
+ sigprocmask(SIG_SETMASK, &omask, (sigset_t *)0);
+#else
+ (void) sigsetmask(mask);
+#endif
+ while(!info->abort) {
+ print_prompt();
+ *end = '\0';
+#ifdef POSIX_SIGNALS
+ nsig.sa_handler = listen_int_handler; /* fgets is not signal-safe */
+ osig = csig;
+ sigaction(SIGCONT, &nsig, &csig);
+ if ((RETSIGTYPE (*)())csig.sa_handler==(RETSIGTYPE (*)())listen_int_handler)
+ csig = osig;
+#else
+ old_sig_cont = sig_cont;
+ sig_cont = signal(SIGCONT, print_prompt);
+ if (sig_cont == print_prompt)
+ sig_cont = old_sig_cont;
+#endif
+ if (fgets(input, BUFSIZ, stdin) != input) {
+ code = SS_ET_EOF;
+ goto egress;
+ }
+ cp = strchr(input, '\n');
+ if (cp) {
+ *cp = '\0';
+ if (cp == input)
+ continue;
+ }
+#ifdef POSIX_SIGNALS
+ sigaction(SIGCONT, &csig, (struct sigaction *)0);
+#else
+ (void) signal(SIGCONT, sig_cont);
+#endif
+ for (end = input; *end; end++)
+ ;
+
+ code = ss_execute_line (sci_idx, input);
+ if (code == SS_ET_COMMAND_NOT_FOUND) {
+ register char *c = input;
+ while (*c == ' ' || *c == '\t')
+ c++;
+ cp = strchr (c, ' ');
+ if (cp)
+ *cp = '\0';
+ cp = strchr (c, '\t');
+ if (cp)
+ *cp = '\0';
+ ss_error (sci_idx, 0, dgettext(TEXT_DOMAIN,
+ "Unknown request \"%s\". Type \"?\" for a request list."),
+ c);
+ }
+ }
+ code = 0;
+egress:
+#ifdef POSIX_SIGNALS
+ sigaction(SIGINT, &isig, (struct sigaction *)0);
+#else
+ (void) signal(SIGINT, sig_int);
+#endif
+ memcpy(listen_jmpb, old_jmpb, sizeof(jmp_buf));
+ current_info = old_info;
+ return code;
+}
+
+void ss_abort_subsystem(sci_idx, code)
+ int sci_idx;
+ int code;
+{
+ ss_info(sci_idx)->abort = 1;
+ ss_info(sci_idx)->exit_status = code;
+
+}
+
+void ss_quit(argc, argv, sci_idx, infop)
+ int argc;
+ char **argv;
+ int sci_idx;
+ pointer infop;
+{
+ ss_abort_subsystem(sci_idx, 0);
+}
diff --git a/usr/src/lib/krb5/ss/mit-sipb-copyright.h b/usr/src/lib/krb5/ss/mit-sipb-copyright.h
new file mode 100644
index 0000000000..d9444d9bd6
--- /dev/null
+++ b/usr/src/lib/krb5/ss/mit-sipb-copyright.h
@@ -0,0 +1,20 @@
+#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+
+Copyright 1987 by the Student Information Processing Board
+ of the Massachusetts Institute of Technology
+
+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 names of M.I.T. and the M.I.T. S.I.P.B. not be
+used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+M.I.T. and the M.I.T. S.I.P.B. make no representations about
+the suitability of this software for any purpose. It is
+provided "as is" without express or implied warranty.
+
+*/
+
diff --git a/usr/src/lib/krb5/ss/mk_cmds.c b/usr/src/lib/krb5/ss/mk_cmds.c
new file mode 100644
index 0000000000..8b2a25a010
--- /dev/null
+++ b/usr/src/lib/krb5/ss/mk_cmds.c
@@ -0,0 +1,103 @@
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * make_commands.c
+ *
+ * util/ss/mk_cmds.c
+ *
+ * Copyright 1987, 1988 by MIT Student Information Processing Board
+ *
+ * For copyright information, see copyright.h.
+ */
+
+#include "copyright.h"
+#include <stdio.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/file.h>
+#include <string.h>
+#include "ss_internal.h"
+
+static const char copyright[] =
+ "Copyright 1987 by MIT Student Information Processing Board";
+
+extern pointer malloc PROTOTYPE((unsigned));
+extern char *last_token;
+extern FILE *output_file;
+
+extern FILE *yyin, *yyout;
+#ifndef NO_YYLINENO
+extern int yylineno;
+#endif
+
+int main(argc, argv)
+ int argc;
+ char **argv;
+{
+ char c_file[MAXPATHLEN];
+ int result;
+ char *path, *p, *q;
+
+ if (argc != 2) {
+ fputs("Usage: ", stderr);
+ fputs(argv[0], stderr);
+ fputs("cmdtbl.ct\n", stderr);
+ exit(1);
+ }
+
+ path = malloc(strlen(argv[1])+4); /* extra space to add ".ct" */
+ strcpy(path, argv[1]);
+ p = strrchr(path, '/');
+ if (p == (char *)NULL)
+ p = path;
+ else
+ p++;
+ p = strrchr(p, '.');
+ if (p == (char *)NULL || strcmp(p, ".ct"))
+ strcat(path, ".ct");
+ yyin = fopen(path, "r");
+ if (!yyin) {
+ perror(path);
+ exit(1);
+ }
+
+ p = strrchr(path, '.');
+ *p = '\0';
+ q = rindex(path, '/');
+ strcpy(c_file, (q) ? q + 1 : path);
+ strcat(c_file, ".c");
+ *p = '.';
+
+ output_file = fopen(c_file, "w+");
+ if (!output_file) {
+ perror(c_file);
+ exit(1);
+ }
+
+ fputs("/* ", output_file);
+ fputs(c_file, output_file);
+ fputs(" - automatically generated from ", output_file);
+ fputs(path, output_file);
+ fputs(" */\n", output_file);
+ fputs("#include <ss/ss.h>\n\n", output_file);
+ fputs("#ifndef __STDC__\n#define const\n#endif\n\n", output_file);
+ /* parse it */
+ result = yyparse();
+ /* put file descriptors back where they belong */
+ fclose(yyin); /* bye bye input file */
+ fclose(output_file); /* bye bye output file */
+
+ return result;
+}
+
+yyerror(s)
+ char *s;
+{
+ fputs(s, stderr);
+#ifdef NO_YYLINENO
+ fprintf(stderr, "\nLast token was '%s'\n", last_token);
+#else
+ fprintf(stderr, "\nLine %d; last token was '%s'\n",
+ yylineno, last_token);
+#endif
+}
diff --git a/usr/src/lib/krb5/ss/options.c b/usr/src/lib/krb5/ss/options.c
new file mode 100644
index 0000000000..18fcabf724
--- /dev/null
+++ b/usr/src/lib/krb5/ss/options.c
@@ -0,0 +1,34 @@
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * Copyright 1987, 1988 by MIT Student Information Processing Board
+ *
+ * For copyright information, see copyright.h.
+ */
+#include "copyright.h"
+#include <stdio.h>
+#include <ss/ss.h>
+
+struct option {
+ char *text;
+ long value;
+};
+
+static struct option options[] = {
+ { "dont_list", SS_OPT_DONT_LIST },
+ { "^list", SS_OPT_DONT_LIST },
+ { "dont_summarize", SS_OPT_DONT_SUMMARIZE },
+ { "^summarize", SS_OPT_DONT_SUMMARIZE },
+ { (char *)NULL, 0 }
+};
+
+long
+flag_val(string)
+ register char *string;
+{
+ register struct option *opt;
+ for (opt = options; opt->text; opt++)
+ if (!strcmp(opt->text, string))
+ return(opt->value);
+ return(0);
+}
diff --git a/usr/src/lib/krb5/ss/pager.c b/usr/src/lib/krb5/ss/pager.c
new file mode 100644
index 0000000000..3972f2fd9f
--- /dev/null
+++ b/usr/src/lib/krb5/ss/pager.c
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * Pager: Routines to create a "more" running out of a particular file
+ * descriptor.
+ *
+ * Copyright 1987, 1988 by MIT Student Information Processing Board
+ *
+ * For copyright information, see copyright.h.
+ */
+
+#include "ss_internal.h"
+#include "copyright.h"
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/file.h>
+#include <signal.h>
+#include <errno.h>
+
+static char MORE[] = "more";
+extern char *_ss_pager_name;
+extern char *getenv();
+
+/*
+ * this needs a *lot* of work....
+ *
+ * run in same process
+ * handle SIGINT sensibly
+ * allow finer control -- put-page-break-here
+ */
+void ss_page_stdin();
+
+#ifndef NO_FORK
+int ss_pager_create()
+{
+ int filedes[2];
+
+ if (pipe(filedes) != 0)
+ return(-1);
+
+ switch(fork()) {
+ case -1:
+ return(-1);
+ case 0:
+ /*
+ * Child; dup read half to 0, close all but 0, 1, and 2
+ */
+ if (dup2(filedes[0], 0) == -1)
+ exit(1);
+ ss_page_stdin();
+ default:
+ /*
+ * Parent: close "read" side of pipe, return
+ * "write" side.
+ */
+ (void) close(filedes[0]);
+ return(filedes[1]);
+ }
+}
+#else /* don't fork */
+int ss_pager_create()
+{
+ int fd;
+ fd = open("/dev/tty", O_WRONLY, 0);
+ return fd;
+}
+#endif
+
+void ss_page_stdin()
+{
+ int i;
+#ifdef POSIX_SIGNALS
+ struct sigaction sa;
+ sigset_t mask;
+#endif
+ /*
+ * Close all fd's, excepting stdin/stdout/stderr
+ */
+ closefrom(3);
+
+#ifdef POSIX_SIGNALS
+ sa.sa_handler = SIG_DFL;
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ sigaction(SIGINT, &sa, (struct sigaction *)0);
+#else
+ (void) signal(SIGINT, SIG_DFL);
+#endif
+ {
+#ifdef POSIX_SIGNALS
+ sigemptyset(&mask);
+ sigaddset(&mask, SIGINT);
+ sigprocmask(SIG_UNBLOCK, &mask, (sigset_t *)0);
+#else
+ int mask = sigblock(0);
+ mask &= ~sigmask(SIGINT);
+ sigsetmask(mask);
+#endif
+ }
+ if (_ss_pager_name == (char *)NULL) {
+ if ((_ss_pager_name = getenv("PAGER")) == (char *)NULL)
+ _ss_pager_name = MORE;
+ }
+ (void) execlp(_ss_pager_name, _ss_pager_name, (char *) NULL);
+ {
+ /* minimal recovery if pager program isn't found */
+ char buf[80];
+ register int n;
+ while ((n = read(0, buf, 80)) > 0)
+ write(1, buf, n);
+ }
+ exit(errno);
+}
diff --git a/usr/src/lib/krb5/ss/parse.c b/usr/src/lib/krb5/ss/parse.c
new file mode 100644
index 0000000000..0bc97db28d
--- /dev/null
+++ b/usr/src/lib/krb5/ss/parse.c
@@ -0,0 +1,144 @@
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * Copyright 1987, 1988 by MIT Student Information Processing Board
+ *
+ * For copyright info, see copyright.h.
+ */
+
+#include "ss_internal.h"
+#include "copyright.h"
+
+/* global indicating if we should be printing debug messages */
+extern int g_displayDebugSS;
+
+
+enum parse_mode { WHITESPACE, TOKEN, QUOTED_STRING };
+
+/*
+ * parse(line_ptr, argc_ptr)
+ *
+ * Function:
+ * Parses line, dividing at whitespace, into tokens, returns
+ * the "argc" and "argv" values.
+ * Arguments:
+ * line_ptr (char *)
+ * Pointer to text string to be parsed.
+ * argc_ptr (int *)
+ * Where to put the "argc" (number of tokens) value.
+ * Returns:
+ * argv (char **)
+ * Series of pointers to parsed tokens.
+ */
+
+#define NEW_ARGV(old,n) (char **)realloc((char *)old,\
+ (unsigned)(n+2)*sizeof(char*))
+
+char **ss_parse (sci_idx, line_ptr, argc_ptr)
+ int sci_idx;
+ register char *line_ptr;
+ int *argc_ptr;
+{
+ register char **argv, *cp;
+ register int argc;
+ register enum parse_mode parse_mode;
+
+ argv = (char **) malloc (sizeof(char *));
+ if (argv == (char **)NULL) {
+ ss_error(sci_idx, errno, "Can't allocate storage");
+ *argc_ptr = 0;
+ return(argv);
+ }
+ *argv = (char *)NULL;
+
+ argc = 0;
+
+ parse_mode = WHITESPACE; /* flushing whitespace */
+ cp = line_ptr; /* cp is for output */
+ while (1) {
+#ifdef DEBUG
+ {
+ if (g_displayDebugSS)
+ printf ("character `%c', mode %d\n",
+ *line_ptr, parse_mode);
+ }
+#endif
+ while (parse_mode == WHITESPACE) {
+ if (*line_ptr == '\0')
+ goto end_of_line;
+ if (*line_ptr == ' ' || *line_ptr == '\t') {
+ line_ptr++;
+ continue;
+ }
+ if (*line_ptr == '"') {
+ /* go to quoted-string mode */
+ parse_mode = QUOTED_STRING;
+ cp = line_ptr++;
+ argv = NEW_ARGV (argv, argc);
+ argv[argc++] = cp;
+ argv[argc] = NULL;
+ }
+ else {
+ /* random-token mode */
+ parse_mode = TOKEN;
+ cp = line_ptr;
+ argv = NEW_ARGV (argv, argc);
+ argv[argc++] = line_ptr;
+ argv[argc] = NULL;
+ }
+ }
+ while (parse_mode == TOKEN) {
+ if (*line_ptr == '\0') {
+ *cp++ = '\0';
+ goto end_of_line;
+ }
+ else if (*line_ptr == ' ' || *line_ptr == '\t') {
+ *cp++ = '\0';
+ line_ptr++;
+ parse_mode = WHITESPACE;
+ }
+ else if (*line_ptr == '"') {
+ line_ptr++;
+ parse_mode = QUOTED_STRING;
+ }
+ else {
+ *cp++ = *line_ptr++;
+ }
+ }
+ while (parse_mode == QUOTED_STRING) {
+ if (*line_ptr == '\0') {
+ ss_error (sci_idx, 0,
+ "Unbalanced quotes in command line");
+ free (argv);
+ *argc_ptr = 0;
+ return NULL;
+ }
+ else if (*line_ptr == '"') {
+ if (*++line_ptr == '"') {
+ *cp++ = '"';
+ line_ptr++;
+ }
+ else {
+ parse_mode = TOKEN;
+ }
+ }
+ else {
+ *cp++ = *line_ptr++;
+ }
+ }
+ }
+end_of_line:
+ *argc_ptr = argc;
+#ifdef DEBUG
+
+ if (g_displayDebugSS)
+ {
+ int i;
+ printf ("argc = %d\n", argc);
+ for (i = 0; i <= argc; i++)
+ printf ("\targv[%2d] = `%s'\n", i,
+ argv[i] ? argv[i] : "<NULL>");
+ }
+#endif
+ return(argv);
+}
diff --git a/usr/src/lib/krb5/ss/prompt.c b/usr/src/lib/krb5/ss/prompt.c
new file mode 100644
index 0000000000..e1685acffd
--- /dev/null
+++ b/usr/src/lib/krb5/ss/prompt.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2000 by Sun Microsystems, Inc.
+ * All rights reserved.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * prompt.c: Routines for retrieving and setting a prompt.
+ *
+ * util/ss/prompt.c
+ *
+ * Copyright 1987, 1988 by MIT Student Information Processing Board
+ *
+ * For copyright information, see copyright.h.
+ */
+
+#include "copyright.h"
+#include <stdio.h>
+#include "ss_internal.h"
+
+void
+ss_set_prompt(sci_idx, new_prompt)
+ int sci_idx;
+ char *new_prompt;
+{
+ ss_info(sci_idx)->prompt = new_prompt;
+}
+
+char *
+ss_get_prompt(sci_idx)
+ int sci_idx;
+{
+ return(ss_info(sci_idx)->prompt);
+}
diff --git a/usr/src/lib/krb5/ss/request_tbl.c b/usr/src/lib/krb5/ss/request_tbl.c
new file mode 100644
index 0000000000..56df137f22
--- /dev/null
+++ b/usr/src/lib/krb5/ss/request_tbl.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2000 by Sun Microsystems, Inc.
+ * All rights reserved.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * Copyright 1987, 1988 by MIT Student Information Processing Board
+ *
+ * For copyright information, see copyright.h.
+ */
+
+#include "copyright.h"
+#include "ss_internal.h"
+
+#define ssrt ss_request_table /* for some readable code... */
+
+void
+ss_add_request_table(sci_idx, rqtbl_ptr, position, code_ptr)
+ int sci_idx;
+ ssrt *rqtbl_ptr;
+ int position; /* 1 -> becomes second... */
+ int *code_ptr;
+{
+ register ss_data *info;
+ register int i, size;
+
+ info = ss_info(sci_idx);
+ for (size=0; info->rqt_tables[size] != (ssrt *)NULL; size++)
+ ;
+ /* size == C subscript of NULL == #elements */
+ size += 2; /* new element, and NULL */
+ info->rqt_tables = (ssrt **)realloc((char *)info->rqt_tables,
+ (unsigned)size*sizeof(ssrt));
+ if (info->rqt_tables == (ssrt **)NULL) {
+ *code_ptr = errno;
+ return;
+ }
+ if (position > size - 2)
+ position = size - 2;
+
+ if (size > 1)
+ for (i = size - 2; i >= position; i--)
+ info->rqt_tables[i+1] = info->rqt_tables[i];
+
+ info->rqt_tables[position] = rqtbl_ptr;
+ info->rqt_tables[size-1] = (ssrt *)NULL;
+ *code_ptr = 0;
+}
+
+void
+ss_delete_request_table(sci_idx, rqtbl_ptr, code_ptr)
+ int sci_idx;
+ ssrt *rqtbl_ptr;
+ int *code_ptr;
+{
+ register ss_data *info;
+ register ssrt **rt1, **rt2;
+
+ *code_ptr = SS_ET_TABLE_NOT_FOUND;
+ info = ss_info(sci_idx);
+ rt1 = info->rqt_tables;
+ for (rt2 = rt1; *rt1; rt1++) {
+ if (*rt1 != rqtbl_ptr) {
+ *rt2++ = *rt1;
+ *code_ptr = 0;
+ }
+ }
+ *rt2 = (ssrt *)NULL;
+ return;
+}
diff --git a/usr/src/lib/krb5/ss/requests.c b/usr/src/lib/krb5/ss/requests.c
new file mode 100644
index 0000000000..479a716b33
--- /dev/null
+++ b/usr/src/lib/krb5/ss/requests.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2000 by Sun Microsystems, Inc.
+ * All rights reserved.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * Various minor routines...
+ *
+ * Copyright 1987, 1988, 1989 by MIT
+ *
+ * For copyright information, see mit-sipb-copyright.h.
+ */
+
+#include <ss/mit-sipb-copyright.h>
+#include <stdio.h>
+#include "ss_internal.h"
+#include <libintl.h>
+
+#define DECLARE(name) void name(argc,argv,sci_idx)int argc,sci_idx;char **argv;
+
+/*
+ * ss_self_identify -- assigned by default to the "." request
+ */
+DECLARE(ss_self_identify)
+{
+ register ss_data *info = ss_info(sci_idx);
+ printf((char *)dgettext(TEXT_DOMAIN,
+ "%s version %s\n"), info->subsystem_name,
+ info->subsystem_version);
+}
+
+/*
+ * ss_subsystem_name -- print name of subsystem
+ */
+DECLARE(ss_subsystem_name)
+{
+ printf("%s\n", ss_info(sci_idx)->subsystem_name);
+}
+
+/*
+ * ss_subsystem_version -- print version of subsystem
+ */
+DECLARE(ss_subsystem_version)
+{
+ printf("%s\n", ss_info(sci_idx)->subsystem_version);
+}
+
+/*
+ * ss_unimplemented -- routine not implemented (should be
+ * set up as (dont_list,dont_summarize))
+ */
+DECLARE(ss_unimplemented)
+{
+ ss_perror(sci_idx, SS_ET_UNIMPLEMENTED, "");
+}
+
+int g_displayDebugSS = 0;
+/*
+ * debug message display toggle
+ */
+void
+debugDisplaySS(int onOff) {
+
+ g_displayDebugSS = onOff;
+}
diff --git a/usr/src/lib/krb5/ss/sparc/Makefile b/usr/src/lib/krb5/ss/sparc/Makefile
new file mode 100644
index 0000000000..f459f341c7
--- /dev/null
+++ b/usr/src/lib/krb5/ss/sparc/Makefile
@@ -0,0 +1,13 @@
+#
+# Copyright (c) 1997-2001 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+#pragma ident "%Z%%M% %I% %E% SMI"
+#
+# lib/krb5/ss/sparc/Makefile
+
+MAPDIR= ../spec/sparc
+
+include ../Makefile.com
+
+install: all $(ROOTLIBDIR) $(ROOTLIBS) $(ROOTLINKS)
diff --git a/usr/src/lib/krb5/ss/spec/Makefile b/usr/src/lib/krb5/ss/spec/Makefile
new file mode 100644
index 0000000000..ff34a3c9e9
--- /dev/null
+++ b/usr/src/lib/krb5/ss/spec/Makefile
@@ -0,0 +1,9 @@
+#
+# Copyright (c) 1997-1999 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+#pragma ident "%Z%%M% %I% %E% SMI"
+#
+# lib/krb5/ss/spec/Makefile
+
+include $(SRC)/lib/Makefile.spec.arch
diff --git a/usr/src/lib/krb5/ss/spec/Makefile.targ b/usr/src/lib/krb5/ss/spec/Makefile.targ
new file mode 100644
index 0000000000..5c86dff4f5
--- /dev/null
+++ b/usr/src/lib/krb5/ss/spec/Makefile.targ
@@ -0,0 +1,12 @@
+#
+# Copyright (c) 1997-1999 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+#pragma ident "%Z%%M% %I% %E% SMI"
+#
+# lib/krb5/ss/spec/Makefile.targ
+
+LIBRARY = libss.a
+VERS = .1
+
+OBJECTS = ss.o
diff --git a/usr/src/lib/krb5/ss/spec/amd64/Makefile b/usr/src/lib/krb5/ss/spec/amd64/Makefile
new file mode 100644
index 0000000000..ff8d4177fa
--- /dev/null
+++ b/usr/src/lib/krb5/ss/spec/amd64/Makefile
@@ -0,0 +1,26 @@
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+include ../Makefile.targ
+
+# Add arch specific objects here
+OBJECTS +=
+
+include $(SRC)/lib/Makefile.lib
+include $(SRC)/lib/Makefile.lib.64
+include $(SRC)/lib/Makefile.spec
+
+# Uncomment the following if the linker complains
+#amd64_C_PICFLAGS = -K PIC
+
+# These include paths must be searched before includes paths in CPPFLAGS
+CFLAGS64 += -I$(SRC)/lib/krb5 -I$(SRC)/lib/krb5/ss
+
+#install: $(ROOTABILIB64)
+# We're not shipping libss.so 64 bit yet.
+install:
+
diff --git a/usr/src/lib/krb5/ss/spec/i386/Makefile b/usr/src/lib/krb5/ss/spec/i386/Makefile
new file mode 100644
index 0000000000..0ef948bedb
--- /dev/null
+++ b/usr/src/lib/krb5/ss/spec/i386/Makefile
@@ -0,0 +1,23 @@
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#pragma ident "%Z%%M% %I% %E% SMI"
+#
+# lib/krb5/ss/spec/i386/Makefile
+
+include ../Makefile.targ
+
+# Add arch specific objects here
+OBJECTS +=
+
+include $(SRC)/lib/Makefile.lib
+include $(SRC)/lib/Makefile.spec
+
+# Uncomment the following if the linker complains
+#i386_C_PICFLAGS = -K PIC
+
+# These include paths must be searched before includes paths in CPPFLAGS
+CFLAGS += -I$(SRC)/lib/krb5 -I$(SRC)/lib/krb5/ss
+
+install: $(KRB5ABILIB)
diff --git a/usr/src/lib/krb5/ss/spec/sparc/Makefile b/usr/src/lib/krb5/ss/spec/sparc/Makefile
new file mode 100644
index 0000000000..d6b5d30a3d
--- /dev/null
+++ b/usr/src/lib/krb5/ss/spec/sparc/Makefile
@@ -0,0 +1,25 @@
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#pragma ident "%Z%%M% %I% %E% SMI"
+#
+# lib/krb5/ss/spec/sparc/Makefile
+
+.KEEP_STATE:
+
+include ../Makefile.targ
+
+# Add arch specific objects here
+OBJECTS +=
+
+include $(SRC)/lib/Makefile.lib
+include $(SRC)/lib/Makefile.spec
+
+# Uncomment the following if the linker complains
+#sparc_C_PICFLAGS = -K PIC
+
+# These include paths must be searched before includes paths in CPPFLAGS
+CFLAGS += -I$(SRC)/lib/krb5 -I$(SRC)/lib/krb5/ss
+
+install: $(KRB5ABILIB)
diff --git a/usr/src/lib/krb5/ss/spec/sparcv9/Makefile b/usr/src/lib/krb5/ss/spec/sparcv9/Makefile
new file mode 100644
index 0000000000..9ce7bb1587
--- /dev/null
+++ b/usr/src/lib/krb5/ss/spec/sparcv9/Makefile
@@ -0,0 +1,27 @@
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#pragma ident "%Z%%M% %I% %E% SMI"
+#
+# lib/krb5/ss/spec/sparcv9/Makefile
+
+include ../Makefile.targ
+
+# Add arch specific objects here
+OBJECTS +=
+
+include $(SRC)/lib/Makefile.lib
+include $(SRC)/lib/Makefile.lib.64
+include $(SRC)/lib/Makefile.spec
+
+# Uncomment the following if the linker complains
+#sparcv9_C_PICFLAGS = -K PIC
+
+# These include paths must be searched before includes paths in CPPFLAGS
+CFLAGS64 += -I$(SRC)/lib/krb5 -I$(SRC)/lib/krb5/ss
+
+#install: $(ROOTABILIB64)
+# We're not shipping libss.so 64 bit yet.
+install:
+
diff --git a/usr/src/lib/krb5/ss/spec/ss.spec b/usr/src/lib/krb5/ss/spec/ss.spec
new file mode 100644
index 0000000000..dad94b7976
--- /dev/null
+++ b/usr/src/lib/krb5/ss/spec/ss.spec
@@ -0,0 +1,155 @@
+#
+# Copyright (c) 1998-1999 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+#pragma ident "%Z%%M% %I% %E% SMI"
+#
+# lib/krb5/ss/spec/ss.spec
+
+function debugDisplaySS
+declaration void debugDisplaySS(int onOff)
+version SUNWprivate_1.1
+end
+
+function ss_abort_subsystem
+declaration void ss_abort_subsystem(int sci_idx, int code)
+version SUNWprivate_1.1
+end
+
+function ss_add_info_dir
+declaration void ss_add_info_dir(int sci_idx, char *info_dir, int *code_ptr)
+version SUNWprivate_1.1
+end
+
+function ss_add_request_table
+include <ss.h>
+declaration void ss_add_request_table(int sci_idx, \
+ ss_request_table *rqtbl_ptr, \
+ int position, int *code_ptr)
+version SUNWprivate_1.1
+end
+
+function ss_create_invocation
+declaration int ss_create_invocation(char *subsystem_name, \
+ char *version_string, char *info_ptr, \
+ ss_request_table *request_table_ptr, int *code_ptr)
+
+version SUNWprivate_1.1
+end
+
+function ss_delete_info_dir
+declaration void ss_delete_info_dir(int sci_idx, char *info_dir, \
+ int *code_ptr)
+version SUNWprivate_1.1
+end
+
+function ss_delete_invocation
+declaration void ss_delete_invocation(int sci_idx)
+version SUNWprivate_1.1
+end
+
+function ss_delete_request_table
+declaration void ss_delete_request_table(int sci_idx, \
+ ss_request_table *rqtbl_ptr, int *code_ptr)
+version SUNWprivate_1.1
+end
+
+function ss_error
+declaration void ss_error (int sci_idx, long code, const char * fmt, ...)
+version SUNWprivate_1.1
+end
+
+function ss_execute_command
+declaration int ss_execute_command(int sci_idx, register char *argv[])
+version SUNWprivate_1.1
+end
+
+function ss_execute_line
+declaration int ss_execute_line (int sci_idx, char *line_ptr)
+version SUNWprivate_1.1
+end
+
+function ss_get_prompt
+declaration char *ss_get_prompt(int sci_idx)
+version SUNWprivate_1.1
+end
+
+function ss_help
+include <ss_internal.h>
+declaration void ss_help (int argc, char const * const *argv, \
+ int sci_idx, pointer info_ptr)
+version SUNWprivate_1.1
+end
+
+function ss_list_requests
+include <ss_internal.h>
+declaration void ss_list_requests(int argc, char **argv, int sci_idx, \
+ pointer info_ptr)
+version SUNWprivate_1.1
+end
+
+function ss_listen
+declaration int ss_listen (int sci_idx)
+version SUNWprivate_1.1
+end
+
+function ss_name
+declaration char *ss_name(int sci_idx)
+version SUNWprivate_1.1
+end
+
+function ss_page_stdin
+declaration void ss_page_stdin()
+version SUNWprivate_1.1
+end
+
+function ss_pager_create
+declaration int ss_pager_create()
+version SUNWprivate_1.1
+end
+
+function ss_parse
+declaration char **ss_parse (int sci_idx, register char *line_ptr, \
+ int *argc_ptr)
+version SUNWprivate_1.1
+end
+
+function ss_perror
+declaration void ss_perror (int sci_idx, long code, char const *msg)
+version SUNWprivate_1.1
+end
+
+function ss_quit
+include <ss_internal.h>
+declaration int ss_quit(int argc, char **argv, int sci_idx, pointer infop)
+version SUNWprivate_1.1
+end
+
+function ss_self_identify
+declaration void ss_self_identify(int argc, char **argv, int sci_idx)
+version SUNWprivate_1.1
+end
+
+function ss_set_prompt
+declaration void ss_set_prompt(int sci_idx, char *new_prompt)
+version SUNWprivate_1.1
+end
+
+function ss_std_requests
+version SUNWprivate_1.1
+end
+
+function ss_subsystem_name
+declaration void ss_subsystem_name (int argc, char **argv, int sci_idx)
+version SUNWprivate_1.1
+end
+
+function ss_subsystem_version
+declaration void ss_subsystem_version (int argc, char **argv, int sci_idx)
+version SUNWprivate_1.1
+end
+
+function ss_unimplemented
+declaration void ss_unimplemented (int argc, char **argv, int sci_idx)
+version SUNWprivate_1.1
+end
diff --git a/usr/src/lib/krb5/ss/spec/versions b/usr/src/lib/krb5/ss/spec/versions
new file mode 100644
index 0000000000..6a318d48a3
--- /dev/null
+++ b/usr/src/lib/krb5/ss/spec/versions
@@ -0,0 +1,19 @@
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+sparc {
+ SUNWprivate_1.1;
+}
+sparcv9 {
+ SUNWprivate_1.1;
+}
+i386 {
+ SUNWprivate_1.1;
+}
+amd64 {
+ SUNWprivate_1.1;
+}
diff --git a/usr/src/lib/krb5/ss/ss.h b/usr/src/lib/krb5/ss/ss.h
new file mode 100644
index 0000000000..0fdad1d880
--- /dev/null
+++ b/usr/src/lib/krb5/ss/ss.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright 1987, 1988 by MIT Student Information Processing Board
+ *
+ * For copyright information, see mit-sipb-copyright.h.
+ */
+
+#ifndef _ss_h
+#define _ss_h __FILE__
+
+#include <ss/mit-sipb-copyright.h>
+#include <ss/ss_err.h>
+#include <errno.h>
+
+#ifdef __STDC__
+#define __SS_CONST const
+#define __SS_PROTO (int, const char * const *, int, void *)
+#else
+#define __SS_CONST
+#define __SS_PROTO ()
+#endif
+
+typedef struct _ss_request_entry {
+ __SS_CONST char * __SS_CONST *command_names; /* whatever */
+ void (* __SS_CONST function) __SS_PROTO; /* foo */
+ char *info_string; /* Already L10ed cmd message */
+ int flags; /* 0 */
+} ss_request_entry;
+
+typedef __SS_CONST struct _ss_request_table {
+ int version;
+ ss_request_entry *requests;
+} ss_request_table;
+
+#define SS_RQT_TBL_V2 2
+
+typedef struct _ss_rp_options { /* DEFAULT VALUES */
+ int version; /* SS_RP_V1 */
+ void (*unknown) __SS_PROTO; /* call for unknown command */
+ int allow_suspend;
+ int catch_int;
+} ss_rp_options;
+
+#define SS_RP_V1 1
+
+#define SS_OPT_DONT_LIST 0x0001
+#define SS_OPT_DONT_SUMMARIZE 0x0002
+
+void ss_help __SS_PROTO;
+char *ss_current_request();
+char *ss_name();
+#ifdef __STDC__
+void ss_error (int, long, char const *, ...);
+void ss_perror (int, long, char const *);
+#else
+void ss_error ();
+void ss_perror ();
+#endif
+void ss_abort_subsystem();
+extern ss_request_table ss_std_requests;
+
+/* toggles the display of debugging messages */
+void debugDisplaySS(int onOff);
+
+#endif /* _ss_h */
diff --git a/usr/src/lib/krb5/ss/ss_err.h b/usr/src/lib/krb5/ss/ss_err.h
new file mode 100644
index 0000000000..9c02db50d2
--- /dev/null
+++ b/usr/src/lib/krb5/ss/ss_err.h
@@ -0,0 +1,21 @@
+#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * ss_err.h:
+ * This file is automatically generated; please do not edit it.
+ */
+#define SS_ET_SUBSYSTEM_ABORTED (748800L)
+#define SS_ET_VERSION_MISMATCH (748801L)
+#define SS_ET_NULL_INV (748802L)
+#define SS_ET_NO_INFO_DIR (748803L)
+#define SS_ET_COMMAND_NOT_FOUND (748804L)
+#define SS_ET_LINE_ABORTED (748805L)
+#define SS_ET_EOF (748806L)
+#define SS_ET_PERMISSION_DENIED (748807L)
+#define SS_ET_TABLE_NOT_FOUND (748808L)
+#define SS_ET_NO_HELP_FILE (748809L)
+#define SS_ET_ESCAPE_DISABLED (748810L)
+#define SS_ET_UNIMPLEMENTED (748811L)
+#define ERROR_TABLE_BASE_ss (748800L)
+
+/* for compatibility with older versions... */
+#define ss_err_base ERROR_TABLE_BASE_ss
diff --git a/usr/src/lib/krb5/ss/ss_internal.h b/usr/src/lib/krb5/ss/ss_internal.h
new file mode 100644
index 0000000000..d82f050b28
--- /dev/null
+++ b/usr/src/lib/krb5/ss/ss_internal.h
@@ -0,0 +1,128 @@
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * Copyright 1987, 1988 by MIT Student Information Processing Board
+ *
+ * For copyright information, see copyright.h.
+ */
+
+#ifndef _ss_ss_internal_h
+#define _ss_ss_internal_h __FILE__
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#ifdef __STDC__
+
+#define PROTOTYPE(p) p
+typedef void * pointer;
+
+#else
+
+#define const
+#define volatile
+#define PROTOTYPE(p) ()
+typedef char * pointer;
+
+#endif /* not __STDC__ */
+
+#include <ss/ss.h>
+
+#if defined(__GNUC__)
+#define LOCAL_ALLOC(x) __builtin_alloca(x)
+#define LOCAL_FREE(x)
+#else
+#if defined(vax)
+#define LOCAL_ALLOC(x) alloca(x)
+#define LOCAL_FREE(x)
+extern pointer alloca PROTOTYPE((unsigned));
+#else
+#if defined(__HIGHC__) /* Barf! */
+pragma on(alloca);
+#define LOCAL_ALLOC(x) alloca(x)
+#define LOCAL_FREE(x)
+extern pointer alloca PROTOTYPE((unsigned));
+#else
+/* no alloca? */
+#define LOCAL_ALLOC(x) malloc(x)
+#define LOCAL_FREE(x) free(x)
+#endif
+#endif
+#endif /* LOCAL_ALLOC stuff */
+
+typedef char BOOL;
+
+typedef struct _ss_abbrev_entry {
+ char *name; /* abbrev name */
+ char **abbrev; /* new tokens to insert */
+ unsigned int beginning_of_line : 1;
+} ss_abbrev_entry;
+
+typedef struct _ss_abbrev_list {
+ int n_abbrevs;
+ ss_abbrev_entry *first_abbrev;
+} ss_abbrev_list;
+
+typedef struct {
+/* char *path; */
+ ss_abbrev_list abbrevs[127];
+} ss_abbrev_info;
+
+typedef struct _ss_data { /* init values */
+ /* this subsystem */
+ char *subsystem_name;
+ char *subsystem_version;
+ /* current request info */
+ int argc;
+ char **argv; /* arg list */
+ char const *current_request; /* primary name */
+ /* info directory for 'help' */
+ char **info_dirs;
+ /* to be extracted by subroutines */
+ pointer info_ptr; /* (void *) NULL */
+ /* for ss_listen processing */
+ char *prompt;
+ ss_request_table **rqt_tables;
+ ss_abbrev_info *abbrev_info;
+ struct {
+ unsigned int escape_disabled : 1,
+ abbrevs_disabled : 1;
+ } flags;
+ /* to get out */
+ int abort; /* exit subsystem */
+ int exit_status;
+} ss_data;
+
+#define CURRENT_SS_VERSION 1
+
+#define ss_info(sci_idx) (_ss_table[sci_idx])
+#define ss_current_request(sci_idx,code_ptr) \
+ (*code_ptr=0,ss_info(sci_idx)->current_request)
+void ss_unknown_function();
+void ss_delete_info_dir();
+int ss_execute_line();
+char **ss_parse();
+ss_abbrev_info *ss_abbrev_initialize PROTOTYPE((char *, int *));
+void ss_page_stdin();
+
+extern ss_data **_ss_table;
+extern char *ss_et_msgs[];
+
+#ifndef HAVE_STDLIB_H
+extern pointer malloc PROTOTYPE((unsigned));
+extern pointer realloc PROTOTYPE((pointer, unsigned));
+extern pointer calloc PROTOTYPE((unsigned, unsigned));
+#endif
+
+#ifdef USE_SIGPROCMASK
+/* fake sigmask, sigblock, sigsetmask */
+#include <signal.h>
+#define sigmask(x) (1L<<(x)-1)
+#define sigsetmask(x) sigprocmask(SIG_SETMASK,&x,NULL)
+static int _fake_sigstore;
+#define sigblock(x) (_fake_sigstore=x,sigprocmask(SIG_BLOCK,&_fake_sigstore,0))
+#endif
+#endif /* _ss_internal_h */
diff --git a/usr/src/lib/krb5/ss/std_rqs.c b/usr/src/lib/krb5/ss/std_rqs.c
new file mode 100644
index 0000000000..0f1c111496
--- /dev/null
+++ b/usr/src/lib/krb5/ss/std_rqs.c
@@ -0,0 +1,110 @@
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/* std_rqs.c - automatically generated from std_rqs.ct */
+#include <ss/ss.h>
+
+#ifndef __STDC__
+#define const
+#endif
+
+static char const * const ssu00001[] = {
+".",
+ (char const *)0
+};
+extern void ss_self_identify __SS_PROTO;
+static char const * const ssu00002[] = {
+"help",
+ (char const *)0
+};
+extern void ss_help __SS_PROTO;
+static char const * const ssu00003[] = {
+"list_help",
+ "lh",
+ (char const *)0
+};
+extern void ss_unimplemented __SS_PROTO;
+static char const * const ssu00004[] = {
+"list_requests",
+ "lr",
+ "?",
+ (char const *)0
+};
+extern void ss_list_requests __SS_PROTO;
+static char const * const ssu00005[] = {
+"quit",
+ "q",
+ (char const *)0
+};
+extern void ss_quit __SS_PROTO;
+static char const * const ssu00006[] = {
+"abbrev",
+ "ab",
+ (char const *)0
+};
+extern void ss_unimplemented __SS_PROTO;
+static char const * const ssu00007[] = {
+"execute",
+ "e",
+ (char const *)0
+};
+extern void ss_unimplemented __SS_PROTO;
+static char const * const ssu00008[] = {
+"?",
+ (char const *)0
+};
+extern void ss_unimplemented __SS_PROTO;
+static char const * const ssu00009[] = {
+"subsystem_name",
+ (char const *)0
+};
+extern void ss_subsystem_name __SS_PROTO;
+static char const * const ssu00010[] = {
+"subsystem_version",
+ (char const *)0
+};
+extern void ss_subsystem_version __SS_PROTO;
+static ss_request_entry ssu00011[] = {
+ { ssu00001,
+ ss_self_identify,
+ "Identify the subsystem.",
+ 3 },
+ { ssu00002,
+ ss_help,
+ "Display info on command or topic.",
+ 0 },
+ { ssu00003,
+ ss_unimplemented,
+ "List topics for which help is available.",
+ 3 },
+ { ssu00004,
+ ss_list_requests,
+ "List available commands.",
+ 0 },
+ { ssu00005,
+ ss_quit,
+ "Leave the subsystem.",
+ 0 },
+ { ssu00006,
+ ss_unimplemented,
+ "Enable/disable abbreviation processing of request lines.",
+ 3 },
+ { ssu00007,
+ ss_unimplemented,
+ "Execute a UNIX command line.",
+ 3 },
+ { ssu00008,
+ ss_unimplemented,
+ "Produce a list of the most commonly used requests.",
+ 3 },
+ { ssu00009,
+ ss_subsystem_name,
+ "Return the name of this subsystem.",
+ 1 },
+ { ssu00010,
+ ss_subsystem_version,
+ "Return the version of this subsystem.",
+ 1 },
+ { 0, 0, 0, 0 }
+};
+
+ss_request_table ss_std_requests = { 2, ssu00011 };
diff --git a/usr/src/lib/krb5/ss/utils.c b/usr/src/lib/krb5/ss/utils.c
new file mode 100644
index 0000000000..0084cec202
--- /dev/null
+++ b/usr/src/lib/krb5/ss/utils.c
@@ -0,0 +1,139 @@
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * Copyright 1987, 1988 by MIT Student Information Processing Board
+ *
+ * For copyright information, see copyright.h.
+ */
+
+#include <string.h>
+#include "copyright.h"
+#include "ss_internal.h" /* includes stdio and string */
+
+extern FILE *output_file;
+
+char *gensym(), *str_concat3(), *quote();
+extern long gensym_n;
+
+void write_ct(hdr, rql)
+ char const *hdr, *rql;
+{
+ char *sym;
+ sym = gensym("ssu");
+ fputs("static ss_request_entry ", output_file);
+ fputs(sym, output_file);
+ fputs("[] = {\n", output_file);
+ fputs(rql, output_file);
+ fputs(" { 0, 0, 0, 0 }\n", output_file);
+ fputs("};\n\nss_request_table ", output_file);
+ fputs(hdr, output_file);
+ fprintf(output_file, " = { %d, ", SS_RQT_TBL_V2);
+ fputs(sym, output_file);
+ fputs(" };\n", output_file);
+}
+
+char * generate_cmds_string(cmds)
+ char const *cmds;
+{
+ char * var_name = gensym("ssu");
+ fputs("static char const * const ", output_file);
+ fputs(var_name, output_file);
+ fputs("[] = {\n", output_file);
+ fputs(cmds, output_file);
+ fputs(",\n (char const *)0\n};\n", output_file);
+ return(var_name);
+}
+
+void generate_function_definition(func)
+ char const *func;
+{
+ fputs("extern void ", output_file);
+ fputs(func, output_file);
+ fputs(" __SS_PROTO;\n", output_file);
+}
+
+char * generate_rqte(func_name, info_string, cmds, options)
+ char const *func_name;
+ char const *info_string;
+ char const *cmds;
+ int options;
+{
+ int size;
+ char *string, *var_name, numbuf[16];
+ var_name = generate_cmds_string(cmds);
+ generate_function_definition(func_name);
+ size = 6; /* " { " */
+ size += strlen(var_name)+7; /* "quux, " */
+ size += strlen(func_name)+7; /* "foo, " */
+ size += strlen(info_string)+9; /* "\"Info!\", " */
+ sprintf(numbuf, "%d", options);
+ size += strlen(numbuf);
+ size += 4; /* " }," + NL */
+ string = malloc(size * sizeof(char *));
+ strcpy(string, " { ");
+ strcat(string, var_name);
+ strcat(string, ",\n ");
+ strcat(string, func_name);
+ strcat(string, ",\n ");
+ strcat(string, info_string);
+ strcat(string, ",\n ");
+ strcat(string, numbuf);
+ strcat(string, " },\n");
+ return(string);
+}
+
+char *
+gensym(name)
+ char *name;
+{
+ char *symbol;
+
+ symbol = malloc((strlen(name)+6) * sizeof(char));
+ gensym_n++;
+ sprintf(symbol, "%s%05ld", name, gensym_n);
+ return(symbol);
+}
+
+/* concatenate three strings and return the result */
+char *str_concat3(a, b, c)
+ register char *a, *b, *c;
+{
+ char *result;
+ int size_a = strlen(a);
+ int size_b = strlen(b);
+ int size_c = strlen(c);
+
+ result = malloc((size_a + size_b + size_c + 2)*sizeof(char));
+ strcpy(result, a);
+ strcpy(&result[size_a], c);
+ strcpy(&result[size_a+size_c], b);
+ return(result);
+}
+
+/* return copy of string enclosed in double-quotes */
+char *quote(string)
+ register char *string;
+{
+ register char *result;
+ int len;
+ len = strlen(string)+1;
+ result = malloc(len+2);
+ result[0] = '"';
+ strncpy(&result[1], string, len-1);
+ result[len] = '"';
+ result[len+1] = '\0';
+ return(result);
+}
+
+#ifndef HAS_STRDUP
+/* make duplicate of string and return pointer */
+char *strdup(s)
+ register char *s;
+{
+ register int len = strlen(s) + 1;
+ register char *new;
+ new = malloc(len);
+ strncpy(new, s, len);
+ return(new);
+}
+#endif