Toshaan Bharvani
2 years ago
commit
3e67362db9
10 changed files with 3649 additions and 0 deletions
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
SUBSYSTEM=="usbmon", GROUP="usbmon", MODE="640" |
@ -0,0 +1,60 @@
@@ -0,0 +1,60 @@
|
||||
-----BEGIN PGP SIGNED MESSAGE----- |
||||
Hash: SHA512 |
||||
|
||||
wireshark-3.4.10.tar.xz: 32344804 bytes |
||||
SHA256(wireshark-3.4.10.tar.xz)=8aa7ef4a44ae62bb8db463cf761e2cc03b97305e0e77ed5be53fa83729187cef |
||||
RIPEMD160(wireshark-3.4.10.tar.xz)=eef58ec4e28c6eecc382c1f000257ab60ee6c40c |
||||
SHA1(wireshark-3.4.10.tar.xz)=63839abd94d3ae376f860e2d2969777680106578 |
||||
|
||||
Wireshark-win64-3.4.10.exe: 71382832 bytes |
||||
SHA256(Wireshark-win64-3.4.10.exe)=faa83ac4f289d07d8e1bacb7e7611758b231a9c00b18e816654f40e7437529fd |
||||
RIPEMD160(Wireshark-win64-3.4.10.exe)=63068a04839ff02828a6915fe648da25cdeadc84 |
||||
SHA1(Wireshark-win64-3.4.10.exe)=00c419e3382d24289cfc9d74be6f37934b784066 |
||||
|
||||
Wireshark-win32-3.4.10.exe: 55424616 bytes |
||||
SHA256(Wireshark-win32-3.4.10.exe)=3bceac74d2d7c388e01b6c25b20088c234fefbcd83e3c960b3e0fcc1eca7839d |
||||
RIPEMD160(Wireshark-win32-3.4.10.exe)=84acc6b49f1e8735ec53127b1d9de14a1d121b2f |
||||
SHA1(Wireshark-win32-3.4.10.exe)=d6486f9015e60e633f0f2a7fd5152959c4bb749b |
||||
|
||||
Wireshark-win64-3.4.10.msi: 49291264 bytes |
||||
SHA256(Wireshark-win64-3.4.10.msi)=b31288207b23700931ddb83785bcc9a9a775758029fbc1cdd653f65b8d802e7d |
||||
RIPEMD160(Wireshark-win64-3.4.10.msi)=d93a0cfebe7c2e412ade6e25c3a225b643d498e0 |
||||
SHA1(Wireshark-win64-3.4.10.msi)=e36624c35824966255f768dc74148a7fe4a895d2 |
||||
|
||||
Wireshark-win32-3.4.10.msi: 43925504 bytes |
||||
SHA256(Wireshark-win32-3.4.10.msi)=6b6770e596968fdb0e68af3e3dba77631004f374accda085dc59df799011fa0f |
||||
RIPEMD160(Wireshark-win32-3.4.10.msi)=374b51b4934bd5d98023df4b8be355bf2c1515e9 |
||||
SHA1(Wireshark-win32-3.4.10.msi)=df8a5c168bad317ff7b6ed1f12dec4926a2983f2 |
||||
|
||||
WiresharkPortable_3.4.10.paf.exe: 38220424 bytes |
||||
SHA256(WiresharkPortable_3.4.10.paf.exe)=85f2382b854be81ee7bc3deedaab41214e60e17a83c25822d4e5831c1d88e379 |
||||
RIPEMD160(WiresharkPortable_3.4.10.paf.exe)=644f056554925fc37a44cfb247d0678efcb01c81 |
||||
SHA1(WiresharkPortable_3.4.10.paf.exe)=8b36a16b9b602a1f5bb8cc37453fd1678e8fa476 |
||||
|
||||
Wireshark 3.4.10 Intel 64.dmg: 131298336 bytes |
||||
SHA256(Wireshark 3.4.10 Intel 64.dmg)=1267edf27870fe17e504f2377f78eb7510c4a13e4b53b9b00e171303208749c4 |
||||
RIPEMD160(Wireshark 3.4.10 Intel 64.dmg)=880a76731ddaed630bfc575e36627cad1e239249 |
||||
SHA1(Wireshark 3.4.10 Intel 64.dmg)=8783733e2f6f124c102b51f2e245d9deab11ff6d |
||||
|
||||
You can validate these hashes using the following commands (among others): |
||||
|
||||
Windows: certutil -hashfile Wireshark-win64-x.y.z.exe SHA256 |
||||
Linux (GNU Coreutils): sha256sum wireshark-x.y.z.tar.xz |
||||
macOS: shasum -a 256 "Wireshark x.y.z Arm 64.dmg" |
||||
Other: openssl sha256 wireshark-x.y.z.tar.xz |
||||
-----BEGIN PGP SIGNATURE----- |
||||
|
||||
iQIzBAEBCgAdFiEEWlrbp9vqbD+HIk8ZgiRKeOb+ruoFAmGVXKYACgkQgiRKeOb+ |
||||
rurDaQ//bZ7JSUS+v+eN1Te+TOBEmurQPc9oiY4/nQKa9vb4pKK3kP36zsUE59qT |
||||
hDCWWxijG4fgriFeMNKPJ9YErzEWyPkIEtXwyke2ubuIiNkRKhvSfz8BME49M9lD |
||||
ybPz/Rer2a/QS0+tU1LSd7NBArJdfxn3QtYbOLBkrqTSCH3eaxXQfKvM9mta10ZW |
||||
9YWxOVF8Lz4QqbolTb16ZgfcCI1XryOGs4W4Hd/YpaUnXvW6eYjIWs+KvCFQv/90 |
||||
3nVjZbeMmW+lyLk1QhoLYo/wW+E80Cf8q5eCx/ohTauBIkcz2okpmB//UmYS4Ldv |
||||
YYyngLMIJpyZxry5YSg8lqBEwSOJh25cSxrKIdthzJMBFHAvtb7QKzGPPLBbvnnt |
||||
IBGq+u80/HqPRLdeBmbdS8e/YtHFSxTdLDb0wfNQ5p/Re/r9x35dFU/6Pafbr19E |
||||
s+FhEAcM66P7hECP91oDd6w3TuE9ZtdKzGNPUSezUSSn5D5FduLQ/lqGfnUV0qBm |
||||
ADi5tqoSkluGWfUefZ2KiUOlhQ4Lr82JaZbBnws8rY+krjRrGUxtnuwdKUTRNcTU |
||||
o5eWlVCvORvaKDJxaWw/3WoSpiP0dmio8XAz7gPxufyBcbw/xIQ+v53rmxIT7O6/ |
||||
b97ZED+ZpU7kpYS8pnvTPPbj3nB4HHPpUkygHUvoUMxibFjOj2o= |
||||
=SVDw |
||||
-----END PGP SIGNATURE----- |
@ -0,0 +1,57 @@
@@ -0,0 +1,57 @@
|
||||
From: Jan Safranek <jsafrane@redhat.com> |
||||
Date: Fri, 26 Nov 2010 14:30:45 +0300 |
||||
Subject: [PATCH] Customize 'permission denied' error. |
||||
|
||||
Add Fedora-specific message to error output when dumpcap cannot be started |
||||
because of permissions. |
||||
|
||||
Signed-off-by: Jan Safranek <jsafrane@redhat.com> |
||||
|
||||
diff --git a/capchild/capture_sync.c b/capchild/capture_sync.c |
||||
index 2f9d2cc..b18e47f 100644 |
||||
--- a/capchild/capture_sync.c |
||||
+++ b/capchild/capture_sync.c |
||||
@@ -375,6 +375,7 @@ sync_pipe_start(capture_options *capture_opts, capture_session *cap_session, voi |
||||
gchar *signal_pipe_name; |
||||
#else |
||||
char errmsg[1024+1]; |
||||
+ const char *securitymsg = ""; |
||||
int sync_pipe[2]; /* pipe used to send messages from child to parent */ |
||||
enum PIPES { PIPE_READ, PIPE_WRITE }; /* Constants 0 and 1 for PIPE_READ and PIPE_WRITE */ |
||||
#endif |
||||
@@ -728,8 +729,11 @@ sync_pipe_start(capture_options *capture_opts, capture_session *cap_session, voi |
||||
dup2(sync_pipe[PIPE_WRITE], 2); |
||||
ws_close(sync_pipe[PIPE_READ]); |
||||
execv(argv[0], argv); |
||||
- g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s", |
||||
- argv[0], g_strerror(errno)); |
||||
+ if (errno == EPERM || errno == EACCES) |
||||
+ securitymsg = "\nAre you a member of the 'wireshark' group? Try running\n'usermod -a -G wireshark _your_username_' as root."; |
||||
+ g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s%s", |
||||
+ argv[0], g_strerror(errno), securitymsg); |
||||
+ |
||||
sync_pipe_errmsg_to_parent(2, errmsg, ""); |
||||
|
||||
/* Exit with "_exit()", so that we don't close the connection |
||||
@@ -826,6 +830,7 @@ sync_pipe_open_command(char** argv, int *data_read_fd, |
||||
int i; |
||||
#else |
||||
char errmsg[1024+1]; |
||||
+ const char *securitymsg = ""; |
||||
int sync_pipe[2]; /* pipe used to send messages from child to parent */ |
||||
int data_pipe[2]; /* pipe used to send data from child to parent */ |
||||
#endif |
||||
@@ -1003,8 +1008,11 @@ sync_pipe_open_command(char** argv, int *data_read_fd, |
||||
ws_close(sync_pipe[PIPE_READ]); |
||||
ws_close(sync_pipe[PIPE_WRITE]); |
||||
execv(argv[0], argv); |
||||
- g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s", |
||||
- argv[0], g_strerror(errno)); |
||||
+ execv(argv[0], (gpointer)argv); |
||||
+ if (errno == EPERM || errno == EACCES) |
||||
+ securitymsg = "\nAre you a member of the 'wireshark' group? Try running\n'usermod -a -G wireshark _your_username_' as root."; |
||||
+ g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s%s", |
||||
+ argv[0], g_strerror(errno), securitymsg); |
||||
sync_pipe_errmsg_to_parent(2, errmsg, ""); |
||||
|
||||
/* Exit with "_exit()", so that we don't close the connection |
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
From: Peter Hatina <phatina@redhat.com> |
||||
Date: Wed, 4 Sep 2013 10:03:57 +0200 |
||||
Subject: [PATCH] fix string overrun in plugins/profinet |
||||
|
||||
|
||||
diff --git a/plugins/epan/profinet/packet-dcom-cba.c b/plugins/epan/profinet/packet-dcom-cba.c |
||||
index 0f1658a..f7fd322 100644 |
||||
--- a/plugins/epan/profinet/packet-dcom-cba.c |
||||
+++ b/plugins/epan/profinet/packet-dcom-cba.c |
||||
@@ -555,7 +555,7 @@ dissect_ICBAPhysicalDevice_get_LogicalDevice_rqst(tvbuff_t *tvb, int offset, |
||||
packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) |
||||
{ |
||||
guint32 u32Pointer; |
||||
- gchar szStr[1000]; |
||||
+ gchar szStr[1000] = ""; |
||||
guint32 u32MaxStr = sizeof(szStr); |
||||
gchar *call; |
||||
|
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
From: Peter Lemenkov <lemenkov@gmail.com> |
||||
Date: Fri, 13 Sep 2013 14:36:55 +0400 |
||||
Subject: [PATCH] Restore Fedora-specific groups |
||||
|
||||
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com> |
||||
diff --git a/wireshark.desktop b/wireshark.desktop |
||||
index 334db48..669c6f1 100644 |
||||
--- a/wireshark.desktop |
||||
+++ b/wireshark.desktop |
||||
@@ -108,4 +108,4 @@ Terminal=false |
||||
MimeType=application/vnd.tcpdump.pcap;application/x-pcapng;application/x-snoop;application/x-iptrace;application/x-lanalyzer;application/x-nettl;application/x-radcom;application/x-etherpeek;application/x-visualnetworks;application/x-netinstobserver;application/x-5view;application/x-tektronix-rf5;application/x-micropross-mplog;application/x-apple-packetlogger;application/x-endace-erf;application/ipfix;application/x-ixia-vwr; |
||||
# Category entry according to: |
||||
# https://specifications.freedesktop.org/menu-spec/1.0/ |
||||
-Categories=Network;Monitor;Qt; |
||||
+Categories=Application;Network;Monitor;Qt; |
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
From: Kenneth Soerensen <knnthsrnsn@gmail.com> |
||||
Date: Wed, 29 Jan 2014 16:04:12 +0400 |
||||
Subject: [PATCH] Fix paths in a wireshark.desktop file |
||||
|
||||
|
||||
diff --git a/wireshark.desktop b/wireshark.desktop |
||||
index 669c6f1..f7df1f3 100644 |
||||
--- a/wireshark.desktop |
||||
+++ b/wireshark.desktop |
||||
@@ -102,8 +102,8 @@ Comment[tr]=Ağ trafiği çözümleyicisi |
||||
Comment[vi]=Trình phân tích giao thông mạng |
||||
Comment[uk]=Аналізатор мережевого трафіку |
||||
Icon=wireshark |
||||
-TryExec=wireshark |
||||
-Exec=wireshark %f |
||||
+TryExec=/usr/bin/wireshark |
||||
+Exec=/usr/bin/wireshark %f |
||||
Terminal=false |
||||
MimeType=application/vnd.tcpdump.pcap;application/x-pcapng;application/x-snoop;application/x-iptrace;application/x-lanalyzer;application/x-nettl;application/x-radcom;application/x-etherpeek;application/x-visualnetworks;application/x-netinstobserver;application/x-5view;application/x-tektronix-rf5;application/x-micropross-mplog;application/x-apple-packetlogger;application/x-endace-erf;application/ipfix;application/x-ixia-vwr; |
||||
# Category entry according to: |
@ -0,0 +1,295 @@
@@ -0,0 +1,295 @@
|
||||
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 |
||||
|
||||
Fedora is using tmpfs which is limited by the size of RAM, thus we need |
||||
to use different directory on different filesystem. |
||||
--- |
||||
ui/qt/about_dialog.cpp | 3 +- |
||||
ui/qt/iax2_analysis_dialog.cpp | 5 +-- |
||||
ui/qt/rtp_analysis_dialog.cpp | 5 +-- |
||||
ui/qt/rtp_audio_stream.cpp | 3 +- |
||||
wsutil/tempfile.c | 9 +++--- |
||||
wsutil/tempfile.h | 4 +-- |
||||
wsutil/wstmpdir.c | 70 ++++++++++++++++++++++++++++++++++++++++++ |
||||
wsutil/wstmpdir.h | 39 +++++++++++++++++++++++ |
||||
8 files changed, 132 insertions(+), 11 deletions(-) |
||||
create mode 100644 wsutil/wstmpdir.c |
||||
create mode 100644 wsutil/wstmpdir.h |
||||
|
||||
diff --git a/ui/qt/about_dialog.cpp b/ui/qt/about_dialog.cpp |
||||
index 31dc581..2f74285 100644 |
||||
--- a/ui/qt/about_dialog.cpp |
||||
+++ b/ui/qt/about_dialog.cpp |
||||
@@ -26,6 +26,7 @@ |
||||
|
||||
#include "wireshark_application.h" |
||||
#include <wsutil/filesystem.h> |
||||
+#include <wsutil/wstmpdir.h> /* for get_tmp_dir() */ |
||||
|
||||
#include <QDesktopServices> |
||||
#include <QUrl> |
||||
@@ -206,7 +206,7 @@ FolderListModel::FolderListModel(QObject * parent): |
||||
appendRow(QStringList() << tr("\"File\" dialogs") << get_last_open_dir() << tr("capture files")); |
||||
|
||||
/* temp */ |
||||
- appendRow(QStringList() << tr("Temp") << g_get_tmp_dir() << tr("untitled capture files")); |
||||
+ appendRow(QStringList() << tr("Temp") << get_tmp_dir() << tr("untitled capture files")); |
||||
|
||||
/* pers conf */ |
||||
appendRow(QStringList() << tr("Personal configuration") |
||||
diff --git a/ui/qt/iax2_analysis_dialog.cpp b/ui/qt/iax2_analysis_dialog.cpp |
||||
index ee4e5fd..fe17a95 100644 |
||||
--- a/ui/qt/iax2_analysis_dialog.cpp |
||||
+++ b/ui/qt/iax2_analysis_dialog.cpp |
||||
@@ -37,6 +37,7 @@ |
||||
#include "ui/rtp_stream.h" |
||||
#endif |
||||
#include <wsutil/utf8_entities.h> |
||||
+#include <wsutil/wstmpdir.h> /* for get_tmp_dir() */ |
||||
|
||||
#include <wsutil/g711.h> |
||||
#include <wsutil/pint.h> |
||||
@@ -271,10 +272,10 @@ Iax2AnalysisDialog::Iax2AnalysisDialog(QWidget &parent, CaptureFile &cf) : |
||||
|
||||
// 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(); |
||||
|
||||
diff --git a/ui/qt/rtp_analysis_dialog.cpp b/ui/qt/rtp_analysis_dialog.cpp |
||||
index 5d82e46..8008984 100644 |
||||
--- a/ui/qt/rtp_analysis_dialog.cpp |
||||
+++ b/ui/qt/rtp_analysis_dialog.cpp |
||||
@@ -37,6 +37,7 @@ |
||||
|
||||
#include <wsutil/g711.h> |
||||
#include <wsutil/pint.h> |
||||
+#include <wsutil/wstmpdir.h> /* for get_tmp_dir() */ |
||||
|
||||
#include <QMessageBox> |
||||
#include <QPushButton> |
||||
@@ -331,10 +332,10 @@ RtpAnalysisDialog::RtpAnalysisDialog(QWidget &parent, CaptureFile &cf, struct _r |
||||
|
||||
// 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_rtp_f").arg(QDir::tempPath()); |
||||
+ QString tempname = QString("%1/wireshark_rtp_f").arg(get_tmp_dir()); |
||||
fwd_tempfile_ = new QTemporaryFile(tempname, this); |
||||
fwd_tempfile_->open(); |
||||
- tempname = QString("%1/wireshark_rtp_r").arg(QDir::tempPath()); |
||||
+ tempname = QString("%1/wireshark_rtp_r").arg(get_tmp_dir()); |
||||
rev_tempfile_ = new QTemporaryFile(tempname, this); |
||||
rev_tempfile_->open(); |
||||
|
||||
diff --git a/ui/qt/rtp_audio_stream.cpp b/ui/qt/rtp_audio_stream.cpp |
||||
index fde66c8..b9531d2 100644 |
||||
--- a/ui/qt/rtp_audio_stream.cpp |
||||
+++ b/ui/qt/rtp_audio_stream.cpp |
||||
@@ -37,6 +37,7 @@ |
||||
#include <ui/rtp_stream.h> |
||||
|
||||
#include <wsutil/nstime.h> |
||||
+#include <wsutil/wstmpdir.h> /* for get_tmp_dir() */ |
||||
|
||||
#include <QAudioFormat> |
||||
#include <QAudioOutput> |
||||
@@ -76,7 +77,7 @@ RtpAudioStream::RtpAudioStream(QObject *parent, _rtp_stream_info *rtp_stream) : |
||||
visual_sample_rate_, SPEEX_RESAMPLER_QUALITY_MIN, NULL); |
||||
speex_resampler_skip_zeros(visual_resampler_); |
||||
|
||||
- QString tempname = QString("%1/wireshark_rtp_stream").arg(QDir::tempPath()); |
||||
+ QString tempname = QString("%1/wireshark_rtp_stream").arg(get_tmp_dir()); |
||||
tempfile_ = new QTemporaryFile(tempname, this); |
||||
tempfile_->open(); |
||||
|
||||
diff --git a/wsutil/tempfile.c b/wsutil/tempfile.c |
||||
index 5082452..f751a7c 100644 |
||||
--- a/wsutil/tempfile.c |
||||
+++ b/wsutil/tempfile.c |
||||
@@ -12,10 +12,12 @@ |
||||
|
||||
#include <glib.h> |
||||
#include "tempfile.h" |
||||
+#include <wsutil/file_util.h> |
||||
+#include <wsutil/wstmpdir.h> /* for get_tmp_dir() */ |
||||
|
||||
/** |
||||
* 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. |
||||
* |
||||
* @param namebuf [in,out] If not NULL, receives the full path of the temp file. |
||||
* Must be freed. |
||||
@@ -30,6 +31,9 @@ create_tempfile(gchar **namebuf, const char *pfx, const char *sfx, GError **err) |
||||
{ |
||||
int fd; |
||||
gchar *safe_pfx = NULL; |
||||
+ gchar *tmp_file; |
||||
+ const char *tmp_dir; |
||||
+ int old_mask; |
||||
|
||||
if (pfx) { |
||||
/* The characters in "delimiters" come from: |
||||
@@ -49,7 +53,15 @@ create_tempfile(gchar **namebuf, const char *pfx, const char *sfx, GError **err) |
||||
gchar* filetmpl = g_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); |
||||
+ |
||||
+ if (namebuf) |
||||
+ *namebuf = tmp_file; |
||||
+ |
||||
+ old_mask = ws_umask(0077); |
||||
+ fd = mkstemps(tmp_file, sfx ? (int) strlen(sfx) : 0); |
||||
+ ws_umask(old_mask); |
||||
|
||||
g_free(filetmpl); |
||||
return fd; |
||||
diff --git a/wsutil/tempfile.h b/wsutil/tempfile.h |
||||
index 1dca2df..bb3160c 100644 |
||||
--- a/wsutil/tempfile.h |
||||
+++ b/wsutil/tempfile.h |
||||
@@ -45,7 +45,7 @@ WS_DLL_PUBLIC char *get_tempfile_path(const char *filename); |
||||
|
||||
/** |
||||
* 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 and mkstemp. |
||||
* |
||||
* @param namebuf [in,out] If not NULL, receives the full path of the temp file. |
||||
* Must be freed. |
||||
diff --git a/wsutil/wstmpdir.c b/wsutil/wstmpdir.c |
||||
new file mode 100644 |
||||
index 0000000..d8b733b |
||||
--- /dev/null |
||||
+++ b/wsutil/wstmpdir.c |
||||
@@ -0,0 +1,71 @@ |
||||
+/* 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'; |
||||
+ fprintf(stderr, "Using P_tmpdir: %s\n", P_tmpdir); |
||||
+ } |
||||
+#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 |
||||
index 0000000..07ac583 |
||||
--- /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 |
||||
+ |
||||
+#endif |
||||
-- |
||||
2.13.0 |
||||
|
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
diff --git a/wsutil/CMakeLists.txt b/wsutil/CMakeLists.txt |
||||
index 0367cd1..6382a2c 100644 |
||||
--- a/wsutil/CMakeLists.txt |
||||
+++ b/wsutil/CMakeLists.txt |
||||
@@ -69,6 +69,7 @@ set(WSUTIL_PUBLIC_HEADERS |
||||
ws_mempbrk_int.h |
||||
ws_pipe.h |
||||
ws_printf.h |
||||
+ wstmpdir.h |
||||
wsjson.h |
||||
xtea.h |
||||
) |
||||
@@ -118,6 +118,7 @@ set(WSUTIL_COMMON_FILES |
||||
unicode-utils.c |
||||
ws_mempbrk.c |
||||
ws_pipe.c |
||||
+ wstmpdir.c |
||||
wsgcrypt.c |
||||
wsjson.c |
||||
xtea.c |
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue