#!/usr/bin/perl

%newshells = ("/usr/local/bin/tcsh","/bin/tcsh",
	      "/usr/yoyo/bin/tcsh_real_disable","/bin/tcsh_disable",
	      "/usr/bin/sh_disable","/bin/sh_disable",
	      "/usr/yoyo/bin/bash","/bin/sh",
	      "/usr/yoyo/bin/tcsh_disable","/bin/tcsh_disable",
	      "/usr/local/bin/disabled_shell","/bin/disabled_shell",
	      "/usr/yoyo/bin/zsh","/usr/local/bin/zsh",
	      "/bin/csh","/bin/csh",
	      "/usr/local/menu/bin/menushell_disable_disable","/usr/local/menu/bin/menushell_disable",
	      "/usr/local/menu/bin/menushell","/usr/local/menu/bin/menushell",
	      "/usr/local/lib/register/bin/confirm","/usr/local/lib/register/bin/confirm",
	      "/usr/yoyo/bin/tcsh_disable_disable","/bin/tcsh_disable",
	      "/usr/games/lib/conquershell","/bin/tcsh",
	      "/usr/local/menu/bin/menushell_disable","/usr/local/menu/bin/menushell_disable",
	      "/usr/yoyo/bin/zsh_disable","/usr/local/bin/zsh_disable",
	      "/usr/yoyo/bin/tcsh","/bin/tcsh",
	      "/usr/yoyo/bin/bash_disable","/usr/local/bin/bash_disable",
	      "/usr/local/bin/disabled_shell_disable","/bin/disabled_hell",
	      "/usr/yoyo/bin/tcsh_real","/bin/tcsh",
	      "/bin/csh_disable","/bin/csh_disable"
);

open PASSWD,'< /etc/passwd' or die "unable to open /etc/passwd";
@passwd = <PASSWD>;
close PASSWD;

foreach(@passwd)
{
    unless(/^\#/)
    {
	my @user = split ':',$_;
	unless($user[2]<100)
	{
	    @auth = `edauth $user[0] 2> /dev/null`;
	    chomp @auth;
	    @authfields = split ':',@auth[0];
	    
	    @passfields = split '=',$authfields[3];
	    chomp $user[6];
	    

	    print "chpass -a \"$user[0]:$passfields[1]:$user[2]:$user[3]::0:0:$user[4]:$user[5]:$newshells{$user[6]}\"\n";
	    #$passfields[1]."\n";
	}
    }
}



