[KLUG Members] Samba wins-to-dns

Peter Buxton members@kalamazoolinux.org
Fri, 16 Aug 2002 11:19:11 -0400


--LZvS9be/3tNcYl/X
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable


Well, judging from the mailling list traffic, it seems they stopped
handing out dns_update (you can get it from the website) and started
distributing this:

cares:00:09am:~$ cat wins2dns.awk
#!/usr/bin/awk -f
#
# Date: Wed, 26 Aug 1998 10:37:39 -0600 (MDT)
# From: Jason Gunthorpe <jgg@deltatee.com>
# To: samba@packages.debian.org
# Subject: Nifty samba script
#
# Here is a really nifty script I just wrote for samba, it takes the
# wins database in /var/samba/wins and writes out two dns files for it.
# In this way network wide wins clients can get into the dns for use by
# unix machines.
#
# Perhaps this could be included in  /usr/doc/examples or somesuch.
#

BEGIN {
  FS=3D"#|\"";
FORWARD=3D"/tmp/wins.hosts"
REVERSE=3D"/tmp/wins.rev"
DOMAIN=3D"caresswm.org"
}
$3 =3D=3D "00" {
  split($4,a," " );
  split(a[2],b,".");
  while (sub(" ","-",$2));
  $2=3Dtolower($2);
  if (b[1] =3D=3D "255")
    next;
  if (length($2) >=3D 8)
    print $2"\ta\t"a[2] > FORWARD
  else
    print $2"\t\ta\t"a[2] > FORWARD
  print b[4]"."b[3]"\t\tptr\t"$2"."DOMAIN"." > REVERSE
}
END {
  system("echo killall -HUP named");
}

cares:00:08am:~$ cat /tmp/wins.hosts
bob             a       192.168.1.32
casemanager-1   a       192.168.1.31
casemanager-3   a       192.168.1.43
casemanager-4   a       192.168.1.42
casemgr2        a       192.168.1.141
devdirector     a       192.168.1.250
execdirector    a       192.168.1.47
hiveducator-1   a       192.168.1.44
julia           a       192.168.1.35
cares:00:09am:~$ cat /tmp/wins.rev
32.1            ptr     bob.caresswm.org.
31.1            ptr     casemanager-1.caresswm.org.
43.1            ptr     casemanager-3.caresswm.org.
42.1            ptr     casemanager-4.caresswm.org.
141.1           ptr     casemgr2.caresswm.org.
250.1           ptr     devdirector.caresswm.org.
47.1            ptr     execdirector.caresswm.org.
44.1            ptr     hiveducator-1.caresswm.org.
35.1            ptr     julia.caresswm.org.
cares:00:09am:~$



--=20
http://killdevil.ath.cx/~peter (/gpg.html)
You can fill my head with Gummi Bears,
but I won't talk! -- Tom Servo, K13.

--LZvS9be/3tNcYl/X
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9XRfvaAK8ZwqLoskRAnTqAKCkljd6H80PcQ0A85DujxCnNGEiSgCcCQXx
VUDgPMC3Z3oAPovtWvxxTEI=
=DmEn
-----END PGP SIGNATURE-----

--LZvS9be/3tNcYl/X--