[Forensics-changes] [reglookup] 01/02: Import Upstream version 1.0.1+svn287
Giovani Augusto Ferreira
giovani-guest at moszumanska.debian.org
Tue Oct 18 11:35:11 UTC 2016
This is an automated email from the git hooks/post-receive script.
giovani-guest pushed a commit to branch debian
in repository reglookup.
commit 0e9b1a95ad63a6183ed07c2b7385d71b36b2bdbc
Author: Giovani Augusto Ferreira <giovani at riseup.net>
Date: Tue Oct 18 09:34:44 2016 -0200
Import Upstream version 1.0.1+svn287
---
.sconsign.dblite | Bin 2343 -> 0 bytes
SConstruct | 65 +++++++++++++++++++++++++--------------
bin/reglookup-timeline | 2 +-
doc/devel/TODO | 2 +-
doc/reglookup-recover.1.docbook | 2 +-
doc/reglookup-recover.1.gz | Bin 1567 -> 0 bytes
doc/reglookup-timeline.1.docbook | 2 +-
doc/reglookup-timeline.1.gz | Bin 1413 -> 0 bytes
doc/reglookup.1.docbook | 2 +-
doc/reglookup.1.gz | Bin 3480 -> 0 bytes
include/byteorder.h | 2 +-
include/lru_cache.h | 2 +-
include/range_list.h | 2 +-
include/regfi.h | 2 +-
include/void_stack.h | 2 +-
include/winsec.h | 2 +-
lib/lru_cache.c | 5 +--
lib/range_list.c | 2 +-
lib/regfi.c | 24 ++++++++-------
lib/void_stack.c | 2 +-
lib/winsec.c | 15 ++++++---
pyregfi-distutils.py | 4 ---
regfi_version.py | 4 ++-
setup.py | 8 +++++
src/common.c | 2 +-
src/reglookup-recover.c | 2 +-
src/reglookup.c | 2 +-
27 files changed, 95 insertions(+), 62 deletions(-)
diff --git a/.sconsign.dblite b/.sconsign.dblite
deleted file mode 100644
index ca20cd0..0000000
Binary files a/.sconsign.dblite and /dev/null differ
diff --git a/SConstruct b/SConstruct
index 3222a2d..f6c7744 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1,11 +1,18 @@
+#-*- mode: Python;-*-
+
import sys
import os
sys.dont_write_bytecode = True
from regfi_version import REGFI_VERSION
+ABI_VERSION=REGFI_VERSION.rsplit('.',1)[0]
+# Package Maintainers: should any of these options in the first line be omitted during
+# package build, instead relying on CFLAGS/LDFLAGS to specify them when appropriate?
cflags = '-std=gnu99 -pedantic -Wall -D_FILE_OFFSET_BITS=64 -fvisibility=hidden'
-cflags += ' -DREGFI_VERSION=\'"%s"\'' % REGFI_VERSION
-cflags += ' -ggdb'
+cflags += ' -DREGFI_VERSION=\'"%s"\' ' % REGFI_VERSION
+cflags += os.environ.get('CFLAGS','-fPIE -pie -fstack-protector -D_FORTIFY_SOURCE=2')
+
+linkflags = "-fPIC " + os.environ.get('LDFLAGS',"-Wl,-z,relro,-z,now")
lib_src = ['lib/regfi.c',
'lib/winsec.c',
@@ -17,13 +24,16 @@ cc=os.environ.get('CC', 'gcc')
env = Environment(ENV=os.environ,
CC=cc,
CFLAGS=cflags,
+ LINKFLAGS=linkflags,
CPPPATH=['include', '/usr/local/include'],
LIBPATH=['lib', '/usr/local/lib'],
LIBS=['m', 'pthread', 'regfi', 'talloc'])
+
# Libraries
libregfi_static = env.Library(lib_src)
-libregfi = env.SharedLibrary(lib_src, LIBS=['m','pthread', 'talloc'])
+libregfi = env.SharedLibrary(lib_src, LIBS=['m','pthread', 'talloc'],
+ SHLIBVERSION=ABI_VERSION)
# Executables
@@ -45,36 +55,41 @@ man_reglookup_recover = env.ManPage('doc/reglookup-recover.1.docbook')
man_reglookup_timeline = env.ManPage('doc/reglookup-timeline.1.docbook')
# Installation
-prefix='/usr/local/'
-if 'PREFIX' in os.environ:
- prefix = os.environ['PREFIX']+'/'
-
-install_items = [prefix+'bin',
- prefix+'lib',
- prefix+'include/regfi',
- prefix+'man']
-
-env.Install(prefix+'bin', [reglookup, reglookup_recover, 'bin/reglookup-timeline'])
-libinstall = env.Install(prefix+'lib', [libregfi, libregfi_static])
-env.Install(prefix+'include/regfi', Glob('include/*.h'))
-env.Install(prefix+'man/man1', [man_reglookup, man_reglookup_recover,
- man_reglookup_timeline])
-env.AddPostAction(libinstall, 'ldconfig')
-
+prefix = os.environ.get('PREFIX','/usr/local')+'/'
+destdir = os.environ.get('DESTDIR','')
+bindir = os.environ.get('BINDIR', prefix + 'bin')
+libdir = os.environ.get('LIBDIR', prefix + 'lib')
+includedir = os.environ.get('INCLUDEDIR', prefix + 'include')
+mandir = os.environ.get('MANDIR', prefix + 'man')
+
+install_bin = [destdir + bindir, destdir + mandir]
+install_lib = [destdir + libdir, destdir + includedir + '/regfi']
+
+env.Install(destdir+bindir, [reglookup, reglookup_recover, 'bin/reglookup-timeline'])
+libinstall = env.InstallVersionedLib(destdir+libdir, [libregfi, libregfi_static], SHLIBVERSION=ABI_VERSION)
+env.Install(destdir+includedir+'/regfi', Glob('include/*.h'))
+env.Install(destdir+mandir+'/man1', [man_reglookup, man_reglookup_recover,
+ man_reglookup_timeline])
+
+if os.getuid() == 0 and destdir == '':
+ env.AddPostAction(libinstall, 'ldconfig')
+
+install_pyregfi = []
if sys.version_info[0] == 2:
- install_items.append('pyregfi2-install.log')
+ install_pyregfi.append('pyregfi2-install.log')
env.Command('pyregfi2-install.log', ['python/pyregfi/__init__.py',
'python/pyregfi/structures.py',
'python/pyregfi/winsec.py'],
- "python pyregfi-distutils.py install | tee pyregfi2-install.log")
+ "python setup.py install --root=/%s | tee pyregfi2-install.log" % destdir)
python_path = os.popen('which python3').read()
if python_path != '':
- install_items.append('pyregfi3-install.log')
+ install_pyregfi.append('pyregfi3-install.log')
env.Command('pyregfi3-install.log', ['python/pyregfi/__init__.py',
'python/pyregfi/structures.py',
'python/pyregfi/winsec.py'],
- "python3 pyregfi-distutils.py install | tee pyregfi3-install.log")
+ "python3 setup.py install --root=/%s | tee pyregfi3-install.log" % destdir)
+
# API documentation
regfi_doc = env.Command('doc/devel/regfi/index.html',
@@ -84,6 +99,7 @@ pyregfi_doc = env.Command('doc/devel/pyregfi/index.html',
Glob('python/pyregfi/*.py')+['doc/devel/Doxyfile.pyregfi', regfi_doc],
'doxygen doc/devel/Doxyfile.pyregfi')
+install_items = install_bin + install_lib + install_pyregfi
# User Friendly Targets
env.Alias('libregfi', libregfi)
@@ -92,6 +108,9 @@ env.Alias('reglookup-recover', reglookup_recover)
env.Alias('bin', [reglookup_recover, reglookup])
env.Alias('doc', [man_reglookup,man_reglookup_recover,man_reglookup_timeline])
env.Alias('doc-devel', [regfi_doc, pyregfi_doc])
+env.Alias('install_bin', install_bin)
+env.Alias('install_lib', install_lib)
+env.Alias('install_pyregfi', install_pyregfi)
env.Alias('install', install_items)
Default('bin', libregfi)
diff --git a/bin/reglookup-timeline b/bin/reglookup-timeline
index 67c7eaa..3815e79 100755
--- a/bin/reglookup-timeline
+++ b/bin/reglookup-timeline
@@ -19,7 +19,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
-# $Id: reglookup-timeline 170 2010-03-06 04:40:25Z tim $
+# $Id$
usage()
diff --git a/doc/devel/TODO b/doc/devel/TODO
index 176545b..4bc8108 100644
--- a/doc/devel/TODO
+++ b/doc/devel/TODO
@@ -1,4 +1,4 @@
-$Id: TODO 262 2011-06-17 17:51:31Z tim $
+$Id$
If you are interested in contributing to this project, here's a few
things you could look into:
diff --git a/doc/reglookup-recover.1.docbook b/doc/reglookup-recover.1.docbook
index 672409c..2623405 100644
--- a/doc/reglookup-recover.1.docbook
+++ b/doc/reglookup-recover.1.docbook
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<refentry id='reglookup-recover.1'>
- <!-- $Id: reglookup-recover.1.docbook 264 2011-06-20 01:13:35Z tim $ -->
+ <!-- $Id$ -->
<refmeta>
<refentrytitle>reglookup</refentrytitle>
<manvolnum>1</manvolnum>
diff --git a/doc/reglookup-recover.1.gz b/doc/reglookup-recover.1.gz
deleted file mode 100644
index f72c0cb..0000000
Binary files a/doc/reglookup-recover.1.gz and /dev/null differ
diff --git a/doc/reglookup-timeline.1.docbook b/doc/reglookup-timeline.1.docbook
index cb0f61b..8de13ea 100644
--- a/doc/reglookup-timeline.1.docbook
+++ b/doc/reglookup-timeline.1.docbook
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<refentry id='reglookup-timeline.1'>
- <!-- $Id: reglookup-timeline.1.docbook 119 2008-08-09 05:55:45Z tim $ -->
+ <!-- $Id$ -->
<refmeta>
<refentrytitle>reglookup-timeline</refentrytitle>
<manvolnum>1</manvolnum>
diff --git a/doc/reglookup-timeline.1.gz b/doc/reglookup-timeline.1.gz
deleted file mode 100644
index 0bdecee..0000000
Binary files a/doc/reglookup-timeline.1.gz and /dev/null differ
diff --git a/doc/reglookup.1.docbook b/doc/reglookup.1.docbook
index c1480eb..951af98 100644
--- a/doc/reglookup.1.docbook
+++ b/doc/reglookup.1.docbook
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<refentry id='reglookup.1'>
- <!-- $Id: reglookup.1.docbook 264 2011-06-20 01:13:35Z tim $ -->
+ <!-- $Id$ -->
<refmeta>
<refentrytitle>reglookup</refentrytitle>
<manvolnum>1</manvolnum>
diff --git a/doc/reglookup.1.gz b/doc/reglookup.1.gz
deleted file mode 100644
index e7496fb..0000000
Binary files a/doc/reglookup.1.gz and /dev/null differ
diff --git a/include/byteorder.h b/include/byteorder.h
index 87cb61b..e3e2b1a 100644
--- a/include/byteorder.h
+++ b/include/byteorder.h
@@ -21,7 +21,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: byteorder.h 168 2010-03-03 00:08:42Z tim $
+ * $Id$
*/
#ifndef _BYTEORDER_H
diff --git a/include/lru_cache.h b/include/lru_cache.h
index 6dfe467..146993b 100644
--- a/include/lru_cache.h
+++ b/include/lru_cache.h
@@ -14,7 +14,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: lru_cache.h 253 2011-06-13 02:27:42Z tim $
+ * $Id$
*/
/**
diff --git a/include/range_list.h b/include/range_list.h
index 356c08e..99c19af 100644
--- a/include/range_list.h
+++ b/include/range_list.h
@@ -14,7 +14,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: range_list.h 253 2011-06-13 02:27:42Z tim $
+ * $Id$
*/
/**
diff --git a/include/regfi.h b/include/regfi.h
index 962ad22..00e1a2c 100644
--- a/include/regfi.h
+++ b/include/regfi.h
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: regfi.h 263 2011-06-18 00:06:51Z tim $
+ * $Id$
*/
/**
diff --git a/include/void_stack.h b/include/void_stack.h
index eb17766..c32cd0d 100644
--- a/include/void_stack.h
+++ b/include/void_stack.h
@@ -14,7 +14,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: void_stack.h 253 2011-06-13 02:27:42Z tim $
+ * $Id$
*/
/**
diff --git a/include/winsec.h b/include/winsec.h
index 9df4a30..3bfa7f3 100644
--- a/include/winsec.h
+++ b/include/winsec.h
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: winsec.h 261 2011-06-17 00:55:49Z tim $
+ * $Id$
*/
/**
diff --git a/lib/lru_cache.c b/lib/lru_cache.c
index 67c1fce..ff576a4 100644
--- a/lib/lru_cache.c
+++ b/lib/lru_cache.c
@@ -14,7 +14,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: lru_cache.c 252 2011-05-08 17:33:49Z tim $
+ * $Id$
*/
/**
@@ -60,7 +60,8 @@ static uint32_t lru_cache_floor_log2(uint32_t n)
}
#if 0
-static void lru_cache_print(lru_cache* ht)
+_EXPORT()
+void lru_cache_print(lru_cache* ht)
{
uint32_t i;
lru_cache_element* cur;
diff --git a/lib/range_list.c b/lib/range_list.c
index 80b97f0..685ffba 100644
--- a/lib/range_list.c
+++ b/lib/range_list.c
@@ -14,7 +14,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: range_list.c 169 2010-03-03 19:24:58Z tim $
+ * $Id$
*/
/**
diff --git a/lib/regfi.c b/lib/regfi.c
index aced069..75d5c7d 100644
--- a/lib/regfi.c
+++ b/lib/regfi.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005-2011 Timothy D. Morgan
+ * Copyright (C) 2005-2011,2015 Timothy D. Morgan
* Copyright (C) 2005 Gerald (Jerry) Carter
*
* This program is free software; you can redistribute it and/or modify
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: regfi.c 274 2011-09-28 00:29:25Z tim $
+ * $Id$
*/
/**
@@ -972,7 +972,7 @@ REGFI_SUBKEY_LIST* regfi_merge_subkeylists(uint16_t num_lists,
*
******************************************************************************/
REGFI_SK* regfi_parse_sk(REGFI_FILE* file, uint32_t offset, uint32_t max_size,
- bool strict)
+ bool strict)
{
REGFI_SK* ret_val = NULL;
uint8_t* sec_desc_buf = NULL;
@@ -1014,7 +1014,7 @@ REGFI_SK* regfi_parse_sk(REGFI_FILE* file, uint32_t offset, uint32_t max_size,
|| (strict && (ret_val->cell_size & 0x00000007) != 0))
{
regfi_log_add(REGFI_LOG_WARN, "Invalid cell size found while"
- " parsing SK record at offset 0x%.8X.", offset);
+ " parsing SK record at offset 0x%.8X.", offset);
goto fail_locked;
}
@@ -1062,11 +1062,11 @@ REGFI_SK* regfi_parse_sk(REGFI_FILE* file, uint32_t offset, uint32_t max_size,
goto fail;
if(!(ret_val->sec_desc = winsec_parse_desc(ret_val, sec_desc_buf,
- ret_val->desc_size)))
+ ret_val->desc_size)))
{
regfi_log_add(REGFI_LOG_ERROR, "Failed to parse security"
- " descriptor while parsing SK record at offset 0x%.8X.",
- offset);
+ " descriptor while parsing SK record at offset 0x%.8X.",
+ offset);
goto fail;
}
@@ -1438,7 +1438,7 @@ const REGFI_SK* regfi_load_sk(REGFI_FILE* file, uint32_t offset, bool strict)
{
REGFI_SK* ret_val = NULL;
int32_t max_size;
- void* failure_ptr = NULL;
+ uint32_t* failure_ptr = NULL;
max_size = regfi_calc_maxsize(file, offset);
if(max_size < 0)
@@ -1446,7 +1446,6 @@ const REGFI_SK* regfi_load_sk(REGFI_FILE* file, uint32_t offset, bool strict)
if(file->sk_cache == NULL)
return regfi_parse_sk(file, offset, max_size, strict);
-
if(!regfi_lock(file, &file->mem_lock, "regfi_load_sk"))
return NULL;
regfi_lock(file, &file->sk_lock, "regfi_load_sk");
@@ -1455,7 +1454,7 @@ const REGFI_SK* regfi_load_sk(REGFI_FILE* file, uint32_t offset, bool strict)
ret_val = (REGFI_SK*)lru_cache_find(file->sk_cache, &offset, 4);
/* Bail out if we have previously cached a parse failure at this offset. */
- if(ret_val == (void*)REGFI_OFFSET_NONE)
+ if(ret_val && *(uint32_t*)ret_val == REGFI_OFFSET_NONE)
{
ret_val = NULL;
goto unlock;
@@ -1470,12 +1469,14 @@ const REGFI_SK* regfi_load_sk(REGFI_FILE* file, uint32_t offset, bool strict)
if(failure_ptr == NULL)
goto unlock;
- *(uint32_t*)failure_ptr = REGFI_OFFSET_NONE;
+ *failure_ptr = REGFI_OFFSET_NONE;
lru_cache_update(file->sk_cache, &offset, 4, failure_ptr);
/* Let the cache be the only owner of this */
talloc_unlink(NULL, failure_ptr);
}
+ else
+ lru_cache_update(file->sk_cache, &offset, 4, ret_val);
}
else
ret_val = talloc_reference(NULL, ret_val);
@@ -2053,6 +2054,7 @@ const REGFI_SK* regfi_fetch_sk(REGFI_FILE* file, const REGFI_NK* key)
if(key == NULL || key->sk_off == REGFI_OFFSET_NONE)
return NULL;
+ /*lru_cache_print(file->sk_cache);*/
return regfi_load_sk(file, key->sk_off + REGFI_REGF_SIZE, true);
}
diff --git a/lib/void_stack.c b/lib/void_stack.c
index bdb7e9b..0a32ebb 100644
--- a/lib/void_stack.c
+++ b/lib/void_stack.c
@@ -14,7 +14,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: void_stack.c 169 2010-03-03 19:24:58Z tim $
+ * $Id$
*/
/**
diff --git a/lib/winsec.c b/lib/winsec.c
index ce2c3a6..7e197c2 100644
--- a/lib/winsec.c
+++ b/lib/winsec.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005-2006,2009-2011 Timothy D. Morgan
+ * Copyright (C) 2005-2006,2009-2011,2015 Timothy D. Morgan
* Copyright (C) 1992-2005 Samba development team
* (see individual files under Subversion for details.)
*
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: winsec.c 261 2011-06-17 00:55:49Z tim $
+ * $Id$
*/
/** @file */
@@ -412,9 +412,14 @@ char* winsec_sid2str(const WINSEC_DOM_SID* sid)
{
uint32_t i, size = WINSEC_MAX_SUBAUTHS*11 + 24;
uint32_t left = size;
- uint8_t comps = sid->num_auths;
- char* ret_val = malloc(size);
-
+ uint8_t comps;
+ char* ret_val;
+
+ if(sid == NULL)
+ return NULL;
+ comps = sid->num_auths;
+
+ ret_val = malloc(size);
if(ret_val == NULL)
return NULL;
diff --git a/pyregfi-distutils.py b/pyregfi-distutils.py
deleted file mode 100644
index 41c11df..0000000
--- a/pyregfi-distutils.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# Called from scons with appropriate python version
-
-from distutils.core import setup
-setup(name='pyregfi', version='1.0', package_dir={'':'python'}, packages=['pyregfi'])
diff --git a/regfi_version.py b/regfi_version.py
index 30e9180..d2cdb21 100644
--- a/regfi_version.py
+++ b/regfi_version.py
@@ -1 +1,3 @@
-REGFI_VERSION="1.0.1"
+SVN_REV = "$Rev$"
+LATEST='1.0.1'
+REGFI_VERSION = "%s.%s" % (LATEST, SVN_REV.split(' ')[1])
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..4ce992a
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,8 @@
+# Called from scons with appropriate python version
+import sys
+from distutils.core import setup
+sys.dont_write_bytecode = True
+from regfi_version import REGFI_VERSION
+sys.dont_write_bytecode = False
+
+setup(name='pyregfi', version=REGFI_VERSION, package_dir={'':'python'}, packages=['pyregfi'])
diff --git a/src/common.c b/src/common.c
index 99f58aa..912392b 100644
--- a/src/common.c
+++ b/src/common.c
@@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: common.c 256 2011-06-15 22:05:37Z tim $
+ * $Id$
*/
#include <iconv.h>
diff --git a/src/reglookup-recover.c b/src/reglookup-recover.c
index 6e17895..ce5334c 100644
--- a/src/reglookup-recover.c
+++ b/src/reglookup-recover.c
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: reglookup-recover.c 273 2011-07-22 02:05:25Z tim $
+ * $Id$
*/
#include <stdio.h>
diff --git a/src/reglookup.c b/src/reglookup.c
index 810e55c..756af77 100644
--- a/src/reglookup.c
+++ b/src/reglookup.c
@@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: reglookup.c 261 2011-06-17 00:55:49Z tim $
+ * $Id$
*/
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/reglookup.git
More information about the forensics-changes
mailing list