Index: trunk/src/cutest_sh_utils.c
===================================================================
--- trunk/src/cutest_sh_utils.c	(revision 68)
+++ trunk/src/cutest_sh_utils.c	(revision 76)
@@ -6,4 +6,72 @@
 #include "samhain.h"
 #include "sh_utils.h"
+
+void Test_sl_strlcpy (CuTest *tc) {
+  int ret;
+  char out[] = "aaaaaa";
+  char in[]  = "bbb";
+
+  ret = sl_strlcpy (NULL, NULL, 0);
+  CuAssertIntEquals(tc, ret, SL_ENONE);
+
+  ret = sl_strlcpy (NULL, in, 0);
+  CuAssertIntEquals(tc, ret, SL_ENULL);
+
+  ret = sl_strlcpy (out, NULL, 0);
+  CuAssertIntEquals(tc, ret, SL_ENONE);
+
+  ret = sl_strlcpy (out, in, 0);
+  CuAssertIntEquals(tc, ret, SL_ENONE);
+
+  ret = sl_strlcpy (out, NULL, 7);
+  CuAssertIntEquals(tc, ret, SL_ENONE);
+  CuAssertStrEquals(tc, "", out);
+
+  out[0] = 'a';
+  ret = sl_strlcpy (out, in, 4);
+  CuAssertIntEquals(tc, ret, SL_ENONE);
+  CuAssertStrEquals(tc, "bbb", out);
+  CuAssertStrEquals(tc, "aa", &out[4]);
+  
+  return;
+}
+
+void Test_sl_strlcat (CuTest *tc) {
+  int ret;
+  char out[16] = "aaaaaa";
+  char in[16]  = "bbb";
+
+  ret = sl_strlcat (NULL, NULL, 0);
+  CuAssertIntEquals(tc, ret, SL_ENONE);
+
+  ret = sl_strlcat (NULL, in, 0);
+  CuAssertIntEquals(tc, ret, SL_ENONE);
+
+  ret = sl_strlcat (out, NULL, 0);
+  CuAssertIntEquals(tc, ret, SL_ENONE);
+
+  ret = sl_strlcat (out, in, 0);
+  CuAssertIntEquals(tc, ret, SL_ENONE);
+
+  ret = sl_strlcat (out, NULL, sizeof(out));
+  CuAssertIntEquals(tc, ret, SL_ENONE);
+  CuAssertStrEquals(tc, "aaaaaa", out);
+
+  ret = sl_strlcat (out, in, 7);
+  CuAssertIntEquals(tc, ret, SL_ETRUNC);
+  CuAssertStrEquals(tc, "aaaaaa", out);
+
+  ret = sl_strlcat (out, in, 8);
+  CuAssertIntEquals(tc, ret, SL_ETRUNC);
+  CuAssertStrEquals(tc, "aaaaaab", out);
+
+  ret = sl_strlcat (out, in, sizeof(out));
+  CuAssertIntEquals(tc, ret, SL_ENONE);
+  CuAssertStrEquals(tc, "aaaaaabbbb", out);
+
+  CuAssertStrEquals(tc, "bbb", in);
+
+  return;
+}
 
 void Test_sh_util_acl_compact (CuTest *tc) {
@@ -238,4 +306,8 @@
   CuAssertIntEquals(tc, ret, S_FALSE);
 
+  /* switch on utf8 checking for sh_util_obscurename() */
+
+  ret = sh_util_obscure_utf8("Y");
+  CuAssertIntEquals(tc, ret, 0);
 
   ret = sh_util_obscure_ok ("0x01,0x02,0x03");
@@ -244,24 +316,54 @@
   ret = sh_util_valid_utf8 (input);
   CuAssertIntEquals(tc, ret, S_TRUE);
+  ret = sh_util_obscurename (0, (char *)input, S_FALSE /* no log message */);
+  CuAssertIntEquals(tc, ret, 0);
 
   input[0] = '\t';
   ret = sh_util_valid_utf8 (input);
   CuAssertIntEquals(tc, ret, S_FALSE);
+  ret = sh_util_obscurename (0, (char *)input, S_FALSE /* no log message */);
+  CuAssertIntEquals(tc, ret, -1);
 
   input[0] = 0x01;
   ret = sh_util_valid_utf8 (input);
   CuAssertIntEquals(tc, ret, S_TRUE);
+  ret = sh_util_obscurename (0, (char *)input, S_FALSE /* no log message */);
+  CuAssertIntEquals(tc, ret, 0);
 
   input[0] = 0x02;
   ret = sh_util_valid_utf8 (input);
   CuAssertIntEquals(tc, ret, S_TRUE);
+  ret = sh_util_obscurename (0, (char *)input, S_FALSE /* no log message */);
+  CuAssertIntEquals(tc, ret, 0);
 
   input[0] = 0x03;
   ret = sh_util_valid_utf8 (input);
   CuAssertIntEquals(tc, ret, S_TRUE);
+  ret = sh_util_obscurename (0, (char *)input, S_FALSE /* no log message */);
+  CuAssertIntEquals(tc, ret, 0);
 
   input[0] = 0x04;
   ret = sh_util_valid_utf8 (input);
   CuAssertIntEquals(tc, ret, S_FALSE);
+  ret = sh_util_obscurename (0, (char *)input, S_FALSE /* no log message */);
+  CuAssertIntEquals(tc, ret, -1);
+
+  input[0] = 'f';
+  ret = sh_util_valid_utf8 (input);
+  CuAssertIntEquals(tc, ret, S_TRUE);
+  ret = sh_util_obscurename (0, (char *)input, S_FALSE /* no log message */);
+  CuAssertIntEquals(tc, ret, 0);
+
+  input[5] = ' ';
+  ret = sh_util_valid_utf8 (input);
+  CuAssertIntEquals(tc, ret, S_FALSE);
+  ret = sh_util_obscurename (0, (char *)input, S_FALSE /* no log message */);
+  CuAssertIntEquals(tc, ret, -1);
+
+  input[5] = 'r'; input[3] = ' ';
+  ret = sh_util_valid_utf8 (input);
+  CuAssertIntEquals(tc, ret, S_TRUE);
+  ret = sh_util_obscurename (0, (char *)input, S_FALSE /* no log message */);
+  CuAssertIntEquals(tc, ret, 0);
 
 
@@ -277,4 +379,9 @@
   char input[16] = "foobar";
 
+  /* switch off utf8 checking for sh_util_obscurename() */
+
+  ret = sh_util_obscure_utf8("N");
+  CuAssertIntEquals(tc, ret, 0);
+
   ret = sh_util_obscure_ok ("0xA1,0xA2,0xA3");
   CuAssertIntEquals(tc, ret, 0);
@@ -303,4 +410,15 @@
   CuAssertIntEquals(tc, ret, -1);
 
+  input[0] = 'f';
+  ret = sh_util_obscurename (0, input, S_FALSE /* no log message */);
+  CuAssertIntEquals(tc, ret, 0);
+
+  input[5] = ' ';
+  ret = sh_util_obscurename (0, input, S_FALSE /* no log message */);
+  CuAssertIntEquals(tc, ret, -1);
+
+  input[5] = 'r'; input[3] = ' ';
+  ret = sh_util_obscurename (0, input, S_FALSE /* no log message */);
+  CuAssertIntEquals(tc, ret, 0);
 #else
   CuAssertIntEquals(tc, ret, 0);
