*BSD News Article 17684


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!constellation!osuunx.ucc.okstate.edu!moe.ksu.ksu.edu!ux1.cso.uiuc.edu!howland.reston.ans.net!noc.near.net!uunet!ogicse!psgrain!ee.und.ac.za!shrike.und.ac.za!casper.cs.uct.ac.za!gimli!root
From: root@gimli.cs.uct.ac.za (Sandi Donno)
Newsgroups: comp.os.386bsd.apps
Subject: Re: [NetBSD] X Screenlocker & Crypt
Message-ID: <sandi.741368217@gimli>
Date: 29 Jun 93 15:36:43 GMT
Article-I.D.: gimli.sandi.741368217
References: <1993Jun28.082922.2194@yvax.byu.edu>
Sender: news@cs.uct.ac.za (news)
Organization: Computer Science Department, University of Cape Town
Lines: 56

In <1993Jun28.082922.2194@yvax.byu.edu> bkh@nephi-hbll.byu.edu (Brian K. Holman) writes:

>I have got xnlock and xlock from export.lcs.mit.edu.  They are suppose
>to allow you to lock your X console until you enter your current password.
>I have NetBSD 0.8 with the security binaries installed.  Both programs
>compiled fine except that it won't accept my password.  Just for fun I
>tried to enter my password in its crypted form as well and that didn't
>work either.  I'm sure it must be something with crypt.  Has anyone had
>a similar problem or have an idea how to solve it.  I am using XFree 1.3.

I hacked the source to make it work for normal users (not just root).

diffs for xlock.c:

174,175d173
< int uid;
< FILE *f;
422c420
<     char        user[30];
---
>     char       *user;
430c428
<     pw = getpwuid(uid);  /* use uid not cuserid(NULL) */
---
>     pw = getpwnam(cuserid(NULL));
433,434c431,432
<     strcpy(user,pw->pw_name);  /* user strcpy not = */
<     
---
>     user = pw->pw_name;
> 
647,667d644
<     int result;
<     char hostname[30];
< 
<     uid = getuid();  /* save the real uid for later */
<     if ((result = fork()) == 0)
<     {
< 	int f;
< 
<   	f = open("/dev/null",O_WRONLY);
<         dup2(f,1);
<         dup2(f,2);
< 	close(f);
< 	
< 	hostname[0] = '+';
< 	gethostname(hostname+1,29);
< 	
< 	execl("/usr/X386/bin/xhost","xhost",hostname,NULL);
<     }
<     else if (result == -1)
<     	exit(1);
<     wait((int *) 0);
--
Sandi Donno
sandi@cs.uct.ac.za