Index: trunk/docs/Changelog
===================================================================
--- trunk/docs/Changelog	(revision 219)
+++ trunk/docs/Changelog	(revision 220)
@@ -1,3 +1,5 @@
 2.5.3:
+	* Fix problem in standalone trustfile, does not work correctly on
+	  group-writeable files (reported by David).
 	* Option SetThrottle to throttle throughput for db download
 	* Option SetConnectionTimeout to configure the client connection 
Index: trunk/src/trustfile.c
===================================================================
--- trunk/src/trustfile.c	(revision 219)
+++ trunk/src/trustfile.c	(revision 220)
@@ -86,4 +86,7 @@
 #else
 #define UID_CAST long
+#define HAVE_GETPWENT
+#define SH_MUTEX_LOCK(a)   ((void)0)
+#define SH_MUTEX_UNLOCK(a) ((void)0)
 #endif
 
@@ -362,6 +365,7 @@
 	SL_IRETURN(status, _("getfname"));
 #else
-      strncat(rbuf, "/",   rsz-strlen(rbuf));
-      strncat(rbuf, fname, rsz-strlen(rbuf));
+      strncat(rbuf, "/",   rsz-strlen(rbuf)-1);
+      strncat(rbuf, fname, rsz-strlen(rbuf)-1);
+      rbuf[rsz-1] = '\0';
 #endif
     }
@@ -624,5 +628,5 @@
 		  fprintf (stderr, 
 			   "trustfile: uid=%ld, trusted_uid=%ld, match found --> OK\n", 
-			   (UID_CAST)(w->pw_uid), *u);
+			   (UID_CAST)(w->pw_uid), (UID_CAST)(*u));
 #endif 
 		  flag = 0;
