[packages/nbtscan] Rel 3
arekm
arekm at pld-linux.org
Mon Mar 9 18:45:24 CET 2026
commit 9d9948347ccfc53d713cb42efbd3bdf4c1ba867b
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Mon Mar 9 18:45:11 2026 +0100
Rel 3
nbtscan-fix-format-specifiers.patch | 46 +++++
nbtscan-fix-implicit-declarations.patch | 292 ++++++++++++++++++++++++++++++++
nbtscan-fix-off-by-one.patch | 21 +++
nbtscan-makefile-hardening.patch | 32 ++++
nbtscan.spec | 11 +-
5 files changed, 401 insertions(+), 1 deletion(-)
---
diff --git a/nbtscan.spec b/nbtscan.spec
index 90fd4d8..c1a5406 100644
--- a/nbtscan.spec
+++ b/nbtscan.spec
@@ -2,11 +2,16 @@ Summary: A program for scanning networks for NetBIOS name information
Summary(pl.UTF-8): Program do skanowania sieci pod kątem informacji o nazwach NetBIOS
Name: nbtscan
Version: 1.5.1
-Release: 2
+Release: 3
License: GPL
Group: Applications/System
Source0: http://www.inetcat.org/software/%{name}-%{version}.tar.gz
# Source0-md5: 85bb085077c380b82a6ff73e0de0c154
+# Debian nbtscan 1.5.1-7 patches
+Patch0: %{name}-fix-implicit-declarations.patch
+Patch1: %{name}-fix-off-by-one.patch
+Patch2: %{name}-fix-format-specifiers.patch
+Patch3: %{name}-makefile-hardening.patch
URL: http://www.inetcat.org/software/nbtscan.html
BuildRequires: autoconf
BuildRequires: automake
@@ -29,6 +34,10 @@ adres MAC.
%prep
%setup -q -n %{name}-1.5.1a
+%patch -P0 -p1
+%patch -P1 -p1
+%patch -P2 -p1
+%patch -P3 -p1
%build
cp -f /usr/share/automake/config.sub .
diff --git a/nbtscan-fix-format-specifiers.patch b/nbtscan-fix-format-specifiers.patch
new file mode 100644
index 0000000..81b7d1c
--- /dev/null
+++ b/nbtscan-fix-format-specifiers.patch
@@ -0,0 +1,46 @@
+diff -urN a/nbtscan.c b/nbtscan.c
+--- a/nbtscan.c 2026-03-09 18:40:06.686357067 +0100
++++ b/nbtscan.c 2026-03-09 18:40:28.163023731 +0100
+@@ -131,24 +131,24 @@
+ printf("Version major: 0x%02x (%1$d)\n", hostinfo->footer->version_major);
+ printf("Version minor: 0x%02x (%1$d)\n", hostinfo->footer->version_minor);
+ printf("Duration: 0x%04x (%1$d)\n", hostinfo->footer->duration);
+- printf("FRMRs Received: 0x%04 (%1$d)\n", hostinfo->footer->frmps_received);
+- printf("FRMRs Transmitted: 0x%04 (%1$d)\n", hostinfo->footer->frmps_transmitted);
+- printf("IFrame Receive errors: 0x%04 (%1$d)\n", hostinfo->footer->iframe_receive_errors);
+- printf("Transmit aborts: 0x%04 (%1$d)\n", hostinfo->footer->transmit_aborts);
+- printf("Transmitted: 0x%08 (%1$d)\n", hostinfo->footer->transmitted);
+- printf("Received: 0x%08 (%1$d)\n", hostinfo->footer->received);
+- printf("IFrame transmit errors: 0x%04 (%1$d)\n", hostinfo->footer->iframe_transmit_errors);
+- printf("No receive buffers: 0x%04 (%1$d)\n", hostinfo->footer->no_receive_buffer);
+- printf("tl timeouts: 0x%04 (%1$d)\n", hostinfo->footer->tl_timeouts);
+- printf("ti timeouts: 0x%04 (%1$d)\n", hostinfo->footer->ti_timeouts);
+- printf("Free NCBS: 0x%04 (%1$d)\n", hostinfo->footer->free_ncbs);
+- printf("NCBS: 0x%04 (%1$d)\n", hostinfo->footer->ncbs);
+- printf("Max NCBS: 0x%04 (%1$d)\n", hostinfo->footer->max_ncbs);
+- printf("No transmit buffers: 0x%04 (%1$d)\n", hostinfo->footer->no_transmit_buffers);
+- printf("Max datagram: 0x%04 (%1$d)\n", hostinfo->footer->max_datagram);
+- printf("Pending sessions: 0x%04 (%1$d)\n", hostinfo->footer->pending_sessions);
+- printf("Max sessions: 0x%04 (%1$d)\n", hostinfo->footer->max_sessions);
+- printf("Packet sessions: 0x%04 (%1$d)\n", hostinfo->footer->packet_sessions);
++ printf("FRMRs Received: 0x%04x (%1$d)\n", hostinfo->footer->frmps_received);
++ printf("FRMRs Transmitted: 0x%04x (%1$d)\n", hostinfo->footer->frmps_transmitted);
++ printf("IFrame Receive errors: 0x%04x (%1$d)\n", hostinfo->footer->iframe_receive_errors);
++ printf("Transmit aborts: 0x%04x (%1$d)\n", hostinfo->footer->transmit_aborts);
++ printf("Transmitted: 0x%08x (%1$d)\n", hostinfo->footer->transmitted);
++ printf("Received: 0x%08x (%1$d)\n", hostinfo->footer->received);
++ printf("IFrame transmit errors: 0x%04x (%1$d)\n", hostinfo->footer->iframe_transmit_errors);
++ printf("No receive buffers: 0x%04x (%1$d)\n", hostinfo->footer->no_receive_buffer);
++ printf("tl timeouts: 0x%04x (%1$d)\n", hostinfo->footer->tl_timeouts);
++ printf("ti timeouts: 0x%04x (%1$d)\n", hostinfo->footer->ti_timeouts);
++ printf("Free NCBS: 0x%04x (%1$d)\n", hostinfo->footer->free_ncbs);
++ printf("NCBS: 0x%04x (%1$d)\n", hostinfo->footer->ncbs);
++ printf("Max NCBS: 0x%04x (%1$d)\n", hostinfo->footer->max_ncbs);
++ printf("No transmit buffers: 0x%04x (%1$d)\n", hostinfo->footer->no_transmit_buffers);
++ printf("Max datagram: 0x%04x (%1$d)\n", hostinfo->footer->max_datagram);
++ printf("Pending sessions: 0x%04x (%1$d)\n", hostinfo->footer->pending_sessions);
++ printf("Max sessions: 0x%04x (%1$d)\n", hostinfo->footer->max_sessions);
++ printf("Packet sessions: 0x%04x (%1$d)\n", hostinfo->footer->packet_sessions);
+ };
+ };
+
diff --git a/nbtscan-fix-implicit-declarations.patch b/nbtscan-fix-implicit-declarations.patch
new file mode 100644
index 0000000..ed46a16
--- /dev/null
+++ b/nbtscan-fix-implicit-declarations.patch
@@ -0,0 +1,292 @@
+diff -urN a/list.c b/list.c
+--- a/list.c 2002-01-13 15:37:05.000000000 +0100
++++ b/list.c 2026-03-09 18:37:57.563023740 +0100
+@@ -49,7 +49,7 @@
+ if(item1==NULL) return 1;
+ if(item1->content == item2->content) return 0;
+ if(item1->content > item2->content) return 1;
+- if(item1->content < item2->content) return -1;
++ return -1;
+ };
+
+ int insert(struct list* lst, unsigned long content) {
+@@ -95,11 +95,11 @@
+ free(item);
+ return ERROR;
+ };
++ return 0;
+ };
+
+ int in_list(struct list* lst, unsigned long content) {
+ struct list_item *temp_item, *item;
+- int cmp;
+
+ item = new_list_item(content);
+ if(lst->head==NULL) return 0;
+diff -urN a/nbtscan.c b/nbtscan.c
+--- a/nbtscan.c 2003-06-06 14:14:00.000000000 +0200
++++ b/nbtscan.c 2026-03-09 18:38:41.193023737 +0100
+@@ -5,6 +5,8 @@
+ #include <stdlib.h>
+ #include <sys/time.h>
+ #include <string.h>
++#include <unistd.h>
++#include <getopt.h>
+ #if HAVE_STDINT_H
+ #include <stdint.h>
+ #endif
+@@ -16,7 +18,12 @@
+
+ int quiet=0;
+
+-print_banner() {
++char* getnbservicename(my_uint8_t service, int unique, char* name);
++struct nb_host_info* parse_response(char* buff, int buffsize);
++int in_list(struct list* lst, unsigned long content);
++void send_query(int sock, struct in_addr dest_addr, my_uint32_t rtt_base);
++
++void print_banner(void) {
+ printf("\nNBTscan version 1.5.1. Copyright (C) 1999-2003 Alla Bezroutchko.\n");
+ printf("This is a free software and it comes with absolutely no warranty.\n");
+ printf("You can use, distribute and modify it under terms of GNU GPL.\n\n");
+@@ -77,13 +84,13 @@
+ return 0;
+ };
+
+-int print_header() {
++void print_header(void) {
+ printf("%-17s%-17s%-10s%-17s%-17s\n", "IP address", "NetBIOS Name",
+ "Server", "User", "MAC address");
+ printf("------------------------------------------------------------------------------\n");
+ };
+
+-int d_print_hostinfo(struct in_addr addr, const struct nb_host_info* hostinfo) {
++void d_print_hostinfo(struct in_addr addr, const struct nb_host_info* hostinfo) {
+ int i;
+ unsigned char service; /* 16th byte of NetBIOS name */
+ char name[16];
+@@ -150,7 +157,6 @@
+ int i, unique;
+ my_uint8_t service; /* 16th byte of NetBIOS name */
+ char name[16];
+- char* sname;
+
+ if(!sf) {
+ printf("\nNetBIOS Name Table for Host %s:\n\n", inet_ntoa(addr));
+@@ -251,11 +257,10 @@
+ /* Print hostinfo in /etc/hosts or lmhosts format */
+ /* If l is true adds #PRE to each line of output (for lmhosts) */
+
+-int l_print_hostinfo(struct in_addr addr, struct nb_host_info* hostinfo, int l) {
++void l_print_hostinfo(struct in_addr addr, struct nb_host_info* hostinfo, int l) {
+ int i;
+ unsigned char service; /* 16th byte of NetBIOS name */
+ char comp_name[16];
+- int is_server=0;
+ int unique;
+ int first_name=1;
+
+@@ -299,7 +304,7 @@
+ struct nb_host_info* hostinfo;
+ fd_set* fdsr;
+ fd_set* fdsw;
+- int sel, size;
++ int size;
+ struct list* scanned;
+ my_uint32_t rtt_base; /* Base time (seconds) for round trip time calculations */
+ float rtt; /* most recent measured RTT, seconds */
+@@ -386,27 +391,27 @@
+
+ if(dump && lmhosts) {
+ printf("Cannot be used with both dump (-d) and lmhosts (-l) options.\n");
+- usage;
++ usage();
+ };
+
+ if(dump && etc_hosts) {
+ printf("Cannot be used with both dump (-d) and /etc/hosts (-e) options.\n");
+- usage;
++ usage();
+ };
+
+ if(verbose && lmhosts){
+ printf("Cannot be used with both verbose (-v) and lmhosts (-l) options.\n");
+- usage;
++ usage();
+ };
+
+ if(verbose && etc_hosts){
+ printf("Cannot be used with both verbose (-v) and /etc/hosts (-e) options.\n");
+- usage;
++ usage();
+ };
+
+ if(lmhosts && etc_hosts){
+ printf("Cannot be used with both lmhosts (-l) and /etc/hosts (-e) options.\n");
+- usage;
++ usage();
+ };
+
+
+diff -urN a/range.c b/range.c
+--- a/range.c 2002-05-23 11:31:45.000000000 +0200
++++ b/range.c 2026-03-09 18:39:00.053023734 +0100
+@@ -35,14 +35,14 @@
+ Returns 1 on success, 0 on failure */
+ int is_range1(char* string, struct ip_range* range) {
+ char* separator;
+- unsigned long mask;
++ unsigned int mask;
+ char* ip;
+
+ if((ip = (char *)malloc(strlen(string)+1))==NULL)
+ err_die("Malloc failed", quiet);
+
+ if (strlen(string)>19) return 0;
+- if(separator=(char*)strchr(string,'/')) {
++ if((separator=(char*)strchr(string,'/'))) {
+ separator++;
+ mask=atoi(separator);
+ if(mask<=0 || mask>32) return 0;
+@@ -98,7 +98,7 @@
+ err_die("Malloc failed", quiet);
+ strcpy(ip,string);
+
+- if(separator = (char*)strchr(ip,'-')) {
++ if((separator = (char*)strchr(ip,'-'))) {
+ *separator=0;
+ separator++;
+ last_octet = atoi(separator);
+@@ -124,7 +124,7 @@
+ return 0;
+ };
+
+-int print_range(const struct ip_range* range) {
++void print_range(const struct ip_range* range) {
+ struct in_addr *addr;
+
+ if((addr = (struct in_addr*)malloc(sizeof(struct in_addr)))==NULL)
+diff -urN a/range.h b/range.h
+--- a/range.h 2002-01-13 15:37:05.000000000 +0100
++++ b/range.h 2026-03-09 18:39:05.633023735 +0100
+@@ -36,6 +36,6 @@
+ Returns 1 on success, 0 on failure */
+ int is_range2(char* string, struct ip_range* range);
+
+-int print_range(const struct ip_range* range);
++void print_range(const struct ip_range* range);
+
+ #endif /* RANGE_H */
+diff -urN a/statusq.c b/statusq.c
+--- a/statusq.c 2002-02-08 14:05:55.000000000 +0100
++++ b/statusq.c 2026-03-09 18:39:47.173023735 +0100
+@@ -1,5 +1,5 @@
+ /* This file contains a portion of code from Samba package, *
+-/* which contains the following license: *
++/ which contains the following license: *
+ /
+ Unix SMB/Netbios implementation
+ Version 1.9
+@@ -31,6 +31,7 @@
+ #include <string.h>
+ #include <stdio.h>
+ #include <stddef.h>
++#include <ctype.h>
+ #include "errors.h"
+
+ extern int quiet;
+@@ -89,7 +90,7 @@
+ /* end of code from Samba */
+
+
+-int send_query(int sock, struct in_addr dest_addr, my_uint32_t rtt_base) {
++void send_query(int sock, struct in_addr dest_addr, my_uint32_t rtt_base) {
+ struct nbname_request request;
+ struct sockaddr_in dest_sockaddr;
+ int status;
+@@ -119,7 +120,7 @@
+ (struct sockaddr *)&dest_sockaddr, sizeof(dest_sockaddr));
+ if(status==-1) {
+ snprintf(errmsg, 80, "%s\tSendto failed", inet_ntoa(dest_addr));
+- err_print(errmsg, quiet); return(-1);
++ err_print(errmsg, quiet);
+ };
+ };
+
+@@ -329,41 +330,41 @@
+ };
+
+ nb_service_t services[] = {
+-"__MSBROWSE__", 0x01, 0, "Master Browser",
+-"INet~Services", 0x1C, 0, "IIS",
+-"IS~", 0x00, 1, "IIS",
+-"", 0x00, 1, "Workstation Service",
+-"", 0x01, 1, "Messenger Service",
+-"", 0x03, 1, "Messenger Service",
+-"", 0x06, 1, "RAS Server Service",
+-"", 0x1F, 1, "NetDDE Service",
+-"", 0x20, 1, "File Server Service",
+-"", 0x21, 1, "RAS Client Service",
+-"", 0x22, 1, "Microsoft Exchange Interchange(MSMail Connector)",
+-"", 0x23, 1, "Microsoft Exchange Store",
+-"", 0x24, 1, "Microsoft Exchange Directory",
+-"", 0x30, 1, "Modem Sharing Server Service",
+-"", 0x31, 1, "Modem Sharing Client Service",
+-"", 0x43, 1, "SMS Clients Remote Control",
+-"", 0x44, 1, "SMS Administrators Remote Control Tool",
+-"", 0x45, 1, "SMS Clients Remote Chat",
+-"", 0x46, 1, "SMS Clients Remote Transfer",
+-"", 0x4C, 1, "DEC Pathworks TCPIP service on Windows NT",
+-"", 0x52, 1, "DEC Pathworks TCPIP service on Windows NT",
+-"", 0x87, 1, "Microsoft Exchange MTA",
+-"", 0x6A, 1, "Microsoft Exchange IMC",
+-"", 0xBE, 1, "Network Monitor Agent",
+-"", 0xBF, 1, "Network Monitor Application",
+-"", 0x03, 1, "Messenger Service",
+-"", 0x00, 0, "Domain Name",
+-"", 0x1B, 1, "Domain Master Browser",
+-"", 0x1C, 0, "Domain Controllers",
+-"", 0x1D, 1, "Master Browser",
+-"", 0x1E, 0, "Browser Service Elections",
+-"", 0x2B, 1, "Lotus Notes Server Service",
+-"IRISMULTICAST", 0x2F, 0, "Lotus Notes",
+-"IRISNAMESERVER", 0x33, 0, "Lotus Notes",
+-"Forte_$ND800ZA", 0x20, 1, "DCA IrmaLan Gateway Server Service"
++{"__MSBROWSE__", 0x01, 0, "Master Browser"},
++{"INet~Services", 0x1C, 0, "IIS"},
++{"IS~", 0x00, 1, "IIS"},
++{"", 0x00, 1, "Workstation Service"},
++{"", 0x01, 1, "Messenger Service"},
++{"", 0x03, 1, "Messenger Service"},
++{"", 0x06, 1, "RAS Server Service"},
++{"", 0x1F, 1, "NetDDE Service"},
++{"", 0x20, 1, "File Server Service"},
++{"", 0x21, 1, "RAS Client Service"},
++{"", 0x22, 1, "Microsoft Exchange Interchange(MSMail Connector)"},
++{"", 0x23, 1, "Microsoft Exchange Store"},
++{"", 0x24, 1, "Microsoft Exchange Directory"},
++{"", 0x30, 1, "Modem Sharing Server Service"},
++{"", 0x31, 1, "Modem Sharing Client Service"},
++{"", 0x43, 1, "SMS Clients Remote Control"},
++{"", 0x44, 1, "SMS Administrators Remote Control Tool"},
++{"", 0x45, 1, "SMS Clients Remote Chat"},
++{"", 0x46, 1, "SMS Clients Remote Transfer"},
++{"", 0x4C, 1, "DEC Pathworks TCPIP service on Windows NT"},
++{"", 0x52, 1, "DEC Pathworks TCPIP service on Windows NT"},
++{"", 0x87, 1, "Microsoft Exchange MTA"},
++{"", 0x6A, 1, "Microsoft Exchange IMC"},
++{"", 0xBE, 1, "Network Monitor Agent"},
++{"", 0xBF, 1, "Network Monitor Application"},
++{"", 0x03, 1, "Messenger Service"},
++{"", 0x00, 0, "Domain Name"},
++{"", 0x1B, 1, "Domain Master Browser"},
++{"", 0x1C, 0, "Domain Controllers"},
++{"", 0x1D, 1, "Master Browser"},
++{"", 0x1E, 0, "Browser Service Elections"},
++{"", 0x2B, 1, "Lotus Notes Server Service"},
++{"IRISMULTICAST", 0x2F, 0, "Lotus Notes"},
++{"IRISNAMESERVER", 0x33, 0, "Lotus Notes"},
++{"Forte_$ND800ZA", 0x20, 1, "DCA IrmaLan Gateway Server Service"}
+ };
+
+ char* getnbservicename(my_uint8_t service, int unique, char* name) {
diff --git a/nbtscan-fix-off-by-one.patch b/nbtscan-fix-off-by-one.patch
new file mode 100644
index 0000000..65ea077
--- /dev/null
+++ b/nbtscan-fix-off-by-one.patch
@@ -0,0 +1,21 @@
+diff -urN a/nbtscan.c b/nbtscan.c
+--- a/nbtscan.c 2026-03-09 18:38:41.193023737 +0100
++++ b/nbtscan.c 2026-03-09 18:40:06.686357067 +0100
+@@ -118,7 +118,7 @@
+ for(i=0; i< hostinfo->header->number_of_names; i++) {
+ service = hostinfo->names[i].ascii_name[15];
+ strncpy(name, hostinfo->names[i].ascii_name, 15);
+- name[16]=0;
++ name[15]=0;
+ printf("%-17s Service: 0x%02x Flags: 0x%04x\n", name, service, hostinfo->names[i].rr_flags);
+ }
+ };
+@@ -170,7 +170,7 @@
+ for(i=0; i< hostinfo->header->number_of_names; i++) {
+ service = hostinfo->names[i].ascii_name[15];
+ strncpy(name, hostinfo->names[i].ascii_name, 15);
+- name[16]=0;
++ name[15]=0;
+ unique = !(hostinfo->names[i].rr_flags & 0x0080);
+ if(sf) {
+ printf("%s%s%s%s", inet_ntoa(addr), sf, name, sf);
diff --git a/nbtscan-makefile-hardening.patch b/nbtscan-makefile-hardening.patch
new file mode 100644
index 0000000..ff09ce0
--- /dev/null
+++ b/nbtscan-makefile-hardening.patch
@@ -0,0 +1,32 @@
+diff -urN a/Makefile.in b/Makefile.in
+--- a/Makefile.in 2003-06-06 14:43:01.000000000 +0200
++++ b/Makefile.in 2026-03-09 18:40:57.233023731 +0100
+@@ -11,22 +11,22 @@
+ BINDIR = @bindir@
+
+ nbtscan: $(OBJECTS)
+- $(CC) $(CFLAGS) -o nbtscan $(OBJECTS) $(LIBS)
++ $(CC) $(CFLAGS) -o nbtscan $(OBJECTS) $(LIBS) $(LDFLAGS)
+
+ install:
+- $(INSTALL) $(TARGET) $(BINDIR)/$(TARGET)
++ $(INSTALL) $(TARGET) $(DESTDIR)$(BINDIR)/$(TARGET)
+
+ nbtscan.o: nbtscan.c statusq.h range.h list.h
+- $(CC) $(CFLAGS) $(DEFS) -c nbtscan.c
++ $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c nbtscan.c
+
+ statusq.o: statusq.c statusq.h
+- $(CC) $(CFLAGS) $(DEFS) -c statusq.c
++ $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c statusq.c
+
+ range.o: range.c range.h
+- $(CC) $(CFLAGS) $(DEFS) -c range.c
++ $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c range.c
+
+ list.o: list.c list.h
+- $(CC) $(CFLAGS) $(DEFS) -c list.c
++ $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c list.c
+
+ clean:
+ -rm $(OBJECTS) nbtscan
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/nbtscan.git/commitdiff/9d9948347ccfc53d713cb42efbd3bdf4c1ba867b
More information about the pld-cvs-commit
mailing list