Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
network:utilities
bing
bing-1.0.5.dif
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bing-1.0.5.dif of Package bing
Index: Makefile =================================================================== --- Makefile.orig +++ Makefile @@ -1,8 +1,8 @@ # # $Id: Makefile,v 1.4 1995/07/21 00:03:30 pb Exp $ # -MANDIR=/usr/local/man -BINDIR=/usr/local/bin +MANDIR=/usr/man +BINDIR=/usr/bin INSTALL=install -c GROFF=groff NROFF=nroff @@ -28,5 +28,5 @@ clean: $(RM) -f bing bing.ps bing.0 install: bing bing.8 - $(INSTALL) -m 644 -o man -g man bing.8 $(MANDIR)/man8 - $(INSTALL) -m 4555 -o root -g staff bing $(BINDIR) + $(INSTALL) -m 644 bing.8 $(MANDIR)/man8 + $(INSTALL) -m 4555 -o root -g root bing $(BINDIR) Index: bing.c =================================================================== --- bing.c.orig +++ bing.c @@ -170,10 +170,13 @@ static char rcsid[] = "$Id: bing.c,v 1.1 #include <netdb.h> #include <unistd.h> #include <stdio.h> +#include <stdlib.h> #include <ctype.h> #include <errno.h> #include <string.h> #include <limits.h> +#include <pwd.h> +#include <grp.h> #include "sysdep.h" @@ -530,7 +533,7 @@ void pr_iph(ip) (void)printf(" %1x %04x", ((ip->ip_off) & 0xe000) >> 13, (ip->ip_off) & 0x1fff); (void)printf(" %02x %02x %04x", ip->ip_ttl, ip->ip_p, ip->ip_sum); -#ifdef linux +#if defined linux && !defined __NETINET_IP_ICMP_H (void)printf(" %s ", inet_ntoa(ip->ip_src)); (void)printf(" %s ", inet_ntoa(ip->ip_dst)); #else @@ -644,7 +647,7 @@ void pr_icmph(icp) (void)printf("Redirect, Bad Code: %d", icp->icmp_code); break; } -#ifdef linux +#if defined linux && !defined __NETINET_IP_ICMP_H (void)printf("(New addr: 0x%08lx)\n", icp->icmp_gwaddr); #else (void)printf("(New addr: 0x%08lx)\n", icp->icmp_gwaddr.s_addr); @@ -671,7 +674,7 @@ void pr_icmph(icp) pr_retip((struct ip *)ICMP_TO_DATA(icp)); break; case ICMP_PARAMPROB: -#ifdef linux +#if defined linux && !defined __NETINET_IP_ICMP_H (void)printf("Parameter problem: pointer = 0x%02x\n", icp->un.gateway); #else @@ -1229,11 +1232,12 @@ int main(argc, argv) struct protoent *proto; struct in_addr ifaddr; struct hoststats *hs1, *hs2; + struct passwd *pwd; int ntrans, nloops, bits; int i; int ch, hold, recv_packlen, preload; u_char *datap, *recv_packet; - char *target1, *target2, *malloc(); + char *target1, *target2; u_char ttl, loop; #ifdef IP_OPTIONS char rspace[3 + 4 * NROUTES + 1]; /* record route space */ @@ -1348,9 +1352,10 @@ int main(argc, argv) moptions |= MULTICAST_IF; { int i1, i2, i3, i4; + char dummy; if (sscanf(optarg, "%u.%u.%u.%u%c", - &i1, &i2, &i3, &i4, &i) != 4) { + &i1, &i2, &i3, &i4, &dummy) != 4) { printf("bad interface address '%s'\n", optarg); exit(1); @@ -1406,6 +1411,21 @@ int main(argc, argv) perror("bing: socket"); exit(1); } + + // drop root privs + if((pwd = getpwuid(getuid())) == NULL) + { + perror("bing: getpwuid()"); + exit(1); + } + if(initgroups(pwd->pw_name, pwd->pw_gid) < 0) + { + perror("bing: initgroups()"); + exit(1); + } + setgid(getgid()); + setuid(getuid()); + hold = 1; if (options & F_SO_DEBUG) (void)setsockopt(s, SOL_SOCKET, SO_DEBUG, (char *)&hold, Index: sysdep.h =================================================================== --- sysdep.h.orig +++ sysdep.h @@ -46,7 +46,7 @@ #ifndef _SYSDEP_H_ #define _SYSDEP_H_ -#ifdef linux +#if defined linux && !defined __NETINET_IP_ICMP_H #define icmp icmphdr #define ip iphdr #define icmp_type type @@ -66,7 +66,9 @@ #define ip_sum check #define ip_src saddr #define ip_dst daddr +#ifndef MAX_IPOPTLEN #define MAX_IPOPTLEN 4096 +#endif #define ICMP_MINLEN 16 #define IPOPT_MINOFF 4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor