+2005-12-12 Usha Ketineni <ketineni@us.ibm.com>, NeilBrown <neilb@suse.de>
+ *support/nfs/rpcmisc.c(rpc_init): is stdin is a socket, but
+ is already connected (as e.g. from ssh), don't assume we
+ were started by inetd.
+
2005-11-03 Steve Dickson <SteveD@redhat.com> NeilBrown <neilb@suse.de>
*utils/idmapd/idmaps.c:
if (getsockname(0, (struct sockaddr *) &saddr, &asize) == 0
&& saddr.sin_family == AF_INET) {
int ssize = sizeof (int);
- _rpcfdtype = 0;
+ int fdtype = 0;
if (getsockopt(0, SOL_SOCKET, SO_TYPE,
- (char *)&_rpcfdtype, &ssize) == -1)
+ (char *)&fdtype, &ssize) == -1)
xlog(L_FATAL, "getsockopt failed: %s", strerror(errno));
- _rpcpmstart = 1;
- } else {
+ /* inetd passes a UDP socket or a listening TCP socket.
+ * listen will fail on a connected TCP socket(passed by rsh).
+ */
+ if (!(fdtype == SOCK_STREAM && listen(0,5) == -1)) {
+ _rpcfdtype = fdtype;
+ _rpcpmstart = 1;
+ }
+ }
+ if (!_rpcpmstart) {
pmap_unset(prog, vers);
sock = RPC_ANYSOCK;
}