From fb4c80619a9d305abdd8b73ec6436693d6052899 Mon Sep 17 00:00:00 2001 From: Martin Blapp Date: Mon, 16 Dec 2002 22:24:26 +0000 Subject: [PATCH] Change the name for the local unix-socket based protocol from "unix" back to "local". Add some compat stuff so both ways work for some time. Reviewed by: phk Approved by: imp (UPDATING) Requested by: iedowse, lukem@netbsd.org --- UPDATING | 7 +++++++ etc/netconfig | 2 +- lib/libc/rpc/getnetconfig.c | 12 ++++++++++++ lib/libc/rpc/rpc_generic.c | 19 ++++++++++++++----- lib/libypclnt/ypclnt_passwd.c | 4 +++- usr.bin/rpcinfo/rpcinfo.c | 2 +- usr.sbin/rpcbind/rpcbind.c | 17 ++++++++++++----- usr.sbin/rpcbind/security.c | 2 +- 8 files changed, 51 insertions(+), 14 deletions(-) diff --git a/UPDATING b/UPDATING index 35cbfb7a9a87..e606137dec88 100644 --- a/UPDATING +++ b/UPDATING @@ -17,6 +17,13 @@ NOTE TO PEOPLE WHO THINK THAT 5.0-CURRENT IS SLOW: developers choose to disable these features on build machines to maximize performance. +20021216: + A name change in /etc/netconfig has been reverted to stay + compatible with with suns TIRPC and also with NetBSD. You need + to run mergemaster after make world. A new libc does still work + with a outdated /etc/netconfig for some time, but you'll get + a warning. This warning will be removed in 20030301. + 20021202: The recent binutils upgrade marks a kernel flag day on sparc64: modules built with the old binutils will not work diff --git a/etc/netconfig b/etc/netconfig index 6e6abd0e8d46..109f2e36ad43 100644 --- a/etc/netconfig +++ b/etc/netconfig @@ -16,4 +16,4 @@ tcp6 tpi_cots_ord v inet6 tcp - - udp tpi_clts v inet udp - - tcp tpi_cots_ord v inet tcp - - rawip tpi_raw - inet - - - -unix tpi_cots_ord - loopback - - - +local tpi_cots_ord - loopback - - - diff --git a/lib/libc/rpc/getnetconfig.c b/lib/libc/rpc/getnetconfig.c index d959687f5d3e..370085028d4a 100644 --- a/lib/libc/rpc/getnetconfig.c +++ b/lib/libc/rpc/getnetconfig.c @@ -418,6 +418,18 @@ getnetconfigent(netid) return (NULL); } + if (strcmp(netid, "unix") == 0) { + fprintf(stderr, "The local transport is called \"unix\" "); + fprintf(stderr, "in /etc/netconfig.\n"); + fprintf(stderr, "Please change this to \"local\" manually "); + fprintf(stderr, "or run mergemaster(8).\n"); + fprintf(stderr, "See UPDATING entry 20021216 for details.\n"); + fprintf(stderr, "Continuing in 10 seconds\n\n"); + fprintf(stderr, "This warning will be removed 20030301\n"); + sleep(10); + + } + /* * Look up table if the entries have already been read and parsed in * getnetconfig(), then copy this entry into a buffer and return it. diff --git a/lib/libc/rpc/rpc_generic.c b/lib/libc/rpc/rpc_generic.c index 3223997dc23f..181392035672 100644 --- a/lib/libc/rpc/rpc_generic.c +++ b/lib/libc/rpc/rpc_generic.c @@ -98,7 +98,7 @@ static const struct netid_af na_cvt[] = { { "udp6", AF_INET6, IPPROTO_UDP }, { "tcp6", AF_INET6, IPPROTO_TCP }, #endif - { "unix", AF_LOCAL, 0 } + { "local", AF_LOCAL, 0 } }; #if 0 @@ -524,7 +524,9 @@ __rpc_nconf2sockinfo(const struct netconfig *nconf, struct __rpc_sockinfo *sip) int i; for (i = 0; i < (sizeof na_cvt) / (sizeof (struct netid_af)); i++) - if (!strcmp(na_cvt[i].netid, nconf->nc_netid)) { + if (strcmp(na_cvt[i].netid, nconf->nc_netid) == 0 || ( + strcmp(nconf->nc_netid, "unix") == 0 && + strcmp(na_cvt[i].netid, "local") == 0)) { sip->si_af = na_cvt[i].af; sip->si_proto = na_cvt[i].protocol; sip->si_socktype = @@ -554,13 +556,20 @@ __rpc_sockinfo2netid(struct __rpc_sockinfo *sip, const char **netid) { int i; - for (i = 0; i < (sizeof na_cvt) / (sizeof (struct netid_af)); i++) + for (i = 0; i < (sizeof na_cvt) / (sizeof (struct netid_af)); i++) { if (na_cvt[i].af == sip->si_af && na_cvt[i].protocol == sip->si_proto) { - if (netid) - *netid = na_cvt[i].netid; + if (strcmp(na_cvt[i].netid, "local") == 0 && + getnetconfigent("local") == NULL) { + if (netid) + *netid = "unix"; + } else { + if (netid) + *netid = na_cvt[i].netid; + } return 1; } + } return 0; } diff --git a/lib/libypclnt/ypclnt_passwd.c b/lib/libypclnt/ypclnt_passwd.c index 0dd6569919b3..076408ff27e1 100644 --- a/lib/libypclnt/ypclnt_passwd.c +++ b/lib/libypclnt/ypclnt_passwd.c @@ -154,7 +154,9 @@ yppasswd_local(ypclnt_t *ypclnt, const struct passwd *pwd, const char *passwd) } /* connect to rpc.yppasswdd */ - nc = getnetconfigent("unix"); + nc = getnetconfigent("local"); + if (nc == NULL) + nc = getnetconfigent("unix"); clnt = clnt_tp_create(ypclnt->server, YPPASSWDPROG, YPPASSWDVERS, nc); if (clnt == NULL) { ypclnt_error(ypclnt, __func__, diff --git a/usr.bin/rpcinfo/rpcinfo.c b/usr.bin/rpcinfo/rpcinfo.c index bbe6a17ba071..b8f6c1cc58da 100644 --- a/usr.bin/rpcinfo/rpcinfo.c +++ b/usr.bin/rpcinfo/rpcinfo.c @@ -545,7 +545,7 @@ pmapdump(int argc, char **argv) else if (head->pml_map.pm_prot == IPPROTO_TCP) printf("%6s", "tcp"); else if (head->pml_map.pm_prot == IPPROTO_ST) - printf("%6s", "unix"); + printf("%6s", "local"); else printf("%6ld", head->pml_map.pm_prot); printf("%7ld", head->pml_map.pm_port); diff --git a/usr.sbin/rpcbind/rpcbind.c b/usr.sbin/rpcbind/rpcbind.c index b2ad5f1de65f..9a12ac0ced00 100644 --- a/usr.sbin/rpcbind/rpcbind.c +++ b/usr.sbin/rpcbind/rpcbind.c @@ -158,7 +158,9 @@ main(int argc, char *argv[]) tcptrans = ""; #endif - nconf = getnetconfigent("unix"); + nconf = getnetconfigent("local"); + if (nconf == NULL) + nconf = getnetconfigent("unix"); if (nconf == NULL) { syslog(LOG_ERR, "%s: can't find local transport\n", argv[0]); exit(1); @@ -279,7 +281,8 @@ init_transport(struct netconfig *nconf) return (1); } - if (!strcmp(nconf->nc_netid, "unix")) { + if ((strcmp(nconf->nc_netid, "local") == 0) || + (strcmp(nconf->nc_netid, "unix") == 0)) { memset(&sun, 0, sizeof sun); sun.sun_family = AF_LOCAL; unlink(_PATH_RPCBINDSOCK); @@ -438,7 +441,8 @@ init_transport(struct netconfig *nconf) if (!checkbind) return 1; } else { - if (strcmp(nconf->nc_netid, "unix") != 0) { + if ((strcmp(nconf->nc_netid, "local") != 0) && + (strcmp(nconf->nc_netid, "unix") != 0)) { if ((aicode = getaddrinfo(NULL, servname, &hints, &res)) != 0) { syslog(LOG_ERR, @@ -502,7 +506,8 @@ init_transport(struct netconfig *nconf) if ((strcmp(nconf->nc_protofmly, NC_INET) == 0 && (strcmp(nconf->nc_proto, NC_TCP) == 0 || strcmp(nconf->nc_proto, NC_UDP) == 0)) || - strcmp(nconf->nc_netid, "unix") == 0) { + (strcmp(nconf->nc_netid, "unix") == 0) || + (strcmp(nconf->nc_netid, "local") == 0)) { struct pmaplist *pml; if (!svc_register(my_xprt, PMAPPROG, PMAPVERS, @@ -543,7 +548,9 @@ init_transport(struct netconfig *nconf) /* Let's snarf the universal address */ /* "h1.h2.h3.h4.p1.p2" */ udp_uaddr = taddr2uaddr(nconf, &taddr.addr); - } else if (strcmp(nconf->nc_netid, "unix") == 0) + } else if (strcmp(nconf->nc_netid, "local") == 0) + pml->pml_map.pm_prot = IPPROTO_ST; + else if (strcmp(nconf->nc_netid, "unix") == 0) pml->pml_map.pm_prot = IPPROTO_ST; pml->pml_next = list_pml; list_pml = pml; diff --git a/usr.sbin/rpcbind/security.c b/usr.sbin/rpcbind/security.c index 61cea5ac01bd..8657247f60ac 100644 --- a/usr.sbin/rpcbind/security.c +++ b/usr.sbin/rpcbind/security.c @@ -214,7 +214,7 @@ logit(int severity, struct sockaddr *addr, rpcproc_t procnum, rpcprog_t prognum, /* Write syslog record. */ if (addr->sa_family == AF_LOCAL) - strcpy(fromname, "unix"); + strcpy(fromname, "local"); else getnameinfo(addr, addr->sa_len, fromname, sizeof fromname, NULL, 0, NI_NUMERICHOST);