Mailing List Archive

NessusClient/nessus pdf_output.c,1.8,1.9
Update of /usr/local/cvs/NessusClient/nessus
In directory raccoon.nessus.org:/tmp/cvs-serv46159

Modified Files:
pdf_output.c
Log Message:
Added some Windows specific path handlings for Cygwin.
Replacing "htmldoc" by argv[0] is a general fix apart from that.


Index: pdf_output.c
===================================================================
RCS file: /usr/local/cvs/NessusClient/nessus/pdf_output.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- pdf_output.c 4 May 2006 17:19:43 -0000 1.8
+++ pdf_output.c 5 Jul 2006 14:10:06 -0000 1.9
@@ -31,6 +31,10 @@

#include <includes.h>

+#ifdef CYGWIN
+#include <sys/cygwin.h>
+#endif /* CYGWIN */
+
#include "report.h"
#include "report_utils.h"
#include "error_dialog.h"
@@ -369,7 +373,7 @@
{
int i;
for ( i = 3 ; i < getdtablesize(); i++ ) close(i);
- ret = execvp("htmldoc", argv);
+ ret = execvp(argv[0], argv);
if ( ret ) exit(127);
else exit(0);
}
@@ -398,6 +402,20 @@
int htmldoc_ret;
char ** argv = NULL;

+#ifdef CYGWIN
+ char w32name[PATH_MAX];
+
+ /* On Windows we need the specific location of the htmldoc program and
+ * its data files.
+ * By default it is assumed it is installed as part of
+ * NessusClient installation.
+ */
+ char * htmldoc_datadir = g_win32_get_package_installation_subdirectory(NULL,
+ NULL, "share\\htmldoc");
+ char * htmldoc_program = g_win32_get_package_installation_subdirectory(NULL,
+ NULL, "bin\\htmldoc.exe");
+#endif /* CYGWIN */
+
const char *nessus_dir = estrdup(prefs_get_string(Global, "nessus_dir"));

snprintf(tmpfname, PATH_MAX, "%s/.nessus_%d_pdf",nessus_dir, getpid());
@@ -412,7 +430,13 @@
/* Write the arglist to plain HTML suitable to be processed by HTMLDoc */
arglist_to_plainhtml(context, be, "report.html");

+#ifndef CYGWIN
argv = append_argv(argv, "htmldoc");
+#else
+ argv = append_argv(argv, htmldoc_program);
+ argv = append_argv(argv, "--datadir");
+ argv = append_argv(argv, htmldoc_datadir);
+#endif /* CYGWIN */
argv = append_argv(argv, "--firstpage");
argv = append_argv(argv, "p1");
argv = append_argv(argv, "--footer");
@@ -424,7 +448,12 @@
argv = append_argv(argv, "--quiet");
argv = append_argv(argv, "--webpage");
argv = append_argv(argv, "-f");
+#ifndef CYGWIN
argv = append_argv(argv, filename);
+#else
+ cygwin_conv_to_win32_path(filename, w32name);
+ argv = append_argv(argv, w32name);
+#endif /* CYGWIN */
argv = append_argv(argv, "report.html");
htmldoc_ret = exec_htmldoc(argv);

@@ -441,6 +470,12 @@
chdir(cwd);
rmdir(tmpfname);
efree(&cwd);
+
+#ifdef CYGWIN
+ g_free(htmldoc_datadir);
+ g_free(htmldoc_program);
+#endif /* CYGWIN */
+
return(htmldoc_ret);
}


_______________________________________________
Nessus-cvs mailing list
Nessus-cvs@list.nessus.org
http://mail.nessus.org/mailman/listinfo/nessus-cvs