Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
net-tools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
net-tools
Commits
77344ce0
Commit
77344ce0
authored
Jun 12, 1999
by
Phil Blundell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bump version to 1.53
Fix some buffer overruns. Add support to netstat for GRE and ESP.
parent
9c92a93a
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
63 additions
and
43 deletions
+63
-43
Makefile
Makefile
+1
-1
README
README
+10
-2
arp.c
arp.c
+2
-2
iptunnel.c
iptunnel.c
+3
-2
lib/inet.c
lib/inet.c
+21
-21
lib/masq_info.c
lib/masq_info.c
+5
-1
netstat.c
netstat.c
+19
-13
slattach.c
slattach.c
+2
-1
No files found.
Makefile
View file @
77344ce0
...
@@ -96,7 +96,7 @@ endif
...
@@ -96,7 +96,7 @@ endif
# -------- end of user definitions --------
# -------- end of user definitions --------
MAINTAINER
=
Philip.Blundell@pobox.com
MAINTAINER
=
Philip.Blundell@pobox.com
RELEASE
=
1.5
2
RELEASE
=
1.5
3
.EXPORT_ALL_VARIABLES
:
.EXPORT_ALL_VARIABLES
:
...
...
README
View file @
77344ce0
README
README
Information about the net-tools package
Information about the net-tools package
NET-TOOLS A collection of programs that form the base set of the
NET-TOOLS A collection of programs that form the base set of the
NET-3 networking distribution for the Linux operating
NET-3 networking distribution for the Linux operating
system.
system.
...
@@ -31,7 +32,14 @@ Contents:
...
@@ -31,7 +32,14 @@ Contents:
Notes
Notes
-----
-----
This is net-tools 1.52. Notable changes since 1.51 include:
This is net-tools 1.53. Notable changes since 1.52 include:
- a bunch of buffer overrun vulnerabilities are fixed (thanks to
David Wagner)
- Meelis Roos contributed an Estonian translation
- netstat recognizes ESP and GRE protocols, courtesy John D. Hardin.
Notable changes since 1.51 include:
- Jean-Michel Vansteene updated the French translation.
- Jean-Michel Vansteene updated the French translation.
- Dag Brattli contributed support for IrDA
- Dag Brattli contributed support for IrDA
...
...
arp.c
View file @
77344ce0
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
* NET-3 Networking Distribution for the LINUX operating
* NET-3 Networking Distribution for the LINUX operating
* system.
* system.
*
*
* Version: $Id: arp.c,v 1.1
2 1999/03/24 09:49:43
philip Exp $
* Version: $Id: arp.c,v 1.1
3 1999/06/12 23:04:14
philip Exp $
*
*
* Maintainer: Bernd 'eckes' Eckenfels, <net-tools@lina.inka.de>
* Maintainer: Bernd 'eckes' Eckenfels, <net-tools@lina.inka.de>
*
*
...
@@ -529,7 +529,7 @@ static int arp_show(char *name)
...
@@ -529,7 +529,7 @@ static int arp_show(char *name)
ap
->
herror
(
host
);
ap
->
herror
(
host
);
return
(
-
1
);
return
(
-
1
);
}
}
s
trcpy
(
host
,
ap
->
sprint
(
&
sa
,
1
));
s
afe_strncpy
(
host
,
ap
->
sprint
(
&
sa
,
1
),
sizeof
(
host
));
}
}
/* Open the PROCps kernel table. */
/* Open the PROCps kernel table. */
if
((
fp
=
fopen
(
_PATH_PROCNET_ARP
,
"r"
))
==
NULL
)
{
if
((
fp
=
fopen
(
_PATH_PROCNET_ARP
,
"r"
))
==
NULL
)
{
...
...
iptunnel.c
View file @
77344ce0
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
#include "intl.h"
#include "intl.h"
#include "net-support.h"
#include "net-support.h"
#include "version.h"
#include "version.h"
#include "util.h"
#undef GRE_CSUM
#undef GRE_CSUM
#define GRE_CSUM htons(0x8000)
#define GRE_CSUM htons(0x8000)
...
@@ -279,7 +280,7 @@ static int parse_args(int argc, char **argv, struct ip_tunnel_parm *p)
...
@@ -279,7 +280,7 @@ static int parse_args(int argc, char **argv, struct ip_tunnel_parm *p)
p
->
iph
.
saddr
=
get_addr32
(
*
argv
);
p
->
iph
.
saddr
=
get_addr32
(
*
argv
);
}
else
if
(
strcmp
(
*
argv
,
"dev"
)
==
0
)
{
}
else
if
(
strcmp
(
*
argv
,
"dev"
)
==
0
)
{
NEXT_ARG
();
NEXT_ARG
();
strncpy
(
medium
,
*
argv
,
IFNAMSIZ
-
1
);
s
afe_s
trncpy
(
medium
,
*
argv
,
IFNAMSIZ
-
1
);
}
else
if
(
strcmp
(
*
argv
,
"ttl"
)
==
0
)
{
}
else
if
(
strcmp
(
*
argv
,
"ttl"
)
==
0
)
{
unsigned
uval
;
unsigned
uval
;
NEXT_ARG
();
NEXT_ARG
();
...
@@ -304,7 +305,7 @@ static int parse_args(int argc, char **argv, struct ip_tunnel_parm *p)
...
@@ -304,7 +305,7 @@ static int parse_args(int argc, char **argv, struct ip_tunnel_parm *p)
}
else
{
}
else
{
if
(
p
->
name
[
0
])
if
(
p
->
name
[
0
])
usage
();
usage
();
strncpy
(
p
->
name
,
*
argv
,
IFNAMSIZ
);
s
afe_s
trncpy
(
p
->
name
,
*
argv
,
IFNAMSIZ
);
}
}
argc
--
;
argv
++
;
argc
--
;
argv
++
;
}
}
...
...
lib/inet.c
View file @
77344ce0
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
* support functions for the net-tools.
* support functions for the net-tools.
* (NET-3 base distribution).
* (NET-3 base distribution).
*
*
* Version: $Id: inet.c,v 1.1
1 1999/03/03 21:43:0
8 philip Exp $
* Version: $Id: inet.c,v 1.1
2 1999/06/12 23:04:1
8 philip Exp $
*
*
* Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
* Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
* Copyright 1993 MicroWalt Corporation
* Copyright 1993 MicroWalt Corporation
...
@@ -91,7 +91,6 @@ static int INET_resolve(char *name, struct sockaddr_in *sin)
...
@@ -91,7 +91,6 @@ static int INET_resolve(char *name, struct sockaddr_in *sin)
/* Try the NETWORKS database to see if this is a known network. */
/* Try the NETWORKS database to see if this is a known network. */
if
((
np
=
getnetbyname
(
name
))
!=
(
struct
netent
*
)
NULL
)
{
if
((
np
=
getnetbyname
(
name
))
!=
(
struct
netent
*
)
NULL
)
{
sin
->
sin_addr
.
s_addr
=
htonl
(
np
->
n_net
);
sin
->
sin_addr
.
s_addr
=
htonl
(
np
->
n_net
);
strcpy
(
name
,
np
->
n_name
);
return
1
;
return
1
;
}
}
#ifdef DEBUG
#ifdef DEBUG
...
@@ -103,14 +102,15 @@ static int INET_resolve(char *name, struct sockaddr_in *sin)
...
@@ -103,14 +102,15 @@ static int INET_resolve(char *name, struct sockaddr_in *sin)
errno
=
h_errno
;
errno
=
h_errno
;
return
-
1
;
return
-
1
;
}
}
memcpy
((
char
*
)
&
sin
->
sin_addr
,
(
char
*
)
hp
->
h_addr_list
[
0
],
hp
->
h_length
);
memcpy
((
char
*
)
&
sin
->
sin_addr
,
(
char
*
)
hp
->
h_addr_list
[
0
],
strcpy
(
name
,
hp
->
h_name
);
sizeof
(
struct
in_addr
));
return
0
;
return
0
;
}
}
static
int
INET_rresolve
(
char
*
name
,
s
truct
sockaddr_in
*
sin
,
int
numeric
,
static
int
INET_rresolve
(
char
*
name
,
s
ize_t
len
,
struct
sockaddr_in
*
sin
,
unsigned
int
netmask
)
int
numeric
,
unsigned
int
netmask
)
{
{
struct
hostent
*
ent
;
struct
hostent
*
ent
;
struct
netent
*
np
;
struct
netent
*
np
;
...
@@ -129,14 +129,14 @@ static int INET_rresolve(char *name, struct sockaddr_in *sin, int numeric,
...
@@ -129,14 +129,14 @@ static int INET_rresolve(char *name, struct sockaddr_in *sin, int numeric,
if
(
ad
==
INADDR_ANY
)
{
if
(
ad
==
INADDR_ANY
)
{
if
((
numeric
&
0x7FFF
)
==
0
)
{
if
((
numeric
&
0x7FFF
)
==
0
)
{
if
(
numeric
&
0x8000
)
if
(
numeric
&
0x8000
)
s
trcpy
(
name
,
"default"
);
s
afe_strncpy
(
name
,
"default"
,
len
);
else
else
strcpy
(
name
,
"*"
);
safe_strncpy
(
name
,
"*"
,
len
);
return
(
0
);
return
(
0
);
}
}
}
}
if
(
numeric
&
0x7FFF
)
{
if
(
numeric
&
0x7FFF
)
{
strcpy
(
name
,
inet_ntoa
(
sin
->
sin_addr
)
);
safe_strncpy
(
name
,
inet_ntoa
(
sin
->
sin_addr
),
len
);
return
(
0
);
return
(
0
);
}
}
#if 0
#if 0
...
@@ -145,7 +145,7 @@ static int INET_rresolve(char *name, struct sockaddr_in *sin, int numeric,
...
@@ -145,7 +145,7 @@ static int INET_rresolve(char *name, struct sockaddr_in *sin, int numeric,
pn
=
INET_nn
;
pn
=
INET_nn
;
while
(
pn
!=
NULL
)
{
while
(
pn
!=
NULL
)
{
if
(
pn
->
addr
.
sin_addr
.
s_addr
==
ad
)
{
if
(
pn
->
addr
.
sin_addr
.
s_addr
==
ad
)
{
s
trcpy
(
name
,
pn
->
name
);
s
afe_strncpy
(
name
,
pn
->
name
,
len
);
return
(
0
);
return
(
0
);
}
}
pn
=
pn
->
next
;
pn
=
pn
->
next
;
...
@@ -157,16 +157,14 @@ static int INET_rresolve(char *name, struct sockaddr_in *sin, int numeric,
...
@@ -157,16 +157,14 @@ static int INET_rresolve(char *name, struct sockaddr_in *sin, int numeric,
if
((
ad
&
(
~
netmask
))
!=
0
)
{
if
((
ad
&
(
~
netmask
))
!=
0
)
{
ent
=
gethostbyaddr
((
char
*
)
&
ad
,
4
,
AF_INET
);
ent
=
gethostbyaddr
((
char
*
)
&
ad
,
4
,
AF_INET
);
if
(
ent
!=
NULL
)
if
(
ent
!=
NULL
)
s
trcpy
(
name
,
ent
->
h_name
);
s
afe_strncpy
(
name
,
ent
->
h_name
,
len
);
}
else
{
}
else
{
np
=
getnetbyaddr
(
host_ad
,
AF_INET
);
np
=
getnetbyaddr
(
host_ad
,
AF_INET
);
if
(
np
!=
NULL
)
{
if
(
np
!=
NULL
)
strcpy
(
name
,
np
->
n_name
);
safe_strncpy
(
name
,
np
->
n_name
,
len
);
}
}
if
((
ent
==
NULL
)
&&
(
np
==
NULL
))
{
strcpy
(
name
,
inet_ntoa
(
sin
->
sin_addr
));
}
}
if
((
ent
==
NULL
)
&&
(
np
==
NULL
))
safe_strncpy
(
name
,
inet_ntoa
(
sin
->
sin_addr
),
len
);
pn
=
(
struct
addr
*
)
malloc
(
sizeof
(
struct
addr
));
pn
=
(
struct
addr
*
)
malloc
(
sizeof
(
struct
addr
));
pn
->
addr
=
*
sin
;
pn
->
addr
=
*
sin
;
pn
->
next
=
INET_nn
;
pn
->
next
=
INET_nn
;
...
@@ -198,9 +196,11 @@ static char *INET_sprint(struct sockaddr *sap, int numeric)
...
@@ -198,9 +196,11 @@ static char *INET_sprint(struct sockaddr *sap, int numeric)
if
(
sap
->
sa_family
==
0xFFFF
||
sap
->
sa_family
==
0
)
if
(
sap
->
sa_family
==
0xFFFF
||
sap
->
sa_family
==
0
)
return
safe_strncpy
(
buff
,
_
(
"[NONE SET]"
),
sizeof
(
buff
));
return
safe_strncpy
(
buff
,
_
(
"[NONE SET]"
),
sizeof
(
buff
));
if
(
INET_rresolve
(
buff
,
(
struct
sockaddr_in
*
)
sap
,
numeric
,
0xffffff00
)
!=
0
)
if
(
INET_rresolve
(
buff
,
sizeof
(
buff
),
(
struct
sockaddr_in
*
)
sap
,
numeric
,
0xffffff00
)
!=
0
)
return
(
NULL
);
return
(
NULL
);
return
(
buff
);
return
(
buff
);
}
}
...
@@ -211,8 +211,8 @@ char *INET_sprintmask(struct sockaddr *sap, int numeric,
...
@@ -211,8 +211,8 @@ char *INET_sprintmask(struct sockaddr *sap, int numeric,
if
(
sap
->
sa_family
==
0xFFFF
||
sap
->
sa_family
==
0
)
if
(
sap
->
sa_family
==
0xFFFF
||
sap
->
sa_family
==
0
)
return
safe_strncpy
(
buff
,
_
(
"[NONE SET]"
),
sizeof
(
buff
));
return
safe_strncpy
(
buff
,
_
(
"[NONE SET]"
),
sizeof
(
buff
));
if
(
INET_rresolve
(
buff
,
(
struct
sockaddr_in
*
)
sap
,
numeric
,
if
(
INET_rresolve
(
buff
,
sizeof
(
buff
),
(
struct
sockaddr_in
*
)
sap
,
netmask
)
!=
0
)
n
umeric
,
n
etmask
)
!=
0
)
return
(
NULL
);
return
(
NULL
);
return
(
buff
);
return
(
buff
);
}
}
...
...
lib/masq_info.c
View file @
77344ce0
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* NET-3 Networking Distribution for the LINUX operating
* NET-3 Networking Distribution for the LINUX operating
* system. (net-tools, net-drivers)
* system. (net-tools, net-drivers)
*
*
* Version: $Id: masq_info.c,v 1.
5 1999/02/23 12:46:31
philip Exp $
* Version: $Id: masq_info.c,v 1.
6 1999/06/12 23:04:19
philip Exp $
*
*
* Author: Bernd 'eckes' Eckenfels <net-tools@lina.inka.de>
* Author: Bernd 'eckes' Eckenfels <net-tools@lina.inka.de>
* Copyright 1999 Bernd Eckenfels, Germany
* Copyright 1999 Bernd Eckenfels, Germany
...
@@ -124,6 +124,10 @@ static int read_masqinfo(FILE * f, struct masq *mslist, int nmslist)
...
@@ -124,6 +124,10 @@ static int read_masqinfo(FILE * f, struct masq *mslist, int nmslist)
ms
->
proto
=
"udp"
;
ms
->
proto
=
"udp"
;
else
if
(
strcmp
(
"ICMP"
,
buf
)
==
0
)
else
if
(
strcmp
(
"ICMP"
,
buf
)
==
0
)
ms
->
proto
=
"icmp"
;
ms
->
proto
=
"icmp"
;
else
if
(
strcmp
(
"GRE"
,
buf
)
==
0
)
ms
->
proto
=
"gre"
;
else
if
(
strcmp
(
"ESP"
,
buf
)
==
0
)
ms
->
proto
=
"esp"
;
else
{
else
{
EINTERN
(
"masq_info.c"
,
"ip_masquerade unknown type"
);
EINTERN
(
"masq_info.c"
,
"ip_masquerade unknown type"
);
return
(
-
1
);
return
(
-
1
);
...
...
netstat.c
View file @
77344ce0
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* NET-3 Networking Distribution for the LINUX operating
* NET-3 Networking Distribution for the LINUX operating
* system.
* system.
*
*
* Version: $Id: netstat.c,v 1.2
7 1999/04/20 14:28:14
philip Exp $
* Version: $Id: netstat.c,v 1.2
8 1999/06/12 23:04:15
philip Exp $
*
*
* Authors: Fred Baumgarten, <dc6iq@insu1.etec.uni-karlsruhe.de>
* Authors: Fred Baumgarten, <dc6iq@insu1.etec.uni-karlsruhe.de>
* Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
* Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
...
@@ -549,8 +549,8 @@ static void igmp_do_one(int lnr, const char *line)
...
@@ -549,8 +549,8 @@ static void igmp_do_one(int lnr, const char *line)
((
struct
sockaddr
*
)
&
mcastaddr
)
->
sa_family
);
((
struct
sockaddr
*
)
&
mcastaddr
)
->
sa_family
);
return
;
return
;
}
}
s
tr
cpy
(
mcast_addr
,
ap
->
sprint
((
struct
sockaddr
*
)
&
mcastaddr
,
s
afe_strn
cpy
(
mcast_addr
,
ap
->
sprint
((
struct
sockaddr
*
)
&
mcastaddr
,
flag_not
));
flag_not
)
,
sizeof
(
mcast_addr
)
);
printf
(
"%-15s %-6d %s
\n
"
,
device
,
refcnt
,
mcast_addr
);
printf
(
"%-15s %-6d %s
\n
"
,
device
,
refcnt
,
mcast_addr
);
#endif
#endif
}
else
{
/* IPV4 */
}
else
{
/* IPV4 */
...
@@ -587,8 +587,8 @@ static void igmp_do_one(int lnr, const char *line)
...
@@ -587,8 +587,8 @@ static void igmp_do_one(int lnr, const char *line)
((
struct
sockaddr
*
)
&
mcastaddr
)
->
sa_family
);
((
struct
sockaddr
*
)
&
mcastaddr
)
->
sa_family
);
return
;
return
;
}
}
s
tr
cpy
(
mcast_addr
,
ap
->
sprint
((
struct
sockaddr
*
)
&
mcastaddr
,
s
afe_strn
cpy
(
mcast_addr
,
ap
->
sprint
((
struct
sockaddr
*
)
&
mcastaddr
,
flag_not
)
);
flag_not
)
,
sizeof
(
mcast_addr
)
);
printf
(
"%-15s %-6d %s
\n
"
,
device
,
refcnt
,
mcast_addr
);
printf
(
"%-15s %-6d %s
\n
"
,
device
,
refcnt
,
mcast_addr
);
#endif
#endif
}
/* IPV4 */
}
/* IPV4 */
...
@@ -676,8 +676,10 @@ static void tcp_do_one(int lnr, const char *line)
...
@@ -676,8 +676,10 @@ static void tcp_do_one(int lnr, const char *line)
rxq
=
0L
;
rxq
=
0L
;
txq
=
0L
;
txq
=
0L
;
}
}
strcpy
(
local_addr
,
ap
->
sprint
((
struct
sockaddr
*
)
&
localaddr
,
flag_not
));
safe_strncpy
(
local_addr
,
ap
->
sprint
((
struct
sockaddr
*
)
&
localaddr
,
strcpy
(
rem_addr
,
ap
->
sprint
((
struct
sockaddr
*
)
&
remaddr
,
flag_not
));
flag_not
),
sizeof
(
local_addr
));
safe_strncpy
(
rem_addr
,
ap
->
sprint
((
struct
sockaddr
*
)
&
remaddr
,
flag_not
),
sizeof
(
rem_addr
));
if
(
flag_all
||
(
flag_lst
&&
!
rem_port
)
||
(
!
flag_lst
&&
rem_port
))
{
if
(
flag_all
||
(
flag_lst
&&
!
rem_port
)
||
(
!
flag_lst
&&
rem_port
))
{
snprintf
(
buffer
,
sizeof
(
buffer
),
"%s"
,
get_sname
(
htons
(
local_port
),
"tcp"
,
flag_not
));
snprintf
(
buffer
,
sizeof
(
buffer
),
"%s"
,
get_sname
(
htons
(
local_port
),
"tcp"
,
flag_not
));
...
@@ -820,7 +822,8 @@ static void udp_do_one(int lnr, const char *line)
...
@@ -820,7 +822,8 @@ static void udp_do_one(int lnr, const char *line)
if
(
flag_all
||
(
notnull
(
remaddr
)
&&
!
flag_lst
)
||
(
!
notnull
(
remaddr
)
&&
flag_lst
))
if
(
flag_all
||
(
notnull
(
remaddr
)
&&
!
flag_lst
)
||
(
!
notnull
(
remaddr
)
&&
flag_lst
))
{
{
strcpy
(
local_addr
,
ap
->
sprint
((
struct
sockaddr
*
)
&
localaddr
,
flag_not
));
safe_strncpy
(
local_addr
,
ap
->
sprint
((
struct
sockaddr
*
)
&
localaddr
,
flag_not
),
sizeof
(
local_addr
));
snprintf
(
buffer
,
sizeof
(
buffer
),
"%s"
,
get_sname
(
htons
(
local_port
),
"udp"
,
flag_not
));
snprintf
(
buffer
,
sizeof
(
buffer
),
"%s"
,
get_sname
(
htons
(
local_port
),
"udp"
,
flag_not
));
if
((
strlen
(
local_addr
)
+
strlen
(
buffer
))
>
22
)
if
((
strlen
(
local_addr
)
+
strlen
(
buffer
))
>
22
)
local_addr
[
22
-
strlen
(
buffer
)]
=
'\0'
;
local_addr
[
22
-
strlen
(
buffer
)]
=
'\0'
;
...
@@ -828,7 +831,8 @@ static void udp_do_one(int lnr, const char *line)
...
@@ -828,7 +831,8 @@ static void udp_do_one(int lnr, const char *line)
strcat
(
local_addr
,
buffer
);
strcat
(
local_addr
,
buffer
);
snprintf
(
buffer
,
sizeof
(
buffer
),
"%s"
,
get_sname
(
htons
(
rem_port
),
"udp"
,
flag_not
));
snprintf
(
buffer
,
sizeof
(
buffer
),
"%s"
,
get_sname
(
htons
(
rem_port
),
"udp"
,
flag_not
));
strcpy
(
rem_addr
,
ap
->
sprint
((
struct
sockaddr
*
)
&
remaddr
,
flag_not
));
safe_strncpy
(
rem_addr
,
ap
->
sprint
((
struct
sockaddr
*
)
&
remaddr
,
flag_not
),
sizeof
(
rem_addr
));
if
((
strlen
(
rem_addr
)
+
strlen
(
buffer
))
>
22
)
if
((
strlen
(
rem_addr
)
+
strlen
(
buffer
))
>
22
)
rem_addr
[
22
-
strlen
(
buffer
)]
=
'\0'
;
rem_addr
[
22
-
strlen
(
buffer
)]
=
'\0'
;
strcat
(
rem_addr
,
":"
);
strcat
(
rem_addr
,
":"
);
...
@@ -939,14 +943,16 @@ static void raw_do_one(int lnr, const char *line)
...
@@ -939,14 +943,16 @@ static void raw_do_one(int lnr, const char *line)
if
(
flag_all
||
(
notnull
(
remaddr
)
&&
!
flag_lst
)
||
(
!
notnull
(
remaddr
)
&&
flag_lst
))
if
(
flag_all
||
(
notnull
(
remaddr
)
&&
!
flag_lst
)
||
(
!
notnull
(
remaddr
)
&&
flag_lst
))
{
{
snprintf
(
buffer
,
sizeof
(
buffer
),
"%s"
,
get_sname
(
htons
(
local_port
),
"raw"
,
flag_not
));
snprintf
(
buffer
,
sizeof
(
buffer
),
"%s"
,
get_sname
(
htons
(
local_port
),
"raw"
,
flag_not
));
strcpy
(
local_addr
,
ap
->
sprint
((
struct
sockaddr
*
)
&
localaddr
,
flag_not
));
safe_strncpy
(
local_addr
,
ap
->
sprint
((
struct
sockaddr
*
)
&
localaddr
,
flag_not
),
sizeof
(
local_addr
));
if
((
strlen
(
local_addr
)
+
strlen
(
buffer
))
>
22
)
if
((
strlen
(
local_addr
)
+
strlen
(
buffer
))
>
22
)
local_addr
[
22
-
strlen
(
buffer
)]
=
'\0'
;
local_addr
[
22
-
strlen
(
buffer
)]
=
'\0'
;
strcat
(
local_addr
,
":"
);
strcat
(
local_addr
,
":"
);
strcat
(
local_addr
,
buffer
);
strcat
(
local_addr
,
buffer
);
snprintf
(
buffer
,
sizeof
(
buffer
),
"%s"
,
get_sname
(
htons
(
rem_port
),
"raw"
,
flag_not
));
snprintf
(
buffer
,
sizeof
(
buffer
),
"%s"
,
get_sname
(
htons
(
rem_port
),
"raw"
,
flag_not
));
strcpy
(
rem_addr
,
ap
->
sprint
((
struct
sockaddr
*
)
&
remaddr
,
flag_not
));
safe_strncpy
(
rem_addr
,
ap
->
sprint
((
struct
sockaddr
*
)
&
remaddr
,
flag_not
),
sizeof
(
rem_addr
));
if
((
strlen
(
rem_addr
)
+
strlen
(
buffer
))
>
22
)
if
((
strlen
(
rem_addr
)
+
strlen
(
buffer
))
>
22
)
rem_addr
[
22
-
strlen
(
buffer
)]
=
'\0'
;
rem_addr
[
22
-
strlen
(
buffer
)]
=
'\0'
;
strcat
(
rem_addr
,
":"
);
strcat
(
rem_addr
,
":"
);
...
@@ -1310,13 +1316,13 @@ static int ipx_info(void)
...
@@ -1310,13 +1316,13 @@ static int ipx_info(void)
/* Fetch and resolve the Source */
/* Fetch and resolve the Source */
(
void
)
ap
->
input
(
4
,
sad
,
&
sa
);
(
void
)
ap
->
input
(
4
,
sad
,
&
sa
);
s
trcpy
(
buf
,
ap
->
sprint
(
&
sa
,
flag_not
));
s
afe_strncpy
(
buf
,
ap
->
sprint
(
&
sa
,
flag_not
),
sizeof
(
buf
));
snprintf
(
sad
,
sizeof
(
sad
),
"%s:%04X"
,
buf
,
sport
);
snprintf
(
sad
,
sizeof
(
sad
),
"%s:%04X"
,
buf
,
sport
);
if
(
!
nc
)
{
if
(
!
nc
)
{
/* Fetch and resolve the Destination */
/* Fetch and resolve the Destination */
(
void
)
ap
->
input
(
4
,
dad
,
&
sa
);
(
void
)
ap
->
input
(
4
,
dad
,
&
sa
);
s
trcpy
(
buf
,
ap
->
sprint
(
&
sa
,
flag_not
));
s
afe_strncpy
(
buf
,
ap
->
sprint
(
&
sa
,
flag_not
),
sizeof
(
buf
));
snprintf
(
dad
,
sizeof
(
dad
),
"%s:%04X"
,
buf
,
dport
);
snprintf
(
dad
,
sizeof
(
dad
),
"%s:%04X"
,
buf
,
dport
);
}
else
}
else
strcpy
(
dad
,
"-"
);
strcpy
(
dad
,
"-"
);
...
...
slattach.c
View file @
77344ce0
...
@@ -58,6 +58,7 @@
...
@@ -58,6 +58,7 @@
#include "version.h"
#include "version.h"
#include "config.h"
#include "config.h"
#include "intl.h"
#include "intl.h"
#include "util.h"
#ifndef _PATH_LOCKD
#ifndef _PATH_LOCKD
#define _PATH_LOCKD "/var/lock"
/* lock files */
#define _PATH_LOCKD "/var/lock"
/* lock files */
...
@@ -665,7 +666,7 @@ main(int argc, char *argv[])
...
@@ -665,7 +666,7 @@ main(int argc, char *argv[])
/* Is a terminal given? */
/* Is a terminal given? */
if
(
optind
!=
(
argc
-
1
))
usage
();
if
(
optind
!=
(
argc
-
1
))
usage
();
s
trncpy
(
path
,
argv
[
optind
],
128
);
s
afe_strncpy
(
path
,
argv
[
optind
],
sizeof
(
path
)
);
if
(
!
strcmp
(
path
,
"-"
))
{
if
(
!
strcmp
(
path
,
"-"
))
{
opt_e
=
1
;
opt_e
=
1
;
sp
=
NULL
;
sp
=
NULL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment