2N/A/*
2N/A * Copyright 1987, 1988 by MIT Student Information Processing Board
2N/A *
2N/A * For copyright information, see copyright.h.
2N/A */
2N/A
2N/A/*
2N/A * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A
2N/A#include "ss_internal.h"
2N/A#include "copyright.h"
2N/A#define size sizeof(ss_data *)
2N/A
2N/A
2N/Aint ss_create_invocation(subsystem_name, version_string, info_ptr,
2N/A request_table_ptr, code_ptr)
2N/A char *subsystem_name, *version_string;
2N/A char *info_ptr;
2N/A ss_request_table *request_table_ptr;
2N/A int *code_ptr;
2N/A{
2N/A register int sci_idx;
2N/A register ss_data *new_table;
2N/A register ss_data **table;
2N/A
2N/A *code_ptr = 0;
2N/A table = _ss_table;
2N/A new_table = (ss_data *) malloc(sizeof(ss_data));
2N/A
2N/A if (table == (ss_data **) NULL) {
2N/A table = (ss_data **) malloc(2 * size);
2N/A table[0] = table[1] = (ss_data *)NULL;
2N/A }
2N/A
2N/A for (sci_idx = 1; table[sci_idx] != (ss_data *)NULL; sci_idx++)
2N/A ;
2N/A table = (ss_data **) realloc((char *)table,
2N/A ((unsigned)sci_idx+2)*size);
2N/A table[sci_idx+1] = (ss_data *) NULL;
2N/A table[sci_idx] = new_table;
2N/A
2N/A new_table->subsystem_name = subsystem_name;
2N/A new_table->subsystem_version = version_string;
2N/A new_table->argv = (char **)NULL;
2N/A new_table->current_request = (char *)NULL;
2N/A new_table->info_dirs = (char **)malloc(sizeof(char *));
2N/A *new_table->info_dirs = (char *)NULL;
2N/A new_table->info_ptr = info_ptr;
2N/A /* Solaris Kerberos */
2N/A new_table->prompt = malloc((unsigned)strlen(subsystem_name)+3);
2N/A strcpy(new_table->prompt, subsystem_name);
2N/A strcat(new_table->prompt, ": ");
2N/A#ifdef silly
2N/A new_table->abbrev_info = ss_abbrev_initialize("/etc/passwd", code_ptr);
2N/A#else
2N/A new_table->abbrev_info = NULL;
2N/A#endif
2N/A /*
2N/A * Solaris Kerberos
2N/A * Disabling the ability to drop out of kadmin to a shell,
2N/A * avoiding potential issues with users acquiring elevated privs.
2N/A */
2N/A new_table->flags.escape_disabled = 1;
2N/A new_table->flags.abbrevs_disabled = 0;
2N/A new_table->rqt_tables =
2N/A (ss_request_table **) calloc(2, sizeof(ss_request_table *));
2N/A *(new_table->rqt_tables) = request_table_ptr;
2N/A *(new_table->rqt_tables+1) = (ss_request_table *) NULL;
2N/A _ss_table = table;
2N/A return(sci_idx);
2N/A}
2N/A
2N/Avoid
2N/Ass_delete_invocation(sci_idx)
2N/A int sci_idx;
2N/A{
2N/A register ss_data *t;
2N/A int ignored_code;
2N/A
2N/A t = ss_info(sci_idx);
2N/A free(t->prompt);
2N/A free(t->rqt_tables);
2N/A while(t->info_dirs[0] != (char *)NULL)
2N/A ss_delete_info_dir(sci_idx, t->info_dirs[0], &ignored_code);
2N/A free((char *)t->info_dirs);
2N/A free((char *)t);
2N/A}