[1255] in Kerberos-V5-bugs
krb5b4pl3: appl/bsd/{krlogin.c,kcmd.c}: need to set owner of socket to pgrp, not just pid
daemon@ATHENA.MIT.EDU (Jonathan I. Kamens)
Thu Mar 23 15:14:54 1995
From: "Jonathan I. Kamens" <jik@cam.ov.com>
Date: Thu, 23 Mar 1995 15:18:13 -0500
To: krb5-bugs@MIT.EDU
This patch is based on my earlier patches. Basically, there was one
instance in krlogin.c where the owner of the socket was being set to
the process group rather than to the process, but this should actually
be done in all cases where the owner of the socket is set.
--- krlogin.c 1995/03/23 18:31:17 1.12
+++ krlogin.c 1995/03/23 20:13:06
@@ -336,6 +336,12 @@
krb5_error_code status;
int debug_port = 0;
#endif /* KERBEROS */
+#if (defined(BSD) && BSD+0 >= 43) || defined(ultrix) || !defined(HAVE_SETOWN) \
+ || defined(hpux)
+ int pid = getpid();
+#else
+ int pid = -getpid();
+#endif
if (strrchr(argv[0], '/'))
argv[0] = strrchr(argv[0], '/')+1;
@@ -616,19 +622,15 @@
#ifdef hpux
/* hpux invention */
{
- int pid = getpid();
ioctl(rem, FIOSSAIOSTAT, &pid); /* trick: pid is non-zero */
ioctl(rem, FIOSSAIOOWN, &pid);
}
#else
#ifdef HAVE_SETOWN
- (void) fcntl(rem, F_SETOWN, getpid());
+ (void) fcntl(rem, F_SETOWN, pid);
#else
#ifdef SIOCSPGRP
- {
- int pid = getpid();
- (void) ioctl(rem, SIOCSPGRP, &pid);
- }
+ (void) ioctl(rem, SIOCSPGRP, &pid);
#endif /* SIOCSPGRP */
#endif /* HAVE_SETOWN */
#endif /* hpux */
--- kcmd.c 1995/03/23 19:51:54 1.10
+++ kcmd.c 1995/03/23 20:12:09
@@ -93,7 +93,7 @@
struct sockaddr_in *laddr, *faddr;
krb5_flags authopts;
{
- int i, s, timo = 1, pid;
+ int i, s, timo = 1, pid, ownpid;
#ifdef POSIX_SIGNALS
sigset_t oldmask, urgmask;
#else
@@ -120,6 +120,11 @@
char *whoami = (progname ? progname : "kcmd");
pid = getpid();
+#if (defined(BSD) && BSD+0 >= 43) || defined(ultrix) || !defined(HAVE_SETOWN)
+ ownpid = pid;
+#else
+ ownpid = -pid;
+#endif
/*
* Try to parse the host name as an address. If that fails, then
@@ -229,10 +234,10 @@
return (-1);
}
#ifdef HAVE_SETOWN
- fcntl(s, F_SETOWN, pid);
+ fcntl(s, F_SETOWN, ownpid);
#else
#ifdef SIOCSPGRP
- ioctl(s, SIOCSPGRP, &pid);
+ ioctl(s, SIOCSPGRP, &ownpid);
#endif /* SIOCSPGRP */
#endif /* HAVE_SETOWN */