From 489570f2a6017ebf03a66b98c1e5b2b43c82702e Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Thu, 1 May 2014 10:53:09 -0700 Subject: [PATCH] Use md5 for NIS users --- nis/md5-lib.pl | 1 + nis/save_passwd_shadow.cgi | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 120000 nis/md5-lib.pl diff --git a/nis/md5-lib.pl b/nis/md5-lib.pl new file mode 120000 index 000000000..8c60ccdc0 --- /dev/null +++ b/nis/md5-lib.pl @@ -0,0 +1 @@ +../useradmin/md5-lib.pl \ No newline at end of file diff --git a/nis/save_passwd_shadow.cgi b/nis/save_passwd_shadow.cgi index b785cbbaf..88157b795 100755 --- a/nis/save_passwd_shadow.cgi +++ b/nis/save_passwd_shadow.cgi @@ -3,6 +3,7 @@ # Create, update or delete a password/shadow files entry require './nis-lib.pl'; +require './md5-lib.pl'; use Time::Local; &ReadParse(); @@ -25,14 +26,13 @@ else { $in{'passmode'} != 2 || $in{'encpass'} =~ /^[^:]*$/ || &error($text{'passwd_epass'}); %uconfig = &foreign_config("useradmin"); - $salt = chr(int(rand(26))+65) . chr(int(rand(26))+65); @passwd = ( $in{'name'}, 'x', $in{'uid'}, $in{'gid'}, $in{'real'}, $in{'home'}, $in{'shell'} ? $in{'shell'} : $in{'other'} ); $pass = $in{'passmode'} == 0 ? "" : $in{'passmode'} == 1 ? $uconfig{'lock_string'} : $in{'passmode'} == 2 ? $in{'encpass'} : - &unix_crypt($in{'pass'}, $salt); + &encrypt_md5($in{'pass'}); if ($in{'mode'} == 2) { # Parse extra shadow inputs if ($in{'expired'} ne "" && $in{'expirem'} ne "" &&