2017-06-29 08:53:33 +00:00
|
|
|
From cb54210f7f02b07768cfbf49ae266d487f580e1b Mon Sep 17 00:00:00 2001
|
|
|
|
From: rpm-build <rpm-build>
|
|
|
|
Date: Thu, 29 Jun 2017 15:32:58 +0200
|
|
|
|
Subject: [PATCH] Move /tmp to /var/tmp
|
2013-11-02 12:44:30 +00:00
|
|
|
|
2017-06-29 08:53:33 +00:00
|
|
|
Fedora is using tmpfs which is limited by the size of RAM, thus we need
|
|
|
|
to use different directory on different filesystem.
|
2022-10-06 04:30:26 +00:00
|
|
|
|
2017-06-29 08:53:33 +00:00
|
|
|
---
|
|
|
|
ui/qt/about_dialog.cpp | 3 +-
|
2022-10-06 04:30:26 +00:00
|
|
|
ui/qt/iax2_analysis_dialog.cpp | 5 ++-
|
|
|
|
ui/qt/utils/rtp_audio_file.cpp | 3 +-
|
|
|
|
wsutil/tempfile.c | 18 +++++++-
|
|
|
|
wsutil/tempfile.h | 2 +-
|
|
|
|
wsutil/wstmpdir.c | 71 ++++++++++++++++++++++++++++++++++
|
|
|
|
wsutil/wstmpdir.h | 39 +++++++++++++++++++
|
|
|
|
7 files changed, 134 insertions(+), 7 deletions(-)
|
2017-06-29 08:53:33 +00:00
|
|
|
create mode 100644 wsutil/wstmpdir.c
|
|
|
|
create mode 100644 wsutil/wstmpdir.h
|
2014-08-07 14:35:19 +00:00
|
|
|
|
2016-01-14 10:56:55 +00:00
|
|
|
diff --git a/ui/qt/about_dialog.cpp b/ui/qt/about_dialog.cpp
|
2022-10-06 04:30:26 +00:00
|
|
|
index 752b669ac4..42c2be0fca 100644
|
2016-01-14 10:56:55 +00:00
|
|
|
--- a/ui/qt/about_dialog.cpp
|
|
|
|
+++ b/ui/qt/about_dialog.cpp
|
2022-10-06 04:30:26 +00:00
|
|
|
@@ -14,6 +14,7 @@
|
2017-06-29 08:53:33 +00:00
|
|
|
|
2022-10-06 04:30:26 +00:00
|
|
|
#include "main_application.h"
|
2017-06-29 08:53:33 +00:00
|
|
|
#include <wsutil/filesystem.h>
|
|
|
|
+#include <wsutil/wstmpdir.h> /* for get_tmp_dir() */
|
|
|
|
|
New version 2.6.0
Fix for CVE-2018-9256, CVE-2018-9257, CVE-2018-9258, CVE-2018-9259, CVE-2018-9260, CVE-2018-9261, CVE-2018-9262, CVE-2018-9263, CVE-2018-9264, CVE-2018-9265, CVE-2018-9266, CVE-2018-9267, CVE-2018-9268, CVE-2018-9269, CVE-2018-9270, CVE-2018-9271, CVE-2018-9272, CVE-2018-9273, CVE-2018-9274
Switch from autotools to cmake
Removed python2-devel(#1560284) and libssh2-devel from dependencies
Removed python scripts
2018-05-02 11:34:24 +00:00
|
|
|
#include <QDesktopServices>
|
|
|
|
#include <QUrl>
|
2022-10-06 04:30:26 +00:00
|
|
|
@@ -185,7 +186,7 @@ FolderListModel::FolderListModel(QObject * parent):
|
2019-12-19 08:51:56 +00:00
|
|
|
appendRow(QStringList() << tr("\"File\" dialogs") << get_last_open_dir() << tr("capture files"));
|
2016-01-14 10:56:55 +00:00
|
|
|
|
|
|
|
/* temp */
|
2022-10-06 04:30:26 +00:00
|
|
|
- appendRow(QStringList() << tr("Temp") << (global_capture_opts.temp_dir && global_capture_opts.temp_dir[0] ? global_capture_opts.temp_dir : g_get_tmp_dir()) << tr("untitled capture files"));
|
|
|
|
+ appendRow(QStringList() << tr("Temp") << (global_capture_opts.temp_dir && global_capture_opts.temp_dir[0] ? global_capture_opts.temp_dir : get_tmp_dir()) << tr("untitled capture files"));
|
2016-01-14 10:56:55 +00:00
|
|
|
|
|
|
|
/* pers conf */
|
2019-12-19 08:51:56 +00:00
|
|
|
appendRow(QStringList() << tr("Personal configuration")
|
2016-01-14 10:56:55 +00:00
|
|
|
diff --git a/ui/qt/iax2_analysis_dialog.cpp b/ui/qt/iax2_analysis_dialog.cpp
|
2022-10-06 04:30:26 +00:00
|
|
|
index 07b9b42e01..fb09de989b 100644
|
2016-01-14 10:56:55 +00:00
|
|
|
--- a/ui/qt/iax2_analysis_dialog.cpp
|
|
|
|
+++ b/ui/qt/iax2_analysis_dialog.cpp
|
2022-10-06 04:30:26 +00:00
|
|
|
@@ -25,6 +25,7 @@
|
2017-06-29 08:53:33 +00:00
|
|
|
#include "ui/rtp_stream.h"
|
|
|
|
#endif
|
|
|
|
#include <wsutil/utf8_entities.h>
|
|
|
|
+#include <wsutil/wstmpdir.h> /* for get_tmp_dir() */
|
|
|
|
|
2016-01-14 10:56:55 +00:00
|
|
|
#include <wsutil/g711.h>
|
|
|
|
#include <wsutil/pint.h>
|
2022-10-06 04:30:26 +00:00
|
|
|
@@ -255,10 +256,10 @@ Iax2AnalysisDialog::Iax2AnalysisDialog(QWidget &parent, CaptureFile &cf) :
|
2016-01-14 10:56:55 +00:00
|
|
|
|
|
|
|
// We keep our temp files open for the lifetime of the dialog. The GTK+
|
|
|
|
// UI opens and closes at various points.
|
|
|
|
- QString tempname = QString("%1/wireshark_iax2_f").arg(QDir::tempPath());
|
|
|
|
+ QString tempname = QString("%1/wireshark_iax2_f").arg(get_tmp_dir());
|
|
|
|
fwd_tempfile_ = new QTemporaryFile(tempname, this);
|
|
|
|
fwd_tempfile_->open();
|
|
|
|
- tempname = QString("%1/wireshark_iax2_r").arg(QDir::tempPath());
|
|
|
|
+ tempname = QString("%1/wireshark_iax2_r").arg(get_tmp_dir());
|
|
|
|
rev_tempfile_ = new QTemporaryFile(tempname, this);
|
|
|
|
rev_tempfile_->open();
|
|
|
|
|
2021-11-25 11:06:21 +00:00
|
|
|
diff --git a/ui/qt/utils/rtp_audio_file.cpp b/ui/qt/utils/rtp_audio_file.cpp
|
2022-10-06 04:30:26 +00:00
|
|
|
index 591a63bbf3..203f5c5286 100644
|
2021-11-25 11:06:21 +00:00
|
|
|
--- a/ui/qt/utils/rtp_audio_file.cpp
|
|
|
|
+++ b/ui/qt/utils/rtp_audio_file.cpp
|
|
|
|
@@ -31,6 +31,7 @@
|
2017-06-29 08:53:33 +00:00
|
|
|
|
2021-11-25 11:06:21 +00:00
|
|
|
#include "rtp_audio_file.h"
|
|
|
|
#include <ws_attributes.h>
|
2016-01-14 10:56:55 +00:00
|
|
|
+#include <wsutil/wstmpdir.h> /* for get_tmp_dir() */
|
2017-06-29 08:53:33 +00:00
|
|
|
|
2021-11-25 11:06:21 +00:00
|
|
|
RtpAudioFile::RtpAudioFile(bool use_disk_for_temp, bool use_disk_for_frames):
|
|
|
|
real_pos_(0)
|
|
|
|
@@ -45,7 +46,7 @@ RtpAudioFile::RtpAudioFile(bool use_disk_for_temp, bool use_disk_for_frames):
|
2016-01-14 10:56:55 +00:00
|
|
|
|
2021-11-25 11:06:21 +00:00
|
|
|
tempname = "memory";
|
|
|
|
if (use_disk_for_temp) {
|
|
|
|
- tempname = QString("%1/wireshark_rtp_stream").arg(QDir::tempPath());
|
|
|
|
+ tempname = QString("%1/wireshark_rtp_stream").arg(get_tmp_dir());
|
|
|
|
sample_file_ = new QTemporaryFile(tempname, this);
|
|
|
|
} else {
|
|
|
|
sample_file_ = new QBuffer(this);
|
2014-08-07 14:35:19 +00:00
|
|
|
diff --git a/wsutil/tempfile.c b/wsutil/tempfile.c
|
2022-10-06 04:30:26 +00:00
|
|
|
index f93f96d538..73964a1def 100644
|
2014-08-07 14:35:19 +00:00
|
|
|
--- a/wsutil/tempfile.c
|
|
|
|
+++ b/wsutil/tempfile.c
|
2022-10-06 04:30:26 +00:00
|
|
|
@@ -14,10 +14,12 @@
|
|
|
|
|
2013-09-24 08:55:09 +00:00
|
|
|
#include "tempfile.h"
|
2022-10-06 04:30:26 +00:00
|
|
|
#include "file_util.h"
|
2020-12-03 13:36:37 +00:00
|
|
|
+#include <wsutil/file_util.h>
|
2016-01-14 10:56:55 +00:00
|
|
|
+#include <wsutil/wstmpdir.h> /* for get_tmp_dir() */
|
2022-10-06 04:30:26 +00:00
|
|
|
|
2020-12-03 13:36:37 +00:00
|
|
|
/**
|
|
|
|
* Create a tempfile with the given prefix (e.g. "wireshark"). The path
|
|
|
|
- * is created using g_file_open_tmp.
|
|
|
|
+ * is created using get_tmp_dir.
|
New version 2.6.0
Fix for CVE-2018-9256, CVE-2018-9257, CVE-2018-9258, CVE-2018-9259, CVE-2018-9260, CVE-2018-9261, CVE-2018-9262, CVE-2018-9263, CVE-2018-9264, CVE-2018-9265, CVE-2018-9266, CVE-2018-9267, CVE-2018-9268, CVE-2018-9269, CVE-2018-9270, CVE-2018-9271, CVE-2018-9272, CVE-2018-9273, CVE-2018-9274
Switch from autotools to cmake
Removed python2-devel(#1560284) and libssh2-devel from dependencies
Removed python scripts
2018-05-02 11:34:24 +00:00
|
|
|
*
|
2022-10-06 04:30:26 +00:00
|
|
|
* @param tempdir [in] If not NULL, the directory in which to create the file.
|
2020-12-03 13:36:37 +00:00
|
|
|
* @param namebuf [in,out] If not NULL, receives the full path of the temp file.
|
2022-10-06 04:30:26 +00:00
|
|
|
@@ -33,6 +33,9 @@ create_tempfile(const char *tempdir, gchar **namebuf, const char *pfx, const cha
|
2020-12-03 13:36:37 +00:00
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
gchar *safe_pfx = NULL;
|
|
|
|
+ gchar *tmp_file;
|
|
|
|
+ const char *tmp_dir;
|
|
|
|
+ int old_mask;
|
2022-10-06 04:30:26 +00:00
|
|
|
|
2020-12-03 13:36:37 +00:00
|
|
|
if (pfx) {
|
|
|
|
/* The characters in "delimiters" come from:
|
2022-10-06 04:30:26 +00:00
|
|
|
@@ -54,7 +57,16 @@ create_tempfile(const char *tempdir, gchar **namebuf, const char *pfx, const cha
|
|
|
|
gchar* filetmpl = ws_strdup_printf("%sXXXXXX%s", safe_pfx ? safe_pfx : "", sfx ? sfx : "");
|
|
|
|
g_free(safe_pfx);
|
|
|
|
|
|
|
|
- fd = g_file_open_tmp(filetmpl, namebuf, err);
|
|
|
|
+ tmp_dir = get_tmp_dir();
|
|
|
|
+ tmp_file = g_strconcat(tmp_dir, "/", filetmpl, NULL);
|
2020-12-03 13:36:37 +00:00
|
|
|
+
|
2022-10-06 04:30:26 +00:00
|
|
|
+ if (namebuf)
|
|
|
|
+ *namebuf = tmp_file;
|
2020-12-03 13:36:37 +00:00
|
|
|
+
|
2022-10-06 04:30:26 +00:00
|
|
|
+ old_mask = ws_umask(0077);
|
|
|
|
+ fd = mkstemps(tmp_file, sfx ? (int) strlen(sfx) : 0);
|
|
|
|
+ ws_umask(old_mask);
|
|
|
|
+
|
|
|
|
g_free(filetmpl);
|
|
|
|
}
|
|
|
|
else {
|
2016-01-14 10:56:55 +00:00
|
|
|
diff --git a/wsutil/tempfile.h b/wsutil/tempfile.h
|
2022-10-06 04:30:26 +00:00
|
|
|
index 70031b5419..72011e265a 100644
|
2016-01-14 10:56:55 +00:00
|
|
|
--- a/wsutil/tempfile.h
|
|
|
|
+++ b/wsutil/tempfile.h
|
2022-10-06 04:30:26 +00:00
|
|
|
@@ -23,7 +23,7 @@ extern "C" {
|
2016-01-14 10:56:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a tempfile with the given prefix (e.g. "wireshark"). The path
|
2020-12-03 13:36:37 +00:00
|
|
|
- * is created using g_file_open_tmp.
|
2016-01-14 10:56:55 +00:00
|
|
|
+ * is created using get_tmp_dir and mkstemp.
|
|
|
|
*
|
2022-10-06 04:30:26 +00:00
|
|
|
* @param tempdir [in] If not NULL, the directory in which to create the file.
|
2016-01-14 10:56:55 +00:00
|
|
|
* @param namebuf [in,out] If not NULL, receives the full path of the temp file.
|
2013-09-24 08:55:09 +00:00
|
|
|
diff --git a/wsutil/wstmpdir.c b/wsutil/wstmpdir.c
|
|
|
|
new file mode 100644
|
2022-10-06 04:30:26 +00:00
|
|
|
index 0000000000..9128d354ce
|
2013-09-24 08:55:09 +00:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/wsutil/wstmpdir.c
|
2020-12-03 13:36:37 +00:00
|
|
|
@@ -0,0 +1,71 @@
|
2013-09-24 08:55:09 +00:00
|
|
|
+/* wstmpdir.c
|
|
|
|
+ *
|
|
|
|
+ * Copyright (C) 2013 Red Hat, Inc. All right reserved.
|
|
|
|
+ *
|
|
|
|
+ * Temporary directory routine
|
|
|
|
+ *
|
|
|
|
+ * This program is free software; you can redistribute it and/or
|
|
|
|
+ * modify it under the terms of the GNU General Public License
|
|
|
|
+ * as published by the Free Software Foundation; either version 2
|
|
|
|
+ * of the License, or (at your option) any later version.
|
|
|
|
+ *
|
|
|
|
+ * This program is distributed in the hope that it will be useful,
|
|
|
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
+ * GNU General Public License for more details.
|
|
|
|
+ *
|
|
|
|
+ * You should have received a copy of the GNU General Public License
|
|
|
|
+ * along with this program; if not, write to the Free Software
|
|
|
|
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
+ *
|
|
|
|
+ * Author: Peter Hatina <phatina@redhat.com>
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+#include "config.h"
|
|
|
|
+
|
|
|
|
+#include <glib.h>
|
|
|
|
+#include "wstmpdir.h"
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * Gets the directory to use for temporary files.
|
|
|
|
+ *
|
|
|
|
+ * Inspired by glib-2.0. If no TMP, TEMP or TMPDIR is set,
|
|
|
|
+ * /var/tmp is returned (Fedora specific).
|
|
|
|
+ *
|
|
|
|
+ * Returns: the directory to use for temporary files.
|
|
|
|
+ */
|
|
|
|
+const char *get_tmp_dir(void)
|
|
|
|
+{
|
|
|
|
+ static gchar *tmp_dir;
|
|
|
|
+
|
|
|
|
+ if (g_once_init_enter(&tmp_dir)) {
|
|
|
|
+ gchar *tmp;
|
|
|
|
+
|
|
|
|
+ tmp = g_strdup(g_getenv("TEMP"));
|
|
|
|
+ if (tmp == NULL || *tmp == '\0') {
|
|
|
|
+ g_free(tmp);
|
|
|
|
+ tmp = g_strdup(g_getenv("TMPDIR"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+#ifdef P_tmpdir
|
|
|
|
+ if (tmp == NULL || *tmp == '\0') {
|
|
|
|
+ gsize k;
|
|
|
|
+ g_free(tmp);
|
|
|
|
+ tmp = g_strdup(P_tmpdir);
|
|
|
|
+ k = strlen(tmp);
|
|
|
|
+ if (k > 1 && G_IS_DIR_SEPARATOR(tmp[k - 1]))
|
|
|
|
+ tmp[k - 1] = '\0';
|
2020-12-03 13:36:37 +00:00
|
|
|
+ fprintf(stderr, "Using P_tmpdir: %s\n", P_tmpdir);
|
2013-09-24 08:55:09 +00:00
|
|
|
+ }
|
|
|
|
+#endif /* P_tmpdir */
|
|
|
|
+
|
|
|
|
+ if (tmp == NULL || *tmp == '\0') {
|
|
|
|
+ g_free(tmp);
|
|
|
|
+ tmp = g_strdup("/var/tmp");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ g_once_init_leave(&tmp_dir, tmp);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return tmp_dir;
|
|
|
|
+}
|
|
|
|
diff --git a/wsutil/wstmpdir.h b/wsutil/wstmpdir.h
|
|
|
|
new file mode 100644
|
2022-10-06 04:30:26 +00:00
|
|
|
index 0000000000..07ac5837ac
|
2013-09-24 08:55:09 +00:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/wsutil/wstmpdir.h
|
|
|
|
@@ -0,0 +1,39 @@
|
|
|
|
+/* wstmpdir.c
|
|
|
|
+ *
|
|
|
|
+ * Copyright (C) 2013 Red Hat, Inc. All right reserved.
|
|
|
|
+ *
|
|
|
|
+ * Temporary directory routine
|
|
|
|
+ *
|
|
|
|
+ * This program is free software; you can redistribute it and/or
|
|
|
|
+ * modify it under the terms of the GNU General Public License
|
|
|
|
+ * as published by the Free Software Foundation; either version 2
|
|
|
|
+ * of the License, or (at your option) any later version.
|
|
|
|
+ *
|
|
|
|
+ * This program is distributed in the hope that it will be useful,
|
|
|
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
+ * GNU General Public License for more details.
|
|
|
|
+ *
|
|
|
|
+ * You should have received a copy of the GNU General Public License
|
|
|
|
+ * along with this program; if not, write to the Free Software
|
|
|
|
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
+ *
|
|
|
|
+ * Author: Peter Hatina <phatina@redhat.com>
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+#ifndef __WS_TMP_DIR_H__
|
|
|
|
+#define __WS_TMP_DIR_H__
|
|
|
|
+
|
|
|
|
+#include "ws_symbol_export.h"
|
|
|
|
+
|
|
|
|
+#ifdef __cplusplus
|
|
|
|
+extern "C" {
|
|
|
|
+#endif // __cplusplus
|
|
|
|
+
|
|
|
|
+WS_DLL_PUBLIC const char *get_tmp_dir(void);
|
|
|
|
+
|
|
|
|
+#ifdef __cplusplus
|
|
|
|
+}
|
|
|
|
+#endif // __cplusplus
|
|
|
|
+
|
2017-06-29 08:53:33 +00:00
|
|
|
+#endif
|
|
|
|
--
|
2022-10-06 04:30:26 +00:00
|
|
|
2.37.3
|
|
|
|
|