home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / PASCAL / NWTP04 / XCONN / LOGCON.PAS next >
Pascal/Delphi Source File  |  1993-12-29  |  2KB  |  79 lines

  1. {$X+,V-,B-}
  2. program LogCon;
  3.  
  4. { Example program for the nwConn unit/ NwTP 0.4 API. (c) 1994, R.Spronk }
  5.  
  6. { Shows the use of the GetObjectLoginControl Function. }
  7.  
  8. uses nwMisc,nwConn;
  9.  
  10. CONST TestObjName='TEST';
  11.       { name of the object whose LOGIN_CONTROL property is read. }
  12.       { must be of objecttype 'ot_user' }
  13.  
  14. Var li:TloginControl;
  15.     s:string;
  16.  
  17. {
  18.      BadLoginCount             :byte;
  19.      AccountResetTime          :NovTimeRec;  dmy, hms valid only
  20.      LastIntruderAdress        :TinterNetworkAdress;
  21.  
  22.      MaxConcurrentConnections  :byte;
  23.      LoginTimes                :array[1..42] of byte;
  24.  
  25.      unknown1                  :byte;
  26.      unknown2                  :array[1..6] of byte;
  27. }
  28.  
  29. begin
  30. IF NOT GetObjectLoginControl('TEST',1,li)
  31.  then begin
  32.       writeln('GetObjectLoginCntrol Failed. error#',nwConn.result);
  33.       halt(1);
  34.       end;
  35.  
  36. writeln('Logincontrol Information:');
  37. writeln;
  38. if li.AccountDisabled then writeln('The account is DISABLED.');
  39.  
  40. NovTimeRec2String(li.AccountExpirationDate,s);delete(s,1,5);
  41. if pos('lid date &',s)>0 then s:='No expiration date set.';
  42. writeln('Account Expires: ',s);
  43.  
  44. writeln;
  45. writeln('Minimum Password length =',li.MinimumPasswordLength);
  46. writeln('Days between password changes =',li.DaysBetweenPasswordChanges);
  47.  
  48. NovTimerec2String(li.PasswordExpirationDate,s);delete(s,1,5);
  49. if pos('lid date &',s)>0 then s:='No Expiration date set.';
  50. writeln('Password Expiration date: ',s);
  51.  
  52. write('Password control flag: ');
  53. CASE li.PasswordControlFlag of
  54.  0:writeln('User is allowed to change password.');
  55.  1:writeln('Supervisor must change password.');
  56.  2:writeln('User is allowed to change password. Passwords must be unique.');
  57.  3:writeln('Supervisor must change passwords. Passwords must be unique.');
  58.  else writeln('Unknown Password control Flag:',li.PasswordControlFlag);
  59. end; {case}
  60.  
  61. writeln;
  62. IF li.MaxGraceLoginsAllowed=0
  63.  then writeln('Grace logins are unlimited.')
  64.  else begin
  65.       writeln('Max. Grace Logins: ',li.MaxGraceLoginsAllowed);
  66.       writeln('Remaining Grace Logins: ',li.GraceLoginsRemaining);
  67.       end;
  68. writeln;
  69.  
  70. NovTimeRec2String(li.LastLoginTime,s);delete(s,1,5);
  71. if pos('lid date &',s)>0 then s:='Object has never logged in.';
  72. writeln('Last login time: ',s);
  73.  
  74. writeln;
  75. NovTimeRec2String(li.Unknown2,s);delete(s,1,5);
  76. if pos('lid date &',s)>0 then s:='?? time not set.';
  77. writeln('unknown2 ??? time: ',s);
  78.  
  79. end.