#!/bin/sh

# $Id: makeauth,v 1.1 1998/12/16 12:05:28 zagy Exp $

###
# This program was written by and is copyright Alec Muffett 1991,
# 1992, 1993, 1994, 1995, and 1996, and is provided as part of the
# Crack v5.0 Password Cracking package.
#
# The copyright holder disclaims all responsibility or liability with
# respect to its usage or its effect upon hardware or computer
# systems, and maintains copyright as set out in the "LICENCE"
# document which accompanies distributions of Crack v5.0 and upwards.
###
###
# Adjusted for Internet-Dialer
###

# where the files are...
SHADOW=/etc/shadow
PASSWD=/etc/passwd

# which group is allowed to dial...
GROUP=users

for line in `
(
	sed -e 's/^/STAG:/' < $SHADOW
	sed -e 's/^/PTAG:/' < $PASSWD
) |
awk -F: '
BEGIN {
	OFS=":";
}
$1 == "STAG" {
	pw[$2] = $3;
	next;
}
$1 == "PTAG"{
	$3 = pw[$2];
	print $0;	

}' |
sed -e 's/^PTAG://' | cut -d: -f1-2`; do

usr=`echo $line|cut -d: -f1`
if [ "`groups $usr | grep $GROUP`" !=  "" ]; then
    echo "$line" >> internet.new
fi
done
mv -f internet.new internet
