[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Change to set shell active/inactive using -U/-Z rather than -e and changing shell.
[Thread Prev] | [Thread Next]
- Subject: [PATCH] Change to set shell active/inactive using -U/-Z rather than -e and changing shell.
- From: Ian Jones <ianj@xxxxxxxxxxxxx>
- Date: Sun, 16 Apr 2023 19:25:19 -0400
- To: codeforce@xxxxxxxxxx
- Cc: Ian Jones <ianj@xxxxxxxxxxxxx>
--- Shell.pm | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Shell.pm b/Shell.pm index 6a70c75..4a20478 100644 --- a/Shell.pm +++ b/Shell.pm @@ -43,13 +43,6 @@ use constant { main::cbind("pub", "-", "shell", \&mshell); main::cbind("msg", "-", "shell", \&mshell); -# Returns yesterday's date in mmmDDYYYY format -sub yesterday { - my @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); - my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(); - my $localtime = sprintf("%s%02d%04d", $months[$mon], $mday-1, $year+1900); - return $localtime; -} sub init { #dependencies for figlet unveil("/usr/local/bin/figlet", "rx") or die "Unable to unveil $!"; @@ -106,7 +99,7 @@ sub mshell { return; } elsif (main::isstaff($bot, $nick) && $text =~ /^approve\s+([[:ascii:]]+)/) { my $username = $1; - system "doas usermod -e 0 -s /bin/ksh $username"; + system "doas usermod -U $username"; foreach my $chan (@teamchans) { main::putserv($bot, "PRIVMSG $chan :$username approved"); } @@ -145,8 +138,7 @@ sub mshell { mailshell($username, $email, $pass, "shell", $version); main::putserv($bot, "PRIVMSG $nick :Check your email!"); if ($approval eq "true") { - my $yesterday = yesterday(); - system "doas usermod -e $yesterday -s /sbin/nologin $username"; + system "doas usermod -Z $username"; main::putserv($bot, "PRIVMSG $nick :Your account has been created but must be manually approved by your admins ($staff) before it can be used."); foreach my $chan (@teamchans) { main::putservlocalnet($bot, "PRIVMSG $chan :$staff: $nick\'s account $username must be manually unblocked before it can be used."); -- 2.37.3