Index: trunk/src/samhain_hide.c
===================================================================
--- trunk/src/samhain_hide.c	(revision 326)
+++ trunk/src/samhain_hide.c	(revision 327)
@@ -122,11 +122,16 @@
 /* The configure options (#defines) for the Kernel
  */
+#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
 /* 2.6.19 (((2) << 16) + ((6) << 8) + (19)) */
 #define SH_KERNEL_MIN 132627 
 
-#if SH_KERNEL_NUMERIC >= SH_KERNEL_MIN
+#if SH_KERNEL_NUMERIC >= KERNEL_VERSION(2,6,33)
+#include <linux/generated/autoconf.h>
+#else
+#if SH_KERNEL_NUMERIC >= KERNEL_VERSION(2,6,19)
 #include <linux/autoconf.h>
 #else
 #include <linux/config.h>
+#endif
 #endif
 
@@ -182,4 +187,7 @@
  */
 #include <linux/file.h>
+#if SH_KERNEL_NUMERIC >= KERNEL_VERSION(2,6,26)
+#include <linux/fdtable.h>
+#endif
 
 /*****************************************************
@@ -202,5 +210,18 @@
 /* The old address of the sys_getdents syscall.
  */
+#if SH_KERNEL_NUMERIC < KERNEL_VERSION(2,6,27)
 int (*old_getdents)(unsigned int, struct dirent *, unsigned int);
+#else
+
+struct linux_dirent {
+  unsigned long   d_ino;
+  unsigned long   d_off;
+  unsigned short  d_reclen;
+  char            d_name[1];
+};
+
+int (*old_getdents)(unsigned int, struct linux_dirent *, unsigned int);
+#endif
+
 #ifdef __NR_getdents64
 #if SH_KERNEL_NUMERIC >= 132628
@@ -290,7 +311,5 @@
 
 #else
-/*
- *  RedHat 2.4.20 kernel
- */
+#if SH_KERNEL_NUMERIC < KERNEL_VERSION(2,6,25)
 struct task_struct * fetch_task_struct (int pid)
 {
@@ -299,4 +318,16 @@
   return (task_ptr);
 }
+#else
+struct task_struct * fetch_task_struct (int pid)
+{
+  struct task_struct * task_ptr = NULL;
+  struct pid * task_pid = find_vpid(pid);
+  if (task_pid)
+    {
+      task_ptr = pid_task (task_pid, PIDTYPE_PID);
+    }
+  return (task_ptr);
+}
+#endif
 #endif
 
@@ -345,5 +376,9 @@
  *   name. 
  */
+#if SH_KERNEL_NUMERIC < KERNEL_VERSION(2,6,27)
 int new_getdents (unsigned int fd, struct dirent *dirp, unsigned int count)
+#else
+int new_getdents (unsigned int fd, struct linux_dirent *dirp, unsigned int count)
+#endif
 {
   int                  status = 0;    /* Return value from original getdents */
@@ -352,7 +387,13 @@
   int                  dir_is_proc = 0;
 
+#if SH_KERNEL_NUMERIC < KERNEL_VERSION(2,6,27)
   struct dirent      * dirp_prev;
   struct dirent      * dirp_new;
   struct dirent      * dirp_current;
+#else
+  struct linux_dirent      * dirp_prev;
+  struct linux_dirent      * dirp_new;
+  struct linux_dirent      * dirp_current;
+#endif
 
   int                  dir_table_bytes;
@@ -413,5 +454,9 @@
    * (kernel oops)
    */
+#if SH_KERNEL_NUMERIC < KERNEL_VERSION(2,6,27)
   dirp_new = (struct dirent *) kmalloc (status, GFP_ATOMIC);
+#else
+  dirp_new = (struct linux_dirent *) kmalloc (status, GFP_ATOMIC);
+#endif
 
   if (dirp_new == NULL)
@@ -514,7 +559,13 @@
       /* Next entry in dirp table.
        */
+#if SH_KERNEL_NUMERIC < KERNEL_VERSION(2,6,27)
       if (dir_table_bytes > 0)
 	dirp_current = (struct dirent *) ( (char *) dirp_current + 
 					   forward_bytes);
+#else
+      if (dir_table_bytes > 0)
+	dirp_current = (struct linux_dirent *) ( (char *) dirp_current + 
+					   forward_bytes);
+#endif
     }
 
@@ -534,4 +585,6 @@
   return (status);
 }
+
+
 
 /* For 2.4 kernel
@@ -554,7 +607,13 @@
   int                  dir_is_proc = 0;
 
+#if SH_KERNEL_NUMERIC < KERNEL_VERSION(2,6,27)
   struct dirent64    * dirp_prev;
   struct dirent64    * dirp_new;
   struct dirent64    * dirp_current;
+#else
+  struct linux_dirent64    * dirp_prev;
+  struct linux_dirent64    * dirp_new;
+  struct linux_dirent64    * dirp_current;
+#endif
 
   int                  dir_table_bytes;
@@ -764,7 +823,13 @@
       /* Next entry in dirp table.
        */
+#if SH_KERNEL_NUMERIC < KERNEL_VERSION(2,6,27)
       if (dir_table_bytes > 0)
 	dirp_current = (struct dirent64 *) ( (char *) dirp_current + 
 					     forward_bytes);
+#else
+      if (dir_table_bytes > 0)
+	dirp_current = (struct linux_dirent64 *) ( (char *) dirp_current + 
+					     forward_bytes);
+#endif
     }
 
@@ -786,5 +851,5 @@
 
 #ifdef LINUX26
-static struct module *find_module(const char *name)
+static struct module *sh_find_module(const char *name)
 {
         struct module *mod;
@@ -833,15 +898,19 @@
     spinlock_t * modlist_lock = (spinlock_t * ) SH_MODLIST_LOCK;
 #endif
+#if SH_KERNEL_NUMERIC >= KERNEL_VERSION(2,6,30)
+    struct mutex * sh_module_mutex = &module_mutex;
+#else
+#if (SH_KERNEL_NUMERIC >= SH_KERNEL_MIN)
+    struct mutex * sh_module_mutex = (struct mutex *) SH_MODLIST_MUTEX;
+#endif
+#endif
+
+    struct module *mod;
+
 #if SH_KERNEL_NUMERIC >= SH_KERNEL_MIN
-    struct mutex * module_mutex = (struct mutex *) SH_MODLIST_MUTEX;
-#endif
-
-    struct module *mod;
-
-#if SH_KERNEL_NUMERIC >= SH_KERNEL_MIN
-    mutex_lock(module_mutex);
-#endif
-
-    mod = find_module(SH_INSTALL_NAME"_hide");
+    mutex_lock(sh_module_mutex);
+#endif
+
+    mod = sh_find_module(SH_INSTALL_NAME"_hide");
     if (mod) {
       /* Delete from various lists */
@@ -858,5 +927,5 @@
     }
 #if SH_KERNEL_NUMERIC >= SH_KERNEL_MIN
-      mutex_unlock(module_mutex);
+      mutex_unlock(sh_module_mutex);
 #endif
   }
@@ -881,4 +950,5 @@
    */
   sh_sys_call_table[SYS_getdents]     = (unsigned long) old_getdents;
+
 #ifdef __NR_getdents64
   sh_sys_call_table[SYS_getdents64]   = (unsigned long) old_getdents64;
