/* * kadmin/v5client/network.c * * Copyright 1995 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. * */ /* * network.c - Handle network and protocol related functions for kadmin5. */ #include "k5-int.h" #include "com_err.h" #include "adm.h" #include "adm_proto.h" #include "kadmin5.h" /* * Own storage. */ static int server_socket = -1; static krb5_auth_context *server_auth_context = (krb5_auth_context *) NULL; static krb5_ccache server_ccache = (krb5_ccache) NULL; static krb5_boolean server_active = 0; static krb5_error_code server_stat = 0; static krb5_boolean server_op_in_prog = 0; /* * Static strings. */ static const char *kadmin_server_name = "kadmin-server"; static const char *proto_serv_supp_msg = "server response follows:"; static const char *proto_serv_end_msg = "end of server response."; static const char *proto_cmd_unsupp_fmt = "(%s) %s protocol command not supported by server"; static const char *proto_pw_unacc_fmt = "(%s) password unacceptable to server"; static const char *proto_bad_pw_fmt = "(%s) bad password entered"; static const char *proto_in_tkt_fmt = "(%s) not an initial ticket"; static const char *proto_cant_chg_fmt = "(%s) cannot change password"; static const char *proto_lang_uns_fmt = "(%s) language not supported"; static const char *proto_p_exists_fmt = "(%s) principal already exists"; static const char *proto_p_notexist_fmt = "(%s) principal does not exist"; static const char *proto_no_auth_fmt = "(%s) not authorized for this operation"; static const char *proto_bad_opt_fmt = "(%s) option not recognized by server"; static const char *proto_value_req_fmt = "(%s) value required for option"; static const char *proto_system_err_fmt = "(%s) remote system error"; static const char *proto_ufo_err_fmt = "- (%s) protocol command %s returned unexpected error %d"; static const char *net_conn_err_fmt = "- %s: cannot connect to server"; /* * print_proto_sreply() - Print server's error reply strings. */ void print_proto_sreply(ncomps, complist) krb5_int32 ncomps; krb5_data *complist; { int i; if (ncomps > 0) { for (i=0; i