[1248] in Kerberos-V5-bugs

home help back first fref pref prev next nref lref last post

krb5b4pl3: appl/bsd/{kcmd.c,krlogin.c}: use SIOCSPGRP if F_SETOWN is missing

daemon@ATHENA.MIT.EDU (Jonathan I. Kamens)
Wed Mar 22 22:29:18 1995

From: "Jonathan I. Kamens" <jik@cam.ov.com>
Date: Wed, 22 Mar 1995 22:32:35 -0500
To: krb5-bugs@MIT.EDU

kcmd.c and krlogin.c should use SIOCSPGRP to set the owner of the
socket if it is defined and F_SETOWN isn't available.

Here's a patch:

--- kcmd.c	1995/03/13 23:06:08	1.6
+++ kcmd.c	1995/03/23 03:02:43
@@ -49,7 +49,12 @@
 #endif /* POSIX_SIGNALS */
 #include <sys/socket.h>
 #include <sys/stat.h>
-     
+
+#ifdef HAVE_SYS_SOCKIO_H
+/* For SIOCSPGRP */
+#include <sys/sockio.h>
+#endif
+
 #include <netinet/in.h>
 #include <netdb.h>
      
@@ -221,7 +226,12 @@
     	}
 #ifdef HAVE_SETOWN
     	fcntl(s, F_SETOWN, pid);
-#endif
+#else
+#ifdef SIOCSPGRP
+	ioctl(s, SIOCSPGRP, &pid);
+#endif /* SIOCSPGRP */
+#endif /* HAVE_SETOWN */
+	
     	sin.sin_family = hp->h_addrtype;
     	memcpy((caddr_t)&sin.sin_addr,hp->h_addr, hp->h_length);
     	sin.sin_port = rport;
--- krlogin.c	1995/03/20 18:52:06	1.9
+++ krlogin.c	1995/03/23 03:30:22
@@ -72,7 +72,7 @@
 #endif
 
 #ifdef HAVE_SYS_SOCKIO_H
-/* for SIOCATMARK */
+/* for SIOCATMARK and SIOCSPGRP */
 #include <sys/sockio.h>
 #endif
 
@@ -617,8 +617,15 @@
 #else
 #ifdef HAVE_SETOWN
     (void) fcntl(rem, F_SETOWN, getpid());
-#endif
-#endif
+#else
+#ifdef SIOCSPGRP
+    {
+	int pid = getpid();
+	(void) ioctl(rem, SIOCSPGRP, &pid);
+    }
+#endif /* SIOCSPGRP */
+#endif /* HAVE_SETOWN */
+#endif /* hpux */
     if (options & SO_DEBUG &&
 	setsockopt(rem, SOL_SOCKET, SO_DEBUG, (char*)&on, sizeof (on)) < 0)
       perror("rlogin: setsockopt (SO_DEBUG)");

home help back first fref pref prev next nref lref last post