[Nagiosplug-devel] check_radius_adv: Patch to support x86_64 in Linux and bug fix in password attribute (resend)

Jorge Daniel Sequeira Matias martin at andorinha.ist.utl.pt
Fri Aug 25 13:24:26 CEST 2006


Hi list

  Like my last post with a patch to support x86_64 arch in plugin check_radius_adv, here goes a patch to the plugin check_radius_ih-1.1.
  This patches fixes the following:

    - Add support for x84_64 architecture in Linux;
    - Solves problem with Password attribute creation in the RADIUS packet.      Because the password is binary data and sometimes has bytes with value 0x00 ('\0' or NULL char), which means terminator character in strings, the copy of the password hash to the attribute cannot be copied in string copy functions. Those truncate prematurely the data being copied.

--- Here it goes ----
--- check_radius_ih-1.1.orig/check_radius_ih.c  2006-07-13 09:58:14.000000000 +0100
+++ check_radius_ih-1.1/check_radius_ih.c       2006-08-23 17:29:27.000000000 +0100
@@ -712,7 +712,9 @@
        switch (data_type)                      /* copy based on our datatype           */
        {
                case DATATYPE_STRING:
-                       strncpy((char*)curr->attr_data.string,(char *)attr_value,LEGAL_SIZE(curr->attr_data.string)-1);
+                       /* We need to copy the whole source string because password hashes can contain NULL */
+                       /* in the middle of it                                                              */
+                       memcpy((char*)curr->attr_data.string,(char *)attr_value,LEGAL_SIZE(curr->attr_data.string)-1);
                        break;
                case DATATYPE_ADDRESS:
                        curr->attr_data.address = *intval;
diff -Nru check_radius_ih-1.1.orig/md5.h check_radius_ih-1.1/md5.h
--- check_radius_ih-1.1.orig/md5.h      2006-03-17 09:36:33.000000000 +0000
+++ check_radius_ih-1.1/md5.h   2006-08-23 17:25:18.000000000 +0100
@@ -19,6 +19,8 @@
 /* UINT4 defines a four byte word */
 #if defined(__alpha) && defined(__osf__)
 typedef unsigned int UINT4;
+#elif defined(__x86_64)
+typedef unsigned int UINT4;
 #else
 typedef unsigned long int UINT4;
 #endif
---------------------------------------

Best Regards,
Jorge Matias
SysAdm at CIIST in
Instituto Superior Técnico, Lisbon - PORTUGAL.




More information about the Devel mailing list