From 576b3cdf9fa6c69c957324c6557417f2a450d7e5 Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Tue, 2 Mar 1999 02:26:22 +0000 Subject: [PATCH] * ovsec_kadmd.c (log_badverf): Actually make a real lookup table for procedure numbers. Also, if we don't find the procedure number, just log the number rather than falling off the end of an array. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11234 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kadmin/server/ChangeLog | 7 ++++ src/kadmin/server/ovsec_kadmd.c | 61 ++++++++++++++++++++++++--------- 2 files changed, 51 insertions(+), 17 deletions(-) diff --git a/src/kadmin/server/ChangeLog b/src/kadmin/server/ChangeLog index 0fa33d9ec..42bef0e09 100644 --- a/src/kadmin/server/ChangeLog +++ b/src/kadmin/server/ChangeLog @@ -1,3 +1,10 @@ +Mon Mar 1 21:24:49 1999 Tom Yu + + * ovsec_kadmd.c (log_badverf): Actually make a real lookup table + for procedure numbers. Also, if we don't find the procedure + number, just log the number rather than falling off the end of an + array. + 1998-11-13 Theodore Ts'o * Makefile.in: Set the myfulldir and mydir variables (which are diff --git a/src/kadmin/server/ovsec_kadmd.c b/src/kadmin/server/ovsec_kadmd.c index b8a5088d8..9337fb925 100644 --- a/src/kadmin/server/ovsec_kadmd.c +++ b/src/kadmin/server/ovsec_kadmd.c @@ -786,33 +786,60 @@ void log_badverf(gss_name_t client_name, gss_name_t server_name, struct svc_req *rqst, struct rpc_msg *msg, char *data) { - static const char *const proc_names[] = { - "kadm5_create_principal", - "kadm5_delete_principal", - "kadm5_modify_principal", - "kadm5_rename_principal", - "kadm5_get_principal", - "kadm5_chpass_principal", - "kadm5_randkey_principal", - "kadm5_create_policy", - "kadm5_delete_policy", - "kadm5_modify_policy", - "kadm5_get_policy", - "kadm5_get_privs", + struct procnames { + rpc_u_int32 proc; + const char *proc_name; }; + static const struct procnames proc_names[] = { + {1, "CREATE_PRINCIPAL"}, + {2, "DELETE_PRINCIPAL"}, + {3, "MODIFY_PRINCIPAL"}, + {4, "RENAME_PRINCIPAL"}, + {5, "GET_PRINCIPAL"}, + {6, "CHPASS_PRINCIPAL"}, + {7, "CHRAND_PRINCIPAL"}, + {8, "CREATE_POLICY"}, + {9, "DELETE_POLICY"}, + {10, "MODIFY_POLICY"}, + {11, "GET_POLICY"}, + {12, "GET_PRIVS"}, + {13, "INIT"}, + {14, "GET_PRINCS"}, + {15, "GET_POLS"}, + {16, "SETKEY_PRINCIPAL"}, + {17, "SETV4KEY_PRINCIPAL"}, + }; +#define NPROCNAMES (sizeof (proc_names) / sizeof (struct procnames)) OM_uint32 minor; gss_buffer_desc client, server; gss_OID gss_type; char *a; + rpc_u_int32 proc; + int i; + const char *procname; (void) gss_display_name(&minor, client_name, &client, &gss_type); (void) gss_display_name(&minor, server_name, &server, &gss_type); a = inet_ntoa(rqst->rq_xprt->xp_raddr.sin_addr); - krb5_klog_syslog(LOG_NOTICE, "WARNING! Forged/garbled request: %s, " - "claimed client = %s, server = %s, addr = %s", - proc_names[msg->rm_call.cb_proc], client.value, - server.value, a); + proc = msg->rm_call.cb_proc; + procname = NULL; + for (i = 0; i < NPROCNAMES; i++) { + if (proc_names[i].proc == proc) { + procname = proc_names[i].proc_name; + break; + } + } + if (procname != NULL) + krb5_klog_syslog(LOG_NOTICE, "WARNING! Forged/garbled request: %s, " + "claimed client = %s, server = %s, addr = %s", + procname, client.value, + server.value, a); + else + krb5_klog_syslog(LOG_NOTICE, "WARNING! Forged/garbled request: %d, " + "claimed client = %s, server = %s, addr = %s", + proc, client.value, + server.value, a); (void) gss_release_buffer(&minor, &client); (void) gss_release_buffer(&minor, &server); -- 2.26.2