OSDN Git Service

生キー指定で、16桁未満とSaltが16進数以外で???にするように修正
authorh677 <h677>
Thu, 18 Mar 2010 14:09:04 +0000 (14:09 +0000)
committerh677 <h677>
Thu, 18 Mar 2010 14:09:04 +0000 (14:09 +0000)
Trip.pas

index 5b18f8b..1d6d242 100644 (file)
--- a/Trip.pas
+++ b/Trip.pas
@@ -424,12 +424,12 @@ procedure get_pw_salt(
     const pw : PChar;
     var convpw : String;
     const salt : PChar
-);
+) ;
 var
     i : integer;
 begin
     // ^([0-9A-Fa-f]{16})([./0-9A-Za-z]{0,2})$
-    if (Length(pw) >= 17) or (Length(pw) <= 19) then begin
+    if (Length(pw) >= 17) and (Length(pw) <= 19) then begin
         // \83L\81[\95\94\95ª
         for  i := 0 to 7 do begin
             if (Pos(pw[2*i + 0 + 1], '0123456789abcdefABCDEF') > 0) and
@@ -501,6 +501,9 @@ begin
             if (pw[ 0 ] = '#') and (Length(pw) >= 20) then begin
                 // \8f«\97\88\82Ì\8ag\92£\97p
                 Result := '???';
+            end else if Length(convpw) = 0 then begin
+                // \90\83L\81[\95û\8e®\83G\83\89\81[
+                Result := '???';
             end else if Length(convpw) = 8 then begin
                 Result := Copy( crypt_r( PChar(convpw), salt, s ), 4, 100 );
             end else begin