* ovsec_kadmd.c (log_badverf): Actually make a real lookup table
authorTom Yu <tlyu@mit.edu>
Tue, 2 Mar 1999 02:26:22 +0000 (02:26 +0000)
committerTom Yu <tlyu@mit.edu>
Tue, 2 Mar 1999 02:26:22 +0000 (02:26 +0000)
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
src/kadmin/server/ovsec_kadmd.c

index 0fa33d9ec8a113b41d5ad3eb8d47e5ce2b7b2eb5..42bef0e0937a4a3b0eafdbd1de3f22c66b272406 100644 (file)
@@ -1,3 +1,10 @@
+Mon Mar  1 21:24:49 1999  Tom Yu  <tlyu@mit.edu>
+
+       * 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  <tytso@rsts-11.mit.edu>
 
        * Makefile.in: Set the myfulldir and mydir variables (which are
index b8a5088d8ec8e95c80a827900d46da13094b3175..9337fb925e9543b1d92d42df00dc962e11a813e5 100644 (file)
@@ -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);