Path: blob/main/crypto/krb5/src/kadmin/cli/ss_wrapper.c
34914 views
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */1/*2* Copyright 1994 by the Massachusetts Institute of Technology.3* All Rights Reserved.4*5* Export of this software from the United States of America may6* require a specific license from the United States Government.7* It is the responsibility of any person or organization contemplating8* export to obtain such a license before exporting.9*10* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and11* distribute this software and its documentation for any purpose and12* without fee is hereby granted, provided that the above copyright13* notice appear in all copies and that both that copyright notice and14* this permission notice appear in supporting documentation, and that15* the name of M.I.T. not be used in advertising or publicity pertaining16* to distribution of the software without specific, written prior17* permission. Furthermore if you modify this software you must label18* your software as modified software and not distribute it in such a19* fashion that it might be confused with the original M.I.T. software.20* M.I.T. makes no representations about the suitability of21* this software for any purpose. It is provided "as is" without express22* or implied warranty.23*/2425#include <k5-platform.h>26#include <krb5.h>27#include <locale.h>28#include <ss/ss.h>29#include "kadmin.h"3031#ifdef NEED_SS_EXECUTE_COMMAND_PROTO32int ss_execute_command(int, char **);33#endif3435extern ss_request_table kadmin_cmds;36extern int exit_status;37extern char *whoami;3839int40main(int argc, char *argv[])41{42char *request, **args;43krb5_error_code retval;44int sci_idx, code = 0;4546setlocale(LC_ALL, "");47whoami = ((whoami = strrchr(argv[0], '/')) ? whoami+1 : argv[0]);4849kadmin_startup(argc, argv, &request, &args);50sci_idx = ss_create_invocation(whoami, "5.0", NULL, &kadmin_cmds, &retval);51if (retval) {52ss_perror(sci_idx, retval, _("creating invocation"));53exit(1);54}5556if (*args != NULL) {57/* Execute post-option arguments as a single script-mode command. */58code = ss_execute_command(sci_idx, args);59if (code) {60ss_perror(sci_idx, code, *args);61exit_status = 1;62}63} else if (request != NULL) {64/* Execute the -q option as a single interactive command. */65code = ss_execute_line(sci_idx, request);66if (code != 0) {67ss_perror(sci_idx, code, request);68exit_status = 1;69}70} else {71/* Prompt for commands. */72(void)ss_listen(sci_idx);73}7475return quit() ? 1 : exit_status;76}777879