Index: trunk/Makefile
===================================================================
--- trunk/Makefile	(revision 64)
+++ trunk/Makefile	(revision 65)
@@ -18,5 +18,5 @@
 
 BUILD_TREE=$(BUILD_BIN) $(BUILD_DOC)
-SUB_DIRS=lib src doc
+SUB_DIRS=lib src doc bin
 
 FILES=$(REGLOOKUP)
Index: trunk/bin/Makefile
===================================================================
--- trunk/bin/Makefile	(revision 65)
+++ trunk/bin/Makefile	(revision 65)
@@ -0,0 +1,17 @@
+# $Id$
+
+################################################################################
+
+TIMELINE=$(BUILD_BIN)/reglookup-timeline
+FILES=$(TIMELINE)
+
+all: $(FILES)
+
+$(TIMELINE):
+	cp reglookup-timeline $@
+
+install:
+	cp -r $(FILES) $(BIN_PREFIX)
+
+clean:
+	rm -f *~
Index: trunk/lib/regfio.c
===================================================================
--- trunk/lib/regfio.c	(revision 64)
+++ trunk/lib/regfio.c	(revision 65)
@@ -31,5 +31,5 @@
 const unsigned int regfio_num_reg_types = 11;
 static const char* regfio_type_names[] =
-  {"NONE", "SZ", "EXPAND_SZ", "BINARY", "DWORD", "DWORD_BE", "LINK"
+  {"NONE", "SZ", "EXPAND_SZ", "BINARY", "DWORD", "DWORD_BE", "LINK",
    "MULTI_SZ", "RSRC_LIST", "RSRC_DESC", "RSRC_REQ_LIST"};
 
Index: trunk/lib/smb_deps.c
===================================================================
--- trunk/lib/smb_deps.c	(revision 64)
+++ trunk/lib/smb_deps.c	(revision 65)
@@ -4,5 +4,5 @@
  *   http://websvn.samba.org/cgi-bin/viewcvs.cgi/trunk/source/
  *
- * Copyright (C) 2005 Timothy D. Morgan
+ * Copyright (C) 2005-2006 Timothy D. Morgan
  * Copyright (C) 1992-2005 Samba development team 
  *               (see individual files under Subversion for details.)
@@ -181,6 +181,4 @@
     if((new_data = zalloc(new_size)) == NULL)
       return false;
-
-    memset(new_data, '\0', (size_t)new_size );
   } 
   else 
@@ -237,5 +235,8 @@
 bool prs_init(prs_struct *ps, uint32 size, void *ctx, bool io)
 {
+  if(ps == NULL)
+    return false;
   memset(ps, 0, sizeof(prs_struct));
+
   ps->io = io;
   ps->bigendian_data = RPC_LITTLE_ENDIAN;
@@ -253,5 +254,4 @@
       return false;
 
-    memset(ps->data_p, '\0', (size_t)size);
     ps->is_dynamic = true; /* We own this memory. */
   }
@@ -279,4 +279,5 @@
       return NULL;
   }
+
   return &ps->data_p[ps->data_offset];
 }
@@ -795,5 +796,5 @@
   uint32 old_offset;
   uint32 offset_acl_size;
-  SEC_ACL *psa;
+  SEC_ACL* psa;
 
   /*
@@ -804,5 +805,5 @@
    */
 
-  if (ppsa == NULL)
+  if (ppsa == NULL || ps == NULL)
     return false;
 
@@ -819,16 +820,15 @@
   }
 
-  depth++;
-	
+  depth++;	
   old_offset = ps->data_offset;
 
-  if(!prs_uint16("revision", ps, depth, &psa->revision))
-    return false;
-
-  if(!prs_uint16_pre("size     ", ps, depth, &psa->size, &offset_acl_size))
-    return false;
-
-  if(!prs_uint32("num_aces ", ps, depth, &psa->num_aces))
-    return false;
+  if(!prs_uint16("revision", ps, depth, &psa->revision)
+     || !prs_uint16_pre("size     ", ps, depth, &psa->size, &offset_acl_size)
+     || !prs_uint32("num_aces ", ps, depth, &psa->num_aces))
+  {
+    free(psa);
+    *ppsa = NULL;
+    return false;
+  }
 
   if (ps->io) 
@@ -840,5 +840,9 @@
      */
     if((psa->ace = (SEC_ACE*)zcalloc(sizeof(SEC_ACE), psa->num_aces+1)) == NULL)
-      return false;
+    {
+      free(psa);
+      *ppsa = NULL;
+      return false;
+    }
   }
 
@@ -848,5 +852,9 @@
     snprintf(tmp, sizeof(tmp)-1, "ace_list[%02d]: ", i);
     if(!sec_io_ace(tmp, &psa->ace[i], ps, depth))
-      return false;
+    {
+      free(psa);
+      *ppsa = NULL;
+      return false;
+    }
   }
 
@@ -864,5 +872,9 @@
     {
       if (!prs_uint8("acl extra space", ps, depth, &c))
+      {
+	free(psa);
+	*ppsa = NULL;
 	return false;
+      }
     }
   }
@@ -870,5 +882,9 @@
   if(!prs_uint16_post("size     ", ps, depth, &psa->size, 
 		      offset_acl_size, old_offset))
-  { return false; }
+  { 
+    free(psa);
+    *ppsa = NULL;
+    return false; 
+  }
 
   return true;
@@ -888,9 +904,8 @@
   SEC_DESC *psd;
 
-  if (ppsd == NULL)
+  if (ppsd == NULL || ps == NULL)
     return false;
 
   psd = *ppsd;
-
   if (psd == NULL) 
   {
@@ -913,11 +928,13 @@
   old_offset = ps->data_offset;
 
-  if(!prs_uint16("revision ", ps, depth, &psd->revision))
-    return false;
-
-  if(!prs_uint16("type     ", ps, depth, &psd->type))
-    return false;
-
-  if (!ps->io) 
+  if(!prs_uint16("revision ", ps, depth, &psd->revision)
+     || !prs_uint16("type     ", ps, depth, &psd->type))
+  {
+    free(psd);
+    *ppsd = NULL;
+    return false;
+  }
+
+  if (!ps->io)
   {
     uint32 offset = SEC_DESC_HEADER_SIZE;
@@ -960,16 +977,13 @@
   }
 
-  if(!prs_uint32("off_owner_sid", ps, depth, &psd->off_owner_sid))
-    return false;
-
-  if(!prs_uint32("off_grp_sid  ", ps, depth, &psd->off_grp_sid))
-    return false;
-
-  if(!prs_uint32("off_sacl     ", ps, depth, &psd->off_sacl))
-    return false;
-
-  if(!prs_uint32("off_dacl     ", ps, depth, &psd->off_dacl))
-    return false;
-
+  if(!prs_uint32("off_owner_sid", ps, depth, &psd->off_owner_sid)
+     || !prs_uint32("off_grp_sid  ", ps, depth, &psd->off_grp_sid)
+     || !prs_uint32("off_sacl     ", ps, depth, &psd->off_sacl)
+     || !prs_uint32("off_dacl     ", ps, depth, &psd->off_dacl))
+  {
+    free(psd);
+    *ppsd = NULL;    
+    return false;
+  }
   max_offset = MAX(max_offset, ps->data_offset);
 
@@ -978,5 +992,9 @@
     tmp_offset = ps->data_offset;
     if(!prs_set_offset(ps, old_offset + psd->off_owner_sid))
-      return false;
+    {
+      free(psd);
+      *ppsd = NULL;
+      return false;
+    }
 
     if (ps->io) 
@@ -984,14 +1002,30 @@
       /* reading */
       if((psd->owner_sid = (DOM_SID*)zalloc(sizeof(DOM_SID))) == NULL)
+      {
+	free(psd);
+	*ppsd = NULL;
 	return false;
+      }
     }
 
     if(!smb_io_dom_sid("owner_sid ", psd->owner_sid , ps, depth))
-      return false;
+    {
+      if(ps->io)
+	free(psd->owner_sid);
+      free(psd);
+      *ppsd = NULL;
+      return false;
+    }
 
     max_offset = MAX(max_offset, ps->data_offset);
 
     if (!prs_set_offset(ps,tmp_offset))
-      return false;
+    {
+      if(ps->io)
+	free(psd->owner_sid);
+      free(psd);
+      *ppsd = NULL;
+      return false;
+    }
   }
 
@@ -1000,5 +1034,11 @@
     tmp_offset = ps->data_offset;
     if(!prs_set_offset(ps, old_offset + psd->off_grp_sid))
-      return false;
+    {
+      if(ps->io)
+	free(psd->owner_sid);
+      free(psd);
+      *ppsd = NULL;
+      return false;
+    }
 
     if (ps->io) 
@@ -1006,14 +1046,37 @@
       /* reading */
       if((psd->grp_sid = (DOM_SID*)zalloc(sizeof(DOM_SID))) == NULL)
+      {
+	free(psd->owner_sid);
+	free(psd);
+	*ppsd = NULL;
 	return false;
+      }
     }
 
     if(!smb_io_dom_sid("grp_sid", psd->grp_sid, ps, depth))
-      return false;
+    {
+      if(ps->io)
+      {
+	free(psd->grp_sid);
+	free(psd->owner_sid);
+      }
+      free(psd);
+      *ppsd = NULL;
+      return false;
+    }
 			
     max_offset = MAX(max_offset, ps->data_offset);
 
     if (!prs_set_offset(ps,tmp_offset))
-      return false;
+    {
+      if(ps->io)
+      {
+	free(psd->grp_sid);
+	free(psd->owner_sid);
+      }
+      free(psd);
+      *ppsd = NULL;
+      return false;
+    }
   }
 
@@ -1021,11 +1084,28 @@
   {
     tmp_offset = ps->data_offset;
-    if(!prs_set_offset(ps, old_offset + psd->off_sacl))
-      return false;
-    if(!sec_io_acl("sacl", &psd->sacl, ps, depth))
-      return false;
+    if(!prs_set_offset(ps, old_offset + psd->off_sacl)
+       || !sec_io_acl("sacl", &psd->sacl, ps, depth))
+    {
+      if(ps->io)
+      {
+	free(psd->grp_sid);
+	free(psd->owner_sid);
+      }
+      free(psd);
+      *ppsd = NULL;
+      return false;
+    }
     max_offset = MAX(max_offset, ps->data_offset);
     if (!prs_set_offset(ps,tmp_offset))
-      return false;
+    {
+      if(ps->io)
+      {
+	free(psd->grp_sid);
+	free(psd->owner_sid);
+      }
+      free(psd);
+      *ppsd = NULL;
+      return false;
+    }
   }
 
@@ -1033,15 +1113,41 @@
   {
     tmp_offset = ps->data_offset;
-    if(!prs_set_offset(ps, old_offset + psd->off_dacl))
-      return false;
-    if(!sec_io_acl("dacl", &psd->dacl, ps, depth))
-      return false;
+    if(!prs_set_offset(ps, old_offset + psd->off_dacl)
+       || !sec_io_acl("dacl", &psd->dacl, ps, depth))
+    {
+      if(ps->io)
+      {
+	free(psd->grp_sid);
+	free(psd->owner_sid);
+      }
+      free(psd);
+      *ppsd = NULL;
+      return false;
+    }
     max_offset = MAX(max_offset, ps->data_offset);
     if (!prs_set_offset(ps,tmp_offset))
-      return false;
+    {
+      if(ps->io)
+      {
+	free(psd->grp_sid);
+	free(psd->owner_sid);
+      }
+      free(psd);
+      *ppsd = NULL;
+      return false;
+    }
   }
 
   if(!prs_set_offset(ps, max_offset))
-    return false;
+  {
+      if(ps->io)
+      {
+	free(psd->grp_sid);
+	free(psd->owner_sid);
+      }
+      free(psd);
+      *ppsd = NULL;
+      return false;
+  }
 
   return true;
@@ -1057,7 +1163,9 @@
 bool sec_ace_equal(SEC_ACE *s1, SEC_ACE *s2)
 {
-  /* Trivial case */
+  /* Trivial cases */
   if (!s1 && !s2) 
     return true;
+  if (!s1 || !s2) 
+    return false;
 
   /* Check top level stuff */
@@ -1130,8 +1238,9 @@
 bool sec_desc_equal(SEC_DESC *s1, SEC_DESC *s2)
 {
-  /* Trivial case */
-
+  /* Trivial cases */
   if (!s1 && !s2)
-    goto done;
+    return true;
+  if (!s1 || !s2)
+    return false;
 
   /* Check top level stuff */
@@ -1159,5 +1268,4 @@
     return false;
 
- done:
   return true;
 }
Index: trunk/src/Makefile
===================================================================
--- trunk/src/Makefile	(revision 64)
+++ trunk/src/Makefile	(revision 65)
@@ -16,5 +16,5 @@
 
 install:
-	cp -r $(BUILD_BIN)/* $(BIN_PREFIX)
+	cp -r $(FILES) $(BIN_PREFIX)
 
 clean:
