Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: XUS3

XUS3.m

Go to the documentation of this file.
  1. XUS3 ;SF-ISC/STAFF - SIGNON ;5/31/2006
  1. ;;8.0;KERNEL;**32,149,265,419**;Jul 10, 1995;Build 5
  1. TT ;Terminal Type select
  1. Q:$D(XUIOP(1))
  1. S DIC("B")=$S($P(XUIOP,";",2)]"":$P(XUIOP,";",2),$D(^%ZIS(1,XUDEV,"SUBTYPE")):+^("SUBTYPE"),1:"C-VT100")
  1. S DIC="^%ZIS(2,",DIC(0)="AEMQO",DIC("S")="I $P(^(0),U,2)" D ^DIC K DIC Q:Y<1
  1. ;M/11 & M/VX sites may want to remove the ; from the next line.
  1. ;S J=$P(Y,U,2) I $D(^%IS(0,"SUB",J)) S $P(^%IS($I,1),U,3)=J
  1. S ^VA(200,DUZ,1.2)=+Y,$P(XUIOP,";",2)=$P(Y,U,2) Q
  1. ;
  1. WAIT ;** doesn't work with virtual device
  1. Q:'$L(IO("ZIO"))
  1. S X=XUT,XUT=0,H=$P(^DISV("XU",XUDEV),U,2),T=$P(H,",",2)+$P(XOPT,U,3),H=T\86400+H,T=T#86400 Q:H<$H I +$H=H Q:$P($H,",",2)'<T
  1. LOCK S XUT=X,XMB="XUSLOCK",XMB(1)=$I,XMB(2)=+XUT,XMB(3)=$P(XUVOL,U,1)_","_XUCI D ^XMB
  1. Q Q
  1. ;
  1. SEC ;Check device's security and time lock.
  1. Q:$P(XOPT,"^",11) ;Bypass device lockout
  1. N %A,%B,%H,Y
  1. S %A=$P(XUSER(0),U,4),%B=0
  1. I $G(^%ZIS(1,XUDEV,95))]"",%A'="@" D
  1. . S %H=$P(^(95),U),%B=1 F Y=1:1:$L(%H) I %A[$E(%H,Y) S %B=0
  1. I %B D Q
  1. . S XMB="XUSECURITY",XMB(1)=$P(XUSER(0),U,1),XMB(2)=$I,XMB(3)=^(95),XMB(4)=%A D ^XMB
  1. . S XUM=10
  1. . Q
  1. S %A=$P($G(^%ZIS(1,XUDEV,"TIME")),U) Q:%A=""
  1. S Y=$P($H,",",2),%H=Y\60#60+(Y\3600*100),Y=$P(%A,"-",2)
  1. I Y'<%A G NOPE:%H'>Y&(%H'<%A) Q
  1. Q:%H'>%A&(%H'<Y)
  1. NOPE S XMB="XUSTIME",XMB(1)=$I,XMB(2)=$P(XUSER(0),U,1),XMB(4)=%A D ^XMB
  1. S XUM=13,XUM(0)=%A
  1. Q
  1. ;
  1. H3(%) ;Convert $H to seconds.
  1. Q 86400*%+$P(%,",",2)
  1. ;
  1. GETFAC(IP) ;Set XUFAC from saved value, Failed Access Count
  1. I $D(XUFAC) Q
  1. S XUFAC=0 ;Use default.
  1. Q:'$L(IP)
  1. N X,R
  1. S X=$$FINDFAC(IP)
  1. ;Clear count if lockout time has passed
  1. I X>0 D
  1. . L +^XUSEC(4,X,0):5
  1. . S R=$G(^XUSEC(4,X,0))
  1. . L -^XUSEC(4,X,0)
  1. . ;Use 30 seconds as a balance. Not lock user out, stop scripts.
  1. . I ($$H3($P(R,"^",3))+30)<$$H3($H) D CLRFAC(IP) Q ;Exit without changing XUFAC
  1. . S XUFAC=$P(R,U,2)
  1. . Q
  1. ;If IP is a TS, if should lock return 4 else 0.
  1. I $$TS S XUFAC=$S($$IPCHECK^XUSTZIP(IP):4,1:0)
  1. Q
  1. ;
  1. TS() ;Is IP a Terminal Server (check TSCHK in XUSTZIP).
  1. Q $L($O(^XTV(8989.3,1,405.2,"B",IP,0)))
  1. ;
  1. FINDFAC(IP) ;Find the entry
  1. N I
  1. I $G(XUFAC(1))>0,$D(^XUSEC(4,XUFAC(1),0)) Q XUFAC(1)
  1. K XUFAC(1)
  1. Q:'$L(IP) 0
  1. S I=$O(^XUSEC(4,"B",IP,0))
  1. I I>0 S XUFAC(1)=I
  1. Q I
  1. SETFAC(IP) ;Set the value of Failed Access atempts
  1. N FDA,IEN,I
  1. I $G(XUFAC(1)),'$D(^XUSEC(4,XUFAC(1),0)) K XUFAC(1)
  1. S I=$S($G(XUFAC(1)):XUFAC(1),1:"?+1")_","
  1. S FDA(3.084,I,.01)=IP,FDA(3.084,I,2)=XUFAC,FDA(3.084,I,3)=$H
  1. D UPDATE^DIE("S","FDA","IEN")
  1. I $G(IEN(1))>0 S XUFAC(1)=IEN(1)
  1. Q
  1. ;
  1. CLRFAC(IP) ;Clear FAC from the global
  1. N DA,DIK,I
  1. S I=$$FINDFAC(IP) Q:I'>0
  1. S DA=I,DIK="^XUSEC(4," D ^DIK
  1. Q
  1. ;
  1. FAIL(IP) ;If user fails logon, Call to inc XUFAC
  1. ; and check if time to lock. IP is optional.
  1. S IP=$$IP^XUSTZIP
  1. D GETFAC(IP) I '$L($G(XOPT)) D XOPT^XUS
  1. S XUFAC=XUFAC+1 D SETFAC(IP) ;Fail count
  1. Q XUFAC'<$P(XOPT,U,2)
  1. ;
  1. NO() ;Fail, R/S entry. Reference to XGWIN has been removed.
  1. N XUEXIT,% ;Gets set in $$TXT, If 1 halt process.
  1. W !,"Device: ",$I,!!,$$TXT(XUM),!
  1. S %=$$FAIL($G(IO("IP"))),XUEXIT=XUEXIT!$D(XUHALT)
  1. I ('XUEXIT)&'% Q 0 ;Continue to try
  1. I 'XUEXIT&(XUM-7) W !,$$TXT(7) ;Tell user we are locking device
  1. ;XUF handled in XUSTZ
  1. I 'XUEXIT D ^XUSTZ
  1. H 4
  1. Q XUEXIT
  1. ;
  1. TXT(%) ;Call by R/S and Broker
  1. N XU1
  1. ;This string tells if a error code should HALT process.
  1. S:'$D(XUEXIT) XUEXIT=$E("111000010100100000000",%)
  1. S XU1=30810+(%/100)
  1. S %=$$EZBLD^DIALOG(XU1) I %["|" S %=$P(%,"|",1)_$G(XUM(0))_$P(%,"|",2)
  1. K XUM(0)
  1. Q %
  1. ;All error messages are now in the DIALOG file.
  1. ;Message numbers are 30810.01 to 30810.99
  1. ZZ ;;Halt;Error Messages
  1. 1 ;;1;No Signons.
  1. 2 ;;1;Maximum users.
  1. 3 ;;1;Bad device.
  1. 4 ;;0;Invalid A/V code.
  1. 5 ;;0;No Access for User.
  1. 6 ;;0;Invalid device password.
  1. 7 ;;0;Device locked.
  1. 8 ;;1;This device is out of service.
  1. 9 ;;0;*** MULTIPLE SIGN-ONS NOT ALLOWED ***
  1. 10 ;;1;You don't have access to this device!
  1. 11 ;;0;Access code terminated.
  1. 12 ;;0;Change VERIFY code.
  1. 13 ;;1;Time limited device.
  1. 14 ;;0;Bad UCI!
  1. 15 ;;0;Bad Routine.
  1. 16 ;;0;No PRIMARY MENU.
  1. 17 ;;0;User Time limited.
  1. 18 ;;0;User lockout
  1. 19 ;;0;Signon not allowed as you have required forms to sign in terminal mode.
  1. 20 ;;0;Client IP address not setup.
  1. 21 ;;0;Null Verify code