From 56b9a13725c4c3aef1930933574ed5f1d8dd88f2 Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Sun, 30 Apr 2023 11:24:41 +0200 Subject: [PATCH] remove "make_user_account.pl": long dead ...and yet dangerous! We do not want to ever accidentally run adduser. --- bin/make_user_account.pl | 50 ---------------------------------------- 1 file changed, 50 deletions(-) delete mode 100755 bin/make_user_account.pl diff --git a/bin/make_user_account.pl b/bin/make_user_account.pl deleted file mode 100755 index 5938a071e..000000000 --- a/bin/make_user_account.pl +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/local/bin/perl -w - -use strict; -use lib "/home/k/PAUSE/lib"; -use Getopt::Long; -use PAUSE; -use DBI; - -my %Opt; -GetOptions(\%Opt, - "dry-run|n", - ) or die; - -my $user = shift @ARGV or die "Usage: $0 user"; - -my $db = DBI->connect( - $PAUSE::Config->{AUTHEN_DATA_SOURCE_NAME}, - $PAUSE::Config->{AUTHEN_DATA_SOURCE_USER}, - $PAUSE::Config->{AUTHEN_DATA_SOURCE_PW}, - {RaiseError => 1} - ); -my $sth = $db->prepare(qq{SELECT password FROM usertable WHERE user=?}); -my $ret = $sth->execute(uc $user); - -die "User '$user' not found" unless $sth->rows > 0; -die "Panic: more than one user '$user'" if $sth->rows > 1; - -my($passwd) = $sth->fetchrow_array; -$sth->finish; -$db->disconnect; - -my $lcuser = lc $user; -if ($Opt{"dry-run"}) { - warn "WOULD now call - adduser --group $lcuser - adduser --ingroup $lcuser --disabled-login $lcuser -WOULD then recommend to call - vipw -s -and set the crypted password of '$lcuser' to '$passwd'\n"; -} else { - my @system = ("adduser", "--group", $lcuser); - $ret = system @system; - die "'@system' returned bad status: '$ret'" if $ret; - @system = ("adduser", "--ingroup", $lcuser, "--disabled-login", $lcuser); - $ret = system @system; - die "'@system' returned bad status: '$ret'" if $ret; - print "please run - vipw -s -now and set the crypted password of '$lcuser' to '$passwd'\n"; -}