+
+Fri Apr 28 10:13:21 EDT 1995 Paul Park (pjpark@mit.edu)
+ Add new library libkadm.
+ * configure.in - Check for presence of vsprintf.
+ * passwd.c - Use size_t for sizes.
+ * proto_serv.c - Allow for case-insensitivity of commands.
+ - Remove socket-dependent includes and add NEED_SOCKETS
+ * srv_key.c - Use size_t for sizes.
+ * srv_main.c - Check for presence of vsprintf.
+ * srv_net.c - Remove socket-dependent includes and add NEED_SOCKETS
+ - Use size_t for sizes.
+ - Return success if bind succeeds.
+ * srv_output.c - Add language name recoginition.
+
Fri Apr 28 13:06:18 1995 Theodore Y. Ts'o <tytso@dcl>
* srv_net.c: Linux doesn't have SOMAXCONN, assume 5 if not defined.
COMERRLIB=$(BUILDTOP)/util/et/libcom_err.a
SSLIB=$(BUILDTOP)/util/ss/libss.a
DBMLIB=
-KDBLIB=$(TOPLIBD)/libkdb5.a
+KDBLIB=$(TOPLIBD)/libkdb5.a
+KADMLIB=$(TOPLIBD)/libkadm.a
all::
-KLIB = $(KDBLIB) $(TOPLIBD)/libkrb5.a $(TOPLIBD)/libcrypto.a $(SSLIB) $(COMERRLIB) $(DBMLIB)
-DEPKLIB = $(TOPLIBD)/libkrb5.a $(TOPLIBD)/libcrypto.a $(SSLIB) $(COMERRLIB) $(DBMLIB)
+KLIB = $(KADMLIB) $(KDBLIB) $(TOPLIBD)/libkrb5.a $(TOPLIBD)/libcrypto.a $(SSLIB) $(COMERRLIB) $(DBMLIB)
+DEPKLIB = $(KADMLIB) $(TOPLIBD)/libkrb5.a $(TOPLIBD)/libcrypto.a $(SSLIB) $(COMERRLIB) $(DBMLIB)
SRCS = \
$(srcdir)/srv_main.c $(srcdir)/srv_key.c \
AC_CHECK_LIB(ndbm,main)
AC_CHECK_LIB(dbm,main)
AC_FUNC_CHECK(waitpid,AC_DEFINE(HAVE_WAITPID))
+AC_FUNC_CHECK(vsprintf,AC_DEFINE(HAVE_VSPRINTF))
CHECK_WAIT_TYPE
ET_RULES
KRB_INCLUDE
if (kret)
pwret = 0;
if (akey1.contents) {
- memset((char *) akey1.contents, 0, akey1.length);
+ memset((char *) akey1.contents, 0, (size_t) akey1.length);
krb5_xfree(akey1.contents);
}
if (pkey1.contents) {
- memset((char *) pkey1.contents, 0, pkey1.length);
+ memset((char *) pkey1.contents, 0, (size_t) pkey1.length);
krb5_xfree(pkey1.contents);
}
if (akey.contents) {
- memset((char *) akey.contents, 0, akey.length);
+ memset((char *) akey.contents, 0, (size_t) akey.length);
krb5_xfree(akey.contents);
}
if (pkey.contents) {
- memset((char *) pkey.contents, 0, pkey.length);
+ memset((char *) pkey.contents, 0, (size_t) pkey.length);
krb5_xfree(pkey.contents);
}
DPRINT(DEBUG_CALLS, debug_level,
krb5_xfree(entry2write.alt_key.contents);
}
if (akey.contents) {
- memset((char *) akey.contents, 0, akey.length);
+ memset((char *) akey.contents, 0, (size_t) akey.length);
krb5_xfree(akey.contents);
}
if (pkey.contents) {
- memset((char *) pkey.contents, 0, pkey.length);
+ memset((char *) pkey.contents, 0, (size_t) pkey.length);
krb5_xfree(pkey.contents);
}
DPRINT(DEBUG_CALLS, debug_level,
* protocol as implemented in lib/krb5/os/adm_conn.c. Any changes
* in one module must be reflected in the other.
*/
-#include <sys/types.h>
-#include <sys/signal.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <setjmp.h>
+#define NEED_SOCKETS
#include "k5-int.h"
#include "com_err.h"
#include "kadm5_defs.h"
#include "adm.h"
+#include <setjmp.h>
static const char *proto_addrs_msg = "%d: cannot get memory for addresses";
static const char *proto_rcache_msg = "%d: cannot get replay cache";
cmd_repl_complist = (krb5_data *) NULL;
err_aux = 0;
if (num_args > 0) {
- if (!strcmp(arglist[0].data, KRB5_ADM_QUIT_CMD)) {
+ if (!strcasecmp(arglist[0].data, KRB5_ADM_QUIT_CMD)) {
DPRINT(DEBUG_REQUESTS, proto_debug_level,
("> %d:QUIT command\n", my_id));
/* QUIT takes no arguments */
err_aux = KRB5_ADM_BAD_ARGS;
}
}
- else if (!strcmp(arglist[0].data, KRB5_ADM_CHECKPW_CMD)) {
+ else if (!strcasecmp(arglist[0].data, KRB5_ADM_CHECKPW_CMD)) {
DPRINT(DEBUG_REQUESTS, proto_debug_level,
("> %d:CHECKPW command\n", my_id));
if (num_args == 2) {
err_aux = KRB5_ADM_BAD_ARGS;
}
}
- else if (!strcmp(arglist[0].data, KRB5_ADM_CHANGEPW_CMD)) {
+ else if (!strcasecmp(arglist[0].data, KRB5_ADM_CHANGEPW_CMD)) {
DPRINT(DEBUG_REQUESTS, proto_debug_level,
("> %d:CHANGEPW command\n", my_id));
if (num_args == 3) {
err_aux = KRB5_ADM_BAD_ARGS;
}
}
- else if (!strcmp(arglist[0].data, KRB5_ADM_MOTD_CMD)) {
+ else if (!strcasecmp(arglist[0].data, KRB5_ADM_MOTD_CMD)) {
DPRINT(DEBUG_REQUESTS, proto_debug_level,
("> %d:MOTD command\n", my_id));
if (num_args <= 2) {
err_aux = KRB5_ADM_BAD_ARGS;
}
}
- else if (!strcmp(arglist[0].data, KRB5_ADM_MIME_CMD)) {
+ else if (!strcasecmp(arglist[0].data, KRB5_ADM_MIME_CMD)) {
DPRINT(DEBUG_REQUESTS, proto_debug_level,
("> %d:MIME command\n", my_id));
if (num_args == 1) {
err_aux = KRB5_ADM_BAD_ARGS;
}
}
- else if (!strcmp(arglist[0].data, KRB5_ADM_LANGUAGE_CMD)) {
+ else if (!strcasecmp(arglist[0].data, KRB5_ADM_LANGUAGE_CMD)) {
DPRINT(DEBUG_REQUESTS, proto_debug_level,
("> %d:LANGUAGE command\n", my_id));
if (num_args == 2) {
mencb_init = 0;
}
if (mkeyb_init) {
- memset(master_keyblock.contents, 0, master_keyblock.length);
+ memset(master_keyblock.contents, 0,
+ (size_t) master_keyblock.length);
krb5_xfree(master_keyblock.contents);
mkeyb_init = 0;
}
done:
if (kret) {
if (primary->contents) {
- memset((char *) primary->contents, 0, primary->length);
+ memset((char *) primary->contents, 0, (size_t) primary->length);
krb5_xfree(primary->contents);
}
if (alternate->contents) {
- memset((char *) alternate->contents, 0, alternate->length);
+ memset((char *) alternate->contents, 0,
+ (size_t) alternate->length);
krb5_xfree(alternate->contents);
}
}
if (psalt_data.data) {
- memset(psalt_data.data, 0, psalt_data.length);
+ memset(psalt_data.data, 0, (size_t) psalt_data.length);
krb5_xfree(psalt_data.data);
}
if (asalt_data.data) {
- memset(asalt_data.data, 0, asalt_data.length);
+ memset(asalt_data.data, 0, (size_t) asalt_data.length);
krb5_xfree(asalt_data.data);
}
DPRINT(DEBUG_CALLS, key_debug_level,
done:
if (kret) {
if (eprimary->contents) {
- memset((char *) eprimary->contents, 0, eprimary->length);
+ memset((char *) eprimary->contents, 0, (size_t) eprimary->length);
krb5_xfree(eprimary->contents);
}
if (ealternate->contents) {
- memset((char *) ealternate->contents, 0, ealternate->length);
+ memset((char *) ealternate->contents, 0,
+ (size_t) ealternate->length);
krb5_xfree(ealternate->contents);
}
}
done:
if (kret) {
if (primary->contents) {
- memset((char *) primary->contents, 0, primary->length);
+ memset((char *) primary->contents, 0, (size_t) primary->length);
krb5_xfree(primary->contents);
}
if (alternate->contents) {
- memset((char *) alternate->contents, 0, alternate->length);
+ memset((char *) alternate->contents, 0,
+ (size_t) alternate->length);
krb5_xfree(alternate->contents);
}
}
mit_des_is_weak_key(alternate.contents))
weakness = 1;
if (primary.contents) {
- memset((char *) primary.contents, 0, primary.length);
+ memset((char *) primary.contents, 0, (size_t) primary.length);
krb5_xfree(primary.contents);
}
if (alternate.contents) {
- memset((char *) alternate.contents, 0, alternate.length);
+ memset((char *) alternate.contents, 0,
+ (size_t) alternate.length);
krb5_xfree(alternate.contents);
}
}
strcat(outbuf, " - ");
}
cp = &outbuf[strlen(outbuf)];
+#if HAVE_VSPRINTF
vsprintf(cp, format, ap);
+#else /* HAVE_VSPRINTF */
+ sprintf(cp, format, ((int *) ap)[0], ((int *) ap)[1],
+ ((int *) ap)[2], ((int *) ap)[3],
+ ((int *) ap)[4], ((int *) ap)[5]);
+#endif /* HAVE_VSPRINTF */
#ifndef DEBUG
syslog(LOG_AUTH|LOG_ERR, outbuf);
#endif /* DEBUG */
/*
* srv_net.c - handle networking functions of the administrative server.
*/
-#include <sys/types.h>
-#include <sys/signal.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
#include <errno.h>
#include <setjmp.h>
#include <sys/wait.h>
#include <pthread.h>
#endif /* USE_PTHREADS */
+#define NEED_SOCKETS
#include "k5-int.h"
#include "com_err.h"
#include "kadm5_defs.h"
}
/* Allocate the slave table */
- net_slave_table = (net_slave_info *) malloc(MAX_SLAVES *
- sizeof(net_slave_info));
+ net_slave_table = (net_slave_info *)
+ malloc((size_t) (MAX_SLAVES * sizeof(net_slave_info)));
/* Make our service name */
net_service_name = (char *) malloc(strlen(local_realm) +
strlen(KRB5_ADM_SERVICE_NAME) + 2);
(void) sprintf(net_service_name, "%s%s%s",
KRB5_ADM_SERVICE_NAME, "/", local_realm);
krb5_xfree(local_realm);
- memset((char *) net_slave_table, 0, MAX_SLAVES * sizeof(net_slave_info));
+ memset((char *) net_slave_table, 0,
+ (size_t) (MAX_SLAVES * sizeof(net_slave_info)));
net_max_slaves = MAX_SLAVES;
DPRINT(DEBUG_HOST, net_debug_level,
("- name of service is %s\n", net_service_name));
else {
DPRINT(DEBUG_HOST, net_debug_level,
("- bound socket %d on port\n", net_listen_socket));
+ kret = 0;
break;
}
} while (bind_tries < MAX_BIND_TRIES);
static const char *out_adm_no_err = "Unknown error.";
static int output_debug_level = 0;
static int output_mime_enabled = 0;
+static int output_lang_inited = 0;
+static char **output_lang_list = (char **) NULL;
+static char *output_langstring = (char *) NULL;
\f
+/*
+ * lang_error_message() - Return language-dependent Kerberos error message.
+ *
+ * This is just a hook.
+ */
static char *
lang_error_message(lang, kval)
char *lang;
return(ret);
}
+/*
+ * lang_adm_message() - Return language-dependent administrative message.
+ *
+ * This is just a hook.
+ */
static char *
lang_adm_message(lang, ecode, aux, nargs, alist)
char *lang;
char *ret;
const char *ermsg;
char *erarg;
- int alen;
+ size_t alen;
erarg = (char *) NULL;
switch (ecode) {
return(ret);
}
+/*
+ * mimeify_text() - MIME encode text.
+ *
+ * This is just a hook.
+ */
static char *
mimeify_text(msg)
char *msg;
return(ret);
}
+/*
+ * lang_init_slist() - Initialize list of supported languages.
+ */
+static int
+lang_init_slist(llist)
+ char *llist;
+{
+ int ret;
+
+ DPRINT(DEBUG_CALLS, output_debug_level, ("* lang_init_slist()\n"));
+ ret = 1;
+ if (llist) {
+ int nseps, i;
+ char *sepp;
+
+ /* First count the number of commas. */
+ sepp = llist;
+ for (nseps=1;
+ (sepp = strchr(sepp, (int) ',')) != (char *) NULL;
+ nseps++)
+ sepp++;
+
+ output_langstring =
+ (char *) malloc((size_t) (strlen(llist)+1));
+ output_lang_list =
+ (char **) malloc((size_t) ((nseps+1) * sizeof(char *)));
+ if (output_lang_list && output_langstring) {
+ strcpy(output_langstring, llist);
+ sepp = output_langstring;
+ for (i=0; i<nseps; i++) {
+ output_lang_list[i] = sepp;
+ sepp = strchr(sepp, (int) ',');
+ if (sepp) {
+ *sepp = '\0';
+ sepp++;
+ }
+ }
+ output_lang_list[nseps] = (char *) NULL;
+ }
+ else {
+ if (output_langstring)
+ free(output_langstring);
+ ret = 0;
+ }
+ }
+ DPRINT(DEBUG_CALLS, output_debug_level,
+ ("X lang_init_slist() = %d\n", ret));
+}
+
/*
* output_init() - Initialize output context.
*/
((language_list) ? language_list : "(null)"),
mime_enabled));
output_mime_enabled = mime_enabled;
+ output_lang_inited = lang_init_slist(language_list);
DPRINT(DEBUG_CALLS, output_debug_level, ("X output_init() = %d\n", kret));
return(kret);
}
int debug_level;
{
DPRINT(DEBUG_CALLS, output_debug_level, ("* output_finish()\n"));
+ if (output_lang_inited) {
+ if (output_langstring)
+ free(output_langstring);
+ if (output_lang_list)
+ free(output_lang_list);
+ }
DPRINT(DEBUG_CALLS, output_debug_level, ("X output_finish()\n"));
}
char *lname;
{
krb5_boolean ret;
+ int i;
DPRINT(DEBUG_CALLS, output_debug_level,
("* output_lang_supported(lang=%s)\n",
((lname) ? lname : "(default)")));
ret = 1;
+ if (lname) {
+ ret = 0;
+ if (output_lang_inited && output_lang_list) {
+ for (i=0; output_lang_list[i]; i++)
+ if (!strcmp(output_lang_list[i], lname))
+ ret = 1;
+ }
+ }
DPRINT(DEBUG_CALLS, output_debug_level,
("X output_lang_supported() = %d\n", ret));
return(ret);