Makefile.am | 4 ++-- enforcer/src/db/test/test.sqlite | 4 ++-- enforcer/utils/1.4-2.0_db_convert/README.md | 5 +++++ enforcer/utils/1.4-2.0_db_convert/convert_mysql | 6 +++--- enforcer/utils/1.4-2.0_db_convert/convert_sqlite | 6 +++--- enforcer/utils/convert_mysql_to_sqlite | 4 ++-- enforcer/utils/convert_sqlite_to_mysql | 4 ++-- libhsm/src/lib/libhsm.c | 2 +- m4/opendnssec_common.m4 | 2 +- 9 files changed, 21 insertions(+), 16 deletions(-) diff --git a/Makefile.am b/Makefile.am index 68b49472..faa97c3b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -38,8 +38,8 @@ install-data-hook: $(INSTALL) @INSTALLATIONUSERARG@ @INSTALLATIONGROUPARG@ -d $(DESTDIR)$(localstatedir)/opendnssec/signconf $(INSTALL) @INSTALLATIONUSERARG@ @INSTALLATIONGROUPARG@ -d $(DESTDIR)$(localstatedir)/opendnssec/unsigned $(INSTALL) @INSTALLATIONUSERARG@ @INSTALLATIONGROUPARG@ -d $(DESTDIR)$(localstatedir)/opendnssec/signed - $(INSTALL) -d $(DESTDIR)$(localstatedir)/run - $(INSTALL) @INSTALLATIONUSERARG@ @INSTALLATIONGROUPARG@ -d $(DESTDIR)$(localstatedir)/run/opendnssec + $(INSTALL) -d $(DESTDIR)/run + $(INSTALL) @INSTALLATIONUSERARG@ @INSTALLATIONGROUPARG@ -d $(DESTDIR)/run/opendnssec docs: (cd libhsm; $(MAKE) doxygen) diff --git a/enforcer/src/db/test/test.sqlite b/enforcer/src/db/test/test.sqlite index 3884f256..26c69a0f 100644 --- a/enforcer/src/db/test/test.sqlite +++ b/enforcer/src/db/test/test.sqlite @@ -28,11 +28,11 @@ CREATE TABLE test ( id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(255) ); -INSERT INTO test ( name ) VALUES ( "test" ); +INSERT INTO test ( name ) VALUES ( 'test' ); CREATE TABLE test2 ( id INTEGER PRIMARY KEY AUTOINCREMENT, rev INTEGER NOT NULL, name VARCHAR(255) ); -INSERT INTO test2 ( rev, name ) VALUES ( 1, "test" ); +INSERT INTO test2 ( rev, name ) VALUES ( 1, 'test' ); diff --git a/enforcer/utils/1.4-2.0_db_convert/README.md b/enforcer/utils/1.4-2.0_db_convert/README.md index 89f3e382..40e655c9 100644 --- a/enforcer/utils/1.4-2.0_db_convert/README.md +++ b/enforcer/utils/1.4-2.0_db_convert/README.md @@ -26,6 +26,11 @@ General preparation may occur. If you do, and see unexpected state, the best way to deal with it is to start a rollover for the offending keytype. +ALTLinux specifics +----------------- +The migration scripts and DB schema can be found in +/usr/share/opendnssec/enforcer/utils/1.4-2.0_db_convert. + Conversion Sqlite ----------------- diff --git a/enforcer/utils/1.4-2.0_db_convert/convert_mysql b/enforcer/utils/1.4-2.0_db_convert/convert_mysql index 7b9869e7..f26d63d0 100755 --- a/enforcer/utils/1.4-2.0_db_convert/convert_mysql +++ b/enforcer/utils/1.4-2.0_db_convert/convert_mysql @@ -5,7 +5,7 @@ set -e # old and new databases live on the same host and are accessable by the same # user. -SCHEMA=../../src/db/schema.mysql +SCHEMA='/usr/share/opendnssec/enforcer/schema/schema.mysql' DB_IN="" DB_OUT="" @@ -44,7 +44,7 @@ if [ ! $DB_VERSION -eq 4 ]; then fi # Look for zones without an active key. -Z=`mysql -u $DB_USR -p$DB_PWD -h $DB_HOST $DB_IN < find_problematic_zones.sql` +Z=`mysql -u $DB_USR -p$DB_PWD -h $DB_HOST $DB_IN < '/usr/share/opendnssec/enforcer/utils/1.4-2.0_db_convert/find_problematic_zones.sql'` if [[ $Z = *[![:space:]]* ]]; then echo "Found zones without an active KSK but with a ready KSK waiting for ds-seen. This can cause problem after the conversion if the DS was actually already uploaded. You are adviced to submit these DS records and issue a ds-seen command before continueing. If you know better, disable this check to continue." echo "Zones: $Z" @@ -59,6 +59,6 @@ echo "Creating tables in $DB_OUT (as user $DB_USR)" mysql -u $DB_USR -p$DB_PWD -h $DB_HOST $DB_OUT < $SCHEMA echo "Converting database" -sed "s/REMOTE/$DB_IN/g" mysql_convert.sql > TMP +sed "s/REMOTE/$DB_IN/g" '/usr/share/opendnssec/enforcer/utils/1.4-2.0_db_convert/mysql_convert.sql' > TMP mysql -u $DB_USR -p$DB_PWD -h $DB_HOST $DB_OUT < TMP rm TMP diff --git a/enforcer/utils/1.4-2.0_db_convert/convert_sqlite b/enforcer/utils/1.4-2.0_db_convert/convert_sqlite index e54ef71a..3c41332b 100755 --- a/enforcer/utils/1.4-2.0_db_convert/convert_sqlite +++ b/enforcer/utils/1.4-2.0_db_convert/convert_sqlite @@ -3,7 +3,7 @@ set -e # This scipt converts a ODS 1.4.9 Sqlite database to ODS 2.0. -SCHEMA=../../src/db/schema.sqlite +SCHEMA='/usr/share/opendnssec/enforcer/schema/schema.sqlite' DB_IN="" DB_OUT="" @@ -36,7 +36,7 @@ if [ ! $DB_VERSION -eq 4 ]; then fi # Look for zones without an active key. -Z=`sqlite3 $DB_IN < find_problematic_zones.sql` +Z=`sqlite3 $DB_IN < '/usr/share/opendnssec/enforcer/utils/1.4-2.0_db_convert/find_problematic_zones.sql'` if [[ $Z = *[![:space:]]* ]]; then echo "Found zones without an active KSK but with a ready KSK waiting for ds-seen. This can cause problem after the conversion if the DS was actually already uploaded. You are adviced to submit these DS records and issue a ds-seen command before continueing. If you know better, disable this check to continue." echo "Zones: $Z" @@ -46,5 +46,5 @@ fi rm -f $DB_OUT sqlite3 $DB_OUT < $SCHEMA echo "attach '$DB_IN' as REMOTE;" | - cat - sqlite_convert.sql | sqlite3 $DB_OUT + cat - '/usr/share/opendnssec/enforcer/utils/1.4-2.0_db_convert/sqlite_convert.sql' | sqlite3 $DB_OUT diff --git a/enforcer/utils/convert_mysql_to_sqlite b/enforcer/utils/convert_mysql_to_sqlite index 0c763a04..68bbd1d3 100755 --- a/enforcer/utils/convert_mysql_to_sqlite +++ b/enforcer/utils/convert_mysql_to_sqlite @@ -1,11 +1,11 @@ -#!/usr/bin/env bash +#!/bin/bash set -e # This scipt converts a MySQL to a SQLite database. It assumes both # old and new databases live on the same host and are accessable by the same # user. -SCHEMA=../src/db/schema.sqlite +SCHEMA='/usr/share/opendnssec/enforcer/schema/schema.sqlite' DB_IN="" DB_OUT="" diff --git a/enforcer/utils/convert_sqlite_to_mysql b/enforcer/utils/convert_sqlite_to_mysql index 90359e36..31dcfe09 100755 --- a/enforcer/utils/convert_sqlite_to_mysql +++ b/enforcer/utils/convert_sqlite_to_mysql @@ -1,11 +1,11 @@ -#!/usr/bin/env bash +#!/bin/bash set -e # This scipt converts a SQLite3 to a MySQL database. It assumes both # old and new databases live on the same host and are accessable by the same # user. -SCHEMA=../src/db/schema.mysql +SCHEMA='/usr/share/opendnssec/enforcer/schema/schema.mysql' DB_IN="" DB_OUT="" diff --git a/libhsm/src/lib/libhsm.c b/libhsm/src/lib/libhsm.c index fedf32a3..3498a8bd 100644 --- a/libhsm/src/lib/libhsm.c +++ b/libhsm/src/lib/libhsm.c @@ -1361,7 +1361,7 @@ hsm_hex_unparse(char *dst, const unsigned char *src, size_t len) size_t i; for (i = 0; i < len; i++) { - snprintf(dst + (2*i), dst_len, "%02x", src[i]); + snprintf(dst + (2*i), dst_len - (2*i), "%02x", src[i]); } dst[len*2] = '\0'; } diff --git a/m4/opendnssec_common.m4 b/m4/opendnssec_common.m4 index b1e375e2..309a3e64 100644 --- a/m4/opendnssec_common.m4 +++ b/m4/opendnssec_common.m4 @@ -17,7 +17,7 @@ OPENDNSSEC_LIBEXEC_DIR=$full_libexecdir/opendnssec OPENDNSSEC_DATA_DIR=$full_datadir/opendnssec OPENDNSSEC_SYSCONF_DIR=$full_sysconfdir/opendnssec OPENDNSSEC_LOCALSTATE_DIR="$full_localstatedir/opendnssec" -OPENDNSSEC_PID_DIR="$full_localstatedir/run/opendnssec" +OPENDNSSEC_PID_DIR="/run/opendnssec" AC_SUBST([OPENDNSSEC_BIN_DIR]) AC_SUBST([OPENDNSSEC_SBIN_DIR])