#!/usr/bin/perl

# **** License ****
#
# Copyright (c) 2020 AT&T Intellectual Property.
#   All Rights Reserved.
#
# SPDX-License-Identifier: GPL-2.0-only
#
#
# **** End License ****

use strict;
use warnings;

use lib "/opt/vyatta/share/perl5";
use Vyatta::Login::Password qw( is_old_password );

chomp( my $userpwd = <STDIN> );
my ( $user, $pwd ) = split( ':', $userpwd, 2 );
exit 0 if ( !defined($user) || !defined($pwd) );

exit 1 if is_old_password( $user, $pwd );
exit 0;
