diff options
| author | Paul Park <pjpark@mit.edu> | 1995-06-08 19:08:06 +0000 |
|---|---|---|
| committer | Paul Park <pjpark@mit.edu> | 1995-06-08 19:08:06 +0000 |
| commit | 914a83c4b912d161b72e80d376709c8f5ee307e3 (patch) | |
| tree | c15d182455ac441d2cff22e8cea42b19772e2ee6 /src/kadmin/v5server | |
| parent | 2527d32669ae3694e28e660d24ceed060d284cf1 (diff) | |
| download | krb5-914a83c4b912d161b72e80d376709c8f5ee307e3.tar.gz krb5-914a83c4b912d161b72e80d376709c8f5ee307e3.tar.xz krb5-914a83c4b912d161b72e80d376709c8f5ee307e3.zip | |
Update kadmind5 to use new logging routines
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5976 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/kadmin/v5server')
| -rw-r--r-- | src/kadmin/v5server/ChangeLog | 8 | ||||
| -rw-r--r-- | src/kadmin/v5server/admin.c | 16 | ||||
| -rw-r--r-- | src/kadmin/v5server/passwd.c | 6 | ||||
| -rw-r--r-- | src/kadmin/v5server/proto_serv.c | 26 | ||||
| -rw-r--r-- | src/kadmin/v5server/srv_acl.c | 2 | ||||
| -rw-r--r-- | src/kadmin/v5server/srv_main.c | 69 | ||||
| -rw-r--r-- | src/kadmin/v5server/srv_net.c | 30 |
7 files changed, 58 insertions, 99 deletions
diff --git a/src/kadmin/v5server/ChangeLog b/src/kadmin/v5server/ChangeLog index 0c24228d9..b5d4000e1 100644 --- a/src/kadmin/v5server/ChangeLog +++ b/src/kadmin/v5server/ChangeLog @@ -1,3 +1,11 @@ + +Thu Jun 8 14:46:05 EDT 1995 Paul Park (pjpark@mit.edu) + * admin.c, passwd.c, srv_acl.c - Supply severities for error messages. + * proto_serv.c, srv_net.c - Supply severities for error messages and + change DLOG to DPRINT. + * srv_main.c - Supply severities for error messages. Remove com_err + handling and syslog() logic for routines in libkadm. + Wed Jun 7 12:03:10 1995 <tytso@rsx-11.mit.edu> * Makefile.in (CFLAGS), srv_acl.c (acl_init): Use diff --git a/src/kadmin/v5server/admin.c b/src/kadmin/v5server/admin.c index d38de0aac..5a746fe72 100644 --- a/src/kadmin/v5server/admin.c +++ b/src/kadmin/v5server/admin.c @@ -47,14 +47,14 @@ struct inq_context { static krb5_db_entry admin_def_dbent; static krb5_boolean admin_def_dbent_inited = 0; -static const char *admin_perm_denied_fmt = "ACL entry prevents %s operation by %s"; -static const char *admin_db_write_err_fmt = "database write failed during %s operation by %s"; -static const char *admin_db_success_fmt = "%s operation for %s successfully issued by %s"; -static const char *admin_db_read_err_fmt = "database read failed during %s operation by %s"; -static const char *admin_no_cl_ident_fmt = "cannot get client identity from ticket for %s operation"; -static const char *admin_db_rename_fmt = "%s operation from %s to %s successfully issued by %s"; -static const char *admin_db_del_err_fmt = "database delete entry(%s) failed during %s operation by %s"; -static const char *admin_key_dec_err_fmt = "key decode failed for %s's key during %s operation by %s"; +static const char *admin_perm_denied_fmt = "\004ACL entry prevents %s operation by %s"; +static const char *admin_db_write_err_fmt = "\004database write failed during %s operation by %s"; +static const char *admin_db_success_fmt = "\007%s operation for %s successfully issued by %s"; +static const char *admin_db_read_err_fmt = "\004database read failed during %s operation by %s"; +static const char *admin_no_cl_ident_fmt = "\004cannot get client identity from ticket for %s operation"; +static const char *admin_db_rename_fmt = "\007%s operation from %s to %s successfully issued by %s"; +static const char *admin_db_del_err_fmt = "\004database delete entry(%s) failed during %s operation by %s"; +static const char *admin_key_dec_err_fmt = "\004key decode failed for %s's key during %s operation by %s"; static const char *admin_add_principal_text = "Add Principal"; static const char *admin_modify_principal_text = "Modify Principal"; diff --git a/src/kadmin/v5server/passwd.c b/src/kadmin/v5server/passwd.c index 83d273980..74acada6f 100644 --- a/src/kadmin/v5server/passwd.c +++ b/src/kadmin/v5server/passwd.c @@ -40,9 +40,9 @@ #define KPWD_MIN_PWD_LENGTH 8 extern char *programname; -static const char *pwd_bad_old_pwd = "incorrect old password for %s"; -static const char *pwd_perm_denied = "ACL entry prevents password change for %s"; -static const char *pwd_changed_pwd = "changed password for %s"; +static const char *pwd_bad_old_pwd = "\004incorrect old password for %s"; +static const char *pwd_perm_denied = "\004ACL entry prevents password change for %s"; +static const char *pwd_changed_pwd = "\007changed password for %s"; /* * passwd_check_princ() - Check if the principal specified in the ticket is ok diff --git a/src/kadmin/v5server/proto_serv.c b/src/kadmin/v5server/proto_serv.c index 73c6ce62f..0b85f59a4 100644 --- a/src/kadmin/v5server/proto_serv.c +++ b/src/kadmin/v5server/proto_serv.c @@ -36,18 +36,18 @@ #include "adm_proto.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"; -static const char *proto_ap_req_msg = "%d: error reading AP_REQ message"; -static const char *proto_auth_con_msg = "%d: cannot get authorization context"; -static const char *proto_rd_req_msg = "%d: cannot decode AP_REQ message"; -static const char *proto_mk_rep_msg = "%d: cannot generate AP_REP message"; -static const char *proto_wr_rep_msg = "%d: cannot write AP_REP message"; -static const char *proto_conn_abort_msg = "%d: connection destroyed by client"; -static const char *proto_seq_err_msg = "%d: protocol sequence violation"; -static const char *proto_rd_cmd_msg = "%d: cannot read administrative protocol command"; -static const char *proto_wr_reply_msg = "%d: cannot write administrative protocol reply"; -static const char *proto_fmt_reply_msg = "%d: cannot format administrative protocol reply"; +static const char *proto_addrs_msg = "\004%d: cannot get memory for addresses"; +static const char *proto_rcache_msg = "\004%d: cannot get replay cache"; +static const char *proto_ap_req_msg = "\004%d: error reading AP_REQ message"; +static const char *proto_auth_con_msg = "\004%d: cannot get authorization context"; +static const char *proto_rd_req_msg = "\004%d: cannot decode AP_REQ message"; +static const char *proto_mk_rep_msg = "\004%d: cannot generate AP_REP message"; +static const char *proto_wr_rep_msg = "\004%d: cannot write AP_REP message"; +static const char *proto_conn_abort_msg = "\007%d: connection destroyed by client"; +static const char *proto_seq_err_msg = "\004%d: protocol sequence violation"; +static const char *proto_rd_cmd_msg = "\004%d: cannot read administrative protocol command"; +static const char *proto_wr_reply_msg = "\004%d: cannot write administrative protocol reply"; +static const char *proto_fmt_reply_msg = "\004%d: cannot format administrative protocol reply"; extern char *programname; static int proto_proto_timeout = -1; @@ -720,7 +720,7 @@ proto_serv(kcontext, my_id, cl_sock, sv_p, cl_p) } } else { - DLOG(DEBUG_REQUESTS, proto_debug_level, "connection timed out"); + DPRINT(DEBUG_REQUESTS, proto_debug_level, ("connection timed out")); } diff --git a/src/kadmin/v5server/srv_acl.c b/src/kadmin/v5server/srv_acl.c index 86948233d..4b1cf4d61 100644 --- a/src/kadmin/v5server/srv_acl.c +++ b/src/kadmin/v5server/srv_acl.c @@ -76,7 +76,7 @@ static const char *acl_catchall_entry = "* o"; static const char *acl_line2long_msg = "%s: line %d too long, truncated\n"; static const char *acl_op_bad_msg = "Unrecognized ACL operation '%c' in %s\n"; static const char *acl_syn_err_msg = "%s: syntax error at line %d <%10s...>\n"; -static const char *acl_cantopen_msg = "cannot open ACL file"; +static const char *acl_cantopen_msg = "\007cannot open ACL file"; /* * acl_get_line() - Get a line from the ACL file. diff --git a/src/kadmin/v5server/srv_main.c b/src/kadmin/v5server/srv_main.c index 205fa927b..fe11a5f41 100644 --- a/src/kadmin/v5server/srv_main.c +++ b/src/kadmin/v5server/srv_main.c @@ -30,20 +30,10 @@ #include <stdio.h> #include <sys/signal.h> -#include <syslog.h> #include <setjmp.h> #include "k5-int.h" #include "com_err.h" -#if HAVE_STDARG_H -#include <stdarg.h> -#else /* HAVE_STDARG_H */ -#include <varargs.h> -#endif /* HAVE_STDARG_H */ - -#define KADM_MAX_ERRMSG_SIZE 1024 -#ifndef LOG_AUTH -#define LOG_AUTH 0 -#endif /* LOG_AUTH */ +#include "adm_proto.h" #ifdef LANGUAGES_SUPPORTED static const char *usage_format = "%s: usage is %s [-a aclfile] [-d database] [-e enctype] [-m]\n\t[-k mkeytype] [-l langlist] [-p portnum] [-r realm] [-t timeout] [-n]\n\t[-D dbg] [-M mkeyname] [-T ktabname].\n"; @@ -56,13 +46,12 @@ static const char *fval_not_number = "%s: value (%s) specified for -%c is not nu static const char *extra_params = "%s extra paramters beginning with %s... \n"; static const char *daemon_err = "%s: cannot spawn and detach.\n"; static const char *no_memory_fmt = "%s: cannot allocate %d bytes for %s.\n"; -static const char *begin_op_msg = "%s starting."; -static const char *disp_err_fmt = "dispatch error."; -static const char *happy_exit_fmt = "terminating normally."; +static const char *begin_op_msg = "\007%s starting."; +static const char *disp_err_fmt = "\004dispatch error."; +static const char *happy_exit_fmt = "\007terminating normally."; static const char *init_error_fmt = "%s: cannot initialize %s.\n"; -static const char *unh_signal_fmt = "exiting on signal %d."; +static const char *unh_signal_fmt = "\007exiting on signal %d."; -static const char *messages_msg = "messages"; static const char *proto_msg = "protocol module"; static const char *net_msg = "network"; static const char *output_msg = "output"; @@ -94,45 +83,7 @@ unhandled_signal(signo) #endif /* POSIX_SETJMP */ /* NOTREACHED */ } - -static void -kadm_com_err_proc(whoami, code, format, ap) - const char *whoami; - long code; - const char *format; - va_list ap; -{ - char *outbuf; - - outbuf = (char *) malloc(KADM_MAX_ERRMSG_SIZE); - if (outbuf) { - char *cp; - sprintf(outbuf, "%s: ", whoami); - if (code) { - strcat(outbuf, error_message(code)); - 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 */ - strcat(outbuf, "\n"); - fprintf(stderr, outbuf); - free(outbuf); - } - else { - fprintf(stderr, no_memory_fmt, programname, - KADM_MAX_ERRMSG_SIZE, messages_msg); - } -} - + int main(argc, argv) int argc; @@ -280,8 +231,7 @@ main(argc, argv) #endif /* DEBUG */ krb5_init_context(&kcontext); krb5_init_ets(kcontext); - openlog(programname, LOG_AUTH|LOG_CONS|LOG_NDELAY|LOG_PID, LOG_LOCAL6); - (void) set_com_err_hook(kadm_com_err_proc); + krb5_klog_init(kcontext, "admin_server", programname, 1); if ((signal_number = #if POSIX_SETJMP @@ -354,7 +304,7 @@ main(argc, argv) * We've successfully initialized here. */ #ifndef DEBUG - syslog(LOG_AUTH|LOG_INFO, begin_op_msg, server_name_msg); + com_err(programname, 0, begin_op_msg, server_name_msg); #endif /* DEBUG */ /* @@ -373,7 +323,7 @@ main(argc, argv) else { /* Received an unhandled signal */ #ifndef DEBUG - syslog(LOG_AUTH|LOG_INFO, unh_signal_fmt, signal_number); + com_err(programname, 0, unh_signal_fmt, signal_number); #endif } @@ -383,6 +333,7 @@ main(argc, argv) output_finish(kcontext, debug_level); acl_finish(kcontext, debug_level); key_finish(kcontext, debug_level); + krb5_klog_close(kcontext); krb5_xfree(kcontext); exit(error); } diff --git a/src/kadmin/v5server/srv_net.c b/src/kadmin/v5server/srv_net.c index ed4fbe431..b6fd4cab2 100644 --- a/src/kadmin/v5server/srv_net.c +++ b/src/kadmin/v5server/srv_net.c @@ -77,7 +77,7 @@ typedef struct _net_slave_info { /* * Error messages. */ -static const char *net_waiterr_msg = "child wait failed - cannot reap children"; +static const char *net_waiterr_msg = "\004child wait failed - cannot reap children"; static const char *net_def_realm_fmt = "%s: cannot get default realm (%s).\n"; static const char *net_no_mem_fmt = "%s: cannot get memory.\n"; static const char *net_parse_srv_fmt = "%s: cannot parse server name %s (%s).\n"; @@ -88,9 +88,9 @@ static const char *net_sockerr_fmt = "%s: cannot open network socket (%s).\n"; static const char *net_soerr_fmt = "%s: cannot set socket options (%s).\n"; static const char *net_binderr_fmt = "%s: cannot bind to network address (%s).\n"; -static const char *net_select_fmt = "select failed"; -static const char *net_cl_disp_fmt = "client dispatch failed"; -static const char *net_not_ready_fmt = "select error - no socket to read"; +static const char *net_select_fmt = "\004select failed"; +static const char *net_cl_disp_fmt = "\004client dispatch failed"; +static const char *net_not_ready_fmt = "\004select error - no socket to read"; static const char *net_dispatch_msg = "network dispatch"; static int net_debug_level = 0; @@ -740,7 +740,7 @@ net_dispatch(kcontext) #endif /* !USE_PTHREADS */ /* Receive connections on the socket */ - DLOG(DEBUG_OPERATION, net_debug_level, "listening on socket"); + DPRINT(DEBUG_OPERATION, net_debug_level, ("listening on socket")); if ( #if POSIX_SETJMP sigsetjmp(shutdown_jmp, 1) == 0 @@ -753,7 +753,7 @@ net_dispatch(kcontext) } else kret = EINTR; - DLOG(DEBUG_OPERATION, net_debug_level, "listen done"); + DPRINT(DEBUG_OPERATION, net_debug_level, ("listen done")); while (kret == 0) { /* @@ -767,13 +767,13 @@ net_dispatch(kcontext) #endif /* POSIX_SETJMP */ ) { readfds = mask; - DLOG(DEBUG_OPERATION, net_debug_level, "doing select"); + DPRINT(DEBUG_OPERATION, net_debug_level, ("doing select")); if ((nready = select(net_listen_socket+1, &readfds, (fd_set *) NULL, (fd_set *) NULL, (struct timeval *) NULL)) == 0) { - DLOG(DEBUG_OPERATION, net_debug_level, "nobody ready"); + DPRINT(DEBUG_OPERATION, net_debug_level, ("nobody ready")); continue; /* Nobody ready */ } @@ -788,8 +788,8 @@ net_dispatch(kcontext) int conn_sock; addrlen = sizeof(client_addr); - DLOG(DEBUG_OPERATION, net_debug_level, - "accept connection"); + DPRINT(DEBUG_OPERATION, net_debug_level, + ("accept connection")); while (((conn_sock = accept(net_listen_socket, (struct sockaddr *) &client_addr, &addrlen)) < 0) && @@ -799,8 +799,8 @@ net_dispatch(kcontext) kret = errno; break; } - DLOG(DEBUG_OPERATION, net_debug_level, - "accepted connection"); + DPRINT(DEBUG_OPERATION, net_debug_level, + ("accepted connection")); kret = net_dispatch_client(kcontext, net_listen_socket, conn_sock, @@ -809,7 +809,7 @@ net_dispatch(kcontext) com_err(net_dispatch_msg, kret, net_cl_disp_fmt); continue; } - DLOG(DEBUG_OPERATION, net_debug_level, "dispatch done"); + DPRINT(DEBUG_OPERATION, net_debug_level, ("dispatch done")); } else { com_err(net_dispatch_msg, 0, net_not_ready_fmt); @@ -817,8 +817,8 @@ net_dispatch(kcontext) } } else { - DLOG(DEBUG_OPERATION, net_debug_level, - "dispatch interrupted by SIGTERM"); + DPRINT(DEBUG_OPERATION, net_debug_level, + ("dispatch interrupted by SIGTERM")); kret = 0; break; } |
