NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bin/37862: ypwhich uses only UDP and not TCP
>Number: 37862
>Category: bin
>Synopsis: ypwhich uses only UDP and not TCP
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Thu Jan 24 14:10:00 +0000 2008
>Originator: Wolfgang Stukenbrock
>Release: NetBSD 4.0
>Organization:
Dr. Nagler & Company GmbH
>Environment:
System: NetBSD s012 2.1 NetBSD 2.1 (NSW-S012) #10: Mon Dec 12 12:03:54 CET 2005
wgstuken@s011:/export/netbsd-2.1/usr/src/sys/arch/i386/compile/NSW-S012 i386
Architecture: i386
Machine: i386
>Description:
The ypwhich command uses UDP to retrieve the information from the
server.
If the server is reached via WAN or lots of data is transfered UDP is
unrelyable.
All modern NIS servers also supports TCP for requests.
The following patch for ypwhich.c and the manual ypwhich.1 adds a new
option (-T)
that switches the RPC-mode from UDP to TCP.
With this option ypwhich will work much more relyable on WAN
connections. At least
in our installtion it will do so through IPsec tunnels between
different locations.
>How-To-Repeat:
Not relevant - new functionality is added to the command.
>Fix:
Patch for /usr/src/usr.bin/ypwhich/ypwhich.1
*** /export/NetBSD-4.0/src/usr.bin/ypwhich/ypwhich.1 Sat Feb 26 17:22:27 2005
--- ./src/usr.bin/ypwhich/ypwhich.1 Mon Sep 18 17:16:52 2006
***************
*** 41,51 ****
--- 41,53 ----
.Op Fl h
.Ar host
.Oc
+ .Op Fl T
.Nm
.Op Fl d Ar domain
.Op Fl h Ar host
.Op Fl f
.Op Fl t
+ .Op Fl T
.Fl m Op Ar mname
.Nm
.Fl x
***************
*** 83,88 ****
--- 85,92 ----
.It Fl t
Inhibit translation of map nicknames
to their corresponding map names.
+ .It Fl T
+ Use TCP protocol instead of UDP.
.It Fl m Op Ar mname
Find the master
.Tn NIS
xxxx end of patch for /usr/src/usr.bin/ypwhich/ypwhich.1
Patch for /usr/src/usr.bin/ypwhich/ypwhich.c
*** /export/NetBSD-4.0/src/usr.bin/ypwhich/ypwhich.c Sat Jul 12 16:03:46 2003
--- ./src/usr.bin/ypwhich/ypwhich.c Mon Sep 18 16:38:24 2006
***************
*** 74,79 ****
--- 74,80 ----
* -h: specify a host to ask [default = localhost]
* -m: find master server for a specific map (no map means 'all maps')
* -t: inhibit nickname translation
+ * -T: use TCP not UDB
* -x: print list of yp map aliases and exit
*/
***************
*** 100,105 ****
--- 101,108 ----
int main __P((int, char *[]));
void usage __P((void));
+ static int T_flag = 0;
+
/*
* main
*/
***************
*** 123,129 ****
yp_get_default_domain(&ourdomain);
saw_m = 0;
! while ((ch = getopt(argc, argv, "h:d:xtfm")) != -1) {
switch (ch) {
case 'h':
targhost = optarg;
--- 126,132 ----
yp_get_default_domain(&ourdomain);
saw_m = 0;
! while ((ch = getopt(argc, argv, "h:d:xtTfm")) != -1) {
switch (ch) {
case 'h':
targhost = optarg;
***************
*** 142,147 ****
--- 145,153 ----
case 't':
inhibit = 1;
break;
+ case 'T':
+ T_flag = 1;
+ break;
case 'm':
if (optind < argc && argv[optind][0] != '-')
targmap = argv[optind++];
***************
*** 195,202 ****
usage()
{
fprintf(stderr, "usage:\n");
! fprintf(stderr, "\t%s [-d domain] [[-h] host]\n", getprogname());
! fprintf(stderr, "\t%s [-h host] [-d domain] [-f] [-t] -m [mapname]\n",
getprogname());
fprintf(stderr, "\t%s -x\n", getprogname());
exit(1);
--- 201,208 ----
usage()
{
fprintf(stderr, "usage:\n");
! fprintf(stderr, "\t%s [-T] [-d domain] [[-h] host]\n", getprogname());
! fprintf(stderr, "\t%s [-T] [-h host] [-d domain] [-f] [-t] -m
[mapname]\n",
getprogname());
fprintf(stderr, "\t%s -x\n", getprogname());
exit(1);
***************
*** 237,246 ****
tv.tv_sec = 15;
tv.tv_usec = 0;
ypbind_fd = RPC_ANYSOCK;
! ypbind = clntudp_create(&sin, YPBINDPROG, YPBINDVERS, tv, &ypbind_fd);
! if (ypbind == NULL)
! errx(1, "clntudp_create: %s: %s", host,
! yperr_string(YPERR_YPBIND));
/*
* now call ypbind's "DOMAIN" procedure to get the server name
--- 243,262 ----
tv.tv_sec = 15;
tv.tv_usec = 0;
ypbind_fd = RPC_ANYSOCK;
! if (T_flag != 0)
! {
! ypbind = clnttcp_create(&sin, YPBINDPROG, YPBINDVERS, &ypbind_fd,
0, 0);
! if (ypbind == NULL)
! errx(1, "clnttcp_create: %s: %s", host,
! yperr_string(YPERR_YPBIND));
! }
! else
! {
! ypbind = clntudp_create(&sin, YPBINDPROG, YPBINDVERS, tv,
&ypbind_fd);
! if (ypbind == NULL)
! errx(1, "clntudp_create: %s: %s", host,
! yperr_string(YPERR_YPBIND));
! }
/*
* now call ypbind's "DOMAIN" procedure to get the server name
***************
*** 326,337 ****
tv.tv_sec = 15;
tv.tv_usec = 0;
ypserv_fd = RPC_ANYSOCK;
! ypserv = clntudp_create(&sin, YPPROG, YPVERS, tv, &ypserv_fd);
! if (ypserv == NULL) {
! warnx("clntudp_create: %s: %s", host,
! yperr_string(YPERR_YPSERV));
! goto error;
! }
/*
* did the user specify a map?
--- 342,365 ----
tv.tv_sec = 15;
tv.tv_usec = 0;
ypserv_fd = RPC_ANYSOCK;
! if (T_flag != 0)
! {
! ypserv = clnttcp_create(&sin, YPPROG, YPVERS, &ypserv_fd, 0, 0);
! if (ypserv == NULL) {
! warnx("clnttcp_create: %s: %s", host,
! yperr_string(YPERR_YPSERV));
! goto error;
! }
! }
! else
! {
! ypserv = clntudp_create(&sin, YPPROG, YPVERS, tv, &ypserv_fd);
! if (ypserv == NULL) {
! warnx("clntudp_create: %s: %s", host,
! yperr_string(YPERR_YPSERV));
! goto error;
! }
! }
/*
* did the user specify a map?
xxxx end of patch for /usr/src/usr.bin/ypwhich/ypwhich.1
>Unformatted:
Home |
Main Index |
Thread Index |
Old Index