Hi all,

I've fixed this bug. I'll do an NMU very soon. The debdiff is as attachment.

The major changes are:

1. Use debhelper 13.

2. Use DebSrc3.0. So we split diff.gz to debian/patches


If no one object this after 10 days. I'll upload this to delay/10 queue.


Yours,
Paul

diff -Nru nat-1.0/client.c nat-1.0/client.c
--- nat-1.0/client.c	2022-04-26 22:51:30.000000000 +0800
+++ nat-1.0/client.c	1997-02-17 11:18:04.000000000 +0800
@@ -2711,7 +2711,7 @@
 		(CVAL (inbuf, smb_rcls), SVAL (inbuf, smb_err));
 /* this "can't happen" but does against misconfigured samba, fer example */
       if ((cur_serr == 2) && (sec_mode & 1))
-	DEBUG (1,("Wanted TCon passwd in USER-mode sec!!!\n"));
+	DEBUG (1,("Wanted TCon passwd in USER-mode sec?!??!\n"));
       return(False);
     } /* if smb_rcls err */
 
@@ -3521,7 +3521,7 @@
     natprintf("[*]--- CONNECTED with name: %s\n", p);
 #endif
 
-    DEBUG(1,("session to %s (0x%x) open\n", desthost, name_type));
+    DEBUG(0,("session to %s (0x%x) open\n", desthost, name_type));
     phase = 2;
     goto phase_2;
   } else {
@@ -3613,7 +3613,7 @@
   username[0] = '\0';
   while (!done) {
     if (!userfd || !passfd)
-       done = !uppair();
+       uppair();
     else {
        if (fgets(password, sizeof(password), passfd) == NULL) {
           rewind(passfd);
@@ -3636,11 +3636,8 @@
     }
 
     if ((! *username) && (! *password))
-      done = !uppair();				/* sleaze for NT */
+      uppair();				/* sleaze for NT */
 
-    if (done)
-        break; /* Stop when uppair is done */
-    
 #ifdef VERBOSE
   natprintf("[*]--- Attempting to connect with Username: `%s' Password: `%s'\n",
            username, password);
diff -Nru nat-1.0/debian/changelog nat-1.0/debian/changelog
--- nat-1.0/debian/changelog	2022-04-26 22:51:30.000000000 +0800
+++ nat-1.0/debian/changelog	2022-04-26 22:48:16.000000000 +0800
@@ -1,3 +1,15 @@
+nat (1:1.0-6.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Migrate to debhelper-compat version 13 (Closes: #965744, #1004018)
+    - Delete debian/compat
+    - Build-Depends on debhelper-compat (= 13)
+  * Use DebSrc3.0 (quilt)
+    - Split diff.gz to debian/patches
+  * debian/control: Change Priority from extra to optional
+
+ -- Ying-Chun Liu (PaulLiu) <paul...@debian.org>  Tue, 26 Apr 2022 22:48:16 +0800
+
 nat (1:1.0-6) unstable; urgency=medium
 
   * include.h: Apply patch provided by Cyril Roelandt to fix 
diff -Nru nat-1.0/debian/compat nat-1.0/debian/compat
--- nat-1.0/debian/compat	2022-04-26 22:51:30.000000000 +0800
+++ nat-1.0/debian/compat	1970-01-01 08:00:00.000000000 +0800
@@ -1 +0,0 @@
-5
diff -Nru nat-1.0/debian/control nat-1.0/debian/control
--- nat-1.0/debian/control	2022-04-26 22:51:30.000000000 +0800
+++ nat-1.0/debian/control	2022-04-26 22:26:59.000000000 +0800
@@ -1,8 +1,8 @@
 Source: nat
 Section: admin
-Priority: extra
+Priority: optional
 Maintainer: Javier Fernandez-Sanguino Peña <j...@debian.org>
-Build-Depends: debhelper (>> 3.0.0)
+Build-Depends: debhelper-compat (= 13)
 Standards-Version: 3.9.6
 Homepage: http://www.tux.org/pub/security/secnet/tools/nat10/
 
diff -Nru nat-1.0/debian/patches/0001_add_samples.patch nat-1.0/debian/patches/0001_add_samples.patch
--- nat-1.0/debian/patches/0001_add_samples.patch	1970-01-01 08:00:00.000000000 +0800
+++ nat-1.0/debian/patches/0001_add_samples.patch	2022-04-26 22:21:34.000000000 +0800
@@ -0,0 +1,99 @@
+Index: nat-1.0/samples/localhost-samba.log
+===================================================================
+--- /dev/null
++++ nat-1.0/samples/localhost-samba.log
+@@ -0,0 +1,38 @@
++
++[*]--- Checking host: 127.0.0.1
++[*]--- Obtaining list of remote NetBIOS names
++[*]--- Remote systems name tables:
++
++     LINUX
++     LINUX
++     LINUX
++     __MSBROWSE__
++     SAMBA
++     SAMBA
++     SAMBA
++     SAMBA
++
++[*]--- Attempting to connect with name: *
++[*]--- CONNECTED with name: *
++[*]--- Attempting to connect with protocol: MICROSOFT NETWORKS 1.03
++[*]--- Remote server wants us to encrypt, telling it not to
++[*]--- Attempting to connect with protocol: PC NETWORK PROGRAM 1.0
++[*]--- Attempting to establish session
++
++[*]--- Attempting to access share: \\*\
++[*]--- Unable to access
++
++[*]--- Attempting to access share: \\*\ADMIN$
++[*]--- Unable to access
++
++[*]--- Attempting to access share: \\*\C$
++[*]--- Unable to access
++
++[*]--- Attempting to access share: \\*\D$
++[*]--- Unable to access
++
++[*]--- Attempting to access share: \\*\ROOT
++[*]--- Unable to access
++
++[*]--- Attempting to access share: \\*\WINNT$
++[*]--- Unable to access
+Index: nat-1.0/samples/w2000as.log
+===================================================================
+--- /dev/null
++++ nat-1.0/samples/w2000as.log
+@@ -0,0 +1,51 @@
++
++[*]--- Checking host: 192.168.0.159
++[*]--- Obtaining list of remote NetBIOS names
++[*]--- Remote systems name tables:
++
++     INet~Services
++     IS~W2000AS
++     W2000AS
++     W2000AS
++     WORKGROUP
++     ADMINISTRATOR
++     W2000AS
++     WORKGROUP
++     IWAM_W2000AS
++     WORKGROUP
++     __MSBROWSE__
++
++[*]--- Attempting to connect with name: *
++[*]--- Unable to connect
++
++[*]--- Attempting to connect with name: INet~Services
++[*]--- Unable to connect
++
++[*]--- Attempting to connect with name: IS~W2000AS
++[*]--- Unable to connect
++
++[*]--- Attempting to connect with name: W2000AS
++[*]--- CONNECTED with name: W2000AS
++[*]--- Attempting to connect with protocol: MICROSOFT NETWORKS 1.03
++[*]--- Server time is Wed Jan 25 17:21:06 2006
++[*]--- Timezone is UTC-0.0
++[*]--- Remote server wants us to encrypt, telling it not to
++[*]--- Attempting to establish session
++
++[*]--- Attempting to access share: \\W2000AS\
++[*]--- Unable to access
++
++[*]--- Attempting to access share: \\W2000AS\ADMIN$
++[*]--- Unable to access
++
++[*]--- Attempting to access share: \\W2000AS\C$
++[*]--- Unable to access
++
++[*]--- Attempting to access share: \\W2000AS\D$
++[*]--- Unable to access
++
++[*]--- Attempting to access share: \\W2000AS\ROOT
++[*]--- Unable to access
++
++[*]--- Attempting to access share: \\W2000AS\WINNT$
++[*]--- Unable to access
diff -Nru nat-1.0/debian/patches/0002_patch_manpage.patch nat-1.0/debian/patches/0002_patch_manpage.patch
--- nat-1.0/debian/patches/0002_patch_manpage.patch	1970-01-01 08:00:00.000000000 +0800
+++ nat-1.0/debian/patches/0002_patch_manpage.patch	2022-04-26 22:21:37.000000000 +0800
@@ -0,0 +1,23 @@
+Index: nat-1.0/nat.1
+===================================================================
+--- nat-1.0.orig/nat.1
++++ nat-1.0/nat.1
+@@ -17,10 +17,12 @@ the specified file, in addition to stand
+ Specify the file to read \fBusernames\fP from.  Usernames will be read from
+ the specified file when attempting to guess the password on the remote server.
+ Usernames should appear one per line in the specified file.
++A sample username file can be found at \fB/usr/share/nat/userlist.txt\fP.
+ .IP \fB-p\fP
+ Specify the file to read \fBpasswords\fP from.  Passwords will be read from
+ the specified file when attempting to guess the password on the remote server.
+ Passwords should appear one per line in the specified file.
++A sample password file can be found at \fB/usr/share/nat/passlist.txt\fP.
+ .IP \fB<address>\fP
+ Addresses should be specified in comma deliminated format, with no spaces.
+ Valid address specifications include:
+@@ -68,4 +70,4 @@ operating systems:
+ \fBWindows 95\fP
+ 
+ .SH FILES
+-\fBnat\fP, \fBuserlist.txt\fP, \fBpasslist.txt\fP
++\fBnat\fP, \fB/usr/share/nat/userlist.txt\fP, \fB/usr/share/nat/passlist.txt\fP
diff -Nru nat-1.0/debian/patches/0003_add_patch.patch nat-1.0/debian/patches/0003_add_patch.patch
--- nat-1.0/debian/patches/0003_add_patch.patch	1970-01-01 08:00:00.000000000 +0800
+++ nat-1.0/debian/patches/0003_add_patch.patch	2022-04-26 22:23:45.000000000 +0800
@@ -0,0 +1,30 @@
+Index: nat-1.0/patch
+===================================================================
+--- /dev/null
++++ nat-1.0/patch
+@@ -0,0 +1,25 @@
++diff -Naur nat-1.0.orig/client.c nat-1.0/client.c
++--- nat-1.0.orig/client.c	1997-02-17 04:18:04.000000000 +0100
+++++ nat-1.0/client.c	2003-02-20 14:24:53.000000000 +0100
++@@ -3613,7 +3613,7 @@
++   username[0] = '\0';
++   while (!done) {
++     if (!userfd || !passfd)
++-       uppair();
+++       done = !uppair();
++     else {
++        if (fgets(password, sizeof(password), passfd) == NULL) {
++           rewind(passfd);
++@@ -3636,8 +3636,11 @@
++     }
++ 
++     if ((! *username) && (! *password))
++-      uppair();				/* sleaze for NT */
+++      done = !uppair();				/* sleaze for NT */
++ 
+++    if (done)
+++        break; /* Stop when uppair is done */
+++    
++ #ifdef VERBOSE
++   natprintf("[*]--- Attempting to connect with Username: `%s' Password: `%s'\n",
++            username, password);
diff -Nru nat-1.0/debian/patches/0004_add_sig_handler.patch nat-1.0/debian/patches/0004_add_sig_handler.patch
--- nat-1.0/debian/patches/0004_add_sig_handler.patch	1970-01-01 08:00:00.000000000 +0800
+++ nat-1.0/debian/patches/0004_add_sig_handler.patch	2022-04-26 22:25:09.000000000 +0800
@@ -0,0 +1,548 @@
+Index: nat-1.0/Makefile
+===================================================================
+--- nat-1.0.orig/Makefile
++++ nat-1.0/Makefile
+@@ -362,17 +362,19 @@ LIBSM =
+ # DON'T EDIT BELOW THIS LINE
+ ######################################################################
+ 
+-SRCS = nat.c client.c util.c system.c nmb.c charset.c parse_ip.c
+-OBJS = nat.o client.o util.o system.o nmb.o charset.o parse_ip.o
++SRCS = nat.c client.c util.c system.c nmb.c charset.c parse_ip.c sighandler.c
++OBJS = nat.o client.o util.o system.o nmb.o charset.o parse_ip.o sighandler.o
++CLIENT_OBJS = client.o util.o system.o nmb.o charset.o parse_ip.o sighandler.o
+ CFLAGS1 = -DSTEPPING -DSCANNER -DVERBOSE
+ CFLAGS2 = -DWORKGROUP=\"$(WORKGROUP)\" -DGUEST_ACCOUNT=\"$(GUESTACCOUNT)\" 
+-CFLAGS = $(CFLAGS1) $(CFLAGS2) $(FLAGSM)
++CFLAGS = $(CFLAGS1) $(CFLAGS2) $(FLAGSM) -ggdb -Wall
++CLIENT_CFLAGS = -DVERBOSE $(CFLAGS2) $(FLAGSM) -ggdb -Wall
+ LIBS = $(LIBSM)
+ 
+ all : nat
+ 
+-INCLUDES = version.h local.h includes.h smb.h
+-PROGS = nat
++INCLUDES = version.h local.h includes.h smb.h sighandler.h
++PROGS = nat client
+ 
+ .SUFFIXES:
+ .SUFFIXES: .c .o .h
+@@ -384,5 +386,8 @@ PROGS = nat
+ nat:	$(OBJS)
+ 	$(CC) $(CFLAGS) -o nat $(STATIC) $(OBJS) $(LIBS)
+ 
++client: $(CLIENT_OBJS)
++	$(CC) $(CLIENT_CFLAGS) -o client $(STATIC) $(CLIENT_OBJS) $(LIBS)
++
+ clean:
+ 	rm -f core *.o *~ $(PROGS)
+Index: nat-1.0/client.c
+===================================================================
+--- nat-1.0.orig/client.c
++++ nat-1.0/client.c
+@@ -2711,7 +2711,7 @@ static BOOL send_tcon (char *inbuf,char
+ 		(CVAL (inbuf, smb_rcls), SVAL (inbuf, smb_err));
+ /* this "can't happen" but does against misconfigured samba, fer example */
+       if ((cur_serr == 2) && (sec_mode & 1))
+-	DEBUG (1,("Wanted TCon passwd in USER-mode sec?!??!\n"));
++	DEBUG (1,("Wanted TCon passwd in USER-mode sec!!!\n"));
+       return(False);
+     } /* if smb_rcls err */
+ 
+@@ -3521,7 +3521,7 @@ phase_1:				/* pass the wacky rfc1002 st
+     natprintf("[*]--- CONNECTED with name: %s\n", p);
+ #endif
+ 
+-    DEBUG(0,("session to %s (0x%x) open\n", desthost, name_type));
++    DEBUG(1,("session to %s (0x%x) open\n", desthost, name_type));
+     phase = 2;
+     goto phase_2;
+   } else {
+@@ -3613,7 +3613,7 @@ phase_3:				/* smb session setup/auth */
+   username[0] = '\0';
+   while (!done) {
+     if (!userfd || !passfd)
+-       uppair();
++       done = !uppair();
+     else {
+        if (fgets(password, sizeof(password), passfd) == NULL) {
+           rewind(passfd);
+@@ -3636,8 +3636,11 @@ phase_3:				/* smb session setup/auth */
+     }
+ 
+     if ((! *username) && (! *password))
+-      uppair();				/* sleaze for NT */
++      done = !uppair();				/* sleaze for NT */
+ 
++    if (done)
++        break; /* Stop when uppair is done */
++    
+ #ifdef VERBOSE
+   natprintf("[*]--- Attempting to connect with Username: `%s' Password: `%s'\n",
+            username, password);
+Index: nat-1.0/includes.h
+===================================================================
+--- nat-1.0.orig/includes.h
++++ nat-1.0/includes.h
+@@ -111,6 +111,9 @@
+ #define NO_NETIFH
+ #endif
+ 
++#ifdef __GNU__
++#define NO_SYSMOUNTH
++#endif
+ 
+ #if (defined(SHADOW_PWD)||defined(OSF1_ENH_SEC)||defined(SecureWare)||defined(PWDAUTH))
+ #define PASSWORD_LENGTH 16
+@@ -164,6 +167,8 @@
+ #endif
+ #ifndef NO_SYSMOUNTH
+ #include <sys/mount.h>
++#elif !defined(NO_SYSSTATFSH)
++#include <sys/statfs.h>
+ #endif
+ #include <pwd.h>
+ #ifdef __STDC__
+Index: nat-1.0/nat.c
+===================================================================
+--- nat-1.0.orig/nat.c
++++ nat-1.0/nat.c
+@@ -2,17 +2,18 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <sys/types.h>
++#include <getopt.h>
+ 
+-#ifdef _WIN32
+- #include <arpa/inet.h>
+-#endif
++#include <arpa/inet.h>
+ 
+ #ifdef __STDC__
+ #include <stdarg.h>
+ #else
+ #include <varargs.h>
+ #endif
++#include "sighandler.h"
+ #include "parse_ip.h"
++#include "util.h"
+ 
+ extern char *optarg;
+ extern int optind;
+@@ -30,22 +31,25 @@ struct vuln_res {
+   struct vuln_res *vr_next;
+ };
+ 
++int nas_step (unsigned long xip);
++char *StrnCpy(char *dest,const char *src,int n);
+ void natprintf(char *format, ...);
+ struct vuln_res *module_16000();
+ 
++extern int DEBUGLEVEL;
++
+ int main(argc, argv)
+ int argc;
+ char **argv;
+ {
+    struct vuln_res *vr;
+-   u_long ipaddr;
+    int opt;
+    char *progname;
+    struct ipstr *hosts;
+ 
+    progname = strdup(argv[0]);
+ 
+-   while ((opt = getopt(argc, argv, "o:u:p:")) != -1)
++   while ((opt = getopt(argc, argv, "d:o:u:p:")) != -1)
+       switch(opt) {
+          case 'o': outputfile = strdup(optarg);
+                    break;
+@@ -53,18 +57,30 @@ char **argv;
+                    break;
+          case 'p': passfile = strdup(optarg);
+                    break;
++         case 'd': DEBUGLEVEL = atoi(strdup(optarg));
++                   break;
+          default : exit(-1);
+       }
+ 
++
+    argc -= optind;
+    argv += optind;
+ 
+    if (argc < 1) {
+-      fprintf(stderr,"usage: %s [-o filename] [-u userlist] [-p passlist]"\
++      fprintf(stderr,"usage: %s [-o filename] [-u userlist] [-p passlist] [-d debuglevel]"\
+               " <address>\n", progname);
+       exit(1);
+    }
+ 
++   setup_logging(progname, True);
++   /* Set up signals */
++   set_signal(SIGSEGV, sighandler);
++   set_signal(SIGTERM, sighandler);
++   set_signal(SIGINT, sighandler);
++   set_signal(SIGHUP, SIG_IGN);
++   set_signal(SIGPIPE, sighandler); /* Network errors are treated by the app */
++
++
+    if (userfile) {
+       if ((userfd = fopen(userfile, "r")))
+          natprintf("[*]--- Reading usernames from %s\n", userfile);
+@@ -262,7 +278,7 @@ u_long ipaddr;
+     vvr_strings[ptr_vvr] = pp;		/* chain off to real result string */
+     ptr_vvr++;
+ 
+-    while (pp = get_vuln (i)) {		/* collect the rest of 'em */
++    while ((pp = get_vuln (i))) {		/* collect the rest of 'em */
+       vvr_strings[ptr_vvr] = pp;
+       ptr_vvr++;
+     }
+@@ -304,7 +320,6 @@ va_dcl
+ #endif
+   va_list ap;
+   static FILE *outfd = NULL;
+-  char *s;
+ 
+ #ifdef __STDC__
+    va_start(ap, format);
+@@ -328,3 +343,4 @@ va_dcl
+    vfprintf(outfd, format, ap);
+    return;
+ }
++
+Index: nat-1.0/nmb.c
+===================================================================
+--- nat-1.0.orig/nmb.c
++++ nat-1.0/nmb.c
+@@ -40,7 +40,6 @@ static fstring tbuf;
+ #endif /* SCANNER */
+ 
+ int Debug1(char *, ...);
+-int Debug1();
+ 
+ int num_good_sends=0;
+ int  num_good_receives=0;
+@@ -790,8 +789,7 @@ extern char * try_pass[];
+  */
+ static void H_interpret_node_status(char *p)
+ {
+-/*  int level = (master||rname)?4:0; */
+-  int level = 0;			/* always print */
++  int level = 10;
+   int numnames = CVAL(p,0);
+ 
+   DEBUG(level,("received %d names\n",numnames));
+Index: nat-1.0/parse_ip.h
+===================================================================
+--- nat-1.0.orig/parse_ip.h
++++ nat-1.0/parse_ip.h
+@@ -8,3 +8,6 @@ struct ipstr {
+    char *name;
+    struct ipstr *next;
+ };
++
++struct ipstr *parse_ip(char *input);
++
+Index: nat-1.0/sighandler.c
+===================================================================
+--- /dev/null
++++ nat-1.0/sighandler.c
+@@ -0,0 +1,113 @@
++/* Nessus
++ * Copyright (C) 1998 - 2004 Renaud Deraison
++ *
++ * Adapted for the Netbios Auditing Tool by Javier Fernandez-Sanguino
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2,
++ * as published by the Free Software Foundation
++ *
++ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
++ *
++ *
++ * Signals handlers
++ */
++
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++
++#include "sighandler.h"
++#ifdef HAVE_SYS_WAIT_H
++#include <sys/wait.h>
++#endif
++#ifdef HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++#ifdef HAVE_SYS_RESOURCE_H
++#include <sys/resource.h>
++#endif
++
++
++void (*set_signal(int signum, void (*handler)(int)))(int)
++{
++	struct sigaction saNew,saOld;
++
++	/* Init new handler */
++	sigfillset(&saNew.sa_mask);
++	sigdelset(&saNew.sa_mask, SIGALRM); /* make sleep() work */
++
++	saNew.sa_flags = 0;
++# ifdef HAVE_SIGNAL_SA_RESTORER
++	saNew.sa_restorer = 0; /* not avail on Solaris - jordan */
++# endif
++	saNew.sa_handler = handler;
++
++	sigaction(signum, &saNew, &saOld);
++	return saOld.sa_handler;
++}
++
++
++void sighandler(sign)
++	int sign;
++{
++	char * sig = NULL;
++	int murderer = 0;
++
++	switch(sign)
++	{
++		case SIGTERM:
++			sig = "TERM";
++			close_sockets();
++			break;
++		case SIGINT :
++			sig = "INT";
++			close_sockets();
++			break;
++		case SIGPIPE :
++			sig = "PIPE";
++			close_sockets();
++			break;
++		case SIGSEGV :
++#ifdef HAVE__EXIT
++			signal(SIGSEGV, _exit);
++#else
++			signal(SIGSEGV, exit);
++#endif
++			sig = "SEGV";
++			break;
++		default:
++			sig = "unknown signal";
++	}
++	fprintf(stderr, "Received signal %s!\n", sig);
++#ifdef HAVE__EXIT
++	_exit(1);
++#else
++	exit(1);
++#endif
++
++}
++
++
++void sighand_segv()
++{
++#ifdef HAVE__EXIT
++	signal(SIGSEGV, _exit);
++#else
++	signal(SIGSEGV, exit);
++#endif
++	fprintf(stderr, "Received SIGSEGV!\n");
++#ifdef HAVE__EXIT
++	_exit(1);
++#else
++	exit(1);
++#endif
++}
++
+Index: nat-1.0/sighandler.h
+===================================================================
+--- /dev/null
++++ nat-1.0/sighandler.h
+@@ -0,0 +1,36 @@
++/* Signal handler from Nessus
++ * Copyright (C) 1998 Renaud Deraison
++ *
++ * Adapted to the Netbios Auditing Tool by Javier Fernandez-Sanguino
++ *
++ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
++ */
++
++#ifndef _NAT_SIGHAND_H
++#define _NAT_SIGHAND_H
++
++#include <signal.h>
++
++extern void (*set_signal(int signum, void (*handler)(int)))(int);
++extern void sighand_pipe();
++extern void sighand_term();
++extern void sighand_int();
++extern void sighand_kill();
++extern void sighand_segv();
++extern void sighand_io();
++extern void sighandler(int sign);
++
++#endif
++
+Index: nat-1.0/util.c
+===================================================================
+--- nat-1.0.orig/util.c
++++ nat-1.0/util.c
+@@ -78,7 +78,7 @@ int case_default = CASE_LOWER;
+ /* size of reads during a direct file to file transfer */
+ int ReadSize = 16*1024;
+ 
+-pstring debugf = "/tmp/log.samba";
++pstring debugf = "smb-nat.log";
+ int syslog_level;
+ 
+ /* the following control case operations - they are put here so the
+@@ -236,8 +236,8 @@ va_dcl
+     }
+   
+   va_end(ap);
+-  return(0);
+ #endif /* SCANNER */
++  return(0);
+ }
+ 
+ /****************************************************************************
+@@ -510,13 +510,14 @@ determine if a file descriptor is in fac
+ ****************************************************************************/
+ BOOL is_a_socket(int fd)
+ {
+-  int v,l;
++  int v;
++  socklen_t l;
+   l = sizeof(int);
+ #ifdef _WIN32
+   /* evil, but it works */
+   return(0);
+ #else
+-  return(getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&v, &l) == 0);
++  return(getsockopt(fd, SOL_SOCKET, SO_TYPE, (void *)&v, &l) == 0);
+ #endif  
+ }
+ 
+@@ -2094,8 +2095,13 @@ int read_udp_socket(int fd,char *buf,int
+ {
+   int ret;
+   struct sockaddr sock;
+-  int socklen;
++  socklen_t socklen;
+   
++  /* Just in case */
++  if (fd <= 0) {
++      DEBUG(2,("no valid file descriptor to read the socket\n"));
++      return(0);
++  }
+   socklen = sizeof(sock);
+   bzero((char *)&sock,socklen);
+   bzero((char *)&lastip,sizeof(lastip));
+@@ -2178,6 +2184,10 @@ int read_with_timeout(int fd,char *buf,i
+   struct timeval timeout, tval1, tval2, tvaldiff;
+ 
+   /* just checking .... */
++  if (fd <= 0) {
++      DEBUG(2,("no valid file descriptor to read the socket\n"));
++      return(0);
++  }
+   if (maxcnt <= 0) return(0);
+ 
+   if(time_out == -2)
+@@ -2373,6 +2383,11 @@ int write_data(int fd,char *buffer,int N
+ {
+   int total=0;
+   int ret;
++  /* Just in case */
++  if (fd <= 0) {
++      DEBUG(2,("no valid file descriptor to write_data\n"));
++      return(0);
++  }
+ 
+   while (total < N)
+     {
+@@ -2675,6 +2690,18 @@ BOOL send_smb(int fd,char *buffer)
+   int ret,nwritten=0;
+   len = smb_len(buffer) + 4;
+ 
++  /* Just in case */
++  if (fd <= 0) {
++      DEBUG(2,("no valid file descriptor to send_smb\n"));
++      return False;
++  }
++  /* Is this socket alive? */
++  if ( send_keepalive(fd) < 0 ) {
++      DEBUG(2,("session is no longer available\n"));
++      /* Restore the session? */
++      return False;
++  }
++
+   while (nwritten < len)
+     {
+       ret = write_socket(fd,buffer+nwritten,len - nwritten);
+Index: nat-1.0/util.h
+===================================================================
+--- /dev/null
++++ nat-1.0/util.h
+@@ -0,0 +1,41 @@
++/*
++ * This file has been modified from the original Samba package
++ * by Secure Networks Inc., January and February, 1997.  This package and
++ * all code which it is based on falls under the GNU Public License
++ * agreement.
++ */
++
++/* 
++   Unix SMB/Netbios implementation.
++   Version 1.9.
++   Samba utility functions
++   Copyright (C) Andrew Tridgell 1992-1995
++   
++   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., 675 Mass Ave, Cambridge, MA 02139, USA.
++*/
++
++#ifndef _NAT_UTIL_H
++#define _NAT_UTIL_H
++
++typedef int BOOL;
++#define False (0)
++#define True (1)
++
++void setup_logging(char *pname, BOOL interactive);
++#ifdef __STDC__
++int Debug1(char *format_str, ...);
++#endif
++
++#endif
diff -Nru nat-1.0/debian/patches/series nat-1.0/debian/patches/series
--- nat-1.0/debian/patches/series	1970-01-01 08:00:00.000000000 +0800
+++ nat-1.0/debian/patches/series	2022-04-26 22:24:31.000000000 +0800
@@ -0,0 +1,4 @@
+0001_add_samples.patch
+0002_patch_manpage.patch
+0003_add_patch.patch
+0004_add_sig_handler.patch
diff -Nru nat-1.0/debian/rules nat-1.0/debian/rules
--- nat-1.0/debian/rules	2022-04-26 22:51:30.000000000 +0800
+++ nat-1.0/debian/rules	2022-04-26 22:11:05.000000000 +0800
@@ -5,73 +5,9 @@
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
-# This is the debhelper compatibility version to use.
-#export DH_COMPAT=4
+%:
+	dh $@
 
-
-
-ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
-	CFLAGS += -g
-endif
-ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
-	INSTALL_PROGRAM += -s
-endif
-
-configure: configure-stamp
-configure-stamp:
-	dh_testdir
-	touch configure-stamp
-
-
-build: build-arch build-indep
-build-arch: build-stamp
-build-indep: build-stamp
-
-build-stamp: configure-stamp 
-	dh_testdir
-	$(MAKE)
-	touch build-stamp
-
-clean:
-	dh_testdir
-	dh_testroot
-	rm -f build-stamp configure-stamp
-	$(MAKE) clean
-	dh_clean
-
-install: build
-	dh_testdir
-	dh_testroot
-	dh_clean -k
-	dh_installdirs
+override_dh_auto_install:
+	dh_auto_install
 	install -m 755 nat $(CURDIR)/debian/smb-nat/usr/bin/smb-nat
-	install -m 644 userlist.txt $(CURDIR)/debian/smb-nat/usr/share/smb-nat
-	install -m 644 passlist.txt $(CURDIR)/debian/smb-nat/usr/share/smb-nat
-
-
-# Build architecture-independent files here.
-binary-indep: build install
-# We have nothing to do by default.
-
-# Build architecture-dependent files here.
-binary-arch: build install
-	dh_testdir
-	dh_testroot
-	dh_installdocs
-	dh_installexamples
-	dh_installmenu
-	dh_installman debian/smb-nat.1
-	dh_installinfo
-	dh_installchangelogs 
-	dh_link
-	dh_strip
-	dh_compress
-	dh_fixperms
-	dh_installdeb
-	dh_shlibdeps
-	dh_gencontrol
-	dh_md5sums
-	dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install configure
diff -Nru nat-1.0/debian/smb-nat.install nat-1.0/debian/smb-nat.install
--- nat-1.0/debian/smb-nat.install	1970-01-01 08:00:00.000000000 +0800
+++ nat-1.0/debian/smb-nat.install	2022-04-26 22:11:12.000000000 +0800
@@ -0,0 +1,2 @@
+userlist.txt usr/share/smb-nat/
+passlist.txt usr/share/smb-nat/
diff -Nru nat-1.0/debian/smb-nat.manpages nat-1.0/debian/smb-nat.manpages
--- nat-1.0/debian/smb-nat.manpages	1970-01-01 08:00:00.000000000 +0800
+++ nat-1.0/debian/smb-nat.manpages	2022-04-26 22:05:53.000000000 +0800
@@ -0,0 +1 @@
+debian/smb-nat.1
diff -Nru nat-1.0/debian/source/format nat-1.0/debian/source/format
--- nat-1.0/debian/source/format	1970-01-01 08:00:00.000000000 +0800
+++ nat-1.0/debian/source/format	2022-04-26 22:11:35.000000000 +0800
@@ -0,0 +1 @@
+3.0 (quilt)
diff -Nru nat-1.0/includes.h nat-1.0/includes.h
--- nat-1.0/includes.h	2022-04-26 22:51:30.000000000 +0800
+++ nat-1.0/includes.h	1997-02-17 11:18:04.000000000 +0800
@@ -111,9 +111,6 @@
 #define NO_NETIFH
 #endif
 
-#ifdef __GNU__
-#define NO_SYSMOUNTH
-#endif
 
 #if (defined(SHADOW_PWD)||defined(OSF1_ENH_SEC)||defined(SecureWare)||defined(PWDAUTH))
 #define PASSWORD_LENGTH 16
@@ -167,8 +164,6 @@
 #endif
 #ifndef NO_SYSMOUNTH
 #include <sys/mount.h>
-#elif !defined(NO_SYSSTATFSH)
-#include <sys/statfs.h>
 #endif
 #include <pwd.h>
 #ifdef __STDC__
diff -Nru nat-1.0/Makefile nat-1.0/Makefile
--- nat-1.0/Makefile	2022-04-26 22:51:30.000000000 +0800
+++ nat-1.0/Makefile	2002-05-30 05:59:14.000000000 +0800
@@ -362,19 +362,17 @@
 # DON'T EDIT BELOW THIS LINE
 ######################################################################
 
-SRCS = nat.c client.c util.c system.c nmb.c charset.c parse_ip.c sighandler.c
-OBJS = nat.o client.o util.o system.o nmb.o charset.o parse_ip.o sighandler.o
-CLIENT_OBJS = client.o util.o system.o nmb.o charset.o parse_ip.o sighandler.o
+SRCS = nat.c client.c util.c system.c nmb.c charset.c parse_ip.c
+OBJS = nat.o client.o util.o system.o nmb.o charset.o parse_ip.o
 CFLAGS1 = -DSTEPPING -DSCANNER -DVERBOSE
 CFLAGS2 = -DWORKGROUP=\"$(WORKGROUP)\" -DGUEST_ACCOUNT=\"$(GUESTACCOUNT)\" 
-CFLAGS = $(CFLAGS1) $(CFLAGS2) $(FLAGSM) -ggdb -Wall
-CLIENT_CFLAGS = -DVERBOSE $(CFLAGS2) $(FLAGSM) -ggdb -Wall
+CFLAGS = $(CFLAGS1) $(CFLAGS2) $(FLAGSM)
 LIBS = $(LIBSM)
 
 all : nat
 
-INCLUDES = version.h local.h includes.h smb.h sighandler.h
-PROGS = nat client
+INCLUDES = version.h local.h includes.h smb.h
+PROGS = nat
 
 .SUFFIXES:
 .SUFFIXES: .c .o .h
@@ -386,8 +384,5 @@
 nat:	$(OBJS)
 	$(CC) $(CFLAGS) -o nat $(STATIC) $(OBJS) $(LIBS)
 
-client: $(CLIENT_OBJS)
-	$(CC) $(CLIENT_CFLAGS) -o client $(STATIC) $(CLIENT_OBJS) $(LIBS)
-
 clean:
 	rm -f core *.o *~ $(PROGS)
diff -Nru nat-1.0/nat.1 nat-1.0/nat.1
--- nat-1.0/nat.1	2022-04-26 22:51:30.000000000 +0800
+++ nat-1.0/nat.1	1997-02-17 11:18:04.000000000 +0800
@@ -17,12 +17,10 @@
 Specify the file to read \fBusernames\fP from.  Usernames will be read from
 the specified file when attempting to guess the password on the remote server.
 Usernames should appear one per line in the specified file.
-A sample username file can be found at \fB/usr/share/nat/userlist.txt\fP.
 .IP \fB-p\fP
 Specify the file to read \fBpasswords\fP from.  Passwords will be read from
 the specified file when attempting to guess the password on the remote server.
 Passwords should appear one per line in the specified file.
-A sample password file can be found at \fB/usr/share/nat/passlist.txt\fP.
 .IP \fB<address>\fP
 Addresses should be specified in comma deliminated format, with no spaces.
 Valid address specifications include:
@@ -70,4 +68,4 @@
 \fBWindows 95\fP
 
 .SH FILES
-\fBnat\fP, \fB/usr/share/nat/userlist.txt\fP, \fB/usr/share/nat/passlist.txt\fP
+\fBnat\fP, \fBuserlist.txt\fP, \fBpasslist.txt\fP
diff -Nru nat-1.0/nat.c nat-1.0/nat.c
--- nat-1.0/nat.c	2022-04-26 22:51:30.000000000 +0800
+++ nat-1.0/nat.c	1997-02-17 11:18:04.000000000 +0800
@@ -2,18 +2,17 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
-#include <getopt.h>
 
-#include <arpa/inet.h>
+#ifdef _WIN32
+ #include <arpa/inet.h>
+#endif
 
 #ifdef __STDC__
 #include <stdarg.h>
 #else
 #include <varargs.h>
 #endif
-#include "sighandler.h"
 #include "parse_ip.h"
-#include "util.h"
 
 extern char *optarg;
 extern int optind;
@@ -31,25 +30,22 @@
   struct vuln_res *vr_next;
 };
 
-int nas_step (unsigned long xip);
-char *StrnCpy(char *dest,const char *src,int n);
 void natprintf(char *format, ...);
 struct vuln_res *module_16000();
 
-extern int DEBUGLEVEL;
-
 int main(argc, argv)
 int argc;
 char **argv;
 {
    struct vuln_res *vr;
+   u_long ipaddr;
    int opt;
    char *progname;
    struct ipstr *hosts;
 
    progname = strdup(argv[0]);
 
-   while ((opt = getopt(argc, argv, "d:o:u:p:")) != -1)
+   while ((opt = getopt(argc, argv, "o:u:p:")) != -1)
       switch(opt) {
          case 'o': outputfile = strdup(optarg);
                    break;
@@ -57,30 +53,18 @@
                    break;
          case 'p': passfile = strdup(optarg);
                    break;
-         case 'd': DEBUGLEVEL = atoi(strdup(optarg));
-                   break;
          default : exit(-1);
       }
 
-
    argc -= optind;
    argv += optind;
 
    if (argc < 1) {
-      fprintf(stderr,"usage: %s [-o filename] [-u userlist] [-p passlist] [-d debuglevel]"\
+      fprintf(stderr,"usage: %s [-o filename] [-u userlist] [-p passlist]"\
               " <address>\n", progname);
       exit(1);
    }
 
-   setup_logging(progname, True);
-   /* Set up signals */
-   set_signal(SIGSEGV, sighandler);
-   set_signal(SIGTERM, sighandler);
-   set_signal(SIGINT, sighandler);
-   set_signal(SIGHUP, SIG_IGN);
-   set_signal(SIGPIPE, sighandler); /* Network errors are treated by the app */
-
-
    if (userfile) {
       if ((userfd = fopen(userfile, "r")))
          natprintf("[*]--- Reading usernames from %s\n", userfile);
@@ -278,7 +262,7 @@
     vvr_strings[ptr_vvr] = pp;		/* chain off to real result string */
     ptr_vvr++;
 
-    while ((pp = get_vuln (i))) {		/* collect the rest of 'em */
+    while (pp = get_vuln (i)) {		/* collect the rest of 'em */
       vvr_strings[ptr_vvr] = pp;
       ptr_vvr++;
     }
@@ -320,6 +304,7 @@
 #endif
   va_list ap;
   static FILE *outfd = NULL;
+  char *s;
 
 #ifdef __STDC__
    va_start(ap, format);
@@ -343,4 +328,3 @@
    vfprintf(outfd, format, ap);
    return;
 }
-
diff -Nru nat-1.0/nmb.c nat-1.0/nmb.c
--- nat-1.0/nmb.c	2022-04-26 22:51:30.000000000 +0800
+++ nat-1.0/nmb.c	1997-02-17 11:18:04.000000000 +0800
@@ -40,6 +40,7 @@
 #endif /* SCANNER */
 
 int Debug1(char *, ...);
+int Debug1();
 
 int num_good_sends=0;
 int  num_good_receives=0;
@@ -789,7 +790,8 @@
  */
 static void H_interpret_node_status(char *p)
 {
-  int level = 10;
+/*  int level = (master||rname)?4:0; */
+  int level = 0;			/* always print */
   int numnames = CVAL(p,0);
 
   DEBUG(level,("received %d names\n",numnames));
diff -Nru nat-1.0/parse_ip.h nat-1.0/parse_ip.h
--- nat-1.0/parse_ip.h	2022-04-26 22:51:30.000000000 +0800
+++ nat-1.0/parse_ip.h	1997-02-17 11:18:04.000000000 +0800
@@ -8,6 +8,3 @@
    char *name;
    struct ipstr *next;
 };
-
-struct ipstr *parse_ip(char *input);
-
diff -Nru nat-1.0/patch nat-1.0/patch
--- nat-1.0/patch	2022-04-26 22:51:30.000000000 +0800
+++ nat-1.0/patch	1970-01-01 08:00:00.000000000 +0800
@@ -1,25 +0,0 @@
-diff -Naur nat-1.0.orig/client.c nat-1.0/client.c
---- nat-1.0.orig/client.c	1997-02-17 04:18:04.000000000 +0100
-+++ nat-1.0/client.c	2003-02-20 14:24:53.000000000 +0100
-@@ -3613,7 +3613,7 @@
-   username[0] = '\0';
-   while (!done) {
-     if (!userfd || !passfd)
--       uppair();
-+       done = !uppair();
-     else {
-        if (fgets(password, sizeof(password), passfd) == NULL) {
-           rewind(passfd);
-@@ -3636,8 +3636,11 @@
-     }
- 
-     if ((! *username) && (! *password))
--      uppair();				/* sleaze for NT */
-+      done = !uppair();				/* sleaze for NT */
- 
-+    if (done)
-+        break; /* Stop when uppair is done */
-+    
- #ifdef VERBOSE
-   natprintf("[*]--- Attempting to connect with Username: `%s' Password: `%s'\n",
-            username, password);
diff -Nru nat-1.0/samples/localhost-samba.log nat-1.0/samples/localhost-samba.log
--- nat-1.0/samples/localhost-samba.log	2022-04-26 22:51:30.000000000 +0800
+++ nat-1.0/samples/localhost-samba.log	1970-01-01 08:00:00.000000000 +0800
@@ -1,38 +0,0 @@
-
-[*]--- Checking host: 127.0.0.1
-[*]--- Obtaining list of remote NetBIOS names
-[*]--- Remote systems name tables:
-
-     LINUX
-     LINUX
-     LINUX
-     __MSBROWSE__
-     SAMBA
-     SAMBA
-     SAMBA
-     SAMBA
-
-[*]--- Attempting to connect with name: *
-[*]--- CONNECTED with name: *
-[*]--- Attempting to connect with protocol: MICROSOFT NETWORKS 1.03
-[*]--- Remote server wants us to encrypt, telling it not to
-[*]--- Attempting to connect with protocol: PC NETWORK PROGRAM 1.0
-[*]--- Attempting to establish session
-
-[*]--- Attempting to access share: \\*\
-[*]--- Unable to access
-
-[*]--- Attempting to access share: \\*\ADMIN$
-[*]--- Unable to access
-
-[*]--- Attempting to access share: \\*\C$
-[*]--- Unable to access
-
-[*]--- Attempting to access share: \\*\D$
-[*]--- Unable to access
-
-[*]--- Attempting to access share: \\*\ROOT
-[*]--- Unable to access
-
-[*]--- Attempting to access share: \\*\WINNT$
-[*]--- Unable to access
diff -Nru nat-1.0/samples/w2000as.log nat-1.0/samples/w2000as.log
--- nat-1.0/samples/w2000as.log	2022-04-26 22:51:30.000000000 +0800
+++ nat-1.0/samples/w2000as.log	1970-01-01 08:00:00.000000000 +0800
@@ -1,51 +0,0 @@
-
-[*]--- Checking host: 192.168.0.159
-[*]--- Obtaining list of remote NetBIOS names
-[*]--- Remote systems name tables:
-
-     INet~Services
-     IS~W2000AS
-     W2000AS
-     W2000AS
-     WORKGROUP
-     ADMINISTRATOR
-     W2000AS
-     WORKGROUP
-     IWAM_W2000AS
-     WORKGROUP
-     __MSBROWSE__
-
-[*]--- Attempting to connect with name: *
-[*]--- Unable to connect
-
-[*]--- Attempting to connect with name: INet~Services
-[*]--- Unable to connect
-
-[*]--- Attempting to connect with name: IS~W2000AS
-[*]--- Unable to connect
-
-[*]--- Attempting to connect with name: W2000AS
-[*]--- CONNECTED with name: W2000AS
-[*]--- Attempting to connect with protocol: MICROSOFT NETWORKS 1.03
-[*]--- Server time is Wed Jan 25 17:21:06 2006
-[*]--- Timezone is UTC-0.0
-[*]--- Remote server wants us to encrypt, telling it not to
-[*]--- Attempting to establish session
-
-[*]--- Attempting to access share: \\W2000AS\
-[*]--- Unable to access
-
-[*]--- Attempting to access share: \\W2000AS\ADMIN$
-[*]--- Unable to access
-
-[*]--- Attempting to access share: \\W2000AS\C$
-[*]--- Unable to access
-
-[*]--- Attempting to access share: \\W2000AS\D$
-[*]--- Unable to access
-
-[*]--- Attempting to access share: \\W2000AS\ROOT
-[*]--- Unable to access
-
-[*]--- Attempting to access share: \\W2000AS\WINNT$
-[*]--- Unable to access
diff -Nru nat-1.0/sighandler.c nat-1.0/sighandler.c
--- nat-1.0/sighandler.c	2022-04-26 22:51:30.000000000 +0800
+++ nat-1.0/sighandler.c	1970-01-01 08:00:00.000000000 +0800
@@ -1,113 +0,0 @@
-/* Nessus
- * Copyright (C) 1998 - 2004 Renaud Deraison
- *
- * Adapted for the Netbios Auditing Tool by Javier Fernandez-Sanguino
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2,
- * as published by the Free Software Foundation
- *
- * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
- * Signals handlers
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "sighandler.h"
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_RESOURCE_H
-#include <sys/resource.h>
-#endif
-
-
-void (*set_signal(int signum, void (*handler)(int)))(int)
-{
-	struct sigaction saNew,saOld;
-
-	/* Init new handler */
-	sigfillset(&saNew.sa_mask);
-	sigdelset(&saNew.sa_mask, SIGALRM); /* make sleep() work */
-
-	saNew.sa_flags = 0;
-# ifdef HAVE_SIGNAL_SA_RESTORER
-	saNew.sa_restorer = 0; /* not avail on Solaris - jordan */
-# endif
-	saNew.sa_handler = handler;
-
-	sigaction(signum, &saNew, &saOld);
-	return saOld.sa_handler;
-}
-
-
-void sighandler(sign)
-	int sign;
-{
-	char * sig = NULL;
-	int murderer = 0;
-
-	switch(sign)
-	{
-		case SIGTERM:
-			sig = "TERM";
-			close_sockets();
-			break;
-		case SIGINT :
-			sig = "INT";
-			close_sockets();
-			break;
-		case SIGPIPE :
-			sig = "PIPE";
-			close_sockets();
-			break;
-		case SIGSEGV :
-#ifdef HAVE__EXIT
-			signal(SIGSEGV, _exit);
-#else
-			signal(SIGSEGV, exit);
-#endif
-			sig = "SEGV";
-			break;
-		default:
-			sig = "unknown signal";
-	}
-	fprintf(stderr, "Received signal %s!\n", sig);
-#ifdef HAVE__EXIT
-	_exit(1);
-#else
-	exit(1);
-#endif
-
-}
-
-
-void sighand_segv()
-{
-#ifdef HAVE__EXIT
-	signal(SIGSEGV, _exit);
-#else
-	signal(SIGSEGV, exit);
-#endif
-	fprintf(stderr, "Received SIGSEGV!\n");
-#ifdef HAVE__EXIT
-	_exit(1);
-#else
-	exit(1);
-#endif
-}
-
diff -Nru nat-1.0/sighandler.h nat-1.0/sighandler.h
--- nat-1.0/sighandler.h	2022-04-26 22:51:30.000000000 +0800
+++ nat-1.0/sighandler.h	1970-01-01 08:00:00.000000000 +0800
@@ -1,36 +0,0 @@
-/* Signal handler from Nessus
- * Copyright (C) 1998 Renaud Deraison
- *
- * Adapted to the Netbios Auditing Tool by Javier Fernandez-Sanguino
- *
- * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _NAT_SIGHAND_H
-#define _NAT_SIGHAND_H
-
-#include <signal.h>
-
-extern void (*set_signal(int signum, void (*handler)(int)))(int);
-extern void sighand_pipe();
-extern void sighand_term();
-extern void sighand_int();
-extern void sighand_kill();
-extern void sighand_segv();
-extern void sighand_io();
-extern void sighandler(int sign);
-
-#endif
-
diff -Nru nat-1.0/util.c nat-1.0/util.c
--- nat-1.0/util.c	2022-04-26 22:51:30.000000000 +0800
+++ nat-1.0/util.c	2002-04-04 16:38:43.000000000 +0800
@@ -78,7 +78,7 @@
 /* size of reads during a direct file to file transfer */
 int ReadSize = 16*1024;
 
-pstring debugf = "smb-nat.log";
+pstring debugf = "/tmp/log.samba";
 int syslog_level;
 
 /* the following control case operations - they are put here so the
@@ -236,8 +236,8 @@
     }
   
   va_end(ap);
-#endif /* SCANNER */
   return(0);
+#endif /* SCANNER */
 }
 
 /****************************************************************************
@@ -510,14 +510,13 @@
 ****************************************************************************/
 BOOL is_a_socket(int fd)
 {
-  int v;
-  socklen_t l;
+  int v,l;
   l = sizeof(int);
 #ifdef _WIN32
   /* evil, but it works */
   return(0);
 #else
-  return(getsockopt(fd, SOL_SOCKET, SO_TYPE, (void *)&v, &l) == 0);
+  return(getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&v, &l) == 0);
 #endif  
 }
 
@@ -2095,13 +2094,8 @@
 {
   int ret;
   struct sockaddr sock;
-  socklen_t socklen;
+  int socklen;
   
-  /* Just in case */
-  if (fd <= 0) {
-      DEBUG(2,("no valid file descriptor to read the socket\n"));
-      return(0);
-  }
   socklen = sizeof(sock);
   bzero((char *)&sock,socklen);
   bzero((char *)&lastip,sizeof(lastip));
@@ -2184,10 +2178,6 @@
   struct timeval timeout, tval1, tval2, tvaldiff;
 
   /* just checking .... */
-  if (fd <= 0) {
-      DEBUG(2,("no valid file descriptor to read the socket\n"));
-      return(0);
-  }
   if (maxcnt <= 0) return(0);
 
   if(time_out == -2)
@@ -2383,11 +2373,6 @@
 {
   int total=0;
   int ret;
-  /* Just in case */
-  if (fd <= 0) {
-      DEBUG(2,("no valid file descriptor to write_data\n"));
-      return(0);
-  }
 
   while (total < N)
     {
@@ -2690,18 +2675,6 @@
   int ret,nwritten=0;
   len = smb_len(buffer) + 4;
 
-  /* Just in case */
-  if (fd <= 0) {
-      DEBUG(2,("no valid file descriptor to send_smb\n"));
-      return False;
-  }
-  /* Is this socket alive? */
-  if ( send_keepalive(fd) < 0 ) {
-      DEBUG(2,("session is no longer available\n"));
-      /* Restore the session? */
-      return False;
-  }
-
   while (nwritten < len)
     {
       ret = write_socket(fd,buffer+nwritten,len - nwritten);
diff -Nru nat-1.0/util.h nat-1.0/util.h
--- nat-1.0/util.h	2022-04-26 22:51:30.000000000 +0800
+++ nat-1.0/util.h	1970-01-01 08:00:00.000000000 +0800
@@ -1,41 +0,0 @@
-/*
- * This file has been modified from the original Samba package
- * by Secure Networks Inc., January and February, 1997.  This package and
- * all code which it is based on falls under the GNU Public License
- * agreement.
- */
-
-/* 
-   Unix SMB/Netbios implementation.
-   Version 1.9.
-   Samba utility functions
-   Copyright (C) Andrew Tridgell 1992-1995
-   
-   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., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef _NAT_UTIL_H
-#define _NAT_UTIL_H
-
-typedef int BOOL;
-#define False (0)
-#define True (1)
-
-void setup_logging(char *pname, BOOL interactive);
-#ifdef __STDC__
-int Debug1(char *format_str, ...);
-#endif
-
-#endif

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to