Capturing caller id
Ralph Schleicher (rs@purple.in-ulm.de)
Sun, 5 Nov 1995 16:20:22 +0100
Gert Doering <gert@greenie.muc.de> cited below with "GD" writes:
GD> So you have to do the line/userid checking inside "/sbin/login", not
GD> inside mgetty. On Linux, this isn't too hard, as you have the source for
GD> the login program... (hint, hint)
Why not omitting login(1) completely? I've appended the script
to login here as anonymous UUCP as a starting point. The
corresponding `login.config' entries for UUCP users are
Unknown uucp @ /usr/local/sbin/uulogin @
U* uucp @ /usr/lib/uucp/uucico -l -u @
Ralph
#! /usr/local/bin/perl
#
# uulogin -- query the password of an anonymous UUCP user.
#
# Copyright (C) 1995 Ralph Schleicher <rs@purple.IN-Ulm.DE>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$timeout = 60;
$invoke = '/usr/lib/uucp/uucico -u $login';
# Get the login name from the command line.
#
if (@ARGV == 0)
{
$login = 'Anonymous UUCP';
}
elsif (@ARGV == 1)
{
$login = shift;
}
else
{
die "$0: Usage: uulogin [<user>]\n";
}
# You may have to say `(cd /usr/include; h2ph syslog.h sys/syslog.h)'.
#
require 'syslog.pl';
# Some security issues.
#
$ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin';
$ENV{'SHELL'} = '/bin/sh' if $ENV{'SHELL'} ne '';
$ENV{'IFS'} = '' if $ENV{'IFS'};
umask (022);
# Trap these signals.
#
$SIG{'HUP'} = 'cleanup';
$SIG{'INT'} = 'cleanup';
$SIG{'QUIT'} = 'cleanup';
$SIG{'TERM'} = 'cleanup';
$SIG{'PIPE'} = 'cleanup';
$SIG{'ALRM'} = 'cleanup';
# Give them a hint but accept *every* password.
#
print "Please enter your e-mail address as password.\n";
system ('stty -echo');
alarm $timeout;
print "Password: ";
chop ($password = <STDIN>);
print "\n";
alarm 0;
system ('stty echo');
&syslog ('auth|notice', "uulogin: `$login' sent `$password' as password\n");
# Call uucico(8).
#
$invoke =~ s/\$login/$login/g;
$invoke =~ s/\$password/$password/g;
exec $invoke;
&syslog ('auth|err', "uulogin:$invoke: %m\n");
exit 0;
sub bye
{
system 'stty echo';
exit shift (@_);
}
sub cleanup
{
local ($sig) = @_;
&syslog ('auth|notice', "uulogin: Caught signal $sig\n");
print "\nNow is the time for a timeout.\n"
if $sig eq 'ALRM';
&bye (1);
}
# uulogin ends here