I'm currently checking out NetBSD for a BBS project I have planned. I tried to compile the latest MBSE sourcecode (as of jan. 2nd, 2018). While the code itself compiles without problems, I had to fix the following two issues in order to get MBSE to work properly on a recent NetBSD (7.1) release:
1.) autoconf (configure) won't detect libs intalled on a recent NetBSD system as autoconf does not check the /usr/pkg/lib and /usr/pkg/include paths that are the default locations for everything installed through NetBSD's pkg_add command.
2.) mbtask always exited with the following error: "Operation not permitted can't sgid to bbs". I had to check the NetBSD manpage for the setgid() and setegid() functions to find out that setgid() on NetBSD seems to work different then the Linux implementation of setgid() (and it looks like it's that way for BSD systems in general). AS a result, I added a simple preprocessor dircetive that will check for a BSD system and in that case will use the setegid() system call instead of setgid().
I'd be happy if anyone could verify these changes and (maybe) merge them into the upstream codebase.
Below are the changes (diff) I made to configure.ac and mbtask.c
--- configure.ac 2018-01-03 17:57:54.000000000 +0000
+++ mbsebbs-code/configure.ac 2017-12-21 20:40:17.000000000 +0000
@@ -39,8 +39,8 @@
AC_SUBST(VERSION)
SYSTEM="`uname -s`"
CPU="`uname -m`"
-LDFLAGS="-L/usr/local/lib"
-CPPFLAGS="-I/usr/local/include"
+LDFLAGS="-L/usr/local/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib"
+CPPFLAGS="-I/usr/local/include -I/usr/pkg/include"
#
# Checks for programs.
@@ -75,9 +75,9 @@
AC_ARG_ENABLE(debugging, [ --enable-debugging Compile for debugging], [ debugging=$enableval ], [ debugging=no ])
if test "$debugging" = "yes"; then
- CFLAGS="-O -g -Wall -Wshadow -Wwrite-strings -Wstrict-prototypes -D_REENTRANT -I/usr/local/include"
+ CFLAGS="-O -g -Wall -Wshadow -Wwrite-strings -Wstrict-prototypes -D_REENTRANT -I/usr/local/include -I/usr/pkg/include"
else
- CFLAGS="-O2 -fno-strict-aliasing -Wall -Wshadow -Wwrite-strings -Wstrict-prototypes -D_REENTRANT -I/usr/local/include"
+ CFLAGS="-O2 -fno-strict-aliasing -Wall -Wshadow -Wwrite-strings -Wstrict-prototypes -D_REENTRANT -I/usr/local/include -I/usr/pkg/include"
fi
AC_ARG_ENABLE(optimize, [ --enable-optimize Enable CPU optimize], [ optimize=$enableval ], [ optimize=no ])
--- mbtask.c 2018-01-03 17:56:19.000000000 +0000
+++ mbsebbs-code/mbtask/mbtask.c 2017-12-21 20:47:35.000000000 +0000
@@ -1591,7 +1591,14 @@
* If running in the foreground under valgrind the next call fails.
* Developers should know what they are doing so we are not bailing out.
*/
+
+#if defined(__USE_GNU) || defined(__linux__)
+ if (setgid(pw->pw_gid)) {
+#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+ if (setegid(pw->pw_gid)) {
+#else
if (setgid(pw->pw_gid)) {
+#endif
perror("");
fprintf(stderr, "can't setgid to bbs\n");
if (! nodaemon) {
I will attempt to test this over the weekend.
Regards,
Andrew
Sent from BlueMail
On Jan 3, 2018, 1:09 PM, at 1:09 PM, lodger niels@users.sf.net wrote:
Related
Tickets:
#21One more info: the changes in configure.ac are required if you want to use GeoIP under NetBSD. Otherwise the check for GeoIP done by the generated configure script will fail. As NetBSD uses the -rpath search list in the compiled binary image, the -Wl,-R/usr/lib/pkg directive was added to the linker args to fix this issue.
Thanks, I'll take a look.
On Jan 3, 2018 3:42 PM, "lodger" niels@users.sf.net wrote:
Related
Tickets:
#21Update: the setegid fix is not required, I verified this yesterday on a fresh NetBSD 7.1.1 install. I added that fix due to mbtask always quitting due to permission issues but I found out that I made a mistake by installing the program using "su -" instead of "su". However, the fixes for configure.ac are still relevant in order to find the proper libraries. I'm very sorry for the confusion my ticket caused.
P.S.: I'm also the guy who did the german translation of the menu / text files back in 2008 (you can check the changelog to verify). I found that there are a few typos that I have now fixed and I'd like to send to you. Is a pull-request acceptable for that?
Please send these to me as file attachment to vbcoen@gmail.com
Thanks for your work.
Hi Vincent,
I'm currently setting up a NetBSD 7.2 system in order to re-verify my
work. Once this is done, I'll send you the patches. As for the second
patch (mbtask.c) I'm not sure if that is really required. Hence the
re-verification. I'll get back to you throughout the next week.
Kind regards,
Niels
Am 09.01.19 um 15:04 schrieb Vincent (Bryan) Coen:
Related
Tickets:
#21Cleared as of 1.0.7.11B with code included within 1.0.7.12 via svn code base and the 1.0.7.12 source file in Files section.
.
The change for mbtask.c is omitted on v1.0.7.12. so not a problem - unless you know different!
.
Ah, I see. Then everything is OK - thank you!
Am 24.03.19 um 14:00 schrieb Vincent (Bryan) Coen:
Related
Tickets:
#21