[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-96-g481c0c
From: |
Mats Erik Andersson |
Subject: |
[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-96-g481c0cc |
Date: |
Sat, 19 May 2012 23:22:39 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".
The branch, master has been updated
via 481c0ccc01b8d6d6328dbc85835b689ecc3531fe (commit)
via cbf7786f49c3f59f9623d89cea40615c4c27f180 (commit)
from ab1f0a199cfeb217cadbfccf2c7b9095e97b452d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=481c0ccc01b8d6d6328dbc85835b689ecc3531fe
commit 481c0ccc01b8d6d6328dbc85835b689ecc3531fe
Author: Mats Erik Andersson <address@hidden>
Date: Sun May 20 00:54:02 2012 +0200
rexecd: Allow getpwnam_r.
diff --git a/ChangeLog b/ChangeLog
index d87fb4c..368af76 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2012-05-20 Mats Erik Andersson <address@hidden>
+
+ rexecd: Use getpwnam_r() if available, thus
+ preparing migration to PAM.
+
+ * src/rexecd.c [HAVE_GETPWNAM_R]: Include <xalloc.h>.
+ (doit) [HAVE_GETPWNAM_R]: New variables PWBUF, PWBUFLEN,
+ and PWSTOR. Dynamically allocate PWBUF. Call getpwnam_r()
+ with composite check on result.
+
2012-05-16 Mats Erik Andersson <address@hidden>
ping, traceroute: Type-of-Service.
diff --git a/src/rexecd.c b/src/rexecd.c
index 6042032..d4d0220 100644
--- a/src/rexecd.c
+++ b/src/rexecd.c
@@ -83,6 +83,10 @@
# include <shadow.h>
#endif
#include <syslog.h>
+#ifdef HAVE_GETPWNAM_R
+# include <xalloc.h>
+#endif
+
#include <progname.h>
#include <argp.h>
#include <error.h>
@@ -191,7 +195,13 @@ doit (int f, struct sockaddr *fromp, socklen_t fromlen)
{
char *cmdbuf, *cp, *namep;
char *user, *pass, *pw_password;
+#ifdef HAVE_GETPWNAM_R
+ char *pwbuf;
+ int pwbuflen;
+ struct passwd *pwd, pwstor;
+#else /* !HAVE_GETPWNAM_R */
struct passwd *pwd;
+#endif
char rhost[INET6_ADDRSTRLEN];
int s, ret;
in_port_t port;
@@ -200,6 +210,14 @@ doit (int f, struct sockaddr *fromp, socklen_t fromlen)
char buf[BUFSIZ], sig;
int one = 1;
+#ifdef HAVE_GETPWNAM_R
+ pwbuflen = sysconf (_SC_GETPW_R_SIZE_MAX);
+ if (pwbuflen <= 0)
+ pwbuflen = 1024; /* Guessing only. */
+
+ pwbuf = xmalloc (pwbuflen);
+#endif /* HAVE_GETPWNAM_R */
+
signal (SIGINT, SIG_DFL);
signal (SIGQUIT, SIG_DFL);
signal (SIGTERM, SIG_DFL);
@@ -289,8 +307,13 @@ doit (int f, struct sockaddr *fromp, socklen_t fromlen)
setpwent ();
+#ifdef HAVE_GETPWNAM_R
+ ret = getpwnam_r (user, &pwstor, pwbuf, pwbuflen, &pwd);
+ if (ret || pwd == NULL)
+#else /* !HAVE_GETPWNAM_R */
pwd = getpwnam (user);
if (pwd == NULL)
+#endif /* HAVE_GETPWNAM_R */
{
if (logging)
syslog (LOG_WARNING, "no user named \"%s\"", user);
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=cbf7786f49c3f59f9623d89cea40615c4c27f180
commit cbf7786f49c3f59f9623d89cea40615c4c27f180
Author: Mats Erik Andersson <address@hidden>
Date: Sun May 20 00:40:39 2012 +0200
ping, traceroute: Type-of-service.
diff --git a/ChangeLog b/ChangeLog
index 24ee853..d87fb4c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2012-05-16 Mats Erik Andersson <address@hidden>
+
+ ping, traceroute: Type-of-Service.
+
+ * doc/inetutils <ping, traceroute invocation>: Update.
+ * ping/ping.c (tos): New variable.
+ (argp_options): New option `-T/--tos'.
+ (parse_opt): New case `T'.
+ (main): Set socket option IP_TOS.
+ * src/traceroute.c (opt_tos): New variable.
+ (argp_options): New option `-t/--tos'.
+ (parse_opt): New case `t'.
+ (trace_init): New variable FD. Set socket option IP_TOS.
+
2012-05-14 Mats Erik Andersson <address@hidden>
Build test binaries early.
diff --git a/doc/inetutils.texi b/doc/inetutils.texi
index cc2506b..de7d8f7 100644
--- a/doc/inetutils.texi
+++ b/doc/inetutils.texi
@@ -512,6 +512,7 @@ Send @var{type} packets. Accepted values are
@samp{address},
@c -i, --interval=NUMBER Wait NUMBER seconds between sending each packet
@c -n, --numeric Do not resolve host addresses
@c -r, --ignore-routing Send directly to a host on an attached network
address@hidden -T, --tos=NUM Set type-of-service to NUM
@c --ttl=NUMBER Set specified time-to-live on packet
@table @option
@@ -552,6 +553,12 @@ an error is returned. This option can be used to ping a
local host
through an interface that has no route through it (e.g., after the
interface was dropped by @command{routed}).
address@hidden -T @var{num}
address@hidden address@hidden
address@hidden -T
address@hidden --tos
+Set type-of-service, TOS, to NUM on transmitted packets.
+
@item address@hidden
@opindex --ttl
Set the specified number @var{n} as value of time-to-live when
@@ -780,6 +787,12 @@ Send @var{num} probe packets per hop (default: 3).
@item --resolve-hostnames
@opindex --resolve-hostnames
Resolve hostnames.
+
address@hidden -t @var{num}
address@hidden address@hidden
address@hidden -t
address@hidden --tos
+Set type-of-service, TOS, to NUM on transmitted packets.
@end table
@node whois invocation
diff --git a/ping/ping.c b/ping/ping.c
index 6b3f2e7..22f5368 100644
--- a/ping/ping.c
+++ b/ping/ping.c
@@ -65,6 +65,7 @@ size_t data_length = PING_DATALEN;
unsigned options;
unsigned int suboptions;
unsigned long preload = 0;
+int tos = -1; /* Triggers with non-negative values. */
int ttl = 0;
int timeout = -1;
int linger = MAXWAIT;
@@ -117,6 +118,7 @@ static struct argp_option argp_options[] = {
{"numeric", 'n', NULL, 0, "do not resolve host addresses", GRP+1},
{"ignore-routing", 'r', NULL, 0, "send directly to a host on an attached "
"network", GRP+1},
+ {"tos", 'T', "NUM", 0, "set type of service (TOS) to NUM", GRP+1},
{"ttl", ARG_TTL, "N", 0, "specify N as time-to-live", GRP+1},
{"verbose", 'v', NULL, 0, "verbose output", GRP+1},
{"timeout", 'w', "N", 0, "stop after N seconds", GRP+1},
@@ -186,18 +188,22 @@ parse_opt (int key, char *arg, struct argp_state *state)
options |= OPT_QUIET;
break;
- case 'w':
- timeout = ping_cvt_number (arg, INT_MAX, 0);
+ case 'T':
+ tos = ping_cvt_number (arg, 255, 1);
break;
- case 'W':
- linger = ping_cvt_number (arg, INT_MAX, 0);
+ case 'w':
+ timeout = ping_cvt_number (arg, INT_MAX, 0);
break;
case 'R':
options |= OPT_RROUTE;
break;
+ case 'W':
+ linger = ping_cvt_number (arg, INT_MAX, 0);
+ break;
+
case 'v':
options |= OPT_VERBOSE;
break;
@@ -296,6 +302,11 @@ main (int argc, char **argv)
&ttl, sizeof (ttl)) < 0)
error (0, errno, "setsockopt(IP_TTL)");
+ if (tos >= 0)
+ if (setsockopt (ping->ping_fd, IPPROTO_IP, IP_TOS,
+ &tos, sizeof (tos)) < 0)
+ error (0, errno, "setsockopt(IP_TOS)");
+
init_data_buffer (patptr, pattern_len);
while (argc--)
diff --git a/src/traceroute.c b/src/traceroute.c
index 1c98d7c..8332167 100644
--- a/src/traceroute.c
+++ b/src/traceroute.c
@@ -104,6 +104,7 @@ int opt_port = 33434;
int opt_max_hops = 64;
static int opt_max_tries = 3;
int opt_resolve_hostnames = 0;
+int opt_tos = -1; /* Triggers with non-negative values. */
const char args_doc[] = "HOST";
const char doc[] = "Print the route packets trace to network host.";
@@ -122,6 +123,7 @@ static struct argp_option argp_options[] = {
{"port", 'p', "PORT", 0, "use destination PORT port (default: 33434)",
GRP+1},
{"resolve-hostnames", OPT_RESOLVE, NULL, 0, "resolve hostnames", GRP+1},
+ {"tos", 't', "NUM", 0, "set type of service (TOS) to NUM", GRP+1},
{"tries", 'q', "NUM", 0, "send NUM probe packets per hop (default: 3)",
GRP+1},
{"type", 'M', "METHOD", 0, "use METHOD (`icmp' or `udp') for traceroute "
@@ -144,10 +146,6 @@ parse_opt (int key, char *arg, struct argp_state *state)
error (EXIT_FAILURE, 0, "invalid port number `%s'", arg);
break;
- case OPT_RESOLVE:
- opt_resolve_hostnames = 1;
- break;
-
case 'q':
opt_max_tries = (int) strtol (arg, &p, 10);
if (*p)
@@ -156,6 +154,12 @@ parse_opt (int key, char *arg, struct argp_state *state)
error (EXIT_FAILURE, 0, "number of tries should be between 1 and 10");
break;
+ case 't':
+ opt_tos = strtoul (arg, &p, 0);
+ if (*p || opt_tos < 0 || opt_tos > 255)
+ error (EXIT_FAILURE, 0, "invalid TOS value `%s'", arg);
+ break;
+
case 'M':
if (strcmp (arg, "icmp") == 0)
opt_type = TRACE_ICMP;
@@ -165,6 +169,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
argp_error (state, "invalid method");
break;
+ case OPT_RESOLVE:
+ opt_resolve_hostnames = 1;
+ break;
+
case ARGP_KEY_ARG:
host_is_given = true;
hostname = xstrdup(arg);
@@ -354,7 +362,9 @@ void
trace_init (trace_t * t, const struct sockaddr_in to,
const enum trace_type type)
{
+ int fd;
const int *ttlp;
+
assert (t);
ttlp = &t->ttl;
@@ -399,6 +409,13 @@ trace_init (trace_t * t, const struct sockaddr_in to,
{
/* FIXME: type according to RFC 1393 */
}
+
+ fd = (t->type == TRACE_UDP ? t->udpfd : t->icmpfd);
+
+ if (opt_tos >= 0)
+ if (setsockopt (fd, IPPROTO_IP, IP_TOS,
+ &opt_tos, sizeof (opt_tos)) < 0)
+ error (0, errno, "setsockopt(IP_TOS)");
}
void
@@ -534,6 +551,7 @@ trace_write (trace_t * t)
case TRACE_UDP:
{
char data[] = "SUPERMAN";
+
len = sendto (t->udpfd, (char *) data, sizeof (data),
0, (struct sockaddr *) &t->to, sizeof (t->to));
if (len < 0)
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 24 ++++++++++++++++++++++++
doc/inetutils.texi | 13 +++++++++++++
ping/ping.c | 19 +++++++++++++++----
src/rexecd.c | 23 +++++++++++++++++++++++
src/traceroute.c | 26 ++++++++++++++++++++++----
5 files changed, 97 insertions(+), 8 deletions(-)
hooks/post-receive
--
GNU Inetutils
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-96-g481c0cc,
Mats Erik Andersson <=