Dillo-dev
By thread
dillo-dev@mailman3.com
By month
Messages by month
- ----- 2026 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2000 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1999 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1998 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1997 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1996 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1995 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- 3 participants
- 11667 messages
Re: portability: gmake vs make
by Rodrigo Arias
Hi,
On Sun, Aug 11, 2024 at 01:41:44AM +0200, a1ex(a)dismail.de wrote:
> Hi Rodrigo,
>
> Looking at your recent commit:
>
> >Make Dillo strictly C99, C++11 and POSIX-2001 compliant, without
> >depending on GNU extensions.
>
> Right now the OpenBSD port of Dillo is dependent on gmake (GNU make) to
> build the package.
>
> Out of curiosity, I tried to use the native 'make' command:
>
> $ make
>
> [...]
> Making all in doc
> Using $< in a non-suffix rule context is a GNUmake idiom (Makefile:556)
> *** Error 1 in . (Makefile:583 'all-recursive')
> *** Error 2 in . (Makefile:380 'all')
>
> Everything else builds fine, except this error in doc.
>
> Here is the offending line:
>
> $ diff -up a/doc/Makefile.am b/doc/Makefile.am
> --- a/doc/Makefile.am Sun Aug 11 00:01:58 2024
> +++ b/doc/Makefile.am Sun Aug 11 00:01:51 2024
> @@ -11,6 +11,6 @@ dillo.1: $(srcdir)/dillo.1.in Makefile
>
> # Use .in.html instead of .html.in so it is recognized as HTML.
> user_help.html: $(srcdir)/user_help.in.html Makefile
> - sed 's/__VERSION__/${VERSION}/g' $< > $@
>
> DISTCLEANFILES = dillo.1 user_help.html
>
>
> With that removed, there are no errors.
We need that sed command to adjust the version in the generated
documentation. I didn't knew $< was a GNU extension, but this patch
should fix it:
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 943e70d7..ae2ccd5d 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -11,6 +11,6 @@ dillo.1: $(srcdir)/dillo.1.in Makefile
# Use .in.html instead of .html.in so it is recognized as HTML.
user_help.html: $(srcdir)/user_help.in.html Makefile
- sed 's/__VERSION__/${VERSION}/g' $< > $@
+ sed 's/__VERSION__/${VERSION}/g' $(srcdir)/user_help.in.html > $@
DISTCLEANFILES = dillo.1 user_help.html
Thanks!,
Rodrigo.
Aug. 11, 2024
portability: gmake vs make
by a1exï¼ dismail.de
Hi Rodrigo,
Looking at your recent commit:
>Make Dillo strictly C99, C++11 and POSIX-2001 compliant, without
>depending on GNU extensions.
Right now the OpenBSD port of Dillo is dependent on gmake (GNU make) to
build the package.
Out of curiosity, I tried to use the native 'make' command:
$ make
[...]
Making all in doc
Using $< in a non-suffix rule context is a GNUmake idiom (Makefile:556)
*** Error 1 in . (Makefile:583 'all-recursive')
*** Error 2 in . (Makefile:380 'all')
Everything else builds fine, except this error in doc.
Here is the offending line:
$ diff -up a/doc/Makefile.am b/doc/Makefile.am
--- a/doc/Makefile.am Sun Aug 11 00:01:58 2024
+++ b/doc/Makefile.am Sun Aug 11 00:01:51 2024
@@ -11,6 +11,6 @@ dillo.1: $(srcdir)/dillo.1.in Makefile
# Use .in.html instead of .html.in so it is recognized as HTML.
user_help.html: $(srcdir)/user_help.in.html Makefile
- sed 's/__VERSION__/${VERSION}/g' $< > $@
DISTCLEANFILES = dillo.1 user_help.html
With that removed, there are no errors.
Regards,
Alex
Aug. 10, 2024
[PATCH v3] unveil patch
by a1exï¼ dismail.de
Hi,
Here is a new version of the unveil patch.
Some notable changes:
- Dillo will exit if 'save_dir' is set to $HOME (only with unveil)
- dUnveil() function moved to dlib
- New 'enable_unveil' pref for dillorc
- New dGetsavedir() function to parse 'save_dir'
- New dGetenableunveil() function to parse 'enable_unveil'
enable_unveil is not used by the prefs parser, but rather dGetenableunveil().
I still need to fix it so that we don't get this warning on the console:
prefs: {enable_unveil} is not a recognized token.
To-Do:
- Localize wget and $AUTHORITY
- ...
As always, feedback is welcome.
Regards,
Alex
diff -upr a/configure.ac b/configure.ac
--- a/configure.ac Wed Aug 7 20:50:53 2024
+++ b/configure.ac Thu Aug 8 20:06:15 2024
@@ -36,6 +36,11 @@ AC_ARG_ENABLE([insure],
[enable_insure=$enableval],
[enable_insure=no])
+AC_ARG_ENABLE([unveil],
+ [AS_HELP_STRING([--enable-unveil], [Build with support for unveil])],
+ [enable_unveil=$enableval],
+ [enable_unveil=no])
+
AC_ARG_ENABLE([ipv6],
[AS_HELP_STRING([--enable-ipv6], [Build with support for IPv6])],
[enable_ipv6=$enableval],
@@ -619,6 +624,9 @@ if test "x$enable_insure" = "xyes" ; then
CC="insure -Zoi \"compiler $CC\""
LIBS="$LIBS -lstdc++-2-libc6.1-1-2.9.0"
fi
+if test "x$enable_unveil" = "xyes" ; then
+ AC_DEFINE([ENABLE_UNVEIL], [1], [Enable unveil])
+fi
if test "x$enable_threaded_dns" = "xyes" ; then
CFLAGS="$CFLAGS -DD_DNS_THREADED"
fi
@@ -726,4 +734,5 @@ _AS_ECHO([ GIF enabled : ${enable_gif}])
_AS_ECHO([ SVG enabled : ${enable_svg}])
_AS_ECHO([])
_AS_ECHO([ HTML tests : ${html_tests_ok}])
+_AS_ECHO([ unveil enabled : ${enable_unveil}])
_AS_ECHO([])
diff -upr a/dlib/dlib.c b/dlib/dlib.c
--- a/dlib/dlib.c Wed Aug 7 20:50:53 2024
+++ b/dlib/dlib.c Thu Aug 8 20:07:28 2024
@@ -922,6 +922,99 @@ char *dGethomedir (void)
}
/**
+ * Return the save directory in a static string
+ */
+char *dGetsavedir ()
+{
+ static char *dillorc = NULL;
+ dillorc = dStrconcat(dGethomedir(), "/", ".dillo/dillorc", NULL);
+ FILE *In;
+ int len;
+ char *rcline = NULL, *value = NULL, *p;
+ if ((In = fopen(dillorc, "r")) == NULL) {
+ DLIB_MSG("dGetsavedir: unable to open dillorc.\n");
+ return (NULL);
+ }
+ while ((rcline = dGetline(In)) != NULL) {
+ if (strncmp(rcline, "save_dir", 8) == 0)
+ break;
+ dFree(rcline);
+ }
+ fclose(In);
+ if (!rcline) {
+ value = NULL;
+ DLIB_MSG("dGetsavedir: no 'save_dir' in dillorc..\n");
+ } else {
+ len = (int) strlen(rcline);
+ if (len && rcline[len - 1] == '\n')
+ rcline[len - 1] = 0;
+ if ((p = strchr(rcline, '='))) {
+ while (*++p == ' ');
+ value = dStrdup(p);
+ } else {
+ value = NULL;
+ DLIB_MSG("dGetsavedir: error parsing value in dillorc.\n");
+ }
+ }
+ dFree(rcline);
+ return (value);
+}
+
+/**
+ * Return the enable_unveil value in a static string
+ */
+char *dGetenableunveil ()
+{
+ static char *dillorc = NULL;
+ dillorc = dStrconcat(dGethomedir(), "/", ".dillo/dillorc", NULL);
+ FILE *In;
+ int len;
+ char *rcline = NULL, *value = NULL, *p;
+ if ((In = fopen(dillorc, "r")) == NULL) {
+ DLIB_MSG("dGetenableunveil: unable to open dillorc.\n");
+ return (NULL);
+ }
+ while ((rcline = dGetline(In)) != NULL) {
+ if (strncmp(rcline, "enable_unveil", 13) == 0)
+ break;
+ dFree(rcline);
+ }
+ fclose(In);
+ if (!rcline) {
+ value = NULL;
+ DLIB_MSG("dGetenableunveil: no 'enable_unveil' in dillorc.\n");
+ } else {
+ len = (int) strlen(rcline);
+ if (len && rcline[len - 1] == '\n')
+ rcline[len - 1] = 0;
+ if ((p = strchr(rcline, '='))) {
+ while (*++p == ' ');
+ value = dStrdup(p);
+ } else {
+ value = NULL;
+ DLIB_MSG("dGetenableunveil: error parsing value in dillorc.\n");
+ }
+ }
+ dFree(rcline);
+ return (value);
+}
+
+/**
+ * Use unveil on OpenBSD
+ */
+void *dUnveil(const char *path, const char *perm)
+{
+ #ifdef ENABLE_UNVEIL
+ #ifdef __OpenBSD__
+ if (unveil(path, perm) == -1) {
+ DLIB_MSG("unveil(%s, %s) failed: %s\n", path, perm, strerror(errno));
+ exit(1);
+ }
+ #endif
+ #endif
+}
+
+/**
* Get a line from a FILE stream.
* Return value: read line on success, NULL on EOF.
*/
diff -upr a/dlib/dlib.h b/dlib/dlib.h
--- a/dlib/dlib.h Wed Aug 7 20:50:53 2024
+++ b/dlib/dlib.h Thu Aug 8 20:07:26 2024
@@ -175,6 +175,9 @@ void dLib_show_messages(bool_t show);
*/
char *dGetcwd(void);
char *dGethomedir(void);
+char *dGetsavedir();
+char *dGetenableunveil();
+void *dUnveil(const char *path, const char *perm);
char *dGetline(FILE *stream);
int dClose(int fd);
int dUsleep(unsigned long us);
diff -upr a/dpi/bookmarks.c b/dpi/bookmarks.c
--- a/dpi/bookmarks.c Wed Aug 7 20:50:53 2024
+++ b/dpi/bookmarks.c Thu Aug 8 20:08:40 2024
@@ -37,6 +37,7 @@
#include <signal.h>
#include "../dpip/dpip.h"
#include "dpiutil.h"
+#include "../dlib/dlib.h"
/*
@@ -1606,7 +1607,6 @@ static void termination_handler(int signum)
exit(signum);
}
-
/*
* -- MAIN -------------------------------------------------------------------
*/
@@ -1616,6 +1616,18 @@ int main(void) {
socklen_t address_size;
char *tok;
Dsh *sh;
+
+ /* Use unveil on OpenBSD */
+ if (dGetenableunveil() != NULL) {
+ if (strncmp(dGetenableunveil(), "YES", 3) == 0) {
+ #ifdef ENABLE_UNVEIL
+ char *dil_bm = dStrconcat(dGethomedir(), "/.dillo/bm.txt", NULL);
+ dUnveil(dil_bm, "rwc");
+ dFree(dil_bm);
+ unveil(NULL, NULL);
+ #endif
+ }
+ }
/* Arrange the cleanup function for terminations via exit() */
atexit(cleanup);
diff -upr a/dpi/cookies.c b/dpi/cookies.c
--- a/dpi/cookies.c Wed Aug 7 20:50:53 2024
+++ b/dpi/cookies.c Thu Aug 8 20:08:40 2024
@@ -50,6 +50,7 @@ int main(void)
#include <signal.h>
#include "dpiutil.h"
#include "../dpip/dpip.h"
+#include "../dlib/dlib.h"
/*
@@ -1632,7 +1633,6 @@ static void termination_handler(int signum)
exit(signum);
}
-
/*
* -- MAIN -------------------------------------------------------------------
*/
@@ -1643,7 +1643,19 @@ int main(void) {
int sock_fd, code;
char *buf;
Dsh *sh;
-
+
+ /* Use unveil on OpenBSD */
+ if (dGetenableunveil() != NULL) {
+ if (strncmp(dGetenableunveil(), "YES", 3) == 0) {
+ #ifdef ENABLE_UNVEIL
+ char *dil_loc = dStrconcat(dGethomedir(), "/.dillo", NULL);
+ dUnveil(dil_loc, "rwc");
+ dFree(dil_loc);
+ unveil(NULL, NULL);
+ #endif
+ }
+ }
+
/* Arrange the cleanup function for terminations via exit() */
atexit(cleanup);
diff -upr a/dpi/datauri.c b/dpi/datauri.c
--- a/dpi/datauri.c Wed Aug 7 20:50:53 2024
+++ b/dpi/datauri.c Thu Aug 8 20:08:40 2024
@@ -21,6 +21,7 @@
#include "../dpip/dpip.h"
#include "dpiutil.h"
#include "../src/misc.h"
+#include "../dlib/dlib.h"
/*
* Debugging macros
@@ -290,6 +291,19 @@ int main(void)
unsigned char *data;
int rc;
size_t data_size = 0;
+
+ /* Use unveil on OpenBSD */
+ if (dGetenableunveil() != NULL) {
+ if (strncmp(dGetenableunveil(), "YES", 3) == 0) {
+ #ifdef ENABLE_UNVEIL
+ dUnveil("/tmp", "rwc");
+ char *dil_loc = dStrconcat(dGethomedir(), "/.dillo", NULL);
+ dUnveil(dil_loc, "rwc");
+ dFree(dil_loc);
+ unveil(NULL, NULL);
+ #endif
+ }
+ }
/* Initialize the SockHandler */
sh = a_Dpip_dsh_new(STDIN_FILENO, STDOUT_FILENO, 8*1024);
diff -upr a/dpi/downloads.cc b/dpi/downloads.cc
--- a/dpi/downloads.cc Wed Aug 7 20:50:53 2024
+++ b/dpi/downloads.cc Thu Aug 8 20:08:40 2024
@@ -45,6 +45,7 @@
#include "config.h"
#include "dpiutil.h"
#include "../dpip/dpip.h"
+#include "../dlib/dlib.h"
/*
* Debugging macros
@@ -206,7 +207,6 @@ static char *escape_tooltip(const char *buf, ssize_t l
return ret;
}
-
/*
* Global variables
*/
@@ -1098,13 +1098,30 @@ static void custLabelMeasure(const Fl_Label* o, int& W
fl_measure(o->value, W, H, interpret_symbols);
}
-
-
//int main(int argc, char **argv)
int main()
{
int ww = 420, wh = 85;
-
+
+ /* Use unveil on OpenBSD */
+ if (dGetenableunveil() != NULL) {
+ if (strncmp(dGetenableunveil(), "YES", 3) == 0) {
+ #ifdef ENABLE_UNVEIL
+ dUnveil("/tmp", "rwc");
+ dUnveil("/etc/fonts", "r");
+ dUnveil("/usr/local/bin/wget", "x");
+ char *xauth_loc = dStrconcat(dGethomedir(), "/.Xauthority", NULL);
+ dUnveil(xauth_loc, "r");
+ dFree(xauth_loc);
+ dUnveil("/usr/local/share/fonts", "r");
+ char *dil_loc = dStrconcat(dGethomedir(), "/.dillo", NULL);
+ dUnveil(dil_loc, "rwc");
+ dFree(dil_loc);
+ dUnveil(NULL, NULL);
+ #endif
+ }
+ }
+
Fl::lock();
// Disable '@' and '&' interpretation in normal labels.
diff -upr a/dpi/file.c b/dpi/file.c
--- a/dpi/file.c Wed Aug 7 20:50:53 2024
+++ b/dpi/file.c Thu Aug 8 20:08:40 2024
@@ -37,6 +37,7 @@
#include "../dpip/dpip.h"
#include "dpiutil.h"
#include "d_size.h"
+#include "../dlib/dlib.h"
/*
* Debugging macros
@@ -1063,12 +1064,24 @@ static int File_check_fds(uint_t seconds)
return st;
}
-
int main(void)
{
struct sockaddr_in sin;
socklen_t sin_sz;
int sock_fd, c_st, st = 1;
+
+ /* Use unveil on OpenBSD */
+ if (dGetenableunveil() != NULL) {
+ if (strncmp(dGetenableunveil(), "YES", 3) == 0) {
+ #ifdef ENABLE_UNVEIL
+ dUnveil(dGetsavedir(), "rw");
+ dUnveil("/tmp", "rw");
+ char *dil_loc = dStrconcat(dGethomedir(), "/.dillo", NULL);
+ dUnveil(dil_loc, "rwc");
+ unveil(NULL, NULL);
+ #endif
+ }
+ }
/* Arrange the cleanup function for abnormal terminations */
if (signal (SIGINT, termination_handler) == SIG_IGN)
diff -upr a/dpi/ftp.c b/dpi/ftp.c
--- a/dpi/ftp.c Wed Aug 7 20:50:53 2024
+++ b/dpi/ftp.c Thu Aug 8 20:08:40 2024
@@ -44,6 +44,7 @@
#include "../dpip/dpip.h"
#include "dpiutil.h"
#include "d_size.h"
+#include "../dlib/dlib.h"
/*
* Debugging macros
@@ -282,6 +283,21 @@ int main(int argc, char **argv)
int st, rc;
char *p, *d_cmd;
+ /* Use unveil on OpenBSD */
+ if (dGetenableunveil() != NULL) {
+ if (strncmp(dGetenableunveil(), "YES", 3) == 0) {
+ #ifdef ENABLE_UNVEIL
+ dUnveil("/tmp", "rwc");
+ dUnveil("/usr/local/bin/wget", "x");
+ char *dil_loc = dStrconcat(dGethomedir(), "/.dillo", NULL);
+ dUnveil(dil_loc, "rwc");
+ dFree(dil_loc);
+ dUnveil(dGetsavedir(), "rwc");
+ unveil(NULL, NULL);
+ #endif
+ }
+ }
+
/* wget may need to write a temporary file... */
rc = chdir("/tmp");
if (rc == -1) {
diff -upr a/dpi/vsource.c b/dpi/vsource.c
--- a/dpi/vsource.c Wed Aug 7 20:50:53 2024
+++ b/dpi/vsource.c Thu Aug 8 20:08:40 2024
@@ -21,6 +21,7 @@
#include <errno.h>
#include "../dpip/dpip.h"
#include "dpiutil.h"
+#include "../dlib/dlib.h"
/*
* Debugging macros
@@ -188,6 +189,18 @@ int main(void)
char *dpip_tag, *cmd = NULL, *cmd2 = NULL, *url = NULL, *size_str = NULL;
char *d_cmd;
+ /* Use unveil on OpenBSD */
+ if (dGetenableunveil() != NULL) {
+ if (strncmp(dGetenableunveil(), "YES", 3) == 0) {
+ #ifdef ENABLE_UNVEIL
+ char *dil_loc = dStrconcat(dGethomedir(), "/.dillo", NULL);
+ dUnveil(dil_loc, "r");
+ dFree(dil_loc);
+ unveil(NULL, NULL);
+ #endif
+ }
+ }
+
_MSG("starting...\n");
//sleep(20);
diff -upr a/dpid/main.c b/dpid/main.c
--- a/dpid/main.c Wed Aug 7 20:50:53 2024
+++ b/dpid/main.c Thu Aug 8 20:07:44 2024
@@ -236,6 +236,19 @@ int main(void)
//daemon(0,0); /* Use 0,1 for feedback */
/* TODO: call setsid() ?? */
+ /* Use unveil on OpenBSD */
+ if (dGetenableunveil() != NULL) {
+ if (strncmp(dGetenableunveil(), "YES", 3) == 0) {
+ #ifdef ENABLE_UNVEIL
+ dUnveil("/usr/local/lib/dillo", "rx");
+ dUnveil("/usr/local/etc/dillo", "r");
+ char *dil_loc = dStrconcat(dGethomedir(), "/.dillo", NULL);
+ dUnveil(dil_loc, "rwc");
+ unveil(NULL, NULL);
+ #endif
+ }
+ }
+
/* Allow read and write access, but only for the user.
* TODO: can this cause trouble with umount? */
umask(0077);
diff -upr a/src/dillo.cc b/src/dillo.cc
--- a/src/dillo.cc Wed Aug 7 20:50:53 2024
+++ b/src/dillo.cc Thu Aug 8 20:08:54 2024
@@ -463,7 +463,47 @@ int main(int argc, char **argv)
fclose(fp);
}
dLib_show_messages(prefs.show_msg);
-
+
+ // Use unveil
+ if (dGetenableunveil() != NULL) {
+ if (strncmp(dGetenableunveil(), "YES", 3) == 0) {
+ #ifdef ENABLE_UNVEIL
+ const char *home = dGethomedir();
+ const char *save = prefs.save_dir;
+ int nsave = strlen(save);
+ int nhome = strlen(home);
+ if (nsave <= nhome) {
+ /* Prevent save_dir="/home" and save_dir=$HOME */
+ if (strncmp(save, home, nsave) == 0) {
+ MSG("save_dir cannot contain home\n");
+ exit(1);
+ }
+ }
+ dUnveil("/usr/local/share/fonts", "r");
+ dUnveil("/usr/local/share/icons", "r");
+ dUnveil("/usr/X11R6/share/X11/locale", "r");
+ dUnveil("/usr/X11R6/lib/X11/fonts", "r");
+ dUnveil("/usr/local/etc/dillo", "r");
+ dUnveil("/tmp", "rwc");
+ dUnveil("/usr/local/bin/dpid", "x");
+ dUnveil("/etc/fonts", "r");
+ dUnveil("/etc/resolv.conf", "r");
+ dUnveil("/etc/ssl/cert.pem", "r");
+ dUnveil(prefs.save_dir, "rwc");
+ char *dil_loc = dStrconcat(dGethomedir(), "/.dillo", NULL);
+ dUnveil(dil_loc, "rwc");
+ dFree(dil_loc);
+ char *icons_loc = dStrconcat(dGethomedir(), "/.icons", NULL);
+ dUnveil(icons_loc, "r");
+ dFree(icons_loc);
+ char *xauth_loc = dStrconcat(dGethomedir(), "/.Xauthority", NULL);
+ dUnveil(xauth_loc, "r");
+ dFree(xauth_loc);
+ dUnveil(NULL, NULL);
+ #endif
+ }
+ }
+
// initialize internal modules
a_Dpi_init();
a_Dns_init();
Aug. 8, 2024
Re: [PATCH] Toolbar zoom control button
by a1exï¼ dismail.de
Hi,
On Thu, 8 Aug 2024 14:45:33 +0200
Rodrigo Arias <rodarima(a)gmail.com> wrote:
> I'm working on a zoom icon that a bit more similar to the other
> icons, but I'm having problems to avoid aliasing in the border due to
> the limitations of XPM with the alpha transparency.
>
> I attach two screenshots, one (zoom.png) with the icon background set
> to the same color of the menu so the alpha is blended properly (but
> the icon is not transparent).
>
> And another one (zoom-alias.png) with the alpha cutoff at half, so
> alpha values less than 127 are converted to transparent pixels. This
> one shows some aliasing in the borders, but it works fine if you
> change the menu color.
> Not sure if there is a good solution to this problem, other than
> manually making the aliasing work well with a sharp border. The other
> icons cleverly avoid this problem by doing rectangular shapes.
The reload button, especially the small one, shows the same issue. But
for me it's barely noticable, and I think your icon looks fine!
> I'm also considering leaving the save button by default for now, and
> moving the zoom button to the right, so we preserve the "muscle
> memory" of users. I need to play a bit more to see how it "feels".
Yeah, I had also considered that, and agree it might be better to leave
the save button. It could result in an unexpected surprise to users
upgrading to a new version and saying "Hey, where's the save button!".
Regards,
Alex
Aug. 8, 2024
Re: [PATCH] Toolbar zoom control button
by Rodrigo Arias
Hi,
On Tue, Aug 06, 2024 at 01:27:38PM +0200, Rodrigo Arias wrote:
> Hi,
>
> On Tue, Aug 06, 2024 at 01:14:26PM +0200, a1ex(a)dismail.de wrote:
> > > Thanks!, so far it seems to be working fine.
> > >
> > > I'll try to get it merged soon.
> >
> > Just wanted to check if there is anything else that needs to be
> > addressed with this patch. If so, please let me know and I will work on
> > it.
>
> I think it is good as-is, I just need to test it for a bit. I'll try to
> merge it once I finish with other changes I'm working on. It is queued for
> 3.2.0:
>
> https://github.com/dillo-browser/dillo/issues/235
I'm working on a zoom icon that a bit more similar to the other icons,
but I'm having problems to avoid aliasing in the border due to the
limitations of XPM with the alpha transparency.
I attach two screenshots, one (zoom.png) with the icon background set to
the same color of the menu so the alpha is blended properly (but the
icon is not transparent).
And another one (zoom-alias.png) with the alpha cutoff at half, so alpha
values less than 127 are converted to transparent pixels. This one shows
some aliasing in the borders, but it works fine if you change the menu
color.
Not sure if there is a good solution to this problem, other than
manually making the aliasing work well with a sharp border. The other
icons cleverly avoid this problem by doing rectangular shapes.
I'm also considering leaving the save button by default for now, and
moving the zoom button to the right, so we preserve the "muscle memory"
of users. I need to play a bit more to see how it "feels".
Best,
Rodrigo.
Aug. 8, 2024
Re: [PATCH] Toolbar zoom control button
by Rodrigo Arias
Hi,
On Tue, Aug 06, 2024 at 01:14:26PM +0200, a1ex(a)dismail.de wrote:
>> Thanks!, so far it seems to be working fine.
>>
>> I'll try to get it merged soon.
>
>Just wanted to check if there is anything else that needs to be
>addressed with this patch. If so, please let me know and I will work on
>it.
I think it is good as-is, I just need to test it for a bit. I'll try to
merge it once I finish with other changes I'm working on. It is queued
for 3.2.0:
https://github.com/dillo-browser/dillo/issues/235
Best,
Rodrigo.
Aug. 6, 2024
Re: [PATCH] Toolbar zoom control button
by a1exï¼ dismail.de
Hi Rodrigo,
On Sun, 14 Jul 2024 20:17:44 +0200
Rodrigo Arias <rodarima(a)gmail.com> wrote:
> Hi,
>
> On Sun, Jul 14, 2024 at 07:02:50PM +0200, a1ex(a)dismail.de wrote:
> >Hi list,
> >
> >Here is an improved version of my previous patch.
> >
> >The icon is fixed, it's basic but does the job. If someone wants to
> >make a prettier one, I'm open to it.
> >
> >Other improvements as discussed with Rodrigo:
> >
> >- Middle click resets zoom level
> >- There is now a 'show_zoom' preference in dillorc (enabled by
> >default)
> >- The save button has been disabled by default
> >- The zoom button has been moved to the right of the refresh button
> >
> >Please let me know if you find any issues, and hope you enjoy it :)
>
> Thanks!, so far it seems to be working fine.
>
> I'll try to get it merged soon.
Just wanted to check if there is anything else that needs to be
addressed with this patch. If so, please let me know and I will work on
it.
Thanks,
Alex
Aug. 6, 2024
Re: [PATCH v2] Unveil patch
by Rodrigo Arias
Hi,
On Mon, Aug 05, 2024 at 05:42:54PM +0200, a1ex(a)dismail.de wrote:
>Hi Rodrigo,
>
>On Mon, 5 Aug 2024 15:06:04 +0200
>Rodrigo Arias <rodarima(a)gmail.com> wrote:
>
>> >> I think we could just not allow $HOME to be set as save_dir (or any
>> >> directory that contains $HOME, like /home) and refuse to start if
>> >> this is the case.
>
>Sorry, I guess this is the part that confused me:
>"(or any directory that contains $HOME, like /home)"
>
>I agree with it, just not sure how to implement while still allowing a
>save_dir like '$HOME/Downloads', or '/home/user/Downloads'.
>
>Maybe it's a simple thing, but any help would be appreciated!
By "contains" I mean that $HOME cannot be inside save_dir:
bad: save_dir=/
bad: save_dir=/home
bad: save_dir=/home/<theuser>
ok: save_dir=/home/<theuser>/foo
ok: save_dir=/tmp
Here is a very simple check (doesn't handle /../ and other problems):
const char *home = dGethomedir();
const char *save = prefs.save_dir;
int nsave = strlen(save);
int nhome = strlen(home);
if (nsave <= nhome) {
/* Prevent save_dir="/home" and save_dir=$HOME */
if (strncmp(save, home, nsave) == 0) {
MSG("save_dir cannot contain home\n");
exit(1);
}
}
Best,
Rodrigo.
Aug. 5, 2024
Re: [PATCH v2] Unveil patch
by a1exï¼ dismail.de
Hi Rodrigo,
On Mon, 5 Aug 2024 15:06:04 +0200
Rodrigo Arias <rodarima(a)gmail.com> wrote:
> >> I think we could just not allow $HOME to be set as save_dir (or any
> >> directory that contains $HOME, like /home) and refuse to start if
> >> this is the case.
Sorry, I guess this is the part that confused me:
"(or any directory that contains $HOME, like /home)"
I agree with it, just not sure how to implement while still allowing a
save_dir like '$HOME/Downloads', or '/home/user/Downloads'.
Maybe it's a simple thing, but any help would be appreciated!
> >Not sure I understand what this achieves. So '/home/user' would be
> >blocked, but '/home/user/foo' would be allowed? Why not just
> >explicitly block access to ~/.ssh with unveil, and then let the user
> >do whatever they want after that?
>
> Yeah, but there may be a lot of other unknown directories we don't
> want Dillo to access to (~/.config, ~/.cache, ...). So I think is a
> good approach to block all directories in home, except the downloads
> one.
>
> Another attack may involve encrypting ~/Pictures and asking for a
> ransom, so we should prevent any access to home that is not required.
I think it's unlikely that a user would explicitly choose $HOME as
save_dir, but agree that it would be reasonable to take the precaution
just in case.
Thanks,
Alex
Aug. 5, 2024
Re: [PATCH v2] Unveil patch
by Rodrigo Arias
Hi,
On Sun, Aug 04, 2024 at 05:14:52PM +0200, a1ex(a)dismail.de wrote:
>> If you see your SSH key in the stdout, the unveil() protection alone
>> is not enough to mitigate this attack (check that the key exists
>> first, I used id_rsa). This would also confirm that unveil() settings
>> don't get inherited in forked children.
>
>I placed that after the last unveil call and made sure I used a valid
>key path. Here is the console output:
>
>game over exploit, fopen failed: No such file or directory
>>From what I am seeing, fork() inherits the unveil, and exec() does
>>not.
Hmm, I guess that makes more sense.
I was thinking we could read the preferences only from Dillo, then
unveil accordingly, and then all DPIs would already get the unveiled
environment.
But as you comment, on the exec() the unveil will reset, so we will need
to re-read the dillorc file again. I think this is also a good approach
in case someone runs the dpid by hand, so it adheres to what dillorc
says.
>> Maybe for now we can add a simple implementation of the parser just to
>> parse the "save_dir" and the new "enable_unveil" (or similar) option,
>> like dpid is doing for dpi_dir.
>
>Ok thanks, I will try to use that as an example and see if I can get
>anywhere with it.
Thanks!
>> I think we could just not allow $HOME to be set as save_dir (or any
>> directory that contains $HOME, like /home) and refuse to start if this
>> is the case.
>
>Not sure I understand what this achieves. So '/home/user' would be
>blocked, but '/home/user/foo' would be allowed? Why not just explicitly
>block access to ~/.ssh with unveil, and then let the user do whatever
>they want after that?
Yeah, but there may be a lot of other unknown directories we don't want
Dillo to access to (~/.config, ~/.cache, ...). So I think is a good
approach to block all directories in home, except the downloads one.
Another attack may involve encrypting ~/Pictures and asking for a
ransom, so we should prevent any access to home that is not required.
Best,
Rodrigo.
Aug. 5, 2024