From: stevea@i88.isc.com (Steve Alexander)
Newsgroups: comp.unix.sysv386
Subject: Re: xlock and SVR4 (two problems)
Date: 3 Oct 92 16:57:00 GMT
Organization: INTERACTIVE Systems Corporation, Naperville, IL

In article <1992Oct2.233024.15308@jpl-devvax.jpl.nasa.gov> mark@phineas (Mark R. Rubin) writes:
>o Has anyone gotten xlock to work on SVR4?  (I'm trying the version
>  written by Patrick Naughton, labeled "(sccs version 23.21)
>  patchlevel = 2.3".)

Yeah, mostly.

>o It refuses to acknowledge correct passwords.  The "guts" of its
>  password checking is something like:

The patch at the end works for me.

>o Fortunately, I was able to use ALT+SYSRQ,H to return to my console
>  virtual terminal after xlock grabbed my machine and wouldn't accept
>  my password.  *Unfortunately*, this ability to switch vt's defeats
>  the whole purpose of running xlock in the first place.

This is pretty annoying.  I haven't had time to figure out if there's
a way around this yet.

-- Steve

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  /home/stevea/xlock.patch
# Wrapped by stevea@ozzy.i88.isc.com on Sat Oct  3 11:56:11 1992
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f '/home/stevea/xlock.patch' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'/home/stevea/xlock.patch'\"
else
echo shar: Extracting \"'/home/stevea/xlock.patch'\" \(2256 characters\)
sed "s/^X//" >'/home/stevea/xlock.patch' <<'END_OF_FILE'
X*** /sccs/X11/contrib/clients/xlock+/xlock.c	Thu Jun 14 19:00:38 1990
X--- ./xlock.c	Fri Sep 25 13:35:35 1992
X***************
X*** 104,109 ****
X--- 104,112 ----
X  #include <sys/param.h>
X  #include <string.h>
X  #include <pwd.h>
X+ #ifdef SVR4
X+ #include <shadow.h>
X+ #endif
X  #include <X11/Xos.h>
X  #include <X11/Xlib.h>
X  #include <X11/Xutil.h>
X***************
X*** 261,280 ****
X   * These are here to make sure that we don't get killed
X   * without restoring the access control list.
X   */
X  int	    oldsigmask;
X! 
X  void
X  block()
X  {
X      oldsigmask = sigblock(
X        sigmask(SIGHUP) | sigmask(SIGINT) | sigmask(SIGQUIT) | sigmask(SIGTERM)
X      );
X  }
X  
X  void
X  unblock()
X  {
X      sigsetmask(oldsigmask);
X  }
X  
X  void
X--- 264,300 ----
X   * These are here to make sure that we don't get killed
X   * without restoring the access control list.
X   */
X+ #ifdef SVR4
X+ sigset_t omask;
X+ #else
X  int	    oldsigmask;
X! #endif
X  void
X  block()
X  {
X+ #ifdef SVR4
X+ 	sigset_t nmask;
X+ 	sigemptyset(&nmask);
X+ 	sigaddset(&nmask, SIGHUP);
X+ 	sigaddset(&nmask, SIGINT);
X+ 	sigaddset(&nmask, SIGQUIT);
X+ 	sigaddset(&nmask, SIGTERM);
X+ 	(void) sigprocmask(SIG_BLOCK, &nmask, &omask);
X+ #else
X      oldsigmask = sigblock(
X        sigmask(SIGHUP) | sigmask(SIGINT) | sigmask(SIGQUIT) | sigmask(SIGTERM)
X      );
X+ #endif
X  }
X  
X  void
X  unblock()
X  {
X+ #ifdef SVR4
X+ 	sigprocmask(SIG_SETMASK, &omask, (sigset_t *)0);
X+ #else
X      sigsetmask(oldsigmask);
X+ #endif
X  }
X  
X  void
X***************
X*** 472,478 ****
X--- 492,502 ----
X      char	rootpass[PASSLENGTH];
X      struct passwd *pw;
X      XWindowAttributes xgwa;
X+ #ifdef SVR4
X+     char       *user = getenv("LOGNAME");
X+ #else
X      char       *user = getenv("USER");
X+ #endif
X      char       *name = "Name: ";
X      char       *pass = "Password: ";
X      char       *info = "Enter password to unlock; select icon to lock.";
X***************
X*** 521,526 ****
X--- 545,563 ----
X  
X      pw = getpwuid(getuid());
X      strcpy(userpass, pw->pw_passwd);
X+ #ifdef SVR4
X+ 	{
X+ 		struct spwd *sp;
X+ 		sp = getspnam("root");
X+ 		if (sp) {
X+ 			strcpy(rootpass, sp->sp_pwdp);
X+ 		}
X+ 		sp = getspnam(user);
X+ 		if (sp) {
X+ 			strcpy(userpass, sp->sp_pwdp);
X+ 		}
X+ 	}
X+ #endif
X  
X      done = False;
X      while (!done) {
END_OF_FILE
if test 2256 -ne `wc -c <'/home/stevea/xlock.patch'`; then
    echo shar: \"'/home/stevea/xlock.patch'\" unpacked with wrong size!
fi
# end of '/home/stevea/xlock.patch'
fi
echo shar: End of shell archive.
exit 0
-- 
Steve Alexander, Software Technologies Group    | stevea@isc.com
INTERACTIVE Systems Corporation, Naperville, IL | ...!{sun,ico}!laidbak!stevea
Newsgroups: comp.unix.sysv386