public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* DNS server LaMaraDNS is running on cygwin
@ 2001-11-13 15:29 Gerrit P. Haase
  2001-11-13 15:38 ` Christopher Faylor
  0 siblings, 1 reply; 14+ messages in thread
From: Gerrit P. Haase @ 2001-11-13 15:29 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1867 bytes --]

Hallo Cygwinners,

I have successful compiled ¡LaMaraDNS! ( http://www.maradns.org/ )
¡LaMaraDNS! is an alpha-quality authoritative and recursive (caching)
DNS server.

From the website:
=================
This DNS server has the following features:

  Security-aware programming. A DNS server needs to be secure.
  - I have a number of security features in the code, including:
      1. The code uses a special string library which is resistant
         to buffer overflows.
      2. The code, if started as root, mandates running as an
         unprivledged user in a chroot() jail.
  - Open-Source. This DNS server is public-domain code. There are
    no restrictions attached to this code.
  - Simplicity. This DNS server has the minimum number of features
    needed to correctly act as an authoritative and/or recursive
    name server.

Examples:
=========

$ dig @127.0.0.3 cygwin.com

; <<>> DiG 8.3 <<>> @127.0.0.3 cygwin.com 
; (1 server found)
;; res options: init recurs defnam dnsrch
;; got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6
;; flags: qr; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUERY SECTION:
;;      cygwin.com, type = A, class = IN

;; ANSWER SECTION:
cygwin.com.             1D IN A         209.249.29.67

;; Total query time: 30 msec
;; FROM: ISMENE to SERVER: 127.0.0.3
;; WHEN: Tue Nov 20 21:49:00 2001
;; MSG SIZE  sent: 28  rcvd: 44


$ ./tools/askmara Acygwin.com. 127.0.0.3
# Querying the server with the IP 127.0.0.3
Acygwin.com.|86400|209.249.29.67
# NS replies:
# AR replies:



I have a patch attached if someone wants to test it;)
Just put the patch and the source in one directory and do:

$ tar xvjf maradns-0.8.35.tar.bz2
$ cd maradns-0.8.35
$ patch -p1 < ../maradns.patch
$ make
$ make install

Gerrit
-- 
Erre con erre cigarro
Erre con erre barril
Rápido ruedan los carros
En el ferrocarril

[-- Attachment #2: maradns.patch --]
[-- Type: application/octet-stream, Size: 10297 bytes --]

diff -urbdN maradns-0.8.35/MaraDns.h maradns-0.8.35-1/MaraDns.h
--- maradns-0.8.35/MaraDns.h	Sun Nov 11 23:17:14 2001
+++ maradns-0.8.35-1/MaraDns.h	Tue Nov 20 21:00:38 2001
@@ -10,6 +10,10 @@
 #define       INADDR_NONE             0xffffffff
 #endif /* SOLARIS */
 
+#ifdef __CYGWIN__
+#define MSG_WAITALL 0x40
+#endif /* __CYGWIN__ */
+
 /* The maximum allowed size of a zone name */
 #define MAX_ZONE_SIZE 256
 
diff -urbdN maradns-0.8.35/install.locations maradns-0.8.35-1/install.locations
--- maradns-0.8.35/install.locations	Wed Oct 17 02:44:48 2001
+++ maradns-0.8.35-1/install.locations	Tue Nov 20 20:53:01 2001
@@ -9,9 +9,9 @@
 # Note that the script will break if these are not absolute paths
 
 # The location of programs that the end user may wish to use
-BIN="/usr/local/bin/"
+BIN="/usr/local/bin"
 # The location of the server programs
-SBIN="/usr/local/sbin/"
+SBIN="/usr/local/sbin"
 # The directory to put man pages which describe the end-user programs
 MAN1="/usr/local/man/man1/"
 # The directory to put man pages which describe configuration file formats
diff -urbdN maradns-0.8.35/install.sh maradns-0.8.35-1/install.sh
--- maradns-0.8.35/install.sh	Sat Nov 17 11:38:48 2001
+++ maradns-0.8.35-1/install.sh	Tue Nov 20 21:41:08 2001
@@ -49,22 +49,22 @@
 # Place the binaries in $BIN and $SBIN
 cd server
 # We remove the file first to avoid the "text file busy" problem
-if [ -e $SBIN/maradns ] ; then
-	rm $SBIN/maradns
+if [ -e $SBIN/maradns.exe ] ; then
+	rm $SBIN/maradns.exe
 fi
-cp maradns $SBIN
+/bin/install maradns $SBIN
 cd ../tuzona
-cp getzone $BIN
+/bin/install getzone $BIN
 # We remove the file first to avoid the "text file busy" problem
-if [ -e $SBIN/zoneserver ] ; then
-	rm $SBIN/zoneserver
+if [ -e $SBIN/zoneserver.exe ] ; then
+	rm $SBIN/zoneserver.exe
 fi
-cp zoneserver $SBIN
+/bin/install zoneserver $SBIN
 cd ../tools
-if [ -e $BIN/askmara ] ; then
-	rm $BIN/askmara
+if [ -e $BIN/askmara.exe ] ; then
+	rm $BIN/askmara.exe
 fi
-cp askmara $BIN
+/bin/install askmara $BIN
 # Place the man pages in $MAN1, $MAN5, and $MAN8
 cd ../doc/man
 cp askmara.1 getzone.1 $MAN1
@@ -78,11 +78,11 @@
 # If the system in question does not already have configuration files,
 # place example configuration files in /etc
 if [ ! -f /etc/mararc ] ; then
-	cp example_mararc /etc/mararc
+	cp doc/example_mararc /etc/mararc
 fi
 if [ ! -d /etc/maradns ] ; then
 	mkdir /etc/maradns
 	chmod 755 /etc/maradns
-	cp example_csv1 /etc/maradns/db.example.com
+	cp doc/example_csv1 /etc/maradns/db.example.com
 fi
 
diff -urbdN maradns-0.8.35/libs/JsStr.h maradns-0.8.35-1/libs/JsStr.h
--- maradns-0.8.35/libs/JsStr.h	Wed Oct 17 02:44:47 2001
+++ maradns-0.8.35-1/libs/JsStr.h	Tue Nov 20 20:11:41 2001
@@ -8,6 +8,8 @@
    to overflow the string), and how long each character in the string is
    (can you say unicode?  I thought so) */
 
+#include "flock.h"
+
 #ifdef SOLARIS
 #ifndef _uint_defined
 typedef unsigned int u_int32_t;
diff -urbdN maradns-0.8.35/libs/Makefile maradns-0.8.35-1/libs/Makefile
--- maradns-0.8.35/libs/Makefile	Sat Nov 17 00:35:11 2001
+++ maradns-0.8.35-1/libs/Makefile	Tue Nov 20 20:22:38 2001
@@ -1,13 +1,16 @@
-OBJECTS = JsStr.o JsStrOS.o JsStrCP.o MaraHash.o
+OBJECTS = flock.o JsStr.o JsStrOS.o JsStrCP.o MaraHash.o
 #FLAGS = -O2 -Wall
 #FLAGS = -g -DDEBUG -DTHREADS
 FLAGS = -g $(DEBUG)
 
-all: tests mtest
+all: tests mtest lib
 
 clean:
 	rm -f core $(OBJECTS) tests mtest
 
+flock.o:
+	$(CC) -c $(FLAGS) -o flock.o flock.c
+
 MaraHash.o: JsStr.h MaraHash.c
 	$(CC) -c $(FLAGS) -o MaraHash.o MaraHash.c 
 
@@ -25,6 +28,10 @@
 
 tests: tests.c $(OBJECTS)
 	$(CC) $(FLAGS) -o tests tests.c $(OBJECTS)
+
+lib: flock.o
+	ar -cru libflock.a flock.o
+	ranlib libflock.a
 
 #onetime: $(OBJECTS) kiwi.h config.h onetime.c do_scramble.o cryptdate.o
 #	$(CC) $(FLAGS) -o onetime onetime.c do_scramble.o cryptdate.o
Binary files maradns-0.8.35/libs/MaraHash.o and maradns-0.8.35-1/libs/MaraHash.o differ
diff -urbdN maradns-0.8.35/libs/flock.c maradns-0.8.35-1/libs/flock.c
--- maradns-0.8.35/libs/flock.c	Thu Jan  1 01:00:00 1970
+++ maradns-0.8.35-1/libs/flock.c	Tue Nov 20 20:13:01 2001
@@ -0,0 +1,36 @@
+/* These are the flock() constants.  Since this sytems doesn't have
+   flock(), the values of the constants are probably not available.
+*/
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include "flock.h"
+
+int
+flock (fd, operation)
+     int fd;
+     int operation;
+{
+  struct flock lock;
+
+  switch (operation & ~LOCK_NB)
+    {
+    case LOCK_SH:
+      lock.l_type = F_RDLCK;
+      break;
+    case LOCK_EX:
+      lock.l_type = F_WRLCK;
+      break;
+    case LOCK_UN:
+      lock.l_type = F_UNLCK;
+      break;
+    default:
+      errno = EINVAL;
+      return -1;
+    }
+  lock.l_whence = SEEK_SET;
+  lock.l_start = lock.l_len = 0L;
+
+  return fcntl (fd, (operation & LOCK_NB) ? F_SETLK : F_SETLKW, &lock);
+}
diff -urbdN maradns-0.8.35/libs/flock.h maradns-0.8.35-1/libs/flock.h
--- maradns-0.8.35/libs/flock.h	Thu Jan  1 01:00:00 1970
+++ maradns-0.8.35-1/libs/flock.h	Tue Nov 20 20:11:48 2001
@@ -0,0 +1,13 @@
+# ifndef LOCK_SH
+#  define LOCK_SH 1
+# endif
+# ifndef LOCK_EX
+#  define LOCK_EX 2
+# endif
+# ifndef LOCK_NB
+#  define LOCK_NB 4
+# endif
+# ifndef LOCK_UN
+#  define LOCK_UN 8
+# endif
+
diff -urbdN maradns-0.8.35/parse/Makefile maradns-0.8.35-1/parse/Makefile
--- maradns-0.8.35/parse/Makefile	Wed Oct 17 02:44:47 2001
+++ maradns-0.8.35-1/parse/Makefile	Tue Nov 20 20:26:21 2001
@@ -4,6 +4,7 @@
 DOBJECTS=../dns/Queries.o ../dns/Compress.o ../dns/bobbit.o
 OBJECTS=$(JOBJS) $(MJOBJS) $(POBJECTS) $(DOBJECTS)
 EXECS=parsetest parsetest2
+LIBS=../libs/libflock.a
 
 #FLAGS = -O2
 FLAGS = -g $(DEBUG)
@@ -26,8 +27,8 @@
 	$(CC) -c $(FLAGS) -o ParseIpAcl.o ParseIpAcl.c
 
 parsetest: parsetest.c $(OBJECTS) 
-	$(CC) $(FLAGS) -o parsetest parsetest.c $(OBJECTS) 
+	$(CC) $(FLAGS) -o parsetest parsetest.c $(OBJECTS) $(LIBS)
 
 parsetest2: parsetest2.c $(OBJECTS) 
-	$(CC) $(FLAGS) -o parsetest2 parsetest2.c $(OBJECTS) 
+	$(CC) $(FLAGS) -o parsetest2 parsetest2.c $(OBJECTS) $(LIBS)
 
diff -urbdN maradns-0.8.35/server/Makefile maradns-0.8.35-1/server/Makefile
--- maradns-0.8.35/server/Makefile	Sat Nov 17 11:59:33 2001
+++ maradns-0.8.35-1/server/Makefile	Tue Nov 20 20:43:56 2001
@@ -6,6 +6,7 @@
 ROBJECTS=../rng/rng-api-fst.o ../rng/rng-alg-fst.o
 OBJECTS=$(JOBJS) $(MJOBJS) $(SOBJECTS) $(DOBJECTS) $(POBJECTS) $(ROBJECTS)
 EXECS=maradns
+LIBS=../libs/libflock.a
 
 #FLAGS = -O2 -Wall
 #FLAGS = -g -DDEBUG -DCALL_LOCKS
@@ -32,5 +33,5 @@
 	$(CC) -c $(FLAGS) -o recursive.o recursive.c 
 
 maradns: MaraDNS.c $(OBJECTS) MaraDNS_en.h
-	$(CC) $(FLAGS) -DVERSION=\"$(VERSION)\" -DCOMPILED=\"$(COMPILED)\" -o maradns MaraDNS.c $(OBJECTS) -lpthread
+	$(CC) $(FLAGS) -DVERSION=\"$(VERSION)\" -DCOMPILED=\"$(COMPILED)\" -o maradns MaraDNS.c $(OBJECTS) $(LIBS)
 
diff -urbdN maradns-0.8.35/server/MaraDNS.c maradns-0.8.35-1/server/MaraDNS.c
--- maradns-0.8.35/server/MaraDNS.c	Sat Nov 17 11:54:18 2001
+++ maradns-0.8.35-1/server/MaraDNS.c	Tue Nov 20 21:00:25 2001
@@ -2685,10 +2685,10 @@
 
     /* If this OS supports setrlimit and if setrlimit fails, bail (the ENOSYS
        check is there so OSes w/o setrlimit support can still run MaraDNS) */
-#ifndef SOLARIS
+#if !defined(SOLARIS) && !defined(__CYGWIN__)
     if(setrlimit(RLIMIT_NPROC,&rlim) != 0 && errno != ENOSYS)
         sys_harderror(L_MAXPROC_SET); /* "Unable to set maximum number of processes" */
-#endif /* SOLARIS */
+#endif /* SOLARIS, _CYGWIN__ */
 
     /* Determine the level of error reporting */
     if(js_qstr2js(kvar_query,"verbose_level") == JS_ERROR)
@@ -2890,7 +2890,9 @@
         if(read_kvar(kvar_query,uidstr) == JS_SUCCESS) {
             gid = js_atoi(uidstr,0);
             /* Drop all supplemtal groups */
+#ifndef __CYGWIN__
             setgroups(1,&gid);
+#endif /* __CYGWIN__ */
             /* Set the group ID */
             setgid(gid);
             }
diff -urbdN maradns-0.8.35/tools/Makefile maradns-0.8.35-1/tools/Makefile
--- maradns-0.8.35/tools/Makefile	Fri Nov 16 05:03:12 2001
+++ maradns-0.8.35-1/tools/Makefile	Tue Nov 20 20:26:42 2001
@@ -4,6 +4,7 @@
 OBJECTS=$(JOBJS) $(MJOBJS) $(DOBJECTS)
 ROBJECTS=../rng/rng-alg-fst.o ../rng/rng-api-fst.o
 EXECS=askmara strip.control benchmark 
+LIBS=../libs/libflock.a
 
 #FLAGS = -O2
 FLAGS = -g $(DEBUG)
@@ -14,10 +15,10 @@
 	rm -f core $(EXECS)
 
 askmara: askmara.c askmara_labels_en.h $(OBJECTS) $(ROBJECTS)
-	$(CC) $(FLAGS) -o askmara askmara.c $(OBJECTS) $(ROBJECTS)
+	$(CC) $(FLAGS) -o askmara askmara.c $(OBJECTS) $(ROBJECTS) $(LIBS)
 
 benchmark: benchmark.c askmara_labels_en.h $(OBJECTS) 
-	$(CC) $(FLAGS) -o benchmark benchmark.c $(OBJECTS)
+	$(CC) $(FLAGS) -o benchmark benchmark.c $(OBJECTS) $(LIBS)
 
 strip.control: strip.control.c
 	$(CC) $(FLAGS) -o strip.control strip.control.c
diff -urbdN maradns-0.8.35/tuzona/Makefile maradns-0.8.35-1/tuzona/Makefile
--- maradns-0.8.35/tuzona/Makefile	Wed Oct 17 02:44:48 2001
+++ maradns-0.8.35-1/tuzona/Makefile	Tue Nov 20 20:44:43 2001
@@ -4,6 +4,7 @@
 POBJECTS=../parse/ParseCsv1.o ../parse/ParseMaraRc.o ../parse/ParseIpAcl.o
 OBJECTS=$(JOBJS) $(MJOBJS) $(DOBJECTS) $(POBJECTS)
 EXECS=getzone zoneserver
+LIBS=../libs/libflock.a
 
 FLAGS = -O2
 #FLAGS = -g $(DEBUG)
@@ -14,8 +15,8 @@
 	rm -f core $(EXECS)
 
 getzone: getzone.c $(OBJECTS) 
-	$(CC) $(FLAGS) -o getzone getzone.c $(OBJECTS)
+	$(CC) $(FLAGS) -o getzone getzone.c $(OBJECTS) $(LIBS)
 
 zoneserver: zoneserver.c $(OBJECTS)
-	$(CC) $(FLAGS) -DVERSION=\"$(VERSION)\" -o zoneserver zoneserver.c $(OBJECTS)
+	$(CC) $(FLAGS) -DVERSION=\"$(VERSION)\" -o zoneserver zoneserver.c $(OBJECTS) $(LIBS)
 
diff -urbdN maradns-0.8.35/tuzona/zoneserver.c maradns-0.8.35-1/tuzona/zoneserver.c
--- maradns-0.8.35/tuzona/zoneserver.c	Wed Oct 17 02:44:48 2001
+++ maradns-0.8.35-1/tuzona/zoneserver.c	Tue Nov 20 21:02:29 2001
@@ -627,10 +627,10 @@
 
     rlim.rlim_cur = rlim.rlim_max = maxprocs;
 
-#ifndef SOLARIS
+#if !defined(SOLARIS) && !defined(__CYGWIN__)
     if(setrlimit(RLIMIT_NPROC,&rlim) != 0)
         harderror(L_SETMAX); /* "Unable to set maximum number of processes" */
-#endif
+#endif /* SOLARIS, _CYGWIN__ */
 
     /* Determine the level of error reporting */
     if(js_qstr2js(kvar_query,"verbose_level") == JS_ERROR)

[-- Attachment #3: Type: text/plain, Size: 214 bytes --]

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Fwd: Re: DNS server LaMaraDNS is running on cygwin
@ 2001-11-14  3:43 Gerrit P. Haase
  2001-11-14  7:38 ` Max Bowsher
  0 siblings, 1 reply; 14+ messages in thread
From: Gerrit P. Haase @ 2001-11-14  3:43 UTC (permalink / raw)
  To: cygwin

Hallo Christopher,

Am 2001-11-21 um 04:15 schriebst du:

>>I have successful compiled ?LaMaraDNS! ( http://www.maradns.org/ )
>>?LaMaraDNS! is an alpha-quality authoritative and recursive (caching)
>>DNS server.

> Cool.  Does this provide us with libresolv.a, too?

Nope, I don't think so.

But there are alternative client libraries, aka 'stub resolver' like
'ares':
ftp://athena-dist.mit.edu/pub/ATHENA/ares/ which includes two
executables, 'adig' and 'ahost' as examples how to write interfaces and
'adns':
http://www.chiark.greenend.org.uk/~ian/adns/ which includes three
executables 'adnslogres', 'adnsresfilter', 'adnshost' .

Both are building OOTB and provide a similar interface as libresolv.

I have a version of 'ares' up at my site:
http://timtowtdi.topcities.com/cygwin/ares/

I have also a modified standalone libresolv version taken from ZMailer
which was taken from bind-4.9.4-REL/res/ but this needs some sanitizing.

Ciao,

Gerrit P. Haase                            mailto:gp@familiehaase.de
-- 
=^..^=


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2001-11-21 20:44 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-13 15:29 DNS server LaMaraDNS is running on cygwin Gerrit P. Haase
2001-11-13 15:38 ` Christopher Faylor
2001-11-14  3:43 Fwd: " Gerrit P. Haase
2001-11-14  7:38 ` Max Bowsher
2001-11-14  9:22   ` Gerrit P. Haase
2001-11-14 11:13     ` Max Bowsher
2001-11-14 12:13       ` Gerrit P. Haase
2001-11-21  6:47         ` Gerrit P. Haase
2001-11-21  6:07       ` Max Bowsher
2001-11-21  5:43     ` Gerrit P. Haase
2001-11-14 13:19   ` Stipe Tolj
2001-11-14 13:39     ` Max Bowsher
2001-11-21  8:44       ` Max Bowsher
2001-11-14 14:16     ` Bill Karh
2001-11-21 12:44       ` Bill Karh
2001-11-21  7:59     ` Stipe Tolj

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).