in reply to Kill User
Though mainly this is just a style thing.foreach (@users) { if (/$target/) { $rec = (split)[3]; if ($rec =~ /\D/) { next if $rec =~ /dtr/; ... etc
In addition, your outermost else block seems weird. The first test in the block is for /dtr/, which should never be true, since your outer test is for /\D/, or non-digits, which would have matched already.
When is $done set? use strict; would have alerted you that this is only used once in your code. Your script seems to be an infinite loop.
Also, a security note: if your PATH has been modified at all to cause you to run a different 'finger' than usual, or if someone is able to mangle their finger information so as to put arbitrary text on the 4th field, your `/usr/sbin/fuser -k /dev/tty$rec[3]` statement could potentially execute arbitrary code. As root, this could be a very bad thing. Consider perlsec and running with taint-checking enabled.
I don't mean for this to be a critique of your code.. I just feel you might be interested. :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: Kill User
by Octavian (Monk) on Oct 30, 2000 at 21:34 UTC | |
by Fastolfe (Vicar) on Oct 30, 2000 at 21:41 UTC |