1
0
Fork 0

move open3 to ipc run

This commit is contained in:
ston1th 2020-01-19 09:44:54 +01:00
commit 4e93ecb202
2 changed files with 8 additions and 6 deletions

View file

@ -11,6 +11,8 @@ Copy `smtp_auth_sync.pl` to `/usr/local/sbin/smtp_auth_sync.pl` and set execute
`chmod 755 /usr/local/sbin/smtp_auth_sync.pl` `chmod 755 /usr/local/sbin/smtp_auth_sync.pl`
Dependency: `pkg_add p5-IPC-Run`
Use the `install_openbsd.sh` or `install_linux.sh` scripts to create the `rc` or `systemd` configs. Use the `install_openbsd.sh` or `install_linux.sh` scripts to create the `rc` or `systemd` configs.
## Config Options ## Config Options

View file

@ -5,7 +5,7 @@ use warnings;
use Config; use Config;
use IO::Socket; use IO::Socket;
use IO::Select; use IO::Select;
use IPC::Open3; use IPC::Run qw (start finish );
# Configs # Configs
# File to store the user:password hash mappings # File to store the user:password hash mappings
@ -76,11 +76,11 @@ while (my $conn = $sock->accept()) {
if ($user eq "" or $pass eq "") { if ($user eq "" or $pass eq "") {
next; next;
} }
open3(\*WRITE, \*READ, 0, $enc); my $hash;
print WRITE "$pass"; my $h = start(\@enc, \<<IN, \$hash);
close(WRITE); $pass
chomp(my $hash = <READ>); IN
close(READ); chomp($hash);
if ($hash eq "") { if ($hash eq "") {
next; next;
} }