Index: trunk/src/sh_database.c
===================================================================
--- trunk/src/sh_database.c	(revision 37)
+++ trunk/src/sh_database.c	(revision 40)
@@ -1492,5 +1492,5 @@
 }
 
-static int is_escaped(char * p) {
+static int is_escaped(unsigned char * p) {
 
   int    escp = 0;
@@ -1504,4 +1504,8 @@
 	}
       else if ((*p == '\'' || *p == '\"') && escp == 0)
+	{
+	  retv = S_FALSE;
+	}
+      else if (*p > 0x7F)
 	{
 	  retv = S_FALSE;
@@ -1581,4 +1585,7 @@
       p[2] == 'o' && p[3] == 'g')
     {
+      /* 
+       * recursive call 
+       */
       new       = SH_ALLOC(sizeof(dbins));
       init_db_entry(new);
Index: trunk/src/sh_files.c
===================================================================
--- trunk/src/sh_files.c	(revision 37)
+++ trunk/src/sh_files.c	(revision 40)
@@ -102,4 +102,6 @@
   long    NumCDev;
   long    NumBDev;
+  long    NumDoor;
+  long    NumPort;
   long    NumAll;
   long    TotalBytes;
@@ -1607,4 +1609,6 @@
   theDir.NumCDev     = 0;
   theDir.NumBDev     = 0;
+  theDir.NumDoor     = 0;
+  theDir.NumPort     = 0;
   theDir.NumAll      = 0;
   theDir.TotalBytes  = 0;
@@ -1831,4 +1835,6 @@
     else if (checkit == SH_FILE_CDEV)      ++theDir.NumCDev;
     else if (checkit == SH_FILE_BDEV)      ++theDir.NumBDev;
+    else if (checkit == SH_FILE_DOOR)      ++theDir.NumDoor;
+    else if (checkit == SH_FILE_PORT)      ++theDir.NumPort;
     
     SH_FREE(tmpcat);
@@ -2079,4 +2085,6 @@
     case 'b': SL_RETURN(SH_FILE_BDEV, _("sh_files_filecheck"));      
     case '|': SL_RETURN(SH_FILE_FIFO, _("sh_files_filecheck"));      
+    case 'D': SL_RETURN(SH_FILE_DOOR, _("sh_files_filecheck"));    
+    case 'P': SL_RETURN(SH_FILE_PORT, _("sh_files_filecheck"));    
     case 's': SL_RETURN(SH_FILE_SOCKET, _("sh_files_filecheck"));    
     default:  SL_RETURN(SH_FILE_UNKNOWN, _("sh_files_filecheck"));   
Index: trunk/src/sh_hash.c
===================================================================
--- trunk/src/sh_hash.c	(revision 37)
+++ trunk/src/sh_hash.c	(revision 40)
@@ -1998,4 +1998,6 @@
   p.linkmode    = (UINT32) buf->linkmode;
   p.hardlinks   = (UINT32) buf->hardlinks;
+  p.dev   = (UINT64) buf->dev;
+  p.rdev  = (UINT64) buf->rdev;
   p.mode  = (UINT32) buf->mode;
   p.ino   = (UINT32) buf->ino;
@@ -2059,6 +2061,10 @@
 #endif
 
-#ifndef PRIi64
-#define PRIi64 "lld"
+#ifndef PRIu64
+#ifdef  HAVE_LONG_32
+#define PRIu64 "llu"
+#else
+#define PRIu64 "lu"
+#endif
 #endif
 
@@ -2072,8 +2078,8 @@
 #ifdef SH_USE_XML
   sl_snprintf(form_rval, 80, _("%s%s%s%s%s"), 
-	      _("size_old=\"%"), PRIi64, _("\" size_new=\"%"), PRIi64, "\" ");
+	      _("size_old=\"%"), PRIu64, _("\" size_new=\"%"), PRIu64, "\" ");
 #else
   sl_snprintf(form_rval, 80, _("%s%s%s%s%s"), 
-	      _("size_old=<%"), PRIi64, _(">, size_new=<%"), PRIi64, ">, ");
+	      _("size_old=<%"), PRIu64, _(">, size_new=<%"), PRIu64, ">, ");
 #endif
 
@@ -2124,7 +2130,7 @@
 
   if (is_new)
-    format = _("hardlinks_new=\"%ld\" ");
-  else
-    format = _("hardlinks_old=\"%ld\" ");
+    format = _("hardlinks_new=\"%lu\" ");
+  else
+    format = _("hardlinks_old=\"%lu\" ");
   sl_snprintf(tmp, SH_BUFSIZE, format,
 	      (unsigned long) theFile->hardlinks);
@@ -2133,7 +2139,7 @@
 
   if (is_new)
-    format = _("idevice_new=\"%ld\" ");
-  else
-    format = _("idevice_old=\"%ld\" ");
+    format = _("idevice_new=\"%lu\" ");
+  else
+    format = _("idevice_old=\"%lu\" ");
   sl_snprintf(tmp, SH_BUFSIZE, format, (unsigned long) theFile->rdev);
   sl_strlcat(msg, tmp, SH_BUFSIZE); 
@@ -2141,9 +2147,23 @@
 
   if (is_new)
-    format = _("inode_new=\"%ld\" ");
-  else
-    format = _("inode_old=\"%ld\" ");
+    format = _("inode_new=\"%lu\" ");
+  else
+    format = _("inode_old=\"%lu\" ");
   sl_snprintf(tmp, SH_BUFSIZE, format, (unsigned long) theFile->ino);
   sl_strlcat(msg, tmp, SH_BUFSIZE); 
+
+  /* 
+   * also report device for prelude
+   */
+#if defined(HAVE_LIBPRELUDE) && defined(HAVE_LIBPRELUDE_9)
+  if (is_new)
+    format = _("dev_new=\"%lu,%lu\" ");
+  else
+    format = _("dev_old=\"%lu,%lu\" ");
+  sl_snprintf(tmp, SH_BUFSIZE, format,		      
+	      (unsigned long) major(theFile->dev),
+	      (unsigned long) minor(theFile->dev));
+  sl_strlcat(msg, tmp, SH_BUFSIZE);
+#endif
 
 
@@ -2261,7 +2281,7 @@
 
   if (is_new)
-    format = _("hardlinks_new=<%ld>, ");
-  else
-    format = _("hardlinks_old=<%ld>, ");
+    format = _("hardlinks_new=<%lu>, ");
+  else
+    format = _("hardlinks_old=<%lu>, ");
   sl_snprintf(tmp, SH_BUFSIZE, format,
 	      (unsigned long) theFile->hardlinks);
@@ -2270,7 +2290,7 @@
 
   if (is_new)
-    format = _("idevice_new=<%ld>, ");
-  else
-    format = _("idevice_old=<%ld>, ");
+    format = _("idevice_new=<%lu>, ");
+  else
+    format = _("idevice_old=<%lu>, ");
   sl_snprintf(tmp, SH_BUFSIZE, format, (unsigned long) theFile->rdev);
   sl_strlcat(msg, tmp, SH_BUFSIZE); 
@@ -2278,10 +2298,24 @@
 
   if (is_new)
-    format = _("inode_new=<%ld>, ");
-  else
-    format = _("inode_old=<%ld>, ");
+    format = _("inode_new=<%lu>, ");
+  else
+    format = _("inode_old=<%lu>, ");
   sl_snprintf(tmp, SH_BUFSIZE, format, (unsigned long) theFile->ino);
   sl_strlcat(msg, tmp, SH_BUFSIZE); 
 
+
+  /* 
+   * also report device for prelude
+   */
+#if defined(HAVE_LIBPRELUDE) && defined(HAVE_LIBPRELUDE_9)
+  if (is_new)
+    format = _("dev_new=<%lu,%lu>, ");
+  else
+    format = _("dev_old=<%lu,%lu>, ");
+  sl_snprintf(tmp, SH_BUFSIZE, format,		      
+	      (unsigned long) major(theFile->dev),
+	      (unsigned long) minor(theFile->dev));
+  sl_strlcat(msg, tmp, SH_BUFSIZE);
+#endif
 
   if (is_new)
@@ -2729,7 +2763,7 @@
 	  sl_snprintf(tmp, SH_BUFSIZE, 
 #ifdef SH_USE_XML
-		      _("hardlinks_old=\"%ld\" hardlinks_new=\"%ld\" "),
-#else
-		      _("hardlinks_old=<%ld>, hardlinks_new=<%ld>, "),
+		      _("hardlinks_old=\"%lu\" hardlinks_new=\"%lu\" "),
+#else
+		      _("hardlinks_old=<%lu>, hardlinks_new=<%lu>, "),
 #endif
 		      (unsigned long) p->theFile.hardlinks, 
@@ -2746,7 +2780,7 @@
 	  sl_snprintf(tmp, SH_BUFSIZE,
 #ifdef SH_USE_XML 
-		      _("device_old=\"%ld,%ld\" device_new=\"%ld,%ld\" idevice_old=\"%ld\" idevice_new=\"%ld\" "),
-#else
-		      _("device_old=<%ld,%ld>, device_new=<%ld,%ld>, "),
+		      _("device_old=\"%lu,%lu\" device_new=\"%lu,%lu\" idevice_old=\"%lu\" idevice_new=\"%lu\" "),
+#else
+		      _("device_old=<%lu,%lu>, device_new=<%lu,%lu>, "),
 #endif
 		      (unsigned long) major(p->theFile.rdev), 
@@ -2770,7 +2804,7 @@
 	  sl_snprintf(tmp, SH_BUFSIZE,
 #ifdef SH_USE_XML 
-		      _("inode_old=\"%ld\" inode_new=\"%ld\" "),
-#else
-		      _("inode_old=<%ld>, inode_new=<%ld>, "),
+		      _("inode_old=\"%lu\" inode_new=\"%lu\" "),
+#else
+		      _("inode_old=<%lu>, inode_new=<%lu>, "),
 #endif
 		      (unsigned long) p->theFile.ino, 
@@ -2779,7 +2813,36 @@
 #ifdef REPLACE_OLD
 	  if (sh.flag.reportonce == S_TRUE && sh.flag.update == S_FALSE)
-	    p->theFile.ino = theFile->ino;
-#endif
-	}
+	    {
+	      p->theFile.ino = theFile->ino;
+	      p->theFile.dev = theFile->dev;
+	    }
+#endif
+	}
+
+
+      /* 
+       * also report device for prelude
+       */
+#if defined(HAVE_LIBPRELUDE) && defined(HAVE_LIBPRELUDE_9)
+      if ((modi_mask & MODI_INO) != 0)
+	{
+	  sl_snprintf(tmp, SH_BUFSIZE,
+#ifdef SH_USE_XML 
+		      _("dev_old=\"%lu,%lu\" dev_new=\"%lu,%lu\" "),
+#else
+		      _("dev_old=<%lu,%lu>, dev_new=<%lu,%lu>, "),
+#endif
+		      (unsigned long) major(p->theFile.dev),
+		      (unsigned long) minor(p->theFile.dev),
+		      (unsigned long) major(theFile->dev),
+		      (unsigned long) minor(theFile->dev)
+		      );
+	  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+#ifdef REPLACE_OLD
+	  if (sh.flag.reportonce == S_TRUE && sh.flag.update == S_FALSE)
+	    p->theFile.dev = theFile->dev;
+#endif
+	}
+#endif
 
       if (   ((modi_mask & MODI_USR) != 0)
@@ -2790,12 +2853,12 @@
 	{
 #ifdef SH_USE_XML
-	  sl_snprintf(tmp, SH_BUFSIZE, _("owner_old=\"%s\" owner_new=\"%s\" iowner_old=\"%ld\" iowner_new=\"%ld\" "),
-#else
-	  sl_snprintf(tmp, SH_BUFSIZE, _("owner_old=<%s>, owner_new=<%s>, "),
-#endif
-		      p->theFile.c_owner, theFile->c_owner
-#ifdef SH_USE_XML
-		      , (long) p->theFile.owner, (long) theFile->owner
-#endif
+	  sl_snprintf(tmp, SH_BUFSIZE, 
+		      _("owner_old=\"%s\" owner_new=\"%s\" iowner_old=\"%ld\" iowner_new=\"%ld\" "),
+#else
+	  sl_snprintf(tmp, SH_BUFSIZE, 
+		      _("owner_old=<%s>, owner_new=<%s>, iowner_old=<%ld>, iowner_new=<%ld>, "),
+#endif
+		      p->theFile.c_owner, theFile->c_owner, 
+		      (long) p->theFile.owner, (long) theFile->owner
 		      );
 	  sl_strlcat(msg, tmp, SH_BUFSIZE); 
@@ -2818,10 +2881,13 @@
 	{
 #ifdef SH_USE_XML
-	  sl_snprintf(tmp, SH_BUFSIZE, _("group_old=\"%s\" group_new=\"%s\" igroup_old=\"%ld\" igroup_new=\"%ld\" "),
+	  sl_snprintf(tmp, SH_BUFSIZE, 
+		      _("group_old=\"%s\" group_new=\"%s\" igroup_old=\"%ld\" igroup_new=\"%ld\" "),
 		      p->theFile.c_group, theFile->c_group,
 		      (long) p->theFile.group, (long) theFile->group);
 #else
-	  sl_snprintf(tmp, SH_BUFSIZE, _("group_old=<%s>, group_new=<%s>, "),
-		      p->theFile.c_group, theFile->c_group);
+	  sl_snprintf(tmp, SH_BUFSIZE, 
+		      _("group_old=<%s>, group_new=<%s>, igroup_old=<%ld>, igroup_new=<%ld>, "),
+		      p->theFile.c_group, theFile->c_group,
+		      (long) p->theFile.group, (long) theFile->group);
 #endif
 
@@ -3153,6 +3219,6 @@
   if (ListWithDelimiter == S_TRUE)
     {
-      printf(_("%7ld, %10s, %5d, %12s, %5d, %3d, %-8s, %5d, %-8s, %5d, "),
-	     (unsigned long) p->theFile.ino,
+      printf(_("%7ld, %7ld, %10s, %5d, %12s, %5d, %3d, %-8s, %5d, %-8s, %5d, "),
+	     (unsigned long) p->theFile.ino, (unsigned long) p->theFile.dev,
 	     p->theFile.c_mode, (int) p->theFile.mode,
 	     p->theFile.c_attributes, (int) p->theFile.attributes,
@@ -3163,6 +3229,6 @@
   else
     {
-      printf(_("%7ld %10s %5d %12s %5d %3d %-8s %5d %-8s %5d "),
-	     (unsigned long) p->theFile.ino,
+      printf(_("%7ld %7ld %10s %5d %12s %5d %3d %-8s %5d %-8s %5d "),
+	     (unsigned long) p->theFile.ino, (unsigned long) p->theFile.dev,
 	     p->theFile.c_mode, (int) p->theFile.mode,
 	     p->theFile.c_attributes, (int) p->theFile.attributes,
@@ -3173,7 +3239,7 @@
 
   if ('c' == p->theFile.c_mode[0] || 'b' == p->theFile.c_mode[0])
-    sl_snprintf(str, 80, "%"PRIi64, p->theFile.rdev);
-  else
-    sl_snprintf(str, 80, "%"PRIi64, p->theFile.size);
+    sl_snprintf(str, 80, "%"PRIu64, p->theFile.rdev);
+  else
+    sl_snprintf(str, 80, "%"PRIu64, p->theFile.size);
 
   printf( _(" %8s"), str);
Index: trunk/src/sh_prelude.c
===================================================================
--- trunk/src/sh_prelude.c	(revision 37)
+++ trunk/src/sh_prelude.c	(revision 40)
@@ -39,5 +39,4 @@
 #include <string.h>
 #include <sys/types.h>
-#include <sys/stat.h>
 
 #if TIME_WITH_SYS_TIME
@@ -56,16 +55,7 @@
 #endif
 
-#ifdef MAJOR_IN_MKDEV
-# include <sys/mkdev.h>
-#else
-# ifdef MAJOR_IN_SYSMACROS
-#  include <sys/sysmacros.h>
-# endif
-#endif
-
 #include <unistd.h>
 #include <syslog.h>
 #include <pwd.h>
-#include <grp.h>
 
 int     sh_argc_store;
@@ -412,8 +402,7 @@
                 if ( ptr ) {
                         ret = idmef_file_new_name(file, &str);
-                        if ( ret < 0 )
-                                return;
-                        
-                        prelude_string_set_dup(str, ptr + 1);
+                        if ( ret == 0 ) {
+			        prelude_string_set_dup(str, ptr + 1);
+			}
                 }
         }
@@ -428,10 +417,7 @@
         if ( ptr ) {
                 ret = idmef_time_from_samhain(&time, ptr);
-                if ( ret < 0 ) {
-                        free(ptr);
-                        return;
-		}
-                
-                idmef_file_set_modify_time(file, time);
+                if ( ret == 0 ) {
+                        idmef_file_set_modify_time(file, time);
+		}
                 free(ptr);
         }
@@ -440,10 +426,7 @@
         if ( ptr ) {
                 ret = idmef_time_from_samhain(&time, ptr);
-                if ( ret < 0 ) {
-                        free(ptr);
-                        return;
-		}
-
-                idmef_file_set_create_time(file, time);
+                if ( ret == 0 ) {
+                        idmef_file_set_create_time(file, time);
+		}
                 free(ptr);
         }
@@ -451,21 +434,18 @@
         ptr = get_value(msg, _("inode"), suffix);
         if ( ptr ) {
-                struct stat st;
-
-                ret = lstat(prelude_string_get_string(idmef_file_get_path(file)), &st);
-                if ( ret < 0 ) {
-                        free(ptr);
-                        return;
-		}
-
                 ret = idmef_file_new_inode(file, &inode);
-                if ( ret < 0 ) {
-                        free(ptr);
-                        return;
-		}
-                
-                idmef_inode_set_major_device(inode, major(st.st_dev));
-                idmef_inode_set_minor_device(inode, minor(st.st_dev));
-                idmef_inode_set_number(inode, strtoul(ptr, NULL, 10));
+                if ( ret == 0 ) {
+			char * dev = get_value(msg, _("dev"), suffix);
+			if (dev) {
+			        char * q = strchr(dev, ',');
+				if (*q) {
+				         *q = '\0'; ++q;
+					 idmef_inode_set_major_device(inode, strtoul(dev, NULL, 0));
+					 idmef_inode_set_minor_device(inode, strtoul(  q, NULL, 0));
+				}
+				free(dev);
+			}
+			idmef_inode_set_number(inode, strtoul(ptr, NULL, 10));
+		}
                 free(ptr);
         }
@@ -475,6 +455,6 @@
                 ret = idmef_file_new_checksum(file, &checksum, IDMEF_LIST_APPEND);
                 if ( ret < 0 ) {
-                        free(ptr);
-                        return;
+			free(ptr);
+			goto get_mode;
 		}
 
@@ -482,26 +462,28 @@
 
 		if (hashtype == 0)
-                        idmef_checksum_set_algorithm(checksum, IDMEF_CHECKSUM_ALGORITHM_TIGER);
-
-                else if (hashtype == 1)
-                        idmef_checksum_set_algorithm(checksum, IDMEF_CHECKSUM_ALGORITHM_SHA1);
-
-                else if (hashtype == 2)
-                        idmef_checksum_set_algorithm(checksum, IDMEF_CHECKSUM_ALGORITHM_MD5);
-
-                else
-                        idmef_checksum_set_algorithm(checksum, IDMEF_CHECKSUM_ALGORITHM_TIGER);
-
-
-                ret = idmef_checksum_new_value(checksum, &str);
-                if ( ret < 0 ) {
-                        free(ptr);
-                        return;
+			idmef_checksum_set_algorithm(checksum, IDMEF_CHECKSUM_ALGORITHM_TIGER);
+
+		else if (hashtype == 1)
+			idmef_checksum_set_algorithm(checksum, IDMEF_CHECKSUM_ALGORITHM_SHA1);
+		
+		else if (hashtype == 2)
+			idmef_checksum_set_algorithm(checksum, IDMEF_CHECKSUM_ALGORITHM_MD5);
+		
+		else
+			idmef_checksum_set_algorithm(checksum, IDMEF_CHECKSUM_ALGORITHM_TIGER);
+
+
+		ret = idmef_checksum_new_value(checksum, &str);
+		if ( ret < 0 ) {
+			free(ptr);
+			goto get_mode;
 		}
 
 		/* will be freed on destroy()
 		 */
-                prelude_string_set_nodup(str, ptr);
-        }
+		prelude_string_set_nodup(str, ptr);
+	}
+
+ get_mode:
 
 	mode = get_value(msg, _("mode"), suffix);
@@ -510,10 +492,10 @@
                 ret = idmef_file_new_file_access(file, &access, IDMEF_LIST_APPEND);
                 if ( ret < 0 )
-                        goto mode_free;
+                        goto get_owner;
 
 	        /* flawfinder: ignore *//* is part of name, not access() */
                 ret = idmef_file_access_new_user_id(access, &userid);
                 if ( ret < 0 )
-                        goto mode_free;
+                        goto get_owner;
                 idmef_user_id_set_type(userid, IDMEF_USER_ID_TYPE_OTHER_PRIVS);
 
@@ -521,8 +503,10 @@
 		get_access_info ( access, mode, 7, 9 );
         }
+
+ get_owner:
  
         ptr = get_value(msg, _("owner"), suffix);
         if ( ptr ) {
-                struct passwd *pw;
+	        char * uid;
                 
 	        /* flawfinder: ignore *//* is part of name, not access() */
@@ -530,5 +514,5 @@
                 if ( ret < 0 ) {
                         free(ptr);
-                        goto mode_free;
+                        goto get_group;
 		}
 
@@ -537,5 +521,5 @@
                 if ( ret < 0 ) {
                         free(ptr);
-                        goto mode_free;
+                        goto get_group;
 		}
                 idmef_user_id_set_type(userid, IDMEF_USER_ID_TYPE_USER_PRIVS);
@@ -544,13 +528,13 @@
                 if ( ret < 0 ) {
                         free(ptr);
-                        goto mode_free;
+                        goto get_group;
                 }
                 prelude_string_set_nodup(str, ptr);
                 
-                pw = getpwnam(ptr);
-                if ( ! pw )
-                        goto mode_free;
-                
-                idmef_user_id_set_number(userid, pw->pw_uid);
+                uid = get_value(msg, _("iowner"), suffix);
+                if ( ! uid )
+                        goto get_group;
+                
+                idmef_user_id_set_number(userid, strtoul(uid, NULL, 0));
 
 		if ( mode ) {
@@ -558,9 +542,13 @@
 		        get_access_info ( access, mode, 1, 3 );
 		}
-        }
+
+		free(uid);
+        }
+
+ get_group:
 
         ptr = get_value(msg, _("group"), suffix);
         if ( ptr ) {
-                struct group *gr;
+                char *gid;
                 
 	        /* flawfinder: ignore *//* is part of name, not access() */
@@ -587,13 +575,15 @@
                 prelude_string_set_nodup(str, ptr);
 
-                gr = getgrnam(ptr);
-                if ( ! gr )
+                gid = get_value(msg, _("igroup"), suffix);
+                if ( ! gid )
                         goto mode_free;
 
-                idmef_user_id_set_number(userid, gr->gr_gid);
+                idmef_user_id_set_number(userid, strtoul(gid, NULL, 0));
 
 		if ( mode ) {
 		        get_access_info ( access, mode, 4, 6 ); /* flawfinder: ignore */
 		}
+
+		free(gid);
         }
 
Index: trunk/src/sh_socket.c
===================================================================
--- trunk/src/sh_socket.c	(revision 37)
+++ trunk/src/sh_socket.c	(revision 40)
@@ -111,6 +111,5 @@
 int    pf_unix_fd  = -1;
 static char * sh_sockname = NULL;
-/* static char   sh_sockpass[29]; */
-static char   sh_sockpass_real[15];
+static char   sh_sockpass_real[SOCKPASS_MAX+1];
 
 struct socket_cmd {
@@ -226,5 +225,5 @@
 {
   int j = 0;
-  while (skey->sh_sockpass[2*j] != '\0')
+  while (skey->sh_sockpass[2*j] != '\0' && j < sizeof(sh_sockpass_real))
     {
       sh_sockpass_real[j] = skey->sh_sockpass[2*j];
@@ -309,8 +308,8 @@
 
   i = sl_strlen(c);
-  if (i > 14) {
+  if (i > SOCKPASS_MAX) {
     return -1;
   }
-  for (j = 0; j < 29; ++j)
+  for (j = 0; j < (2*SOCKPASS_MAX+1); ++j)
     {
       skey->sh_sockpass[j] = '\0';
@@ -556,5 +555,5 @@
 
   iov.iov_base = (char *) &message;
-  iov.iov_len  = SH_MAXMSG;
+  iov.iov_len  = sizeof(message);
 
   memset (&msg, 0, sizeof (msg));
@@ -626,7 +625,7 @@
 #endif
 
-  /* nbytes = recv (talkfd, message, SH_MAXMSG, 0); */
-
-  message[SH_MAXMSG-1] = '\0';
+  /* msg.msg_iov.iov_base, filled by recvmsg
+   */
+  message[sizeof(message)-1] = '\0';
 
   if (nbytes < 0)
@@ -684,5 +683,9 @@
   if (eopw) 
     *eopw = '\0';
-  if (0 == strcmp(goodpassword, message))
+  /*
+   * message is null-terminated and >> goodpassword
+   */
+  if (0 == strcmp(goodpassword, message) &&
+      strlen(goodpassword) < (sizeof(message)/2))
     {
       client_uid = sh_socket_flaguid;
@@ -808,5 +811,5 @@
       while (list_cmd)
 	{
-	  sl_snprintf(message, SH_MAXMSG, _("SENT  %8s  %32s  %s"),
+	  sl_snprintf(message, sizeof(message), _("SENT  %8s  %32s  %s"),
 		      list_cmd->cmd, list_cmd->clt, list_cmd->cti);
 	  /*
@@ -835,5 +838,5 @@
   while (list_cmd)
     {
-      sl_snprintf(message, SH_MAXMSG, _(">>>>  %8s  %32s  %s"),
+      sl_snprintf(message, sizeof(message), _(">>>>  %8s  %32s  %s"),
 		  list_cmd->cmd, list_cmd->clt, list_cmd->cti);
       /*
@@ -964,5 +967,5 @@
     }
 
-  sl_strlcpy(cancel_cmd, _("CANCEL"), SH_MAXMSGLEN); 
+  sl_strlcpy(cancel_cmd, _("CANCEL"), sizeof(cancel_cmd)); 
 
   while (sh_socket_read (&cmd) > 0)
@@ -994,5 +997,5 @@
       if (0 == sl_strcmp(new->clt, client_name))
 	{
-	  sl_strlcpy(out, new->cmd, SH_MAXMSGLEN);
+	  sl_strlcpy(out, new->cmd, sizeof(out));
 	  sh_socket_add2run (new);
 	  sh_socket_rm2list  (client_name);
Index: trunk/src/sh_unix.c
===================================================================
--- trunk/src/sh_unix.c	(revision 37)
+++ trunk/src/sh_unix.c	(revision 40)
@@ -120,4 +120,21 @@
 #endif
 #endif
+
+#if defined(S_IFDOOR) && !defined(S_ISDOOR)
+#define S_ISDOOR(mode) (((mode) & S_IFMT) == S_IFDOOR)
+#else
+#if !defined(S_ISDOOR)
+#define S_ISDOOR(mode) (0)
+#endif
+#endif
+
+#if defined(S_IFPORT) && !defined(S_ISPORT)
+#define S_ISPORT(mode) (((mode) & S_IFMT) == S_IFPORT)
+#else
+#if !defined(S_ISPORT)
+#define S_ISPORT(mode) (0)
+#endif
+#endif
+
 
 #undef  FIL__
@@ -2674,4 +2691,12 @@
     c_mode[0] = 's';
   }
+  else if ( S_ISDOOR(buf->st_mode) ) {
+    (*type)   = SH_FILE_DOOR;
+    c_mode[0] = 'D';
+  }
+  else if ( S_ISPORT(buf->st_mode) ) {
+    (*type)   = SH_FILE_PORT;
+    c_mode[0] = 'P';
+  }
   else                              {
     (*type)   = SH_FILE_UNKNOWN;
