Hello community,
here is the log from the commit of package cryptconfig
checked in at Tue Feb 13 00:36:24 CET 2007.
--------
--- cryptconfig/cryptconfig.changes 2007-01-23 21:49:25.000000000 +0100
+++ /mounts/work_src_done/STABLE/cryptconfig/cryptconfig.changes 2007-02-12 22:51:13.996912000 +0100
@@ -1,0 +2,15 @@
+Mon Feb 12 22:50:21 CET 2007 - crivera@suse.de
+
+- Search for the full path when looking for the
+ loop device an image is using.
+- Make get_passphrase() stop reading input when it encounters
+ a new line. This allows cryptconfig to be a little more scriptable
+ and allows the new unit tests to work.
+- Correctly check the return value when adding a key file to an image.
+- Only call luks_close() if we've actually setup a map device.
+- Don't allow encrypted home directories for the root user.
+- Add a mount flag to the open command to allow images to be unlocked
+ and mounted.
+- A few more minor fixes.
+
+-------------------------------------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ cryptconfig.spec ++++++
--- /var/tmp/diff_new_pack.kLk455/_old 2007-02-13 00:36:10.000000000 +0100
+++ /var/tmp/diff_new_pack.kLk455/_new 2007-02-13 00:36:10.000000000 +0100
@@ -12,7 +12,7 @@
Name: cryptconfig
Version: 0.1.0
-Release: 8
+Release: 12
Group: System/Base
License: GNU Library General Public License v. 2.0 and 2.1 (LGPL)
Summary: A Utility to Configure Encrypted Home Directories and LUKS Partitions
@@ -62,6 +62,18 @@
%doc %{_mandir}/man8/cryptconfig.8.gz
%changelog -n cryptconfig
+* Mon Feb 12 2007 - crivera@suse.de
+- Search for the full path when looking for the
+ loop device an image is using.
+- Make get_passphrase() stop reading input when it encounters
+ a new line. This allows cryptconfig to be a little more scriptable
+ and allows the new unit tests to work.
+- Correctly check the return value when adding a key file to an image.
+- Only call luks_close() if we've actually setup a map device.
+- Don't allow encrypted home directories for the root user.
+- Add a mount flag to the open command to allow images to be unlocked
+ and mounted.
+- A few more minor fixes.
* Tue Jan 23 2007 - crivera@suse.de
- Escape the '\' characters in user names when writing to
pam_mount.conf. This allows encrypted directories to work
++++++ cryptconfig-0.1.0.tar.gz ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/cryptconfig-0.1.0/aclocal.m4 new/cryptconfig-0.1.0/aclocal.m4
--- old/cryptconfig-0.1.0/aclocal.m4 2007-01-17 19:11:50.000000000 +0100
+++ new/cryptconfig-0.1.0/aclocal.m4 2007-01-25 23:14:38.000000000 +0100
@@ -103,7 +103,30 @@
# Substitute ALL_LINGUAS so we can use it in po/Makefile
AC_SUBST(ALL_LINGUAS)
-
+
+# Set DATADIRNAME correctly if it is not set yet
+# (copied from glib-gettext.m4)
+if test -z "$DATADIRNAME"; then
+ AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
+ return _nl_msg_cat_cntr],
+ [DATADIRNAME=share],
+ [case $host in
+ *-*-solaris*)
+ dnl On Solaris, if bind_textdomain_codeset is in libc,
+ dnl GNU format message catalog is always supported,
+ dnl since both are added to the libc all together.
+ dnl Hence, we'd like to go with DATADIRNAME=share
+ dnl in this case.
+ AC_CHECK_FUNC(bind_textdomain_codeset,
+ [DATADIRNAME=share], [DATADIRNAME=lib])
+ ;;
+ *)
+ [DATADIRNAME=lib]
+ ;;
+ esac])
+fi
+AC_SUBST(DATADIRNAME)
+
IT_PO_SUBDIR([po])
dnl The following is very similar to
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/cryptconfig-0.1.0/ChangeLog new/cryptconfig-0.1.0/ChangeLog
--- old/cryptconfig-0.1.0/ChangeLog 2007-01-23 20:23:13.000000000 +0100
+++ new/cryptconfig-0.1.0/ChangeLog 2007-02-12 22:06:04.000000000 +0100
@@ -1,3 +1,27 @@
+2007-02-05 Chris Rivera
+
+ * run-cc-tests.py: New file for unit tests.
+
+ * src/cryptconfig-lib.c: Add unlock_image()
+
+ Look for the full file path in loop_find_devs_from_image() when
+ figuring out which loop device is being used.
+
+ Make get_passphrase() stop reading input if it encounters a newline.
+
+ * src/cryptconfig.c: Correctly check the return value for
+ add_key_file_to_device() in the create-image command.
+
+ Refactor code for getting a passphrase and unlocking an image
+ to unlock_image().
+
+ Only call luks_close() if we've actually setup a map device.
+
+ Add mount flags to allow the open and close commands to mount
+ and umount the image device.
+
+ Don't allow encrypted home directories to be created for the root user.
+
2007-01-23 Chris Rivera
* src/cryptconfig.c: Set umask to 022 and avoid trying to copy
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/cryptconfig-0.1.0/configure new/cryptconfig-0.1.0/configure
--- old/cryptconfig-0.1.0/configure 2007-01-22 18:33:07.000000000 +0100
+++ new/cryptconfig-0.1.0/configure 2007-02-12 17:33:16.000000000 +0100
@@ -462,7 +462,7 @@
# include
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT slibdir CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS INTLTOOL_DESKTOP_RULE INTLTOOL_DIRECTORY_RULE INTLTOOL_KEYS_RULE INTLTOOL_PROP_RULE INTLTOOL_OAF_RULE INTLTOOL_PONG_RULE INTLTOOL_SERVER_RULE INTLTOOL_SHEET_RULE INTLTOOL_SOUNDLIST_RULE INTLTOOL_UI_RULE INTLTOOL_XAM_RULE INTLTOOL_KBD_RULE INTLTOOL_XML_RULE INTLTOOL_XML_NOMERGE_RULE INTLTOOL_CAVES_RULE INTLTOOL_SCHEMAS_RULE INTLTOOL_THEME_RULE INTLTOOL_SERVICE_RULE INTLTOOL_EXTRACT INTLTOOL_MERGE INTLTOOL_UPDATE INTLTOOL_PERL INTLTOOL_ICONV INTLTOOL_MSGFMT INTLTOOL_MSGMERGE INTLTOOL_XGETTEXT ALL_LINGUAS GETTEXT_PACKAGE USE_NLS MSGFMT GMSGFMT XGETTEXT CATALOGS CATOBJEXT DATADIRNAME GMOFILES INSTOBJEXT INTLLIBS PO_IN_DATADIR_TRUE PO_IN_DATADIR_FALSE POFILES POSUB PKG_CONFIG ac_pt_PKG_CONFIG GLIB_CFLAGS GLIB_LIBS DU_BIN_PATH MKFS_BIN_PATH LOSETUP_BIN_PATH CRYPTSETUP_BIN_PATH PAM_MODDIR LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT slibdir CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS INTLTOOL_DESKTOP_RULE INTLTOOL_DIRECTORY_RULE INTLTOOL_KEYS_RULE INTLTOOL_PROP_RULE INTLTOOL_OAF_RULE INTLTOOL_PONG_RULE INTLTOOL_SERVER_RULE INTLTOOL_SHEET_RULE INTLTOOL_SOUNDLIST_RULE INTLTOOL_UI_RULE INTLTOOL_XAM_RULE INTLTOOL_KBD_RULE INTLTOOL_XML_RULE INTLTOOL_XML_NOMERGE_RULE INTLTOOL_CAVES_RULE INTLTOOL_SCHEMAS_RULE INTLTOOL_THEME_RULE INTLTOOL_SERVICE_RULE INTLTOOL_EXTRACT INTLTOOL_MERGE INTLTOOL_UPDATE INTLTOOL_PERL INTLTOOL_ICONV INTLTOOL_MSGFMT INTLTOOL_MSGMERGE INTLTOOL_XGETTEXT ALL_LINGUAS DATADIRNAME GETTEXT_PACKAGE USE_NLS MSGFMT GMSGFMT XGETTEXT CATALOGS CATOBJEXT GMOFILES INSTOBJEXT INTLLIBS PO_IN_DATADIR_TRUE PO_IN_DATADIR_FALSE POFILES POSUB PKG_CONFIG ac_pt_PKG_CONFIG GLIB_CFLAGS GLIB_LIBS DU_BIN_PATH MKFS_BIN_PATH LOSETUP_BIN_PATH CRYPTSETUP_BIN_PATH PAM_MODDIR LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -19416,6 +19416,161 @@
# Substitute ALL_LINGUAS so we can use it in po/Makefile
+# Set DATADIRNAME correctly if it is not set yet
+# (copied from glib-gettext.m4)
+if test -z "$DATADIRNAME"; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+extern int _nl_msg_cat_cntr;
+ return _nl_msg_cat_cntr
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ DATADIRNAME=share
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+case $host in
+ *-*-solaris*)
+ echo "$as_me:$LINENO: checking for bind_textdomain_codeset" >&5
+echo $ECHO_N "checking for bind_textdomain_codeset... $ECHO_C" >&6
+if test "${ac_cv_func_bind_textdomain_codeset+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define bind_textdomain_codeset to an innocuous variant, in case declares bind_textdomain_codeset.
+ For example, HP-UX 11i declares gettimeofday. */
+#define bind_textdomain_codeset innocuous_bind_textdomain_codeset
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char bind_textdomain_codeset (); below.
+ Prefer to if __STDC__ is defined, since
+ exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include
+#else
+# include
+#endif
+
+#undef bind_textdomain_codeset
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char bind_textdomain_codeset ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_bind_textdomain_codeset) || defined (__stub___bind_textdomain_codeset)
+choke me
+#else
+char (*f) () = bind_textdomain_codeset;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != bind_textdomain_codeset;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_bind_textdomain_codeset=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_bind_textdomain_codeset=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_bind_textdomain_codeset" >&5
+echo "${ECHO_T}$ac_cv_func_bind_textdomain_codeset" >&6
+if test $ac_cv_func_bind_textdomain_codeset = yes; then
+ DATADIRNAME=share
+else
+ DATADIRNAME=lib
+fi
+
+ ;;
+ *)
+ DATADIRNAME=lib
+ ;;
+ esac
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+
+
@@ -22172,6 +22327,7 @@
s,@INTLTOOL_MSGMERGE@,$INTLTOOL_MSGMERGE,;t t
s,@INTLTOOL_XGETTEXT@,$INTLTOOL_XGETTEXT,;t t
s,@ALL_LINGUAS@,$ALL_LINGUAS,;t t
+s,@DATADIRNAME@,$DATADIRNAME,;t t
s,@GETTEXT_PACKAGE@,$GETTEXT_PACKAGE,;t t
s,@USE_NLS@,$USE_NLS,;t t
s,@MSGFMT@,$MSGFMT,;t t
@@ -22179,7 +22335,6 @@
s,@XGETTEXT@,$XGETTEXT,;t t
s,@CATALOGS@,$CATALOGS,;t t
s,@CATOBJEXT@,$CATOBJEXT,;t t
-s,@DATADIRNAME@,$DATADIRNAME,;t t
s,@GMOFILES@,$GMOFILES,;t t
s,@INSTOBJEXT@,$INSTOBJEXT,;t t
s,@INTLLIBS@,$INTLLIBS,;t t
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/cryptconfig-0.1.0/intltool-extract.in new/cryptconfig-0.1.0/intltool-extract.in
--- old/cryptconfig-0.1.0/intltool-extract.in 2007-01-22 18:32:55.000000000 +0100
+++ new/cryptconfig-0.1.0/intltool-extract.in 2007-02-12 17:33:06.000000000 +0100
@@ -32,7 +32,7 @@
## Release information
my $PROGRAM = "intltool-extract";
my $PACKAGE = "intltool";
-my $VERSION = "0.35.0";
+my $VERSION = "0.35.2";
## Loaded modules
use strict;
@@ -114,6 +114,11 @@
sub place_normal {
$FILE = $ARGV[0];
$OUTFILE = "$FILE.h";
+
+ my $dirname = dirname ($OUTFILE);
+ if (! -d "$dirname" && $dirname ne "") {
+ system ("mkdir -p $dirname");
+ }
}
sub place_local {
@@ -156,7 +161,7 @@
--type=TYPE Specify the file type of FILENAME. Currently supports:
"gettext/glade", "gettext/ini", "gettext/keys"
"gettext/rfc822deb", "gettext/schemas",
- "gettext/scheme", "gettext/xml"
+ "gettext/scheme", "gettext/xml", "gettext/quoted"
-l, --local Writes output into current working directory
(conflicts with --update)
--update Writes output into the same directory the source file
@@ -212,6 +217,7 @@
&type_scheme if $gettext_type eq "scheme";
&type_schemas if $gettext_type eq "schemas";
&type_rfc822deb if $gettext_type eq "rfc822deb";
+ &type_quoted if $gettext_type eq "quoted";
}
sub entity_decode_minimal
@@ -242,7 +248,7 @@
{
return '\"' if $_ eq '"';
return '\n' if $_ eq "\n";
- return '\\' if $_ eq '\\';
+ return '\\\\' if $_ eq '\\';
return $_;
}
@@ -711,6 +717,17 @@
return @list;
}
+sub type_quoted {
+ while ($input =~ /\"(([^\"]|\\\")*[^\\\"])\"/g) {
+ my $message = $1;
+ my $before = $`;
+ $message =~ s/\\\"/\"/g;
+ $before =~ s/[^\n]//g;
+ $messages{$message} = [];
+ $loc{$message} = length ($before) + 2;
+ }
+}
+
sub type_glade {
### For translatable Glade XML files ###
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/cryptconfig-0.1.0/intltool-merge.in new/cryptconfig-0.1.0/intltool-merge.in
--- old/cryptconfig-0.1.0/intltool-merge.in 2007-01-22 18:32:55.000000000 +0100
+++ new/cryptconfig-0.1.0/intltool-merge.in 2007-02-12 17:33:06.000000000 +0100
@@ -35,7 +35,7 @@
## Release information
my $PROGRAM = "intltool-merge";
my $PACKAGE = "intltool";
-my $VERSION = "0.35.0";
+my $VERSION = "0.35.2";
## Loaded modules
use strict;
@@ -60,6 +60,7 @@
my $DESKTOP_STYLE_ARG = 0;
my $SCHEMAS_STYLE_ARG = 0;
my $RFC822DEB_STYLE_ARG = 0;
+my $QUOTED_STYLE_ARG = 0;
my $QUIET_ARG = 0;
my $PASS_THROUGH_ARG = 0;
my $UTF8_ARG = 0;
@@ -79,6 +80,7 @@
"desktop-style|d" => \$DESKTOP_STYLE_ARG,
"schemas-style|s" => \$SCHEMAS_STYLE_ARG,
"rfc822deb-style|r" => \$RFC822DEB_STYLE_ARG,
+ "quoted-style" => \$QUOTED_STYLE_ARG,
"pass-through|p" => \$PASS_THROUGH_ARG,
"utf8|u" => \$UTF8_ARG,
"multiple-output|m" => \$MULTIPLE_OUTPUT,
@@ -157,6 +159,14 @@
&rfc822deb_merge_translations;
&finalize;
}
+elsif ($QUOTED_STYLE_ARG && @ARGV > 2)
+{
+ &utf8_sanity_check;
+ &preparation;
+ &print_message;
+ "ed_merge_translations;
+ &finalize;
+}
else
{
&print_help;
@@ -193,6 +203,7 @@
-k, --keys-style includes translations in the keys style
-s, --schemas-style includes translations in the schemas style
-r, --rfc822deb-style includes translations in the RFC822 style
+ --quoted-style includes translations in the quoted string style
-x, --xml-style includes translations in the standard xml style
Other options:
@@ -415,7 +426,7 @@
{
$nextfuzzy = 1 if /^#, fuzzy/;
- if (/^msgid "((\\.|[^\\])*)"/ )
+ if (/^msgid "((\\.|[^\\]+)*)"/ )
{
$translations{$lang, $msgid} = $msgstr if $inmsgstr && $msgid && $msgstr;
$msgid = "";
@@ -431,14 +442,14 @@
$nextfuzzy = 0;
}
- if (/^msgstr "((\\.|[^\\])*)"/)
+ if (/^msgstr "((\\.|[^\\]+)*)"/)
{
$msgstr = unescape_po_string($1);
$inmsgstr = 1;
$inmsgid = 0;
}
- if (/^"((\\.|[^\\])*)"/)
+ if (/^"((\\.|[^\\]+)*)"/)
{
$msgid .= unescape_po_string($1) if $inmsgid;
$msgstr .= unescape_po_string($1) if $inmsgstr;
@@ -1354,3 +1365,39 @@
return @list;
}
+sub quoted_translation
+{
+ my ($lang, $string) = @_;
+
+ $string =~ s/\\\"/\"/g;
+
+ my $translation = $translations{$lang, $string};
+ $translation = $string if !$translation;
+
+ $translation =~ s/\"/\\\"/g;
+ return $translation
+}
+
+sub quoted_merge_translations
+{
+ if (!$MULTIPLE_OUTPUT) {
+ print "Quoted only supports Multiple Output.\n";
+ exit(1);
+ }
+
+ for my $lang (sort keys %po_files_by_lang) {
+ if ( ! -e $lang ) {
+ mkdir $lang or die "Cannot create subdirectory $lang: $!\n";
+ }
+ open INPUT, "<${FILE}" or die;
+ open OUTPUT, ">$lang/$OUTFILE" or die "Cannot open $lang/$OUTFILE: $!\n";
+ binmode (OUTPUT) if $^O eq 'MSWin32';
+ while (<INPUT>)
+ {
+ s/\"(([^\"]|\\\")*[^\\\"])\"/"\"" . "ed_translation($lang, $1) . "\""/ge;
+ print OUTPUT;
+ }
+ close OUTPUT;
+ close INPUT;
+ }
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/cryptconfig-0.1.0/intltool-update.in new/cryptconfig-0.1.0/intltool-update.in
--- old/cryptconfig-0.1.0/intltool-update.in 2007-01-22 18:32:55.000000000 +0100
+++ new/cryptconfig-0.1.0/intltool-update.in 2007-02-12 17:33:06.000000000 +0100
@@ -30,7 +30,7 @@
## Release information
my $PROGRAM = "intltool-update";
-my $VERSION = "0.35.0";
+my $VERSION = "0.35.2";
my $PACKAGE = "intltool";
## Loaded modules
@@ -90,10 +90,9 @@
$| = 1;
## Sometimes the source tree will be rooted somewhere else.
-my $SRCDIR = ".";
+my $SRCDIR = $ENV{"srcdir"} || ".";
my $POTFILES_in;
-$SRCDIR = $ENV{"srcdir"} if $ENV{"srcdir"};
$POTFILES_in = "<$SRCDIR/POTFILES.in";
my $devnull = ($^O eq 'MSWin32' ? 'NUL:' : '/dev/null');
@@ -124,8 +123,10 @@
&Console_Write_IntltoolHelp if $arg_count > 1;
+my $PKGNAME = FindPackageName ();
+
# --version and --help don't require a module name
-my $MODULE = $GETTEXT_PACKAGE || &FindPackageName || "unknown";
+my $MODULE = $GETTEXT_PACKAGE || $PKGNAME || "unknown";
if ($POT_ARG)
{
@@ -316,7 +317,8 @@
@buf_potfiles_ignore,
@buf_allfiles,
@buf_allfiles_sorted,
- @buf_potfiles_sorted
+ @buf_potfiles_sorted,
+ @buf_potfiles_ignore_sorted
);
## Search and find all translatable files
@@ -342,7 +344,7 @@
## comparing with POTFILES.in
foreach my $ignore ("POTFILES.skip", "POTFILES.ignore")
{
- (-s $ignore) or next;
+ (-s "$SRCDIR/$ignore") or next;
if ("$ignore" eq "POTFILES.ignore")
{
@@ -351,7 +353,7 @@
}
print "Found $ignore: Ignoring files...\n" if $VERBOSE;
- open FILE, "<$ignore" or die "ERROR: Failed to open $ignore!\n";
+ open FILE, "<$SRCDIR/$ignore" or die "ERROR: Failed to open $SRCDIR/$ignore!\n";
while (<FILE>)
{
@@ -359,7 +361,7 @@
}
close FILE;
- @buf_potfiles = (@buf_potfiles_ignore, @buf_potfiles);
+ @buf_potfiles_ignore_sorted = sort (@buf_potfiles_ignore);
}
foreach my $file (@buf_i18n_plain)
@@ -417,7 +419,7 @@
}
}
- if (/\.GetString ?\(QUOTEDTEXT/)
+ if (/\w\.GetString *\(QUOTEDTEXT/)
{
if (defined isNotValidMissing (unpack("x3 A*", $file))) {
## Remove the first 3 chars and add newline
@@ -426,7 +428,8 @@
last;
}
- if (/_\(QUOTEDTEXT/)
+ ## N_ Q_ and _ are the three macros defined in gi8n.h
+ if (/[NQ]?_ *\(QUOTEDTEXT/)
{
if (defined isNotValidMissing (unpack("x3 A*", $file))) {
## Remove the first 3 chars and add newline
@@ -489,6 +492,11 @@
$in2{$_} = 1;
}
+ foreach (@buf_potfiles_ignore_sorted)
+ {
+ $in2{$_} = 1;
+ }
+
my @result;
foreach (@buf_allfiles_sorted)
@@ -504,7 +512,7 @@
foreach (@buf_potfiles_sorted)
{
chomp (my $dummy = $_);
- if ("$dummy" ne "" and ! -f "../$dummy")
+ if ("$dummy" ne "" and !(-f "$SRCDIR/../$dummy" or -f "../$dummy"))
{
push @buf_potfiles_notexist, $_;
}
@@ -537,7 +545,7 @@
warn "\n" if ($VERBOSE or @result);
warn "\e[1mThe following files do not exist anymore:\e[0m\n\n";
warn @buf_potfiles_notexist, "\n";
- warn "Please remove them from POTFILES.in or POTFILES.skip. A file \e[1m'notexist'\e[0m\n".
+ warn "Please remove them from POTFILES.in. A file \e[1m'notexist'\e[0m\n".
"containing this list of absent files has been written in the current directory.\n";
}
}
@@ -671,12 +679,8 @@
}
else
{
- if ($SRCDIR eq ".") {
- print OUTFILE "../$_\n";
- } else {
- print OUTFILE "$SRCDIR/../$_\n";
- }
- $gettext_code = &TextFile_DetermineEncoding ("../$_") if ($gettext_support_nonascii and not defined $forced_gettext_code);
+ print OUTFILE "$SRCDIR/../$_\n";
+ $gettext_code = &TextFile_DetermineEncoding ("$SRCDIR/../$_") if ($gettext_support_nonascii and not defined $forced_gettext_code);
}
next if (! $gettext_support_nonascii);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/cryptconfig-0.1.0/po/Makefile.in.in new/cryptconfig-0.1.0/po/Makefile.in.in
--- old/cryptconfig-0.1.0/po/Makefile.in.in 2007-01-22 18:32:55.000000000 +0100
+++ new/cryptconfig-0.1.0/po/Makefile.in.in 2007-02-12 17:33:06.000000000 +0100
@@ -25,7 +25,7 @@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
-top_builddir = ..
+top_builddir = @top_builddir@
VPATH = @srcdir@
prefix = @prefix@
@@ -56,15 +56,19 @@
PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; fi)
-POFILES=$(shell if test -n "$(PO_LINGUAS)"; then LINGUAS="$(PO_LINGUAS)"; else LINGUAS="$(ALL_LINGUAS)"; fi; for lang in $$LINGUAS; do printf "$$lang.po "; done)
+USER_LINGUAS=$(shell if test -n "$(LINGUAS)"; then LLINGUAS="$(LINGUAS)"; ALINGUAS="$(ALL_LINGUAS)"; for lang in $$LLINGUAS; do if test -n "`grep ^$$lang$$ $(srcdir)/LINGUAS`" -o -n "`echo $$ALINGUAS|grep ' ?$$lang ?'`"; then printf "$$lang "; fi; done; fi)
+
+USE_LINGUAS=$(shell if test -n "$(USER_LINGUAS)"; then LLINGUAS="$(USER_LINGUAS)"; else if test -n "$(PO_LINGUAS)"; then LLINGUAS="$(PO_LINGUAS)"; else LLINGUAS="$(ALL_LINGUAS)"; fi; fi; for lang in $$LLINGUAS; do printf "$$lang "; done)
+
+POFILES=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.po "; done)
DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(POFILES)
EXTRA_DISTFILES = POTFILES.skip Makevars LINGUAS
POTFILES = \
-#This Gets Replace for some reason
+# This comment gets stripped out
-CATALOGS=$(shell if test -n "$(PO_LINGUAS)"; then LINGUAS="$(PO_LINGUAS)"; else LINGUAS="$(ALL_LINGUAS)"; fi; for lang in $$LINGUAS; do printf "$$lang.gmo "; done)
+CATALOGS=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.gmo "; done)
.SUFFIXES:
.SUFFIXES: .po .pox .gmo .mo .msg .cat
@@ -98,11 +102,7 @@
install-data-no: all
install-data-yes: all
$(mkdir_p) $(DESTDIR)$(itlocaledir)
- if test -n "$(PO_LINGUAS)"; then \
- linguas="$(PO_LINGUAS)"; \
- else \
- linguas="$(ALL_LINGUAS)"; \
- fi; \
+ linguas="$(USE_LINGUAS)"; \
for lang in $$linguas; do \
dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \
$(mkdir_p) $$dir; \
@@ -136,17 +136,18 @@
installcheck:
uninstall:
- if test -n "$(PO_LINGUAS)"; then \
- linguas="$(PO_LINGUAS)"; \
- else \
- linguas="$(ALL_LINGUAS)"; \
- fi; \
+ linguas="$(USE_LINGUAS)"; \
for lang in $$linguas; do \
rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \
done
check: all $(GETTEXT_PACKAGE).pot
+ rm -f missing notexist
+ srcdir=$(srcdir) $(INTLTOOL_UPDATE) -m
+ if [ -r missing -o -r notexist ]; then \
+ exit 1; \
+ fi
mostlyclean:
rm -f *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp
@@ -179,11 +180,7 @@
update-po: Makefile
$(MAKE) $(GETTEXT_PACKAGE).pot
tmpdir=`pwd`; \
- if test -n "$(PO_LINGUAS)"; then \
- linguas="$(PO_LINGUAS)"; \
- else \
- linguas="$(ALL_LINGUAS)"; \
- fi; \
+ linguas="$(USE_LINGUAS)"; \
for lang in $$linguas; do \
echo "$$lang:"; \
result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \
@@ -211,8 +208,8 @@
$(MAKE) stamp-it; \
fi
-stamp-it: Makefile.in.in ../config.status POTFILES.in
- cd .. \
+stamp-it: Makefile.in.in $(top_builddir)/config.status POTFILES.in
+ cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/Makefile.in CONFIG_HEADERS= CONFIG_LINKS= \
$(SHELL) ./config.status
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/cryptconfig-0.1.0/src/cryptconfig.c new/cryptconfig-0.1.0/src/cryptconfig.c
--- old/cryptconfig-0.1.0/src/cryptconfig.c 2007-01-23 20:34:04.000000000 +0100
+++ new/cryptconfig-0.1.0/src/cryptconfig.c 2007-02-12 22:22:58.000000000 +0100
@@ -29,6 +29,14 @@
#include "cryptconfig.h"
+typedef struct _command {
+ gchar *name;
+ gchar *arguments;
+ gchar *description;
+ gboolean (*execute) (char *cmd, int argc, char *argv[]);
+ gboolean requires_root;
+} Command;
+
static GHashTable *commands = NULL;
/*
@@ -57,7 +65,7 @@
gchar *fs_type = "ext3", *pass = NULL, *loop_device = NULL;
gchar *key_data = NULL, *map_dev = NULL, *temp_dir = NULL;
gchar *user_field, *prompt = NULL, *extra_key_file = NULL;
- int key_size = KEY_DATA_SIZE;
+ int key_size = KEY_DATA_SIZE;
long image_size, req_fs_size;
struct passwd *pent;
@@ -96,7 +104,13 @@
user_field = argv[2];
g_option_context_free (ctx);
-
+
+ /* don't allow encrypted home directories for root */
+ if (!strncmp (user_field, "root", 4) && strlen (user_field) == 4) {
+ g_printerr (_("Using an encrypted home directory for root is not supported\n"));
+ return FALSE;
+ }
+
/* make sure we're using a valid fs_type */
if (!is_filesystem_supported (fs_type)) {
gchar *fs = get_supported_filesystems ();
@@ -215,17 +229,14 @@
goto cleanup;
}
- /* if the user's home directory does not exist then we */
+ /* disable data copying if the user's home dir doesn't exist */
if (!g_file_test (pent->pw_dir, G_FILE_TEST_IS_DIR)) {
- g_printerr (_("Disabling data copy since user's home directory does not exist\n"));
- no_copy = TRUE;
- }
-
- /*
- * Make sure we have enough disk space to copy the user's data and
- * that the encrypted image is large enough to hold the user's data.
- */
- if (!no_copy) {
+ g_printerr (_("Skipping data copy since user's home directory does not exist\n"));
+ } else if (!no_copy) {
+ /*
+ * Make sure we have enough disk space to copy the user's data and
+ * that the encrypted image is large enough to hold the user's data.
+ */
guint64 home_size;
if (!check_disk_space (image_file, pent->pw_dir, &home_size)) {
g_printerr (_("There is not enough disk space left to copy existing data\n"));
@@ -299,8 +310,8 @@
}
/* get the extra key data and add it to the image if necessary */
- if (extra_key_file && add_key_file_to_device (loop_device, extra_key_file,
- key_data, key_size)) {
+ if (extra_key_file && !add_key_file_to_device (loop_device, extra_key_file,
+ key_data, key_size)) {
g_printerr (_("Failed to add extra key\n"));
goto cleanup;
}
@@ -371,7 +382,6 @@
g_free (key_file);
g_free (temp_dir);
g_free (existing_key_file);
-
return final_ret;
}
@@ -484,9 +494,9 @@
}
/*
- * Create an arbitrary luks disk image
+ * Create a LUKS disk image
*/
-static gboolean command_create_luks_disk_image (char *cmd, int argc, char *argv[])
+static gboolean command_create_luks_image (char *cmd, int argc, char *argv[])
{
GError *err = NULL;
GOptionContext *ctx;
@@ -649,8 +659,8 @@
g_print (_("Done.\n"));
/* get the extra key data and add it to the image if necessary */
- if (extra_key_file && add_key_file_to_device (loop_device, extra_key_file,
- pass, pass_len)) {
+ if (extra_key_file && !add_key_file_to_device (loop_device, extra_key_file,
+ pass, pass_len)) {
g_printerr (_("Failed to add extra key\n"));
goto cleanup;
}
@@ -699,11 +709,8 @@
long size;
GError *err = NULL;
GOptionContext *ctx;
- char *image = NULL;
- gchar *loop_device = NULL, *pass = NULL, *map_name = NULL;
- gchar *key_file = NULL, *map_dev = NULL;
+ gchar *loop_device = NULL, *key_file = NULL, *map_device = NULL;
gboolean ret, retval = FALSE;
- size_t pass_len;
GOptionEntry entries[] = {
{ "key-file", 0, 0, G_OPTION_ARG_STRING, &key_file, N_("The encrytped key for the image"), NULL },
@@ -737,74 +744,21 @@
return FALSE;
}
- image = realpath (argv[2], NULL);
- if (!image) {
- g_printerr ("realpath: %s\n", strerror (errno));
- return FALSE;
- }
-
- /*
- * If --key-file was specified then we need to decrypt the
- * key file and use it's contents to unlock the device.
- */
- if (key_file) {
- gchar *key_data;
- int key_data_size;
-
- if (g_access (key_file, F_OK | R_OK)) {
- g_printerr (_("Unable to access the specified key file\n"));
- goto cleanup;
- }
-
- if (!get_passphrase (_("Enter the key file password"), FALSE, &pass)) {
- g_printerr (_("Failed to get password\n"));
- goto cleanup;
- }
-
- if (!decrypt_key (key_file, pass, &key_data, &key_data_size)) {
- g_printerr (_("Failed to decrypt key file with the provided password\n"));
- goto cleanup;
- }
-
- g_free (pass);
- pass = key_data;
- pass_len = key_data_size;
- } else {
- if (!get_passphrase (_("Enter the image password"), FALSE, &pass)) {
- g_printerr (_("Failed to get password\n"));
- goto cleanup;
- }
-
- pass_len = strlen (pass);
- }
-
/* enlarge the actual image file */
- if (!enlarge_image (image, size)) {
+ if (!enlarge_image (argv[2], size)) {
g_printerr (_("Failed to resize image\n"));
goto cleanup;
}
- if (!loop_open (image, &loop_device)) {
- g_printerr (_("Failed to open disk image\n"));
- goto cleanup;
- }
-
- /* unlock the device */
- map_name = path_to_map_name (loop_device);
- if (!map_name) {
- g_printerr (_("Failed to create map name\n"));
- goto cleanup;
- }
-
- if (!luks_open (pass, pass_len, loop_device, map_name)) {
- g_printerr (_("Failed to open device\n"));
+ /* unlock the image */
+ if (!unlock_image (argv[2], key_file, &map_device, &loop_device)) {
+ g_printerr (_("Failed to unlock image\n"));
goto cleanup;
}
/* resize the actualy file system */
- map_dev = g_build_filename ("/dev/mapper", map_name, NULL);
- if (!resize_filesystem (map_dev)) {
- g_printerr (_("Failed to resize the file system on %s\n"), map_dev);
+ if (!resize_filesystem (map_device)) {
+ g_printerr (_("Failed to resize the file system on %s\n"), map_device);
goto cleanup;
}
@@ -812,16 +766,13 @@
g_print (_("Done.\n"));
cleanup:
- if (g_file_test (map_dev, G_FILE_TEST_EXISTS))
- luks_close (map_dev);
+ if (map_device && g_file_test (map_device, G_FILE_TEST_EXISTS))
+ luks_close (map_device);
if (loop_device)
loop_close (loop_device);
- if (image)
- free (image);
g_free (loop_device);
- g_free (map_name);
- g_free (map_dev);
+ g_free (map_device);
return retval;
}
@@ -992,7 +943,7 @@
}
/*
- * Remove all home directory entries from pam_mount.conf
+ * Remove home directory entries from pam_mount.conf
*/
static gboolean command_disable_pam_mount (char *cmd, int argc, char *argv[])
{
@@ -1119,13 +1070,13 @@
{
GOptionContext *ctx;
GError *err = NULL;
- gchar *key_file = NULL, *pass = NULL, *password = NULL, *prompt = NULL;
- gchar *loop_device = NULL, *map_name = NULL, *map_dev = NULL, *key_data = NULL;
+ gchar *key_file = NULL, *loop_device = NULL, *map_device = NULL, *mount_point = NULL, *fs_type = NULL;
gboolean ret, retval = FALSE;
- int pass_len, key_data_size;
GOptionEntry entries[] = {
+ { "mount", 0, 0, G_OPTION_ARG_STRING, &mount_point, N_("Mount the image at the specified directory"), NULL },
{ "key-file", 0, 0, G_OPTION_ARG_STRING, &key_file, N_("The image key file"), NULL },
+ { "fs-type", 0, 0, G_OPTION_ARG_STRING, &fs_type, N_("The filesystem type. The default is ext3"), NULL },
{ NULL, 0, 0, 0, NULL, NULL, NULL }
};
@@ -1147,56 +1098,43 @@
return FALSE;
}
- prompt = key_file ? _("Enter the key file password") : _("Enter the image password");
- if (!get_passphrase (prompt, FALSE, &password)) {
- g_printerr (_("Failed to get password\n"));
- goto cleanup;
+ /* make sure we're using a valid fs_type if --mount was given */
+ if (mount_point && fs_type && !is_filesystem_supported (fs_type)) {
+ gchar *fs = get_supported_filesystems ();
+ g_printerr (_("%s is not a supported file system\nSupported file "
+ "systems are: %s\n"), fs_type, fs);
+ g_free (fs);
+ return FALSE;
}
- /* if --key-file was given then decrypt the fs key */
- if (key_file) {
- if (g_access (key_file, F_OK | R_OK)) {
- g_printerr (_("Unable to access the specified key file\n"));
+ /* unlock the image */
+ if (!unlock_image (argv[2], key_file, &map_device, &loop_device)) {
+ g_printerr (_("Failed to open image\n"));
+ goto cleanup;
+ }
+
+ /* mount the device if --mount was given */
+ if (mount_point) {
+ if (!g_file_test (mount_point, G_FILE_TEST_IS_DIR)) {
+ g_printerr (_("%s is not a directory\n"), mount_point);
goto cleanup;
}
-
- if (!decrypt_key (key_file, password, &key_data, &key_data_size)) {
- g_printerr (_("Failed to decrypt key file with the provided password\n"));
+
+ if (!mount_dev (fs_type ? fs_type : "ext3", map_device, mount_point)) {
+ g_printerr (_("Failed to mount device\n"));
goto cleanup;
}
- }
-
- pass = key_file ? key_data : password;
- pass_len = key_file ? key_data_size : strlen (password);
-
- /* setup our loop device */
- if (!loop_open (argv[2], &loop_device)) {
- g_printerr (_("Failed to open disk image\n"));
- goto cleanup;
- }
-
- /* unlock the device */
- map_name = path_to_map_name (argv[2]);
- if (!map_name) {
- g_printerr (_("Failed to create map name\n"));
- goto cleanup;
- }
- map_dev = g_build_filename ("/dev/mapper", map_name, NULL);
- if (!luks_open (pass, pass_len, loop_device, map_name)) {
- g_printerr (_("Failed to open device\n"));
- goto cleanup;
+ g_print (_("%s is now mounted at %s\n"), argv[2], mount_point);
+ } else {
+ g_print (_("%s is now available as device %s\n"), argv[2], map_device);
}
retval = TRUE;
- g_print (_("%s is now available on %s\n"), argv[2], map_dev);
cleanup:
- g_free (pass);
g_free (loop_device);
- g_free (key_data);
- g_free (map_name);
- g_free (map_dev);
+ g_free (map_device);
return retval;
}
@@ -1207,7 +1145,7 @@
{
GOptionContext *ctx;
GError *err = NULL;
- gchar *loop_dev = NULL, *map_dev = NULL;
+ gchar *loop_dev = NULL, *map_dev = NULL, *mount_point = NULL;
gboolean ret, retval = FALSE;
ctx = g_option_context_new ("image_file");
@@ -1226,6 +1164,12 @@
g_printerr (_("Unable to find device\n"));
goto cleanup;
}
+
+ /* unmount if necessary */
+ if (get_mount_point (map_dev, &mount_point) && umount (mount_point)) {
+ g_printerr (_("Failed to umount: %s\n"), strerror (errno));
+ goto cleanup;
+ }
/* close the map device */
if (map_dev && !luks_close (map_dev)) {
@@ -1245,6 +1189,7 @@
cleanup:
g_free (loop_dev);
g_free (map_dev);
+ g_free (mount_point);
return retval;
}
@@ -1322,12 +1267,12 @@
register_command ("pm-enable", "user",
_("Enable pam_mount with encrypted home directories"),
TRUE, command_enable_pam_mount);
- register_command ("pm-disable", "",
+ register_command ("pm-disable", "user",
_("Disable pam_mount with encrypted home directories"),
TRUE, command_disable_pam_mount);
register_command ("create-image", "image size_in_mb",
- _("Create an arbitrary LUKS disk image"),
- TRUE, command_create_luks_disk_image);
+ _("Create an arbitrary LUKS image"),
+ TRUE, command_create_luks_image);
register_command ("format", "device",
_("Create a LUKS partition on a device"),
TRUE, command_make_luks_device);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/cryptconfig-0.1.0/src/cryptconfig.h new/cryptconfig-0.1.0/src/cryptconfig.h
--- old/cryptconfig-0.1.0/src/cryptconfig.h 2007-01-17 21:03:28.000000000 +0100
+++ new/cryptconfig-0.1.0/src/cryptconfig.h 2007-02-12 22:02:36.000000000 +0100
@@ -17,14 +17,6 @@
#define PAM_PASSWD_CONF "/etc/pam.d/passwd"
#define CRYPTCONFIG_CONF SYSCONFDIR "/cryptconfig.conf"
-typedef struct _command {
- gchar *name;
- gchar *arguments;
- gchar *description;
- gboolean (*execute) (char *cmd, int argc, char *argv[]);
- gboolean requires_root;
-} Command;
-
gboolean luks_close (char *map_name);
gboolean luks_format (const char *pass, size_t pass_size, char *device);
gboolean luks_open (const char *pass, size_t pass_size,
@@ -49,6 +41,7 @@
gchar *get_supported_filesystems (void);
gboolean is_mounted (const char *dev);
+gboolean get_mount_point (const char *dev, char **mp);
gboolean is_filesystem_supported (const char *fs_type);
gboolean create_filesystem (char *device, char *fs_type);
gboolean resize_filesystem (char *device);
@@ -60,11 +53,12 @@
gboolean disable_pam_mount_all (void);
gchar *path_to_map_name (const char *path);
+gboolean unlock_image (const char *image_file, const char *key_file, char **map_device, char **loop_dev);
gboolean check_disk_space (char *image, char *current_home, guint64 *home_size);
gboolean copy_data (const char *src, const char *dest);
gboolean get_passphrase (const char *prompt, int verify, gchar **passphrase);
gboolean enlarge_image (const char *image, int size_to_add_in_mb);
gboolean get_random_key_data (gchar **key_data, size_t key_size);
gboolean temp_mount (char *fs_type, char *device, char **mount_point);
-
+gboolean mount_dev (char *fs_type, char *device, char *mount_point);
#endif
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/cryptconfig-0.1.0/src/cryptconfig-lib.c new/cryptconfig-0.1.0/src/cryptconfig-lib.c
--- old/cryptconfig-0.1.0/src/cryptconfig-lib.c 2007-01-23 20:48:09.000000000 +0100
+++ new/cryptconfig-0.1.0/src/cryptconfig-lib.c 2007-02-12 22:12:04.000000000 +0100
@@ -35,6 +35,8 @@
#include "cryptconfig.h"
+typedef gboolean (*LineMatchFunc) (char *, void *);
+
static long fs_min_sizes[] = { 10, 10, 40 };
static gchar *fs_list[] = { "ext3", "ext2", "reiserfs" };
static gchar *default_pam_services[] = { "gdm", "login", "kdm", "xdm", "su", "sudo", NULL };
@@ -131,8 +133,7 @@
* TRUE if the line should be written to the new file and FALSE otherwise.
*/
static gboolean filter_file (const char *file, const char *template,
- gboolean (*match_cb) (char *, void *),
- void *data)
+ LineMatchFunc match_func, void *data)
{
FILE *old, *new;
gchar *tmp_name;
@@ -160,7 +161,7 @@
buff[BUFF_SIZE - 1] = '\0';
while (fgets (buff, BUFF_SIZE, old)) {
- if (match_cb (buff, data))
+ if (match_func (buff, data))
fprintf (new, buff);
}
@@ -289,7 +290,7 @@
}
/*
- * The match_cb for removing cryptass entries.
+ * The match_cb for removing cryptpass entries.
*/
static gboolean disable_pam_cryptpass_cb (char *line, void *data)
{
@@ -826,14 +827,15 @@
return FALSE;
md = g_build_filename ("/dev/mapper", map_name, NULL);
-
+
if (!g_file_test (md, G_FILE_TEST_EXISTS)) {
g_free (md);
*map_dev = NULL;
} else {
*map_dev = md;
}
-
+
+ /* try and find the loop device that image is using */
for (i = 0; i < 256; i++) {
int fd, io_ret;
struct loop_info64 info;
@@ -850,11 +852,7 @@
close (fd);
if (!io_ret) {
- gchar *img_bn = g_path_get_basename (image);
- int cmp_ret = strcmp (img_bn, (char *) info.lo_file_name);
- g_free (img_bn);
-
- if (!cmp_ret) {
+ if (!strcmp (image, (char *) info.lo_file_name)) {
*loop_dev = g_strdup (ld);
ret = TRUE;
goto cleanup;
@@ -1200,8 +1198,9 @@
*/
gboolean get_passphrase (const char *prompt, gboolean verify, gchar **passphrase)
{
+ char *p;
int len, tty;
- ssize_t p1, p2;
+ ssize_t p1_len = 0, p2_len = 0, n;
struct termios normal, no_echo;
char buff[BUFF_SIZE];
@@ -1230,9 +1229,16 @@
if (tty)
tcsetattr (STDIN_FILENO, TCSAFLUSH, &no_echo);
- p1 = read (STDIN_FILENO, *passphrase, BUFF_SIZE - 1);
- if (p1 == -1)
- goto error;
+ (*passphrase)[BUFF_SIZE - 1] = '\0';
+ for (p = *passphrase; p1_len < BUFF_SIZE - 1; p++, p1_len++) {
+ n = read (STDIN_FILENO, p, 1);
+ if (n == -1) {
+ goto error;
+ } else if (n == 0 || *p == '\n') {
+ *p = '\0';
+ break;
+ }
+ }
if (verify) {
char passphrase2[BUFF_SIZE];
@@ -1245,20 +1251,24 @@
if (write (STDOUT_FILENO, buff, len) == -1)
goto error;
- p2 = read (STDIN_FILENO, passphrase2, BUFF_SIZE - 1);
- if (p2 == -1)
- goto error;
-
- if (p1 != p2 || strncmp (*passphrase, passphrase2, p1))
+ passphrase2[BUFF_SIZE - 1] = '\0';
+ for (p = passphrase2; p2_len < BUFF_SIZE - 1; p++, p2_len++) {
+ n = read (STDIN_FILENO, p, 1);
+ if (n == -1) {
+ goto error;
+ } else if (n == 0 || *p == '\n') {
+ *p = '\0';
+ break;
+ }
+ }
+
+ if (p1_len != p2_len || strncmp (*passphrase, passphrase2, p1_len))
goto error;
}
if (tty)
tcsetattr (STDIN_FILENO, TCSAFLUSH, &normal);
- if ((*passphrase)[p1 - 1] == '\n')
- (*passphrase)[p1 - 1] = '\0';
-
write (STDOUT_FILENO, "\n", 1);
return TRUE;
@@ -1373,17 +1383,24 @@
*/
gboolean temp_mount (char *fs_type, char *device, char **mount_point)
{
- int status;
- char *mp = g_build_filename (g_get_tmp_dir (), "tmp-mount-XXXXXX", NULL);
- char *argv[] = { "/bin/mount", "-n", "-t", fs_type, "-o", "user_xattr",
- device, mp, NULL};
-
- if (!mkdtemp (mp)) {
- g_free (mp);
+ *mount_point = g_build_filename (g_get_tmp_dir (), "tmp-mount-XXXXXX", NULL);
+ if (!mkdtemp (*mount_point)) {
+ g_free (*mount_point);
return FALSE;
}
- *mount_point = mp;
+ return mount_dev (fs_type, device, *mount_point);
+}
+
+/*
+ * Mount device on a temporary directory. The mount_point string needs
+ * to be freed by the caller.
+ */
+gboolean mount_dev (char *fs_type, char *device, char *mount_point)
+{
+ int status;
+ char *argv[] = { "/bin/mount", "-n", "-t", fs_type, "-o", "user_xattr",
+ device, mount_point, NULL};
return g_spawn_sync (NULL, argv, NULL,
G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL,
NULL, NULL, NULL, NULL, &status, NULL);
@@ -1415,6 +1432,35 @@
}
/*
+ * If device is mounted then get the mount point. The
+ * returned mount point should be freed by the caller.
+ */
+gboolean get_mount_point (const char *dev, char **mp)
+{
+ FILE *fp;
+ char buff[BUFF_SIZE];
+
+ fp = fopen ("/proc/mounts", "r");
+ if (!fp) {
+ g_printerr ("open: %s\n", strerror (errno));
+ return FALSE;
+ }
+
+ while (fgets (buff, BUFF_SIZE, fp)) {
+ if (strstr (buff, dev)) {
+ gchar **fields = g_strsplit (buff, " ", -1);
+ *mp = g_strdup (fields[1]);
+ g_strfreev (fields);
+ fclose (fp);
+ return TRUE;
+ }
+ }
+
+ fclose (fp);
+ return FALSE;
+}
+
+/*
* Resize the file system on a device. Use tune2fs and debugreisefs
* to detect the fs type.
*/
@@ -1501,6 +1547,80 @@
}
/*
+ * Unlock image_file using key_file. If key_file is NULL then we assume
+ * we're using an image password. If TRUE is returned then map_device and
+ * loop_device needs to be freed by the caller.
+ */
+gboolean unlock_image (const char *image_file, const char *key_file,
+ char **map_device, char **loop_device)
+{
+ gchar *map_name = NULL, *map_dev = NULL, *password = NULL, *imgf = NULL;
+ gchar *pass = NULL, *key_data = NULL, *prompt = NULL, *loop_dev = NULL;
+ int pass_len, key_data_size;
+ gboolean ret = FALSE;
+
+ map_name = path_to_map_name (image_file);
+ if (!map_name) {
+ g_printerr (_("Failed to create map name\n"));
+ goto cleanup;
+ }
+
+ map_dev = g_build_filename ("/dev/mapper", map_name, NULL);
+ if (g_file_test (map_dev, G_FILE_TEST_EXISTS)) {
+ g_printerr (_("The map device for this image is in use\n"));
+ goto cleanup;
+ }
+
+ prompt = key_file ? _("Enter the key file password") : _("Enter the image password");
+ if (!get_passphrase (prompt, FALSE, &password)) {
+ g_printerr (_("Failed to get password\n"));
+ goto cleanup;
+ }
+
+ /* if --key-file was given then decrypt the fs key */
+ if (key_file) {
+ if (g_access (key_file, F_OK | R_OK)) {
+ g_printerr (_("Unable to access the specified key file\n"));
+ goto cleanup;
+ }
+
+ if (!decrypt_key (key_file, password, &key_data, &key_data_size)) {
+ g_printerr (_("Failed to decrypt key file with the provided password\n"));
+ goto cleanup;
+ }
+ }
+
+ pass = key_file ? key_data : password;
+ pass_len = key_file ? key_data_size : strlen (password);
+
+ /* setup our loop device */
+ imgf = g_strdup (image_file);
+ if (!loop_open (imgf, &loop_dev)) {
+ g_printerr (_("Failed to open disk image\n"));
+ goto cleanup;
+ }
+
+ /* unlock the device */
+ if (!luks_open (pass, pass_len, loop_dev, map_name)) {
+ g_printerr (_("Failed to open device\n"));
+ goto cleanup;
+ }
+
+ *map_device = g_strdup (map_dev);
+ *loop_device = g_strdup (loop_dev);
+ ret = TRUE;
+
+cleanup:
+ g_free (password);
+ g_free (map_name);
+ g_free (map_dev);
+ g_free (loop_dev);
+ g_free (key_data);
+ g_free (imgf);
+ return ret;
+}
+
+/*
* Decrypt an existing key file and add its contents to the LUKS device.
*/
gboolean add_key_file_to_device (char *device, char *extra_key_file,
@@ -1540,13 +1660,3 @@
g_free (extra_key_data);
return ret;
}
-
-static gboolean enable_shadow_data ()
-{
- return TRUE;
-}
-
-static gboolean disable_shadow_data ()
-{
- return TRUE;
-}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org