[net.unix-wizards] hiding from w

gr30@sdcattb.UUCP (06/09/84)

Does anyone have some code that prevents w(1) from knowing what you're
doing? (I'd like some privacy some times.)
 
                     Thanks,
                     mak
                     ...ucbvax!sdcsvax!sdcattb!gr30

paul@uiucuxc.UUCP (06/21/84)

#R:sdcattb:-270300:uiucuxc:31700006:000:402
uiucuxc!paul    Jun 20 21:02:00 1984

Re: privacy from w and ps

One solution is to fill up your environment past the 1024 character mark.
w & ps become confused, printing only the command name, not the arguments.
It's not a total solution, but it covers 90% of it for me.

         Paul Pomes

uucp:    {ihnp4,pur-ee}!uiucdcs!uiucuxc!paul   harpo!uiucuxc!paul
US Mail: University of Illinois
         1304 W Springfield, Urbana, IL  61801

ber@enea.UUCP (Bjorn Eriksen) (06/24/84)

What we have done is to use two differnet versions of w and ps respectivly.
The original ones has been moved to /etc and can only be used by root or
a special group of people (group staff). The versions that are runnable
by ordinary users doesn't display the arguments only the command. The
modifications are simple (4.2BSD):

In w:

286c286
<			strcpy(doing, lflag ? pr[i].w_args : pr[i].w_comm);
---
> 			strcpy(doing, /*lflag ? pr[i].w_args :*/ pr[i].w_comm);

and in ps.c you let the routine getcmd always return with only
the command name:

	/* if (cflg) { */
		(void) strncpy(cmdbuf, u.u_comm, sizeof (u.u_comm));
		return (savestr(cmdbuf));
	/* } */


-- 
	Bjorn Eriksen
	ENEA DATA Sweden
	UUCP: {decvax,philabs}!mcvax!enea!ber

rfd@ARDC.ARPA (06/26/84)

From:      "Robert F. Donnelly" (MISD-WAD) <rfd@ARDC.ARPA>

	The simplest way to fix w and ps from telling too much is to search the
command line and stop printing after you reach the first blank. Included is the
diff's from old code to new code.

... Bob 

First w

20a21
> #include <strings.h>
118c119
< 	char *cp;
---
> 	char *cp, *index();
120a122
> 	register char *pt_blank;
271a274,275
> 				if( (pt_blank = index(pr[i].w_args,' ')) != 0 )
> 					*pt_blank = '\0';
318a323,324
> 	register char *pt_blank;
> 	char *index();
349a356,357
> 	if( (pt_blank = index(doing, ' ')) != 0 )
> 		*pt_blank = '\0';

and now ps

22a23
> #include <strings.h>
149a151
> 	char *pt_blank, *index();
292c294,296
< 		else
---
> 		else {
> 			if( (pt_blank = index(sp->ap->a_cmdp,' ')) != 0)
> 				*pt_blank = '\0';
293a298
> 		}