[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Change to set shell active/inactive using -U/-Z rather than -e and changing shell.


Thanks for the patch! It's been applied.

-- 
jrmu
IRCNow (https://ircnow.org)

On Sun, Apr 16, 2023 at 07:25:19PM -0400, Ian Jones wrote:
> ---
>  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
> 
> 

Attachment: signature.asc
Description: PGP signature