From jan at intevation.de Wed Mar 1 11:11:44 2006 From: jan at intevation.de (Jan-Oliver Wagner) Date: Wed Mar 1 11:12:05 2006 Subject: [Slad] Patch: SLADinstaller Makefile for Cygwin Message-ID: <20060301111144.GA31031@intevation.de> Hi, attached a patch that makes the Makefile of SLAdinstaller work correctly with Cygwin. Best Jan -- Jan-Oliver Wagner: www.intevation.de/~jan | GISpatcher: www.gispatcher.de Kolab Konsortium : www.kolab-konsortium.de | Thuban : thuban.intevation.org Intevation GmbH : www.intevation.de | Kolab : www.kolab.org FreeGIS : www.freegis.org | GAV : www.grass-verein.de -------------- next part -------------- Index: Makefile =================================================================== RCS file: /anoncvs/sladinstaller/Makefile,v retrieving revision 1.15 diff -u -3 -p -r1.15 Makefile --- Makefile 11 Feb 2006 13:14:37 -0000 1.15 +++ Makefile 1 Mar 2006 11:08:39 -0000 @@ -10,9 +10,10 @@ LDFLAGS+=-L. -L$(OPENSSL)/lib -L/usr/X11 LIBS+=`pkg-config --libs gtk+-2.0` `pkg-config --libs gthread-2.0` `curl-config --libs` -lssl -lcrypto STATLIBS+=-lXft -lfontconfig -lfreetype -lpangoft2-1.0 -lXcursor -lXinerama -lXext -lXi -lXrandr -lXrender -lXt -lX11 -lpng12 -ljpeg -ltiff -lexpat -SYSTEM:=$(shell uname) -ifeq ($(SYSTEM), Windows) -CXXFLAGS+=-mms-bitfields +SYSTEM:=$(shell uname -o) +ifeq ($(SYSTEM), Cygwin) +CXXFLAGS+=-mms-bitfields -DCYGWIN +LDFLAGS+=-mwindows endif include Makefile.config From jan at intevation.de Wed Mar 1 11:19:23 2006 From: jan at intevation.de (Jan-Oliver Wagner) Date: Wed Mar 1 11:19:27 2006 Subject: [Slad] SLADinstaller Patch for windows filenames and process calls Message-ID: <20060301111923.GB31031@intevation.de> Hi, attached is a patch that care for Windows filenames and correct system calls for tar command. The latter ist especially important for binary installations of SLADinstaller on Systems without Cygwin. Best Jan -- Jan-Oliver Wagner: www.intevation.de/~jan | GISpatcher: www.gispatcher.de Kolab Konsortium : www.kolab-konsortium.de | Thuban : thuban.intevation.org Intevation GmbH : www.intevation.de | Kolab : www.kolab.org FreeGIS : www.freegis.org | GAV : www.grass-verein.de -------------- next part -------------- Index: tools.cpp =================================================================== RCS file: /anoncvs/sladinstaller/tools.cpp,v retrieving revision 1.22 diff -u -3 -p -r1.22 tools.cpp --- tools.cpp 13 Feb 2006 21:56:37 -0000 1.22 +++ tools.cpp 1 Mar 2006 11:16:49 -0000 @@ -1,5 +1,9 @@ #define _XOPEN_SOURCE /* glibc2 needs this */ +#ifdef CYGWIN +#include +#endif + #include "memorymap.hpp" #include "tools.hpp" #include @@ -22,6 +26,12 @@ #include #include #include +#include + +#ifdef CYGWIN +#include +#undef pipe +#endif #define _(a) gettext (a) @@ -349,7 +359,11 @@ std::string installonclient(void *ssh_se // prepare some variables std::string filename=pkg; +#ifdef CYGWIN + unsigned pos=filename.find_last_of('\\'); +#else unsigned pos=filename.find_last_of('/'); +#endif if(pos!=std::string::npos) filename.erase(0, pos+1); @@ -623,21 +637,63 @@ mypopen(const char * dir, char ** argv, std::string checkpackage(const std::string& pkg) { +#ifdef CYGWIN + char posixname_gzip_exe[PATH_MAX]; + char posixname_bzip2_exe[PATH_MAX]; + char posixname_pkg[PATH_MAX]; + + char * c_bin_dir = g_win32_get_package_installation_subdirectory(NULL, + NULL, "bin"); + std::string bin_dir(c_bin_dir); + g_free(c_bin_dir); + + std::string gzip_exe = bin_dir + "\\gzip.exe"; + std::string bz2_exe = bin_dir + "\\bzip2.exe"; + + cygwin_conv_to_full_posix_path(gzip_exe.c_str(), posixname_gzip_exe); + cygwin_conv_to_full_posix_path(bz2_exe.c_str(), posixname_bzip2_exe); + cygwin_conv_to_full_posix_path(pkg.c_str(), posixname_pkg); + + std::string gzip_cmd = "--use-compress-program=" + std::string(posixname_gzip_exe); + std::string bzip2_cmd = "--use-compress-program=" + std::string(posixname_bzip2_exe); +#else + std::string gzip_cmd = "tfz"; + std::string bzip2_cmd = "tfj"; + std::string bin_dir("."); +#endif + LOG(std::string("\n")+_("check")+' '+pkg+'\n'); - std::string tarcmd="tf"; + std::string tarcmd="-tf"; + std::string compress_cmd = ""; + if(tolower(pkg[pkg.size()-2])=='g' && tolower(pkg[pkg.size()-1])=='z') +#ifdef CYGWIN + compress_cmd = gzip_cmd; +#else tarcmd="tfz"; - if(tolower(pkg[pkg.size()-3])=='b' && tolower(pkg[pkg.size()-2])=='z' && pkg[pkg.size()-1]=='2') +#endif + if(tolower(pkg[pkg.size()-3])=='b' && tolower(pkg[pkg.size()-2])=='z' + && pkg[pkg.size()-1]=='2') +#ifdef CYGWIN + compress_cmd = bzip2_cmd; +#else tarcmd="tfj"; +#endif - char * cmd[] = { "tar", (char*)tarcmd.c_str(), (char *)pkg.c_str(), 0}; +#ifdef CYGWIN + char * cmd[] = { "tar", (char *)compress_cmd.c_str(), (char*)tarcmd.c_str(), + posixname_pkg, 0 }; + std::string cmd_str = std::string(cmd[0]) + ' ' + cmd[1] + ' ' + cmd[2] + ' ' + cmd[3]; +#else + char * cmd[] = { "tar", (char*)tarcmd.c_str(), (char *)pkg.c_str(), 0 }; + std::string cmd_str = std::string(cmd[0]) + ' ' + cmd[1] + ' ' + cmd[2]; +#endif pid_t tar_pid; - LOG(std::string("\ntar command: ")+cmd[0]+" "+ cmd[1]+" "+ cmd[2]); - FILE *f=mypopen(".", cmd, &tar_pid); + LOG(std::string("\ntar command: ")+cmd_str.c_str()); + FILE *f=mypopen(bin_dir.c_str(), cmd, &tar_pid); if(!f) - return std::string(SLAD_ERROR) +' '+_("could not execute")+": " - +cmd[0]+" "+ cmd[1]+" "+ cmd[2]; + return std::string(SLAD_ERROR) +' '+_("could not execute")+": " + cmd_str.c_str(); bool ok=false; std::string dir; while(!feof(f)) From jan at intevation.de Wed Mar 1 11:37:15 2006 From: jan at intevation.de (Jan-Oliver Wagner) Date: Wed Mar 1 11:37:19 2006 Subject: [Slad] SLADinstaller Patch: keep certain gtk calls out of thread Message-ID: <20060301113715.GD31031@intevation.de> Hi, the attached patch keeps the call of GTK message dialogs out of the thread. Though it worked before on GNU/Linux, on Windows we have problems - the application simply freezes. I am not sure whether this is a bug in GTK, in Windows or something else. However, the solution of the patch should work also for GNU/Linux. I haven't tested it yet apart from that it compiles. So, please test before creating a new release. Best Jan -- Jan-Oliver Wagner: www.intevation.de/~jan | GISpatcher: www.gispatcher.de Kolab Konsortium : www.kolab-konsortium.de | Thuban : thuban.intevation.org Intevation GmbH : www.intevation.de | Kolab : www.kolab.org FreeGIS : www.freegis.org | GAV : www.grass-verein.de -------------- next part -------------- Index: gtk.cpp =================================================================== RCS file: /anoncvs/sladinstaller/gtk.cpp,v retrieving revision 1.49 diff -u -3 -p -r1.49 gtk.cpp --- gtk.cpp 15 Feb 2006 10:52:13 -0000 1.49 +++ gtk.cpp 1 Mar 2006 11:31:07 -0000 @@ -166,6 +166,9 @@ struct ThreadData std::string sshpassphrase; std::string twsitepassphrase; std::string twlocalpassphrase; + + int ret; + std::string result_message; }; static gpointer ThreadFunc(gpointer data) @@ -358,22 +361,22 @@ static gpointer ThreadFunc(gpointer data sshclose(sshhandle); + std::string s = ""; gdk_threads_enter (); if(ret) { PROGRESS_(_("Installation failed!")); PROGRESS_(1.0); - std::string s=_("Installation was not successfull."); + s+=_("Installation was not successfull."); s+=' '; if(err.size()) s+=err; else s+=_("See log window for details."); - ERROR(s.c_str()); } else { - std::string s=_("Installation completed. Please note the SLAD passphrase and tripwire passphrases."); + s+=_("Installation completed. Please note the SLAD passphrase and tripwire passphrases."); s+='\n'; if(filename_sshkey.size()) { @@ -385,13 +388,15 @@ static gpointer ThreadFunc(gpointer data s+=_("The Tripwire passphrases and the SLAD passphrase are saved in:"); s+='\n'; s+=filename_sladconf; filename_sladconf.erase(); } - SUCCESS(s.c_str()); } + + td->ret = ret; + td->result_message = s; gdk_flush(); gdk_threads_leave (); installthreadrun=false; - return gpointer(ret); + return td; } static gboolean installthreadcheck(gpointer data) @@ -399,12 +404,19 @@ static gboolean installthreadcheck(gpoin if(installthreadrun) return true; - g_thread_join(installthread); + gdk_threads_enter(); + ThreadData *td = reinterpret_cast(g_thread_join(installthread)); installthread=0; + if (td->ret) + ERROR(td->result_message.c_str()); + else + SUCCESS(td->result_message.c_str()); + // enable install button gtk_widget_set_sensitive(installbutton, true); + gdk_threads_leave(); return false; } From jan at intevation.de Wed Mar 1 12:05:09 2006 From: jan at intevation.de (Jan-Oliver Wagner) Date: Wed Mar 1 12:05:13 2006 Subject: [Slad] SLADinstaller Patch: gettext for w32 Message-ID: <20060301120509.GE31031@intevation.de> Hi, attached a patch for locale/gettext on Cygwin. It should be applied only after my previous patch to gtk.cpp. Best Jan -- Jan-Oliver Wagner: www.intevation.de/~jan | GISpatcher: www.gispatcher.de Kolab Konsortium : www.kolab-konsortium.de | Thuban : thuban.intevation.org Intevation GmbH : www.intevation.de | Kolab : www.kolab.org FreeGIS : www.freegis.org | GAV : www.grass-verein.de -------------- next part -------------- --- gtk.cpp.orig 2006-03-01 12:27:07.000000000 +0100 +++ gtk.cpp 2006-03-01 13:02:07.000000000 +0100 @@ -606,8 +606,19 @@ { // init gettext +#ifdef CYGWIN + char* localedir = g_win32_get_package_installation_subdirectory(NULL, NULL, + "share\\locale"); +#ifdef LANGUAGE + g_setenv("LANGUAGE", LANGUAGE, FALSE); +#endif /* LANGUAGE */ + setlocale (LC_ALL, "" ); + bindtextdomain (PACKAGE, localedir); +#else /* CYGWIN */ setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); +#endif /* CYGWIN */ + bind_textdomain_codeset (PACKAGE, "UTF-8"); textdomain (PACKAGE); From jan at intevation.de Thu Mar 2 00:34:56 2006 From: jan at intevation.de (Jan-Oliver Wagner) Date: Thu Mar 2 00:35:00 2006 Subject: [Slad] sladinstaller patch: fix untolerable timeouts on windows Message-ID: <20060302003456.GA22391@intevation.de> Hi, attached a patch for sladinstaller that works around a untolerable timout due to trying to resolve non-existing hostnames each time a letter is typed into the corresponding entry field. The problems occurs only for Windows with Cygnus, not for GNU/Linux. Best Jan -- Jan-Oliver Wagner: www.intevation.de/~jan | GISpatcher: www.gispatcher.de Kolab Konsortium : www.kolab-konsortium.de | Thuban : thuban.intevation.org Intevation GmbH : www.intevation.de | Kolab : www.kolab.org FreeGIS : www.freegis.org | GAV : www.grass-verein.de -------------- next part -------------- --- gtk.cpp.orig 2006-03-02 01:31:19.000000000 +0100 +++ gtk.cpp 2006-03-01 13:29:15.000000000 +0100 @@ -779,7 +779,13 @@ gtk_widget_show(hostname); if(defaultHostname) gtk_entry_set_text(GTK_ENTRY(hostname), defaultHostname); +#ifdef CYGWIN + // on Cygwin there occur untolerable timeouts for trying to + // resolve non-existing hostnames + g_signal_connect (G_OBJECT (hostname), "focus-out-event", +#else g_signal_connect (G_OBJECT (hostname), "key-release-event", +#endif G_CALLBACK (hostname_changed), NULL); gtk_tooltips_set_tip(tt, hostname, _("Hostname of target computer onto which SLAD will be installed."), From jan at intevation.de Fri Mar 3 15:29:45 2006 From: jan at intevation.de (Jan-Oliver Wagner) Date: Fri Mar 3 15:29:49 2006 Subject: [Slad] Better separation of reports towards NessusClient? Message-ID: <20060303152945.GA28858@intevation.de> Hi, currently SLAD puts all report results into "general/tcp". This makes it a bit complicated to read, especially if you switched on all reports. Is it possible to create separate areas "slad/JohnTheRipper", "slad/syslog", "slad/lsof", etc.? If yes, how complicated would it be to achieve this? Best Jan -- Jan-Oliver Wagner: www.intevation.de/~jan | GISpatcher: www.gispatcher.de Kolab Konsortium : www.kolab-konsortium.de | Thuban : thuban.intevation.org Intevation GmbH : www.intevation.de | Kolab : www.kolab.org FreeGIS : www.freegis.org | GAV : www.grass-verein.de From d.jagdmann at dn-systems.de Sun Mar 5 13:36:30 2006 From: d.jagdmann at dn-systems.de (Dirk Jagdmann) Date: Sun Mar 5 13:36:26 2006 Subject: [Slad] Patch: SLADinstaller Makefile for Cygwin In-Reply-To: <20060301111144.GA31031@intevation.de> References: <20060301111144.GA31031@intevation.de> Message-ID: <440AE95E.8030505@dn-systems.de> > attached a patch that makes the Makefile of SLAdinstaller > work correctly with Cygwin. applied -- Dirk Jagdmann : Coder Tel. +49-5121-28989-15 -- DN-Systems Enterprise Internet Solutions GmbH Hornemannstr. 11 31137 Hildesheim, Germany Tel. +49-5121-28989-0 Fax. +49-5121-28989-11 Handelsregister HRB-3213 Amtsgericht Hildesheim Gesch?ftsf?hrer: Lukas Grunwald From d.jagdmann at dn-systems.de Sun Mar 5 13:46:28 2006 From: d.jagdmann at dn-systems.de (Dirk Jagdmann) Date: Sun Mar 5 13:46:22 2006 Subject: [Slad] SLADinstaller Patch for windows filenames and process calls In-Reply-To: <20060301111923.GB31031@intevation.de> References: <20060301111923.GB31031@intevation.de> Message-ID: <440AEBB4.8090306@dn-systems.de> > attached is a patch that care for Windows filenames > and correct system calls for tar command. > The latter ist especially important for > binary installations of SLADinstaller on Systems > without Cygwin. applied -- Dirk Jagdmann : Coder Tel. +49-5121-28989-15 -- DN-Systems Enterprise Internet Solutions GmbH Hornemannstr. 11 31137 Hildesheim, Germany Tel. +49-5121-28989-0 Fax. +49-5121-28989-11 Handelsregister HRB-3213 Amtsgericht Hildesheim Gesch?ftsf?hrer: Lukas Grunwald From d.jagdmann at dn-systems.de Sun Mar 5 13:51:35 2006 From: d.jagdmann at dn-systems.de (Dirk Jagdmann) Date: Sun Mar 5 13:51:30 2006 Subject: [Slad] SLADinstaller Patch: keep certain gtk calls out of thread In-Reply-To: <20060301113715.GD31031@intevation.de> References: <20060301113715.GD31031@intevation.de> Message-ID: <440AECE7.8020102@dn-systems.de> > the attached patch keeps the call of GTK message dialogs > out of the thread. > Though it worked before on GNU/Linux, > on Windows we have problems - the application simply freezes. > > I am not sure whether this is a bug in GTK, in Windows or > something else. > > However, the solution of the patch should work also for > GNU/Linux. I haven't tested it yet apart from that it compiles. > So, please test before creating a new release. applied, and did a test on linux. It worked. -- Dirk Jagdmann : Coder Tel. +49-5121-28989-15 -- DN-Systems Enterprise Internet Solutions GmbH Hornemannstr. 11 31137 Hildesheim, Germany Tel. +49-5121-28989-0 Fax. +49-5121-28989-11 Handelsregister HRB-3213 Amtsgericht Hildesheim Gesch?ftsf?hrer: Lukas Grunwald From d.jagdmann at dn-systems.de Sun Mar 5 13:52:59 2006 From: d.jagdmann at dn-systems.de (Dirk Jagdmann) Date: Sun Mar 5 13:52:53 2006 Subject: [Slad] SLADinstaller Patch: gettext for w32 In-Reply-To: <20060301120509.GE31031@intevation.de> References: <20060301120509.GE31031@intevation.de> Message-ID: <440AED3B.6030107@dn-systems.de> > attached a patch for locale/gettext on Cygwin. applied -- Dirk Jagdmann : Coder Tel. +49-5121-28989-15 -- DN-Systems Enterprise Internet Solutions GmbH Hornemannstr. 11 31137 Hildesheim, Germany Tel. +49-5121-28989-0 Fax. +49-5121-28989-11 Handelsregister HRB-3213 Amtsgericht Hildesheim Gesch?ftsf?hrer: Lukas Grunwald From d.jagdmann at dn-systems.de Sun Mar 5 13:54:04 2006 From: d.jagdmann at dn-systems.de (Dirk Jagdmann) Date: Sun Mar 5 13:53:58 2006 Subject: [Slad] sladinstaller patch: fix untolerable timeouts on windows In-Reply-To: <20060302003456.GA22391@intevation.de> References: <20060302003456.GA22391@intevation.de> Message-ID: <440AED7C.1090603@dn-systems.de> > attached a patch for sladinstaller that works around > a untolerable timout due to trying to resolve non-existing > hostnames each time a letter is typed into the corresponding > entry field. applied -- Dirk Jagdmann : Coder Tel. +49-5121-28989-15 -- DN-Systems Enterprise Internet Solutions GmbH Hornemannstr. 11 31137 Hildesheim, Germany Tel. +49-5121-28989-0 Fax. +49-5121-28989-11 Handelsregister HRB-3213 Amtsgericht Hildesheim Gesch?ftsf?hrer: Lukas Grunwald