Fixes for FreeBSD

This commit is contained in:
Citlali del Rey 2024-11-20 21:56:40 -08:00
parent f0e6ec0976
commit 9b3dc7aa55
Signed by: nullobsi
GPG key ID: 933A1F44222C2634
4 changed files with 10 additions and 12 deletions

View file

@ -4,7 +4,7 @@ use warnings FATAL => 'all';
use experimental 'signatures';
use Mojo::Base 'Mojolicious::Controller', -signatures;
use Net::LDAPS;
use Net::LDAP;
use Net::LDAP::Extension::SetPassword;
require unix_dog::Util;
@ -63,7 +63,7 @@ sub update_account($self) {
my $userDN ='CN='.$username.',OU=Dogs,DC=unix,DC=dog';
return Mojo::IOLoop->subprocess->run_p(sub {
my $ldap = Net::LDAPS->new($connStr, verify=>'none', version=>3) or die "$@";
my $ldap = Net::LDAP->new($connStr, verify=>'require', capath=>'/etc/ssl/certs', version=>3) or die "$@";
my $mesg = $ldap->bind($userDN, password=>$curPasswd);
$mesg->code and die $mesg->error;
@ -116,7 +116,7 @@ sub account($self) {
my $config = $self->config;
my $connStr = $config->{'ldap'}->{'uri'};
return Mojo::IOLoop->subprocess->run_p(sub {
my $ldap = Net::LDAPS->new($connStr, verify=>'none', version=>3) or die "$@";
my $ldap = Net::LDAP->new($connStr, verify=>'require', capath=>'/etc/ssl/certs' version=>3) or die "$@";
my $mesg = $ldap->bind();
$mesg->code and die $mesg->error;

View file

@ -4,7 +4,7 @@ use warnings FATAL => 'all';
use experimental 'signatures';
use Mojo::Base 'Mojolicious::Controller', -signatures;
use Net::LDAPS;
use Net::LDAP;
use File::ChangeNotify;
use File::stat;
use File::Basename;
@ -29,8 +29,6 @@ my $acache = Mojo::Cache->new(max_keys => 1);
my $filewatcher;
sub is_dir_used($dir) {
return 0 if not -e $dir;
return 0 if not -d $dir;
opendir my $dh, $dir or return 0;
readdir $dh;
readdir $dh;
@ -49,7 +47,7 @@ sub user_pages ($self) {
}
return Mojo::IOLoop->subprocess->run_p(sub {
my $ldap = Net::LDAPS->new($connStr, verify=>'none', version=>3) or die "$@";
my $ldap = Net::LDAP->new($connStr, verify=>'require', capath=>'/etc/ssl/certs', version=>3) or die "$@";
my $mesg = $ldap->bind();
$mesg->code and die $mesg->error;
@ -64,8 +62,8 @@ sub user_pages ($self) {
for (@sorted) {
my $uid = $_->get_value('uid');
my $web_dir = "/home/$uid/public/www";
my $gem_dir = "/home/$uid/public/gemini";
my $web_dir = "/usr/home/$uid/public/www";
my $gem_dir = "/usr/home/$uid/public/gemini";
my $has_web_page = is_dir_used($web_dir);
my $has_gem_page = is_dir_used($gem_dir);
push @{$users}, {

View file

@ -4,7 +4,7 @@ use warnings FATAL => 'all';
use experimental 'signatures';
use Mojo::Base 'Mojolicious::Controller', -signatures;
use Net::LDAPS;
use Net::LDAP;
use Net::LDAP::Extension::SetPassword;
use Net::LDAP::Constant qw(LDAP_NO_SUCH_OBJECT);
use Email::Simple;
@ -54,7 +54,7 @@ sub register($self) {
my $bindDN = $config->{'ldap'}->{'bindDN'};
my $bindPasswd = $config->{'ldap'}->{'password'};
my $ldap = Net::LDAPS->new($connStr, verify=>'none', version => 3) or die "$@";
my $ldap = Net::LDAP->new($connStr, verify=>'require', capath=>'/etc/ssl/certs', version => 3) or die "$@";
my $mesg = $ldap->bind($bindDN, password=>$bindPasswd);
$mesg->code and die $mesg->error;

View file

@ -1,6 +1,6 @@
---
secrets:
- 888a581283ecac6c1ca08a476f559726da1c0e83
- here
hypnotoad:
listen: