Produced by Araxis Merge on 10/18/2017 11:37:29 AM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | OSCIF_CPRS v32 Phase 2 Build 2OR3.0405_August_2017.zip\OR_30_405V36_SRC.zip\XE8\Broker\Source | Trpcb.pas | Wed Oct 11 20:08:07 2017 UTC |
| 2 | OSCIF_CPRS v32 Phase 2 Build 2OR3.0405_August_2017.zip\OR_30_405V36_SRC.zip\XE8\Broker\Source | Trpcb.pas | Tue Oct 17 19:58:08 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 4800 |
| Changed | 1 | 4 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | { ******** ********** ********** ********** ********** ********** **** | |
| 2 | Pa ckage: XWB - Kernel RPCBroker | |
| 3 | Da te Created : Sept 18, 1997 (Ver sion 1.1) | |
| 4 | Si te Name: O akland, OI Field Off ice, Dept of Veteran Affairs | |
| 5 | De velopers: PII, PII, PII, PII, | |
| 6 | PII | |
| 7 | De scription: Contains TRPCBroker and relat ed compone nts. | |
| 8 | Unit: Tb rpc RPC br oker. | |
| 9 | Cu rrent Rele ase: Versi on 1.1 Pat ch 65 | |
| 10 | ********** ********** ********** ********** ********** ********** *** } | |
| 11 | ||
| 12 | { ******** ********** ********** ********** ********** ** | |
| 13 | Changes in v1.1.65 (HGW 01/1 1/2017) XW B*1.1*65 | |
| 14 | 1. Corre cted CURRE NT_RPC_VER SION to ve rsion XWB* 1.1*65 | |
| 15 | 2. In TR PCBroker.S etConnecte d, added c all to get an Identi ty and Acc ess | |
| 16 | Manag ement (IAM ) Secure T oken Servi ce (STS) S AML Token for Single | |
| 17 | Sign- On interna l (SSOi). The token is used to set SSOiT oken, SSOi SECID, | |
| 18 | SSOiA DUPN, and SSOiLogonN ame proper ties for t he TRPCBro ker connec tion. | |
| 19 | 3. In Au thenticate User, used SSOiToken property to authent icate the user | |
| 20 | (new silent Log in Mode: l mSSOi) | |
| 21 | 4. Remov ed several short str ing type c astings. | |
| 22 | 5. After authentic ating user with Acce ss/Verify codes, if SecID is | |
| 23 | popul ated, then call bind ing RPC (o n test/dev elopment s ystems onl y) so | |
| 24 | that future aut henticatio n will be 2-factor u sing STS t oken. | |
| 25 | 6. User binding (I AM SecID t o VistA NE W PERSON f ile) enabl ed for tes t | |
| 26 | accou nts only. Production accounts will use ' IAM Link M y Account' | |
| 27 | appli cation. | |
| 28 | 7. Enabl e SSH-2 tu nneling fo r Micro Fo cus Reflec tion, whic h replaces | |
| 29 | Attac hmate Refl ection. So me command line chan ges needed to be mad e to | |
| 30 | suppo rt both pr oducts and higher le vels of en cryption. | |
| 31 | 8. Added code to ' create con text' afte r an RPC c all errors out due t o VistA | |
| 32 | clear ing the ap plication context up on an erro r. | |
| 33 | ||
| 34 | Changes in v1.1.60 (HGW 10/0 8/2014) XW B*1.1*60 | |
| 35 | 1. Corre cted CURRE NT_RPC_VER SION to ve rsion XWB* 1.1*60 | |
| 36 | 2. Depre cated old- style brok er which c alled back to client on a diff erent | |
| 37 | port. This has problems o n the Vist A side usi ng IPv6. T he code wi ll not | |
| 38 | be re moved from the VistA routines until all client app lications have | |
| 39 | migra ted to new -style bro ker (as of this patc h, BCMA is still com piled | |
| 40 | with an older B DK that do es not sup port the n ew-style b roker). | |
| 41 | 3. In TR PCBroker.S tartSecure Connection , provided alternati ve command line | |
| 42 | synta x for open ing Attach mate Refle ction or P link.exe w hen the se rver is | |
| 43 | an IP v6 address instead o f a FQDN. | |
| 44 | 4. Chang ed delimit er in Brok erConnecti ons and Br okerAllCon nections l ist from | |
| 45 | ':' t o '/' when storing s erver/port due to in stances wh en the ser ver is | |
| 46 | an IP v6 address instead o f a FQDN. | |
| 47 | ||
| 48 | Changes in v1.1.50 (JLI 6/24 /2008) XWB *1.1*50 | |
| 49 | 1. Addin g use of S SH tunneli ng as comm and line o ption (or property). It | |
| 50 | appea rs that tu nneling wi th Attachm ate Reflec tion will be used wi thin | |
| 51 | the V A. Howeve r, code fo r the use of Plink.e xe for SSH tunneling is | |
| 52 | also provided t o permit s ecure conn ections fo r those us ing VistA | |
| 53 | outsi de of the VA. | |
| 54 | 2. Corre ct RPC Ver sion to ve rsion 50. | |
| 55 | ||
| 56 | Changes in v1.1.31 (DCM ) XW B*1.1*31 | |
| 57 | 1. Added new read only prope rty Broker Version to TRPCBroke r which sh ould | |
| 58 | conta in the ver sion numbe r for the RPCBroker (or Shared RPCBroker) in | |
| 59 | use. | |
| 60 | ||
| 61 | Changes in v1.1.13 (JLI 4/24 /2001) XWB *1.1*13 | |
| 62 | 1. More silent log in code; d eleted obs olete line s | |
| 63 | ||
| 64 | Changes in v1.1.8 (REM 7/13/ 1999) XWB* 1.1*8 | |
| 65 | 1. Check for Multi -Division users. | |
| 66 | ||
| 67 | Changes in v1.1.6 (DPC 4/99) XWB*1.1*6 | |
| 68 | 1. Polli ng to supp ort termin ating orph aned serve r jobs. | |
| 69 | ||
| 70 | Changes in v1.1.4 (DCM 10/22 /98) XWB*1 .1*4 | |
| 71 | 1. Silen t Login ch anges. | |
| 72 | ********** ********** ********** ********** ********** } | |
| 73 | unit Trpcb ; | |
| 74 | ||
| 75 | //TODO - ( future pat ch) Enable TLS secur e TCP conn ection, th en depreca te all | |
| 76 | // r eferences to Plink a nd SSH tun neling her e and in o ther units . | |
| 77 | ||
| 78 | interface | |
| 79 | ||
| 80 | {$I IISBas e.inc} | |
| 81 | ||
| 82 | uses | |
| 83 | {System} | |
| 84 | Classes, SysUtils, StrUtils, ComObj, | |
| 85 | {WinApi} | |
| 86 | Messages , WinProcs , WinTypes , Windows, ActiveX, | |
| 87 | {VA} | |
| 88 | XWBut1, MFunStr, X WBHash, VE RGENCECONT EXTORLib_T LB, XWBSSO i, | |
| 89 | {Vcl} | |
| 90 | Vcl.Cont rols, Vcl. Dialogs, V cl.Forms, Vcl.Graphi cs, Vcl.Ol eCtrls, Vc l.ExtCtrls ; | |
| 91 | ||
| 92 | const | |
| 93 | NoMore: boolean = False; | |
| 94 | MIN_RPCT IMELIMIT: integer = 30; | |
| 95 | CURRENT_ RPC_VERSIO N: String = 'XWB*1.1 *65'; | |
| 96 | ||
| 97 | type | |
| 98 | TParamTy pe = (lite ral, refer ence, list , global, empty, str eam, undef ined); | |
| 99 | TAccessV erifyCodes = String; //to use TAccessVe rifyCodesP roperty ed itor use t his type | |
| 100 | TRemoteP roc = Stri ng; //to use TRemotePr ocProperty editor us e this typ e | |
| 101 | TServer = String; //to use TServerPr operty edi tor use th is type | |
| 102 | TRpcVers ion = Stri ng; //to use TRpcVersi onProperty editor us e this typ e | |
| 103 | TRPCBrok er = class ; | |
| 104 | TVistaLo gin = clas s; | |
| 105 | TLoginMo de = (lmAV Codes, lmA ppHandle, lmSSOi); | |
| 106 | TShowErr orMsgs = ( semRaise, semQuiet); | |
| 107 | TOnLogin Failure = procedure (VistaLogi n: TVistaL ogin) of o bject; | |
| 108 | TOnRPCBF ailure = p rocedure ( RPCBroker: TRPCBroke r) of obje ct; | |
| 109 | TOnPulse Error = pr ocedure(RP CBroker: T RPCBroker; ErrorText : String) of object; | |
| 110 | TSecure = (secureN one, secur eAttachmat e, secureP link); | |
| 111 | ||
| 112 | {------ EB rokerError ------} | |
| 113 | EBrokerErr or = class (Exception ) | |
| 114 | public | |
| 115 | Action: string; | |
| 116 | Code: in teger; | |
| 117 | Mnemonic : string; | |
| 118 | end; | |
| 119 | ||
| 120 | {------ TS tring ---- --} | |
| 121 | TString = class(TObj ect) | |
| 122 | public | |
| 123 | Str: str ing; | |
| 124 | end; | |
| 125 | ||
| 126 | {------ TM ult ------ } | |
| 127 | {:This com ponent def ines the m ultiple fi eld of a p arameter. The multi ple | |
| 128 | field is used to pa ss string- subscripte d array of data in a parameter .} | |
| 129 | TMult = cl ass(TCompo nent) | |
| 130 | private | |
| 131 | FMultipl e: TString List; | |
| 132 | procedur e ClearAll ; | |
| 133 | function GetCount : Word; | |
| 134 | function GetFirst : string; | |
| 135 | function GetLast: string; | |
| 136 | function GetFMult iple(Index : string): string; | |
| 137 | function GetSorte d: boolean ; | |
| 138 | procedur e SetFMult iple(Index : string; value: str ing); | |
| 139 | procedur e SetSorte d(Value: b oolean); | |
| 140 | protected | |
| 141 | public | |
| 142 | construc tor Create (AOwner: T Component) ; override ; {1. 1T8} | |
| 143 | destruct or Destroy ; override ; | |
| 144 | procedur e Assign(S ource: TPe rsistent); override; | |
| 145 | function Order(con st StartSu bscript: s tring; Dir ection: in teger): st ring; | |
| 146 | function Position( const Subs cript: str ing): long int; | |
| 147 | function Subscript (const Pos ition: lon gint): str ing; | |
| 148 | property Count: Wo rd read Ge tCount; | |
| 149 | property First: st ring read GetFirst; | |
| 150 | property Last: str ing read G etLast; | |
| 151 | property MultArray [I: string ]: string | |
| 152 | read GetF Multiple w rite SetFM ultiple; d efault; | |
| 153 | property Sorted: b oolean rea d GetSorte d write Se tSorted; | |
| 154 | end; | |
| 155 | ||
| 156 | {------ TP aramRecord ------} | |
| 157 | {:This com ponent def ines all t he fields that compr ise a para meter.} | |
| 158 | ||
| 159 | TParamReco rd = class (TComponen t) | |
| 160 | private | |
| 161 | FMult: T Mult; | |
| 162 | FValue: string; | |
| 163 | FPType: TParamType ; | |
| 164 | protected | |
| 165 | public | |
| 166 | construc tor Create (AOwner: T Component) ; override ; | |
| 167 | destruct or Destroy ; override ; | |
| 168 | property Value: st ring read FValue wri te FValue; | |
| 169 | property PType: TP aramType r ead FPType write FPT ype; | |
| 170 | property Mult: TMu lt read FM ult write FMult; | |
| 171 | end; | |
| 172 | ||
| 173 | {------ TP arams ---- --} | |
| 174 | {:This com ponent is really a c ollection of paramet ers. Simp le inclusi on | |
| 175 | of this component in the Bro ker compon ent provid es access to all of the | |
| 176 | paramete rs that ma y be neede d when cal ling a rem ote proced ure.} | |
| 177 | TParams = class(TCom ponent) | |
| 178 | private | |
| 179 | FParamet ers: TList ; | |
| 180 | function GetCount: Word; | |
| 181 | function GetParame ter(Index: integer): TParamRec ord; | |
| 182 | procedur e SetParam eter(Index : integer; Parameter : TParamRe cord); | |
| 183 | public | |
| 184 | construc tor Create (AOwner: T Component) ; override ; | |
| 185 | destruct or Destroy ; override ; | |
| 186 | procedur e Assign(S ource: TPe rsistent); override; | |
| 187 | procedur e Clear; | |
| 188 | property Count: Wo rd read Ge tCount; | |
| 189 | property ParamArra y[I: integ er]: TPara mRecord re ad GetPara meter writ e SetParam eter; defa ult; | |
| 190 | end; | |
| 191 | ||
| 192 | ||
| 193 | {------ TV istaLogin ------} //p13 | |
| 194 | TVistaLogi n = class( TPersisten t) | |
| 195 | private | |
| 196 | FLogInHa ndle : str ing; | |
| 197 | FNTToken : string; | |
| 198 | FAccessC ode : stri ng; | |
| 199 | FVerifyC ode : stri ng; | |
| 200 | FDivisio n : stri ng; | |
| 201 | FMode: T LoginMode; | |
| 202 | FDivLst: TStrings; | |
| 203 | FOnFaile dLogin: TO nLoginFail ure; | |
| 204 | FMultiDi vision : b oolean; | |
| 205 | FDUZ: st ring; | |
| 206 | FErrorTe xt : strin g; | |
| 207 | FPromptD iv : boole an; | |
| 208 | FIsProdu ctionAccou nt: Boolea n; | |
| 209 | FDomainN ame: strin g; | |
| 210 | procedur e SetAcces sCode(cons t Value: S tring); | |
| 211 | procedur e SetLogIn Handle(con st Value: String); | |
| 212 | procedur e SetNTTok en(const V alue: Stri ng); | |
| 213 | procedur e SetVerif yCode(cons t Value: S tring); | |
| 214 | procedur e SetDivis ion(const Value: Str ing); | |
| 215 | procedur e SetMode( const Valu e: TLoginM ode); | |
| 216 | procedur e SetMulti Division(V alue: Bool ean); | |
| 217 | procedur e SetDuz(c onst Value : string); | |
| 218 | procedur e SetError Text(const Value: st ring); | |
| 219 | procedur e SetPromp tDiv(const Value: bo olean); | |
| 220 | protected | |
| 221 | procedur e FailedLo gin(Sender : TObject) ; dynamic; | |
| 222 | public | |
| 223 | construc tor Create (AOwner: T Component) ; virtual; | |
| 224 | destruct or Destroy ; override ; | |
| 225 | property LogInHand le: String read FLog InHandle w rite SetLo gInHandle; //for us e by a sec ondary Vis tA login | |
| 226 | property NTToken: String rea d FNTToken write Set NTToken; | |
| 227 | property DivList: TStrings r ead FDivLs t; | |
| 228 | property OnFailedL ogin: TOnL oginFailur e read FOn FailedLogi n write FO nFailedLog in; | |
| 229 | property MultiDivi sion: Bool ean read F MultiDivis ion write SetMultiDi vision; | |
| 230 | property DUZ: stri ng read FD UZ write S etDuz; | |
| 231 | property ErrorText : string r ead FError Text write SetErrorT ext; | |
| 232 | property IsProduct ionAccount : Boolean read FIsPr oductionAc count writ e | |
| 233 | FIsP roductionA ccount; | |
| 234 | property DomainNam e: string read FDoma inName wri te FDomain Name; | |
| 235 | published | |
| 236 | property AccessCod e: String read FAcce ssCode wri te SetAcce ssCode; | |
| 237 | property VerifyCod e: String read FVeri fyCode wri te SetVeri fyCode; | |
| 238 | property Mode: TLo ginMode re ad FMode w rite SetMo de; | |
| 239 | property Division: String re ad FDivisi on write S etDivision ; | |
| 240 | property PromptDiv ision: boo lean read FPromptDiv write Set PromptDiv; | |
| 241 | ||
| 242 | end; | |
| 243 | ||
| 244 | {------ TV istaUser - -----} / /holds 'ge neric' use r attribut es {p13} | |
| 245 | TVistaUser = class(T Object) | |
| 246 | private | |
| 247 | FDUZ: st ring; | |
| 248 | FName: s tring; | |
| 249 | FStandar dName: str ing; | |
| 250 | FDivisio n: String; | |
| 251 | FVerifyC odeChngd: Boolean; | |
| 252 | FTitle: string; | |
| 253 | FService Section: s tring; | |
| 254 | FLanguag e: string; | |
| 255 | FDtime: string; | |
| 256 | FVpid: S tring; | |
| 257 | procedur e SetDivis ion(const Value: Str ing); | |
| 258 | procedur e SetDUZ(c onst Value : String); | |
| 259 | procedur e SetName( const Valu e: String) ; | |
| 260 | procedur e SetVerif yCodeChngd (const Val ue: Boolea n); | |
| 261 | procedur e SetStand ardName(co nst Value: String); | |
| 262 | procedur e SetTitle (const Val ue: string ); | |
| 263 | procedur e SetDTime (const Val ue: string ); | |
| 264 | procedur e SetLangu age(const Value: str ing); | |
| 265 | procedur e SetServi ceSection( const Valu e: string) ; | |
| 266 | public | |
| 267 | property DUZ: Stri ng read FD UZ write S etDUZ; | |
| 268 | property Name: Str ing read F Name write SetName; | |
| 269 | property StandardN ame: Strin g read FSt andardName write Set StandardNa me; | |
| 270 | property Division: String re ad FDivisi on write S etDivision ; | |
| 271 | property VerifyCod eChngd: Bo olean read FVerifyCo deChngd wr ite SetVer ifyCodeChn gd; | |
| 272 | property Title: st ring read FTitle wri te SetTitl e; | |
| 273 | property ServiceSe ction: str ing read F ServiceSec tion write SetServic eSection; | |
| 274 | property Language: string re ad FLangua ge write S etLanguage ; | |
| 275 | property DTime: st ring read FDTime wri te SetDTim e; | |
| 276 | property Vpid: str ing read F Vpid write FVpid; | |
| 277 | end; | |
| 278 | ||
| 279 | {------ TR PCBroker - -----} | |
| 280 | {:This com ponent, wh en placed on a form, allows de sign-time and run-ti me | |
| 281 | connecti on to the server by simply tog gling the Connected property. | |
| 282 | Once con nected you can acces s server d ata.} | |
| 283 | TRPCBroker = class(T Component) | |
| 284 | private | |
| 285 | protected | |
| 286 | FBrokerV ersion: St ring; | |
| 287 | FAccessV erifyCodes : TAccessV erifyCodes ; | |
| 288 | FClearPa rameters: Boolean; | |
| 289 | FClearRe sults: Boo lean; | |
| 290 | FConnect ed: Boolea n; | |
| 291 | FConnect ing: Boole an; | |
| 292 | FCurrent Context: S tring; | |
| 293 | FDebugMo de: Boolea n; | |
| 294 | FListene rPort: int eger; | |
| 295 | FParams: TParams; | |
| 296 | FResults : TStrings ; | |
| 297 | FOnCallR esultStr: String; | |
| 298 | FRemoteP rocedure: TRemotePro c; | |
| 299 | FRpcVers ion: TRpcV ersion; | |
| 300 | FServer: TServer; | |
| 301 | FSocket: integer; | |
| 302 | FRPCTime Limit : in teger; //for adju sting clie nt RPC dur ation time outs | |
| 303 | FPulse : TT imer; //P6 | |
| 304 | FKernelL ogIn : Bo olean; //p13 | |
| 305 | FLogIn: TVistaLogI n; //p13 | |
| 306 | FUser: T VistaUser; //p13 | |
| 307 | FOnRPCBF ailure: TO nRPCBFailu re; | |
| 308 | FShowErr orMsgs: TS howErrorMs gs; | |
| 309 | FRPCBErr or: St ring; | |
| 310 | FOnPulse Error: TOn PulseError ; | |
| 311 | FSecurit yPhrase: S tring; // BSE JL I 060130 | |
| 312 | // Added from CCOW RPCBroker | |
| 313 | FCCOWLog onIDName: String; | |
| 314 | FCCOWLog onIDValue: String; | |
| 315 | FCCOWLog onName: St ring; | |
| 316 | FCCOWLog onNameValu e: String; | |
| 317 | FContext or: TConte xtorContro l; //CCOW | |
| 318 | FCCOWtok en: string ; //CCOW | |
| 319 | FVistaDo main: Stri ng; | |
| 320 | FCCOWLog onVpid: St ring; | |
| 321 | FCCOWLog onVpidValu e: String; | |
| 322 | FWasUser Defined: B oolean; | |
| 323 | FOnRPCCa ll: TNotif yEvent; | |
| 324 | // end o f values f rom CCOWRP CBroker | |
| 325 | // value s for hand ling SSH t unnels | |
| 326 | FUseSecu reConnecti on: TSecur e; | |
| 327 | FSSHPort : String; | |
| 328 | FSSHUser : String; | |
| 329 | FSSHpw: String; | |
| 330 | FSSHhide : Boolean; | |
| 331 | FLastSer ver: Strin g; | |
| 332 | FLastPor t: Integer ; | |
| 333 | // end S SH tunnel values | |
| 334 | // value s for hand ling IAM S TS tokens | |
| 335 | FSSOiTok enValue: S tring; | |
| 336 | FSSOiSEC IDValue: S tring; | |
| 337 | FSSOiADU PNValue: S tring; | |
| 338 | FSSOiLog onNameValu e: String; | |
| 339 | // end S TS token v alues | |
| 340 | FIPsecSe curity: In teger; | |
| 341 | FIPproto col: Integ er; | |
| 342 | function GetCCO WHandle(Co nnectedBro ker: TRPCB roker): st ring; | |
| 343 | procedur e CCOWse tUser(Unam e, token, Domain, Vp id: string ; Contexto r: TContex torControl ); | |
| 344 | function GetCCO Wduz( Cont extor: TCo ntextorCon trol): str ing; | |
| 345 | procedur e SetCle arParamete rs(Value: Boolean); virtual; | |
| 346 | procedur e SetCle arResults( Value: Boo lean); vir tual; | |
| 347 | procedur e SetCon nected(Val ue: Boolea n); virtua l; | |
| 348 | procedur e SetRes ults(Value : TStrings ); virtual ; | |
| 349 | procedur e SetSer ver(Value: TServer); virtual; | |
| 350 | procedur e SetRPC TimeLimit( Value: int eger); vir tual; //S creen chan ges to tim eout. | |
| 351 | procedur e DoPuls eOnTimer(S ender: TOb ject); vir tual; //p 6 | |
| 352 | procedur e SetKer nelLogIn(c onst Value : Boolean) ; virtual; | |
| 353 | procedur e SetUse r(const Va lue: TVist aUser); vi rtual; | |
| 354 | procedur e CheckS SH; | |
| 355 | function getSSH PassWord: string; | |
| 356 | function getSSH Username: string; | |
| 357 | function StartS ecureConne ction(var PseudoServ er, Pseudo Port: Stri ng): Boole an; | |
| 358 | public | |
| 359 | XWBWinso ck: TObjec t; | |
| 360 | property Access VerifyCode s: TAccess VerifyCode s read FAc cessVerify Codes writ e FAccessV erifyCodes ; | |
| 361 | property Param: TParams r ead FParam s write FP arams; | |
| 362 | property Socket : integer read FSock et; | |
| 363 | property RPCTim eLimit : i nteger rea d FRPCTime Limit writ e SetRPCTi meLimit; | |
| 364 | destruct or Destro y; overrid e; | |
| 365 | procedur e Call; virtual; | |
| 366 | procedur e Loaded ; override ; | |
| 367 | procedur e lstCal l(OutputBu ffer: TStr ings); vir tual; | |
| 368 | function pchCal l: PChar; virtual; | |
| 369 | function strCal l: string; virtual; | |
| 370 | function Create Context(st rContext: string): b oolean; vi rtual; | |
| 371 | property Curren tContext: String rea d FCurrent Context; | |
| 372 | property User: TVistaUser read FUse r write Se tUser; | |
| 373 | property OnRPCB Failure: T OnRPCBFail ure read F OnRPCBFail ure write FOnRPCBFai lure; | |
| 374 | property RPCBEr ror: Strin g read FRP CBError wr ite FRPCBE rror; | |
| 375 | property OnPuls eError: TO nPulseErro r read FOn PulseError write FOn PulseError ; | |
| 376 | property Broker Version: S tring read FBrokerVe rsion; | |
| 377 | property Securi tyPhrase: String rea d FSecurit yPhrase wr ite FSecur ityPhrase; // BSE J LI 060130 | |
| 378 | property OnCall ResultStr: String re ad FOnCall ResultStr; | |
| 379 | // broug ht in from CCOWRPCBr oker | |
| 380 | function GetCCO Wtoken(Con textor: TC ontextorCo ntrol): st ring; | |
| 381 | function IsUser Cleared: B oolean; | |
| 382 | function WasUse rDefined: Boolean; | |
| 383 | function IsUser ContextPen ding(aCont extItemCol lection: I ContextIte mCollectio n): Boolea n; | |
| 384 | property Contex tor: TCont extorContr ol read Fc ontextor w rite FCont extor; // CCOW | |
| 385 | property CCOWLo gonIDName: String re ad FCCOWLo gonIDName; | |
| 386 | property CCOWLo gonIDValue : String r ead FCCOWL ogonIDValu e; | |
| 387 | property CCOWLo gonName: S tring read FCCOWLogo nName; | |
| 388 | property CCOWLo gonNameVal ue: String read FCCO WLogonName Value; | |
| 389 | property CCOWLo gonVpid: S tring read FCCOWLogo nVpid; | |
| 390 | property CCOWLo gonVpidVal ue: String read FCCO WLogonVpid Value; | |
| 391 | // added for secur e connecti on via SSH | |
| 392 | property SSHpor t: String read FSSHP ort write FSSHPort; | |
| 393 | property SSHUse r: String read FSSHU ser write FSSHUser; | |
| 394 | property SSHpw: String re ad FSSHpw write FSSH pw; | |
| 395 | property IPsecS ecurity: I nteger rea d FIPsecSe curity wri te FIPsecS ecurity; | |
| 396 | property IPprot ocol: Inte ger read F IPprotocol write FIP protocol; | |
| 397 | // added for Singl e Sign-On with Ident ity and Ac cess Manag ement STS token | |
| 398 | property SSOiTo ken: Strin g read FSS OiTokenVal ue write F SSOiTokenV alue; | |
| 399 | property SSOiSE CID: Strin g read FSS OiSECIDVal ue write F SSOiSECIDV alue; | |
| 400 | property SSOiAD UPN: Strin g read FSS OiADUPNVal ue write F SSOiADUPNV alue; | |
| 401 | property SSOiLo gonName: S tring read FSSOiLogo nNameValue write FSS OiLogonNam eValue; | |
| 402 | published | |
| 403 | construc tor Create (AOwner: T Component) ; override ; | |
| 404 | property ClearP arameters: boolean r ead FClear Parameters write Set ClearParam eters; | |
| 405 | property ClearR esults: bo olean read FClearRes ults write SetClearR esults; | |
| 406 | property Connec ted: boole an read FC onnected w rite SetCo nnected; | |
| 407 | property DebugM ode: boole an read FD ebugMode w rite FDebu gMode defa ult False; | |
| 408 | property Listen erPort: in teger read FListener Port write FListener Port; | |
| 409 | property Result s: TString s read FRe sults writ e SetResul ts; | |
| 410 | property Remote Procedure: TRemotePr oc read FR emoteProce dure write FRemotePr ocedure; | |
| 411 | property RpcVer sion: TRpc Version re ad FRpcVer sion write FRpcVersi on; | |
| 412 | property Server : TServer read FServ er write S etServer; | |
| 413 | property Kernel LogIn: Boo lean read FKernelLog In write S etKernelLo gIn; | |
| 414 | property ShowEr rorMsgs: T ShowErrorM sgs read F ShowErrorM sgs write FShowError Msgs defau lt semRais e; | |
| 415 | property LogIn: TVistaLog In read FL ogIn write FLogin; / / SetLogIn ; | |
| 416 | property OnRPCC all: TNoti fyEvent re ad FOnRPCC all write FOnRPCCall ; | |
| 417 | // added for secur e connecti on via SSH | |
| 418 | property UseSec ureConnect ion: TSecu re read FU seSecureCo nnection w rite FUSeS ecureConne ction; | |
| 419 | property SSHHid e: Boolean read FSSH Hide write FSSHHide; | |
| 420 | end; | |
| 421 | ||
| 422 | {procedure Register; } //P14 - -pack spli t | |
| 423 | procedure StoreConne ction(Brok er: TRPCBr oker); | |
| 424 | function RemoveConn ection(Bro ker: TRPCB roker): Bo olean; | |
| 425 | function Disconnect All(Server : String; ListenerPo rt: Intege r): Boolea n; | |
| 426 | function ExistingSo cket(Broke r: TRPCBro ker): Inte ger; | |
| 427 | procedure Authentica teUser(Con nectingBro ker: TRPCB roker); | |
| 428 | procedure GetBrokerI nfo(Connec tedBroker : TRPCBrok er); //P6 | |
| 429 | function NoSignOnNe eded : Boo lean; | |
| 430 | function ProcessExe cute(Comma nd: String ; cShow: W ord): Inte ger; | |
| 431 | function GetAppHand le(Connect edBroker : TRPCBroke r): String ; | |
| 432 | function ShowApplic ationAndFo cusOK(anAp plication: TApplicat ion): Bool ean; | |
| 433 | procedure SSOiBindUs er(Connect edBroker: TRPCBroker ); | |
| 434 | ||
| 435 | var | |
| 436 | DebugDat a: string; | |
| 437 | BrokerCo nnections: TStringLi st; {thi s list sto res all co nnections by socket number} | |
| 438 | BrokerAl lConnectio ns: TStrin gList; {th is list st ores all c onnections to all of | |
| 439 | the servers, b y an appli cation. I t's used i n Disconne ctAll} | |
| 440 | // The f ollowing 2 variables added to handle clo sing of co mmand box for SSH | |
| 441 | CommandB oxProcessH andle: THa ndle; | |
| 442 | CommandB oxThreadHa ndle: THan dle; | |
| 443 | ||
| 444 | implementa tion | |
| 445 | ||
| 446 | uses | |
| 447 | {VA} | |
| 448 | Loginfrm , RpcbErr, SelDiv, R pcSLogin, fRPCBErrMs g, Wsockc, | |
| 449 | CCOW_con st, fPlink pw, fSSHUs ername, fr mSignonMes sage; | |
| 450 | ||
| 451 | //This "in clude" fil e contains encrypted IAM_Bindi ng pass ph rase, IAM server URL , | |
| 452 | // and SOA P message template | |
| 453 | {$I IAMBas e.inc} | |
| 454 | ||
| 455 | var | |
| 456 | CCOWToke n: String; | |
| 457 | Domain: String; | |
| 458 | PassCode 1: String; | |
| 459 | PassCode 2: String; | |
| 460 | ||
| 461 | const | |
| 462 | DEFAULT_ PULSE : integer = 81000; // P6 default = 45% of 3 minutes. | |
| 463 | MINIMUM_ TIMEOUT : integer = 14; // P6 shortes t allowabl e timeout in secs. | |
| 464 | PULSE_PE RCENTAGE : integer = 45; // P6 % of ti meout for pulse freq uency. | |
| 465 | ||
| 466 | ||
| 467 | {--------- ---------- ------- TM ult.Create --------- ---------- ------- | |
| 468 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 469 | constructo r TMult.Cr eate(AOwne r: TCompon ent); | |
| 470 | begin | |
| 471 | inherite d Create(A Owner); | |
| 472 | FMultipl e := TStri ngList.Cre ate; | |
| 473 | end; //con structor T Mult.Creat e | |
| 474 | ||
| 475 | ||
| 476 | {--------- ---------- ------ TMu lt.Destroy --------- ---------- ------- | |
| 477 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 478 | destructor TMult.Des troy; | |
| 479 | begin | |
| 480 | ClearAll ; | |
| 481 | FMultipl e.Free; | |
| 482 | FMultipl e := nil; | |
| 483 | inherite d Destroy; | |
| 484 | end; //des tructor TM ult.Destro y | |
| 485 | ||
| 486 | ||
| 487 | {--------- ---------- ------- TM ult.Assign --------- ---------- ------- | |
| 488 | All of the items fro m source o bject are copied one by one in to the | |
| 489 | target. S o if the s ource is l ater destr oyed, targ et object will conti nue | |
| 490 | to hold th e copy of all elemen ts, comple tely unaff ected. | |
| 491 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 492 | procedure TMult.Assi gn(Source: TPersiste nt); | |
| 493 | var | |
| 494 | I: integ er; | |
| 495 | SourceSt rings: TSt rings; | |
| 496 | S: TStri ng; | |
| 497 | SourceMu lt: TMult; | |
| 498 | begin | |
| 499 | ClearAll ; | |
| 500 | if Sourc e is TMult then | |
| 501 | begin | |
| 502 | Source Mult := So urce as TM ult; | |
| 503 | try | |
| 504 | for I := 0 to SourceMult .FMultiple .Count - 1 do | |
| 505 | begi n | |
| 506 | S := TString .Create; | |
| 507 | S. Str := (So urceMult.F Multiple.O bjects[I] as TString ).Str; | |
| 508 | Se lf.FMultip le.AddObje ct(SourceM ult.FMulti ple[I], S) ; | |
| 509 | end; //for | |
| 510 | except | |
| 511 | end; / /try | |
| 512 | end //if | |
| 513 | else | |
| 514 | begin | |
| 515 | Source Strings := Source as TStrings; | |
| 516 | for I := 0 to So urceString s.Count - 1 do | |
| 517 | Self [IntToStr( I)] := Sou rceStrings [I]; | |
| 518 | end; //e lse | |
| 519 | end; //pro cedure TMu lt.Assign | |
| 520 | ||
| 521 | ||
| 522 | {--------- ---------- ------ TMu lt.ClearAl l -------- ---------- ------- | |
| 523 | One by one , all Mult items are freed. | |
| 524 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 525 | procedure TMult.Clea rAll; | |
| 526 | var | |
| 527 | I: integ er; | |
| 528 | begin | |
| 529 | for I := 0 to FMul tiple.Coun t - 1 do | |
| 530 | begin | |
| 531 | FMulti ple.Object s[I].Free; | |
| 532 | FMulti ple.Object s[I] := ni l; | |
| 533 | end; //f or | |
| 534 | FMultipl e.Clear; | |
| 535 | end; //pro cedure TMu lt.ClearAl l | |
| 536 | ||
| 537 | ||
| 538 | {--------- ---------- ------ TMu lt.GetCoun t -------- ---------- ------- | |
| 539 | Returns th e number o f elements in the mu ltiple | |
| 540 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 541 | function T Mult.GetCo unt: Word; | |
| 542 | begin | |
| 543 | Result : = FMultipl e.Count; | |
| 544 | end; //fun ction TMul t.GetCount | |
| 545 | ||
| 546 | ||
| 547 | {--------- ---------- ------ TMu lt.GetFirs t -------- ---------- ------- | |
| 548 | Returns th e subscrip t of the f irst eleme nt in the multiple | |
| 549 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 550 | function T Mult.GetFi rst: strin g; | |
| 551 | begin | |
| 552 | if FMult iple.Count > 0 then | |
| 553 | Result := FMulti ple[0] | |
| 554 | else | |
| 555 | Result := ''; | |
| 556 | end; //fun ction TMul t.GetFirst | |
| 557 | ||
| 558 | ||
| 559 | {--------- ---------- ------ TMu lt.GetLast --------- ---------- ------- | |
| 560 | Returns th e subscrip t of the l ast elemen t in the m ultiple | |
| 561 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 562 | function T Mult.GetLa st: string ; | |
| 563 | begin | |
| 564 | if FMult iple.Count > 0 then | |
| 565 | Result := FMulti ple[FMulti ple.Count - 1] | |
| 566 | else | |
| 567 | Result := ''; | |
| 568 | end; //fun ction TMul t.GetLast | |
| 569 | ||
| 570 | ||
| 571 | {--------- ---------- --- TMult. GetFMultip le ------- ---------- ------- | |
| 572 | Returns th e VALUE of the eleme nt whose s ubscript i s passed. | |
| 573 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 574 | function T Mult.GetFM ultiple(In dex: strin g): string ; | |
| 575 | var | |
| 576 | S: TStri ng; | |
| 577 | BrokerCo mponent,Pa ramRecord: TComponen t; | |
| 578 | I: integ er; | |
| 579 | strError : string; | |
| 580 | begin | |
| 581 | try | |
| 582 | S := T String(FMu ltiple.Obj ects[FMult iple.Index Of(Index)] ); | |
| 583 | except | |
| 584 | on ELi stError do | |
| 585 | begin | |
| 586 | {bui ld appropr iate error message} | |
| 587 | strE rror := if f(Self.Nam e <> '', S elf.Name, 'TMult_ins tance'); | |
| 588 | strE rror := st rError + ' [' + Index + ']' + # 13#10 + 'i s undefine d'; | |
| 589 | try | |
| 590 | Pa ramRecord := Self.Ow ner; | |
| 591 | Br okerCompon ent := Sel f.Owner.Ow ner.Owner; | |
| 592 | if (ParamRec ord is TPa ramRecord) and (Brok erComponen t is TRPCB roker) the n | |
| 593 | be gin | |
| 594 | I := 0; | |
| 595 | {if there is an easi er way to figure out which arr ay element points to | |
| 596 | this inst ance of a multiple, use it} // p13 | |
| 597 | while TRPC Broker(Bro kerCompone nt).Param[ I] <> Para mRecord do inc(I); | |
| 598 | strError : = '.Param[ ' + IntToS tr(I) + '] .' + strEr ror; | |
| 599 | strError : = iff(Brok erComponen t.Name <> '', Broker Component. Name, 'TRP CBroker_in stance') + strError; | |
| 600 | en d; //if | |
| 601 | exce pt | |
| 602 | end; //try | |
| 603 | rais e Exceptio n.Create(s trError); | |
| 604 | end; / /on EListE rror do | |
| 605 | end; //t ry | |
| 606 | Result : = S.Str; | |
| 607 | end; //fun ction TMul t.GetFMult iple | |
| 608 | ||
| 609 | ||
| 610 | {--------- ---------- --- TMult. SetGetSort ed ------- ---------- ------- | |
| 611 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 612 | function T Mult.GetSo rted: bool ean; | |
| 613 | begin | |
| 614 | Result : = FMultipl e.Sorted; | |
| 615 | end; //fun ction TMul t.GetSorte d | |
| 616 | ||
| 617 | ||
| 618 | {--------- ---------- --- TMult. SetFMultip le ------- ---------- ------- | |
| 619 | Stores a n ew element in the mu ltiple. F Multiple ( TStringLis t) is the | |
| 620 | structure, which is used to ho ld the sub script and value pai r. Subscr ipt | |
| 621 | is stored as the Str ing, value is stored as an obj ect of the string. | |
| 622 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 623 | procedure TMult.SetF Multiple(I ndex: stri ng; Value: string); | |
| 624 | var | |
| 625 | S: TStri ng; | |
| 626 | Pos: int eger; | |
| 627 | begin | |
| 628 | Pos := F Multiple.I ndexOf(Ind ex); {see if t his subscr ipt alread y exists} | |
| 629 | if Pos = -1 then | |
| 630 | begin {if su bscript is new} | |
| 631 | S := T String.Cre ate; {create st ring objec t} | |
| 632 | S.Str := Value; {put value in it} | |
| 633 | FMulti ple.AddObj ect(Index, S); {add it} | |
| 634 | end //if | |
| 635 | else | |
| 636 | TStrin g(FMultipl e.Objects[ Pos]).Str := Value; { otherwis e replace the value} | |
| 637 | end; //pro cedure TMu lt.SetFMul tiple | |
| 638 | ||
| 639 | ||
| 640 | {--------- ---------- --- TMult. SetSorted ---------- ---------- ---- | |
| 641 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 642 | procedure TMult.SetS orted(Valu e: boolean ); | |
| 643 | begin | |
| 644 | FMultipl e.Sorted : = Value; | |
| 645 | end; //pro cedure TMu lt.GetSort ed | |
| 646 | ||
| 647 | ||
| 648 | {--------- ---------- ------- TM ult.Order ---------- ---------- ------ | |
| 649 | Returns th e subscrip t string o f the next or previo us element from the | |
| 650 | StartSubsc ript. Thi s is very similar to the $O fu nction ava ilable in M. | |
| 651 | Null strin g ('') is returned w hen reachi ng beyong the first or last | |
| 652 | element, o r when lis t is empty . | |
| 653 | Note: A ma jor differ ence betwe en the M $ O and this function is that | |
| 654 | in t his functi on StartSu bscript mu st identif y a valid subscript | |
| 655 | in t he list. | |
| 656 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 657 | function T Mult.Order (const Sta rtSubscrip t: string; Direction : integer) : string; | |
| 658 | var | |
| 659 | Index: l ongint; | |
| 660 | begin | |
| 661 | Result : = ''; | |
| 662 | if Start Subscript = '' then | |
| 663 | if Dir ection > 0 then | |
| 664 | Resu lt := Firs t | |
| 665 | else | |
| 666 | Resu lt := Last | |
| 667 | else | |
| 668 | begin | |
| 669 | Index := Positio n(StartSub script); | |
| 670 | if Ind ex > -1 th en | |
| 671 | if ( Index < (C ount - 1)) and (Dire ction > 0) then | |
| 672 | Re sult := FM ultiple[In dex + 1] | |
| 673 | else | |
| 674 | if (Index > 0) and (Di rection < 0) then | |
| 675 | Result := FMultiple[ Index - 1] ; | |
| 676 | end //el se | |
| 677 | end; //fun ction TMul t.Order | |
| 678 | ||
| 679 | ||
| 680 | {--------- ---------- ------ TMu lt.Positio n -------- ---------- ------- | |
| 681 | Returns th e long int eger value which is the index position o f the | |
| 682 | element in the list. Opposite of TMult. Subscript( ). Rememb er that | |
| 683 | the list i s 0 based! | |
| 684 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 685 | function T Mult.Posit ion(const Subscript: string): longint; | |
| 686 | begin | |
| 687 | Result : = FMultipl e.IndexOf( Subscript) ; | |
| 688 | end; //TMu lt.Positio n | |
| 689 | ||
| 690 | ||
| 691 | {--------- ---------- ----- TMul t.Subscrip t -------- ---------- ------- | |
| 692 | Returns th e string s ubscript o f the elem ent whose position i n the list | |
| 693 | is passed in. Oppos ite of TMu lt.Positio n(). Reme mber that the list i s 0 based! | |
| 694 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 695 | function T Mult.Subsc ript(const Position: longint): string; | |
| 696 | begin | |
| 697 | Result : = ''; | |
| 698 | if (Posi tion > -1) and (Posi tion < Cou nt) then | |
| 699 | Result := FMulti ple[Positi on]; | |
| 700 | end; //fun ction TMul t.Subscrip t | |
| 701 | ||
| 702 | ||
| 703 | {--------- ---------- --- TParam Record.Cre ate ------ ---------- ------- | |
| 704 | Creates TP aramRecord instance and automa tically cr eates TMul t. The | |
| 705 | name of Mu lt is also set in ca se it may be need if exception will be r aised. | |
| 706 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 707 | constructo r TParamRe cord.Creat e(AOwner: TComponent ); | |
| 708 | begin | |
| 709 | inherite d Create(A Owner); | |
| 710 | FMult := TMult.Cre ate(Self); | |
| 711 | FMult.Na me := 'Mul t'; | |
| 712 | {note: F Mult is de stroyed in the SetCl earParamet ers method } | |
| 713 | end; //con structor T ParamRecor d.Create | |
| 714 | ||
| 715 | ||
| 716 | {--------- ---------- ------ TPa ramRecord. Destroy -- ---------- ---------- --- | |
| 717 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 718 | destructor TParamRec ord.Destro y; | |
| 719 | begin | |
| 720 | FMult.Fr ee; | |
| 721 | FMult := nil; | |
| 722 | inherite d; | |
| 723 | end; //des tructor TP aramRecord .Destroy | |
| 724 | ||
| 725 | ||
| 726 | {--------- ---------- ------ TPa rams.Creat e -------- ---------- ------- | |
| 727 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 728 | constructo r TParams. Create(AOw ner: TComp onent); | |
| 729 | begin | |
| 730 | inherite d Create(A Owner); | |
| 731 | FParamet ers := TLi st.Create; {for no w, empty l ist} | |
| 732 | end; //con structor T Params.Cre ate | |
| 733 | ||
| 734 | ||
| 735 | {--------- ---------- ----- TPar ams.Destro y -------- ---------- ------- | |
| 736 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 737 | destructor TParams.D estroy; | |
| 738 | begin | |
| 739 | Clear; {clear the Multip le first!} | |
| 740 | FParamet ers.Free; | |
| 741 | FParamet ers := nil ; | |
| 742 | inherite d Destroy; | |
| 743 | end; //des tructor TP arams.Dest roy | |
| 744 | ||
| 745 | ||
| 746 | {--------- ---------- ------ TPa rams.Assig n -------- ---------- ------- | |
| 747 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 748 | procedure TParams.As sign(Sourc e: TPersis tent); | |
| 749 | var | |
| 750 | I: integ er; | |
| 751 | SourcePa rams: TPar ams; | |
| 752 | begin | |
| 753 | Self.Cle ar; | |
| 754 | SourcePa rams := So urce as TP arams; | |
| 755 | for I := 0 to Sour ceParams.C ount - 1 d o | |
| 756 | begin | |
| 757 | Self[I ].Value := SourcePar ams[I].Val ue; | |
| 758 | Self[I ].PType := SourcePar ams[I].PTy pe; | |
| 759 | Self[I ].Mult.Ass ign(Source Params[I]. Mult); | |
| 760 | end //fo r | |
| 761 | end; //pro cedure TPa rams.Assig n | |
| 762 | ||
| 763 | ||
| 764 | {--------- ---------- ------ TPa rams.Clear --------- ---------- ------- | |
| 765 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 766 | procedure TParams.Cl ear; | |
| 767 | var | |
| 768 | ParamRec ord: TPara mRecord; | |
| 769 | I: integ er; | |
| 770 | begin | |
| 771 | if FPara meters <> nil then | |
| 772 | begin | |
| 773 | for I := 0 to FP arameters. Count - 1 do | |
| 774 | begin | |
| 775 | Para mRecord := TParamRec ord(FParam eters.Item s[I]); | |
| 776 | if P aramRecord <> nil th en | |
| 777 | begi n //could be nil if params we re skipped by develo per | |
| 778 | Pa ramRecord. FMult.Free ; | |
| 779 | Pa ramRecord. FMult := n il; | |
| 780 | Pa ramRecord. Free; | |
| 781 | end; //if | |
| 782 | end; / /for | |
| 783 | FParam eters.Clea r; {rele ase FParam eters TLis t} | |
| 784 | end; //i f | |
| 785 | end; //pro cedure TPa rams.Clear | |
| 786 | ||
| 787 | ||
| 788 | {--------- ---------- ----- TPar ams.GetCou nt ------- ---------- ------- | |
| 789 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 790 | function T Params.Get Count: Wor d; | |
| 791 | begin | |
| 792 | if FPara meters = n il then | |
| 793 | Result := 0 | |
| 794 | else | |
| 795 | Result := FParam eters.Coun t; | |
| 796 | end; //fun ction TPar ams.GetCou nt | |
| 797 | ||
| 798 | ||
| 799 | {--------- ---------- --- TParam s.GetParam eter ----- ---------- ------- | |
| 800 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 801 | function T Params.Get Parameter( Index: int eger): TPa ramRecord; | |
| 802 | begin | |
| 803 | if Index >= FParam eters.Coun t then { if element out of bo unds,} | |
| 804 | while FParameter s.Count <= Index do | |
| 805 | FPar ameters.Ad d(nil); { setup plac e holders} | |
| 806 | if FPara meters.Ite ms[Index] = nil then | |
| 807 | begin {if just a place hol der,} | |
| 808 | {point it to new memory bl ock} | |
| 809 | FParam eters.Item s[Index] : = TParamRe cord.Creat e(Self); | |
| 810 | TParam Record(FPa rameters.I tems[Index ]).PType : = undefine d; {initia lize} | |
| 811 | end; //i f | |
| 812 | Result : = FParamet ers.Items[ Index]; { return req uested par ameter} | |
| 813 | end; //fun ction TPar ams.GetPar ameter | |
| 814 | ||
| 815 | ||
| 816 | {--------- ---------- --- TParam s.SetParam eter ----- ---------- ------- | |
| 817 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 818 | procedure TParams.Se tParameter (Index: in teger; Par ameter: TP aramRecord ); | |
| 819 | begin | |
| 820 | if Index >= FParam eters.Coun t then { if element out of bo unds,} | |
| 821 | while FParameter s.Count <= Index do | |
| 822 | FPar ameters.Ad d(nil); { setup plac e holders} | |
| 823 | if FPara meters.Ite ms[Index] = nil then { if just a place hold er,} | |
| 824 | FParam eters.Item s[Index] : = Paramete r; { point it t o passed p arameter} | |
| 825 | end; //pro cedure TPa rams.SetPa rameter | |
| 826 | ||
| 827 | ||
| 828 | {--------- ---------- ----- TRPC Broker.Cre ate ------ ---------- ------- | |
| 829 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 830 | constructo r TRPCBrok er.Create( AOwner: TC omponent); | |
| 831 | begin | |
| 832 | inherite d Create(A Owner); | |
| 833 | {set def aults} | |
| 834 | //This c onstant de fined in t he interfa ce section needs to be updated for each release | |
| 835 | FBrokerV ersion := CURRENT_RP C_VERSION; | |
| 836 | FClearPa rameters : = boolean( StrToInt(R eadRegData Default(HK LM,REG_BRO KER,'Clear Parameters ','1'))); | |
| 837 | FClearRe sults := b oolean(Str ToInt(Read RegDataDef ault(HKLM, REG_BROKER ,'ClearRes ults','1') )); | |
| 838 | FDebugMo de := Fals e; | |
| 839 | FParams := TParams .Create(Se lf); | |
| 840 | FResults := TStrin gList.Crea te; | |
| 841 | FServer := ReadReg DataDefaul t(HKLM,REG _BROKER,'S erver','BR OKERSERVER '); | |
| 842 | FPulse := TTimer. Create(Sel f); //P6 | |
| 843 | FListene rPort := S trToInt(Re adRegDataD efault(HKL M,REG_BROK ER,'Listen erPort','9 200')); | |
| 844 | FRpcVers ion := '0' ; | |
| 845 | FRPCTime Limit := M IN_RPCTIME LIMIT; | |
| 846 | with FPu lse do /// P6 | |
| 847 | begin | |
| 848 | Enable d := False ; //P6 | |
| 849 | Interv al := DEFA ULT_PULSE; //P6 | |
| 850 | OnTime r := DoPu lseOnTimer ; //P6 | |
| 851 | end; //w ith | |
| 852 | FLogin : = TVistaLo gin.Create (Self); / /p13 | |
| 853 | FKernelL ogin := Tr ue; //p13 | |
| 854 | FUser := TVistaUse r.Create; //p13 | |
| 855 | FShowErr orMsgs := semRaise; //p13 | |
| 856 | XWBWinso ck := TXWB Winsock.Cr eate; | |
| 857 | Applicat ion.Proces sMessages; | |
| 858 | end; //con structor T RPCBroker. Create | |
| 859 | ||
| 860 | ||
| 861 | {--------- ---------- ---- TRPCB roker.Dest roy ------ ---------- ------- | |
| 862 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 863 | destructor TRPCBroke r.Destroy; | |
| 864 | begin | |
| 865 | Connecte d := False ; | |
| 866 | TXWBWins ock(XWBWin sock).Free ; | |
| 867 | FParams. Free; | |
| 868 | FParams := nil; | |
| 869 | FResults .Free; | |
| 870 | FResults := nil; | |
| 871 | FPulse.F ree; //P6 | |
| 872 | FPulse : = nil; | |
| 873 | FUser.Fr ee; | |
| 874 | FUser := nil; | |
| 875 | FLogin.F ree; | |
| 876 | FLogin : = nil; | |
| 877 | inherite d Destroy; | |
| 878 | end; //des tructor TR PCBroker.D estroy | |
| 879 | ||
| 880 | ||
| 881 | {--------- ---------- -- TRPCBro ker.Create Context -- ---------- ------- | |
| 882 | This funct ion is par t of the o verall Bro ker securi ty. | |
| 883 | The passed context s tring is e ssentially a Client/ Server typ e option | |
| 884 | on the ser ver. The server set s up MenuM an environ ment varia bles for t his | |
| 885 | context wh ich will l ater be us ed to scre en RPCs. Only those RPCs whic h are | |
| 886 | in the mul tiple fiel d of this context op tion will be permitt ed to run. | |
| 887 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 888 | function T RPCBroker. CreateCont ext(strCon text: stri ng): boole an; | |
| 889 | var | |
| 890 | Internal Broker: TR PCBroker; {use sep arate comp onent} | |
| 891 | Str: Str ing; | |
| 892 | begin | |
| 893 | Result : = False; | |
| 894 | Connecte d := True; | |
| 895 | Internal Broker := nil; | |
| 896 | try | |
| 897 | Intern alBroker : = TRPCBrok er.Create( Self); | |
| 898 | Intern alBroker.F Socket := Self.Socke t; // p1 3 -- permi ts multipl e broker c onnections to same s erver/port | |
| 899 | with I nternalBro ker do | |
| 900 | begin | |
| 901 | Tag := 1234; | |
| 902 | Show ErrorMsgs := Self.Sh owerrorMsg s; | |
| 903 | Serv er := Self .Server; {in herit appl ication se rver} | |
| 904 | List enerPort : = Self.Lis tenerPort; {in herit list ener port} | |
| 905 | Debu gMode := S elf.DebugM ode; {in herit debu g mode pro perty} | |
| 906 | Remo teProcedur e := 'XWB CREATE CON TEXT'; {se t up RPC} | |
| 907 | Para m[0].PType := litera l; | |
| 908 | Para m[0].Value := Encryp t(strConte xt); | |
| 909 | try | |
| 910 | St r := strCa ll; | |
| 911 | if Str = '1' then | |
| 912 | be gin // make the call // p13 | |
| 913 | Result := True; // p13 | |
| 914 | self.FCurr entContext := strCon text; // p13 | |
| 915 | en d //if // p13 | |
| 916 | el se | |
| 917 | be gin | |
| 918 | Result := False; | |
| 919 | self.FCurr entContext := ''; | |
| 920 | en d; //else | |
| 921 | exce pt // Cod e added to return Fa lse if Use r doesn't have acces s | |
| 922 | on e: EBroke rError do | |
| 923 | be gin | |
| 924 | self.FCurr entContext := ''; | |
| 925 | if Pos('do es not hav e access t o option', e.Message) > 0 then | |
| 926 | begin | |
| 927 | Result : = False | |
| 928 | end //if | |
| 929 | else | |
| 930 | Raise; | |
| 931 | en d; //on e: EBrokerEr ror do | |
| 932 | end; //try | |
| 933 | if R PCBError < > '' then | |
| 934 | se lf.RPCBErr or := RPCB Error; | |
| 935 | end; / /with Inte rnalBroker do | |
| 936 | finally | |
| 937 | Intern alBroker.X WBWinsock := nil; | |
| 938 | Intern alBroker.F ree; {release memory} | |
| 939 | end; //t ry | |
| 940 | end; //fun ction TRPC Broker.Cre ateContext | |
| 941 | ||
| 942 | ||
| 943 | {--------- ---------- ----- TRPC Broker.Loa ded ------ ---------- ------- | |
| 944 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 945 | procedure TRPCBroker .Loaded; | |
| 946 | begin | |
| 947 | inherite d Loaded; | |
| 948 | end; //pro cedure TRP CBroker.Lo aded | |
| 949 | ||
| 950 | ||
| 951 | {--------- ---------- ------ TRP CBroker.Ca ll ------- ---------- ------- | |
| 952 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 953 | procedure TRPCBroker .Call; | |
| 954 | var | |
| 955 | ResultBu ffer: TStr ings; | |
| 956 | begin | |
| 957 | ResultBu ffer := TS tringList. Create; | |
| 958 | try | |
| 959 | if Cle arResults then | |
| 960 | Clea rResults : = True; | |
| 961 | lstCal l(ResultBu ffer); | |
| 962 | Self.R esults.Add Strings(Re sultBuffer ); | |
| 963 | finally | |
| 964 | Result Buffer.Cle ar; | |
| 965 | Result Buffer.Fre e; | |
| 966 | end; //t ry | |
| 967 | end; //pro cedure TRP CBroker.Ca ll | |
| 968 | ||
| 969 | ||
| 970 | {--------- ---------- ---- TRPCB roker.lstC all ------ ---------- ------- | |
| 971 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 972 | procedure TRPCBroker .lstCall(O utputBuffe r: TString s); | |
| 973 | var | |
| 974 | ManyStri ngs: PChar ; | |
| 975 | begin | |
| 976 | ManyStri ngs := pch Call; {ma ke the cal l} | |
| 977 | OutputBu ffer.SetTe xt(ManyStr ings); {pa rse result of call, format as list} | |
| 978 | StrDispo se(ManyStr ings); {ra w result n o longer n eeded, get back mem} | |
| 979 | end; //pro cedure TRP CBroker.1s tCall | |
| 980 | ||
| 981 | ||
| 982 | {--------- ---------- ---- TRPCB roker.strC all ------ ---------- ------- | |
| 983 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 984 | function T RPCBroker. strCall: s tring; | |
| 985 | var | |
| 986 | ResultSt ring: PCha r; | |
| 987 | begin | |
| 988 | ResultSt ring := pc hCall; {ma ke the cal l} | |
| 989 | Result : = StrPas(R esultStrin g); {co nvert and present as Pascal st ring} | |
| 990 | StrDispo se(ResultS tring); {ra w result n o longer n eeded, get back mem} | |
| 991 | end; //fun ction TRPC Broker.str Call | |
| 992 | ||
| 993 | ||
| 994 | {--------- ---------- -- TRPCBro ker.SetCon nected --- ---------- ------- | |
| 995 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 996 | procedure TRPCBroker .SetConnec ted(Value: Boolean); | |
| 997 | var | |
| 998 | thisOwne r: TCompon ent; | |
| 999 | RPCBCont extor: TCo ntextorCon trol; | |
| 1000 | thisPare nt: TForm; | |
| 1001 | BrokerDi r, Str1, S tr2, Str3 :string; | |
| 1002 | PseudoPo rt: Intege r; | |
| 1003 | PseudoSe rver, Pseu doPortStr: String; | |
| 1004 | begin | |
| 1005 | RPCBErro r := ''; | |
| 1006 | Login.Er rorText := ''; | |
| 1007 | if (Conn ected <> V alue) and not(csRead ing in Com ponentStat e) then | |
| 1008 | begin | |
| 1009 | if Val ue and (FC onnecting <> Value) then | |
| 1010 | begin {con nect} | |
| 1011 | // i f change s ervers, cl ear STS to ken values (refresh token) | |
| 1012 | if n ot (FLastS erver = '' ) then | |
| 1013 | begi n | |
| 1014 | if (not (FLa stServer = Server)) or (not (F LastPort = ListenerP ort)) then | |
| 1015 | be gin | |
| 1016 | SSOiToken := ''; | |
| 1017 | SSOiSECID := ''; | |
| 1018 | SSOiADUPN := ''; | |
| 1019 | SSOiLogonN ame := ''; | |
| 1020 | IPsecSecur ity := 0; | |
| 1021 | IPprotocol := 0; | |
| 1022 | en d; //if | |
| 1023 | end; //if | |
| 1024 | FLas tServer := Server; | |
| 1025 | FLas tPort := L istenerPor t; | |
| 1026 | FSoc ket := Exi stingSocke t(Self); | |
| 1027 | FCon necting := True; // FConnected := True; | |
| 1028 | try | |
| 1029 | if FSocket = 0 then | |
| 1030 | be gin | |
| 1031 | if DebugMo de then | |
| 1032 | begin | |
| 1033 | Str1 := 'Control o f debuggin g has been moved fro m the clie nt to the server. To start a D ebug sessi on, do the following :'+#13#10# 13#10; | |
| 1034 | Str2 := '1. On the server, s et initial breakpoin ts where d esired.'+# 13#10+'2. DO DEBUG^X WBTCPM.'+# 13#10+'3. Enter a un ique Liste ner port n umber (i.e ., a port number not in genera l use).'+# 13#10; | |
| 1035 | Str3 := '4. Connec t the clie nt applica tion using the port number ent ered in St ep #3.'; | |
| 1036 | ShowMess age(Str1 + Str2 + St r3); | |
| 1037 | end; //if | |
| 1038 | //TODO - C heckSSH an d FUseSecu reConnecti on will be obsolete when Netwo rkConnect uses best security m ethod | |
| 1039 | CheckSSH; | |
| 1040 | if not (FU seSecureCo nnection = secureNon e) then | |
| 1041 | begin | |
| 1042 | if not S tartSecure Connection (PseudoSer ver, Pseud oPortStr) then | |
| 1043 | exit; | |
| 1044 | PseudoPo rt := StrT oInt(Pseud oPortStr); | |
| 1045 | end //if | |
| 1046 | else | |
| 1047 | begin | |
| 1048 | PseudoPo rt := List enerPort; | |
| 1049 | PseudoSe rver := Se rver; | |
| 1050 | end; //els e | |
| 1051 | //TODO - I mplement n ative SSL/ TLS using Windows SC hannel in Wsockc.Net workConnec t | |
| 1052 | // S hould I ba ck up to a bove and i nitialize SSPI in St artSecureC onnection? | |
| 1053 | FSocket := TXWBWinso ck(XWBWins ock).Netwo rkConnect( DebugMode, PseudoSer ver, | |
| 1054 | Pseudo Port, FRPC TimeLimit) ; | |
| 1055 | //TODO - C ode appear s to conti nue at thi s point ev en if conn ection fai ls. Should there be an "if" he re? | |
| 1056 | Authentica teUser(Sel f); | |
| 1057 | StoreConne ction(Self ); //MUST store con nection be fore Creat eContext() | |
| 1058 | SSOiToken := ''; //Clea r SSOiToke n so a new one must be obtaine d for subs equent log ins | |
| 1059 | //CCOW sta rt | |
| 1060 | if (FConte xtor <> ni l) and (le ngth(CCOWt oken) = 0) then | |
| 1061 | begin | |
| 1062 | //Get ne w CCOW tok en | |
| 1063 | CCOWToke n := GetCC OWHandle(S elf); | |
| 1064 | if Lengt h(CCOWToke n) > 0 the n | |
| 1065 | begin | |
| 1066 | try | |
| 1067 | RPCB Contextor := TContex torControl .Create(Ap plication) ; | |
| 1068 | RPCB Contextor. Run('Broke rLoginModu le#', Pass Code1+Pass Code2, TRU E, '*'); | |
| 1069 | CCOW setUser(us er.name, C COWToken, Domain, us er.Vpid, R PCBContext or); //Cl ear token | |
| 1070 | FCCO WLogonIDNa me := CCOW _LOGON_ID; | |
| 1071 | FCCO WLogonIdVa lue := Dom ain; | |
| 1072 | FCCO WLogonName := CCOW_L OGON_NAME; | |
| 1073 | FCCO WLogonName Value := u ser.name; | |
| 1074 | if u ser.name < > '' then | |
| 1075 | FW asUserDefi ned := Tru e; | |
| 1076 | FCCO WLogonVpid := CCOW_L OGON_VPID; | |
| 1077 | FCCO WLogonVpid Value := u ser.Vpid; | |
| 1078 | RPCB Contextor. Free; | |
| 1079 | RPCB Contextor := nil; | |
| 1080 | except | |
| 1081 | Show Message('P roblem wit h Contexto r.Run'); | |
| 1082 | Free AndNil(RPC BContextor ); | |
| 1083 | end; / /try | |
| 1084 | end; // if Length( CCOWToken) > 0 | |
| 1085 | end; //if | |
| 1086 | //CCOW end | |
| 1087 | FPulse.Ena bled := Tr ue; //P6 S tart heart beat. | |
| 1088 | CreateCont ext(''); //Clos es XUS SIG NON contex t. | |
| 1089 | en d //if FSo cket = 0 | |
| 1090 | el se | |
| 1091 | be gin //p13 | |
| 1092 | StoreConne ction(Self ); | |
| 1093 | FPulse.Ena bled := Tr ue; //p13 | |
| 1094 | en d; //else //p13 | |
| 1095 | FC onnected : = True; // j li mod 12/ 17/01 | |
| 1096 | FC onnecting := False; | |
| 1097 | // 080620 If connected via SSH, With no co mmand box | |
| 1098 | // vi sible, sho uld let us ers know t hey have i t. | |
| 1099 | if not (Comm andBoxProc essHandle = 0) then | |
| 1100 | be gin | |
| 1101 | thisOwner := self.Ow ner; | |
| 1102 | if (thisOw ner is TFo rm) then | |
| 1103 | begin | |
| 1104 | thisPare nt := TFor m(self.Own er); | |
| 1105 | if not ( Pos('(SSH Secure con nection)', thisParent .Caption) > 0) then | |
| 1106 | thisPa rent.Capti on := this Parent.Cap tion + ' ( SSH Secure connectio n)'; | |
| 1107 | end; //if | |
| 1108 | en d; //if | |
| 1109 | exce pt | |
| 1110 | on E: EBroke rError do | |
| 1111 | be gin | |
| 1112 | if E.Code = XWB_BadS ignOn then | |
| 1113 | TXWBWins ock(XWBWin sock).Netw orkDisconn ect(FSocke t); | |
| 1114 | FSocket := 0; | |
| 1115 | FConnected := False; | |
| 1116 | FConnectin g := False ; | |
| 1117 | if not (Co mmandBoxPr ocessHandl e = 0) the n | |
| 1118 | Terminat eProcess(C ommandBoxP rocessHand le,10); | |
| 1119 | FRPCBError := E.Mess age; / / p13 han dle errors as specif ied | |
| 1120 | if Login.E rrorText < > '' then | |
| 1121 | FRPCBErr or := E.Me ssage + ch r(10) + Lo gin.ErrorT ext; | |
| 1122 | if Assigne d(FOnRPCBF ailure) th en / / p13 | |
| 1123 | FOnRPCBF ailure(Sel f) / / p13 | |
| 1124 | else if Sh owErrorMsg s = semRai se then | |
| 1125 | raise; / /this is w here I wou ld do OnNe tError | |
| 1126 | en d; //on | |
| 1127 | end; //try | |
| 1128 | end // if | |
| 1129 | else | |
| 1130 | if not Value the n | |
| 1131 | begin //p1 3 | |
| 1132 | FCon nected := False; //p1 3 | |
| 1133 | FPul se.Enabled := False; //p1 3 | |
| 1134 | if R emoveConne ction(Self ) = NoMore then | |
| 1135 | begi n | |
| 1136 | {F Pulse.Enab led := Fal se; ///P6 ;p13 } | |
| 1137 | TX WBWinsock( XWBWinsock ).NetworkD isconnect( Socket); {actually disconnec t from ser ver} | |
| 1138 | FS ocket := 0 ; {st ore intern al} | |
| 1139 | // FConnected := False; //p1 3 | |
| 1140 | // 080618 fo llowing ad ded to clo se command box if SS H is being used | |
| 1141 | if not (Comm andBoxProc essHandle = 0) then | |
| 1142 | be gin | |
| 1143 | TerminateP rocess(Com mandBoxPro cessHandle ,10); | |
| 1144 | thisOwner := self.Ow ner; | |
| 1145 | if (thisOw ner is TFo rm) then | |
| 1146 | begin | |
| 1147 | thisPare nt := TFor m(self.Own er); | |
| 1148 | if (Pos( '(SSH Secu re connect ion)',this Parent.Cap tion) > 0) then | |
| 1149 | begin | |
| 1150 | // 080 620 remove ' (SSH Se cure conne ction)' on disconnec tion | |
| 1151 | thisPa rent.Capti on := Copy (thisParen t.Caption, 1,Length(t hisParent. Caption)-2 4); | |
| 1152 | end; //i f | |
| 1153 | end; //if | |
| 1154 | en d; //if | |
| 1155 | end; //if | |
| 1156 | end; / /else | |
| 1157 | end; //i f | |
| 1158 | end; //pro cedure TRP CBroker.Se tConnected | |
| 1159 | ||
| 1160 | ||
| 1161 | {--------- -------- T RPCBroker. SetClearPa rameters - ---------- ------- | |
| 1162 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1163 | procedure TRPCBroker .SetClearP arameters( Value: Boo lean); | |
| 1164 | begin | |
| 1165 | if Value then FPar ams.Clear; | |
| 1166 | FClearPa rameters : = Value; | |
| 1167 | end; //pro cedure TRP CBroker.Se tClearPara meters | |
| 1168 | ||
| 1169 | ||
| 1170 | {--------- ---------- TRPCBroke r.SetClear Results -- ---------- ------- | |
| 1171 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1172 | procedure TRPCBroker .SetClearR esults(Val ue: Boolea n); | |
| 1173 | begin | |
| 1174 | if Value then | |
| 1175 | begin {if True} | |
| 1176 | FResul ts.Clear; | |
| 1177 | end; | |
| 1178 | FClearRe sults := V alue; | |
| 1179 | end; //pro cedure TRP CBroker.Se tClearResu lts | |
| 1180 | ||
| 1181 | ||
| 1182 | {--------- ---------- --- TRPCBr oker.SetRe sults ---- ---------- ------- | |
| 1183 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1184 | procedure TRPCBroker .SetResult s(Value: T Strings); | |
| 1185 | begin | |
| 1186 | FResults .Assign(Va lue); | |
| 1187 | end; //pro cedure TRP CBroker.Se tResults | |
| 1188 | ||
| 1189 | ||
| 1190 | {--------- ---------- ---- TRPCB roker.SetR PCTimeLimi t -------- --------- | |
| 1191 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1192 | procedure TRPCBroker .SetRPCTim eLimit(Val ue: intege r); | |
| 1193 | begin | |
| 1194 | if Value <> FRPCTi meLimit th en | |
| 1195 | if Val ue > MIN_R PCTIMELIMI T then | |
| 1196 | FRPC TimeLimit := Value | |
| 1197 | else | |
| 1198 | FRPC TimeLimit := MIN_RPC TIMELIMIT; | |
| 1199 | end; //pro cedure TRP CBroker.Se tRPCTimeLi mit | |
| 1200 | ||
| 1201 | ||
| 1202 | {--------- ---------- ---- TRPCB roker.SetS erver ---- ---------- ------- | |
| 1203 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1204 | procedure TRPCBroker .SetServer (Value: TS erver); | |
| 1205 | begin | |
| 1206 | {if chan ging the n ame of the server, m ake sure t o disconne ct first} | |
| 1207 | if (Valu e <> FServ er) and Co nnected th en | |
| 1208 | begin | |
| 1209 | Connec ted := Fal se; | |
| 1210 | end; //i f | |
| 1211 | FServer := Value; | |
| 1212 | end; //pro cedure TRP CBroker.Se tServer | |
| 1213 | ||
| 1214 | ||
| 1215 | {--------- ---------- -- TRPCBro ker.pchCal l -------- ---------- ---- | |
| 1216 | Lowest lev el remote procedure call that a TRPCBrok er compone nt can mak e. | |
| 1217 | 1. Returns PChar. | |
| 1218 | 2. Convert s Remote P rocedure t o PChar in ternally. | |
| 1219 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1220 | function T RPCBroker. pchCall: P Char; | |
| 1221 | var | |
| 1222 | Value, S ec, App: P Char; | |
| 1223 | BrokerEr ror: EBrok erError; | |
| 1224 | blnResta rtPulse : boolean; //P6 | |
| 1225 | begin | |
| 1226 | RPCBErro r := ''; | |
| 1227 | Connecte d := True; | |
| 1228 | BrokerEr ror := nil ; | |
| 1229 | Value := nil; | |
| 1230 | blnResta rtPulse := False; //P6 | |
| 1231 | Sec := S trAlloc(25 5); | |
| 1232 | App := S trAlloc(25 5); | |
| 1233 | try | |
| 1234 | if FPu lse.Enable d then //P6 If Broker was sendi ng pulse, | |
| 1235 | begin | |
| 1236 | FPul se.Enabled := False; // Stop puls e & | |
| 1237 | blnR estartPuls e := True; // Set flag to restart pulse aft er RPC. | |
| 1238 | end; / /if | |
| 1239 | try | |
| 1240 | Valu e := TXWBW insock(XWB Winsock).t Call(Socke t, RemoteP rocedure, RpcVersion , Param, | |
| 1241 | Sec, App ,FRPCTimeL imit); | |
| 1242 | if ( StrLen(Sec ) > 0) the n | |
| 1243 | begi n | |
| 1244 | Br okerError := EBroker Error.Crea te(StrPas( Sec)); | |
| 1245 | Br okerError. Code := 0; | |
| 1246 | Br okerError. Action := 'Error Ret urned'; | |
| 1247 | end; //if | |
| 1248 | except | |
| 1249 | on E temp: EBro kerError d o | |
| 1250 | wi th Etemp d o | |
| 1251 | be gin //save c opy of err or | |
| 1252 | BrokerErro r := EBrok erError.Cr eate(messa ge); //fi eld by fie ld | |
| 1253 | BrokerErro r.Action : = Action; | |
| 1254 | BrokerErro r.Code := Code; | |
| 1255 | BrokerErro r.Mnemonic := Mnemon ic; | |
| 1256 | if Value < > nil then | |
| 1257 | StrDispo se(Value); | |
| 1258 | Value := S trNew(''); | |
| 1259 | //TODO - D evelop fun ction to t est the li nk | |
| 1260 | {if severe error, ma rk connect ion as clo sed. Per Enrique, w e should | |
| 1261 | replace th is check w ith some f unction, y et to be d eveloped, which | |
| 1262 | will test the link.} | |
| 1263 | if ((Code >= 10050)a nd(Code <= 10058))or( Action = ' connection lost') th en | |
| 1264 | begin | |
| 1265 | Connecte d := False ; | |
| 1266 | blnResta rtPulse := False; / /P6 | |
| 1267 | end; //if | |
| 1268 | en d; //with | |
| 1269 | end; / /try | |
| 1270 | finally | |
| 1271 | StrDis pose(Sec); {do somet hing with these} | |
| 1272 | Sec := nil; | |
| 1273 | StrDis pose(App); | |
| 1274 | App := nil; | |
| 1275 | if ass igned(FOnR PCCall) th en | |
| 1276 | begin | |
| 1277 | Re sult := Va lue; | |
| 1278 | if Result = nil then | |
| 1279 | Res ult := Str New(''); | |
| 1280 | self .FOnCallRe sultStr := Result; | |
| 1281 | FO nRPCCall(s elf); | |
| 1282 | end; / /if | |
| 1283 | if Cle arParamete rs then | |
| 1284 | Clea rParameter s := True; //prep are for ne xt call | |
| 1285 | end; //t ry | |
| 1286 | Result : = Value; | |
| 1287 | if Resul t = nil th en | |
| 1288 | Result := StrNew (''); //return empty str ing | |
| 1289 | if blnRe startPulse then | |
| 1290 | FPulse .Enabled : = True; //Rest art pulse. (P6) | |
| 1291 | if Broke rError <> nil then | |
| 1292 | begin | |
| 1293 | FRPCBE rror := Br okerError. Message; // p13 handle er rors as sp ecified | |
| 1294 | if Log in.ErrorTe xt <> '' t hen | |
| 1295 | FRPC BError := BrokerErro r.Message + chr(10) + Login.Er rorText; | |
| 1296 | if Ass igned(FOnR PCBFailure ) then // p13 | |
| 1297 | begin | |
| 1298 | FOnR PCBFailure (Self); | |
| 1299 | StrD ispose(Res ult); | |
| 1300 | if C urrentCont ext <> '' then //p65 r eset conte xt if RPC errors out (context gets clear ed in Vist A) | |
| 1301 | Cr eateContex t(CurrentC ontext); | |
| 1302 | end | |
| 1303 | else | |
| 1304 | if F ShowErrorM sgs = semR aise then | |
| 1305 | begi n | |
| 1306 | St rDispose(R esult); // re turn memor y we won't use - cau sed a memo ry leak | |
| 1307 | ra ise Broker Error; // p13 | |
| 1308 | end //if | |
| 1309 | else // silent , just ret urn error message in FRPCBErro r | |
| 1310 | Br okerError. Free; // return me mory in Br okerError - otherwis e is a mem ory leak | |
| 1311 | //rais e; //thi s is where I would d o OnNetErr or? | |
| 1312 | end; //i f BrokerEr ror <> nil | |
| 1313 | end; //fun ction TRPC Broker.pch Call | |
| 1314 | ||
| 1315 | ||
| 1316 | {--------- ---------- ------- Di sconnectAl l -------- ---------- ------- | |
| 1317 | Find all c onnections in Broker AllConnect ions list for the pa ssed in | |
| 1318 | server/lis tenerport combinatio n and disc onnect the m. If at l east one | |
| 1319 | connection to the se rver/liste nerport is found, th en it and all other | |
| 1320 | Brokers to the same server/lis tenerport will be di sconnected ; True | |
| 1321 | will be re turned. O therwise F alse will return. | |
| 1322 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1323 | function D isconnectA ll(Server: string; L istenerPor t: integer ): boolean ; | |
| 1324 | var | |
| 1325 | Index: i nteger; | |
| 1326 | begin | |
| 1327 | Result : = False; | |
| 1328 | while (A ssigned(Br okerAllCon nections) and (Broke rAllConnec tions.Find (Server + '/' + IntT oStr(Liste nerPort), Index))) d o | |
| 1329 | begin | |
| 1330 | Result := True; | |
| 1331 | TRPCBr oker(Broke rAllConnec tions.Obje cts[Index] ).Connecte d := False ; | |
| 1332 | {if th e call abo ve disconn ected the last conne ction in t he list, t hen | |
| 1333 | the wh ole list w ill be des troyed, ma king it ne cessary to check if it's | |
| 1334 | still assigned.} | |
| 1335 | end; //w hile | |
| 1336 | end; //fun ction Disc onnectAll | |
| 1337 | ||
| 1338 | ||
| 1339 | {--------- ---------- ------ Sto reConnecti on ------- ---------- ------- | |
| 1340 | Each broke r connecti on is stor ed in Brok erConnecti ons list. | |
| 1341 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1342 | procedure StoreConne ction(Brok er: TRPCBr oker); | |
| 1343 | begin | |
| 1344 | if Broke rConnectio ns = nil t hen {list is created when 1st entry is a dded} | |
| 1345 | try | |
| 1346 | Brok erConnecti ons := TSt ringList.C reate; | |
| 1347 | Brok erConnecti ons.Sorted := True; | |
| 1348 | Brok erConnecti ons.Duplic ates := du pAccept; {store eve ry connect ion} | |
| 1349 | Brok erAllConne ctions := TStringLis t.Create; | |
| 1350 | Brok erAllConne ctions.Sor ted := Tru e; | |
| 1351 | Brok erAllConne ctions.Dup licates := dupAccept ; | |
| 1352 | except | |
| 1353 | TXWB Winsock(Br oker.XWBWi nsock).Net Error('sto re connect ion',XWB_B ldConnectL ist) | |
| 1354 | end; / /try | |
| 1355 | BrokerAl lConnectio ns.AddObje ct(Broker. Server + ' /' + IntTo Str(Broker .ListenerP ort), Brok er); | |
| 1356 | BrokerCo nnections. AddObject( IntToStr(B roker.Sock et), Broke r); | |
| 1357 | end; //pro cedure Sto reConnecti on | |
| 1358 | ||
| 1359 | ||
| 1360 | {--------- ---------- ----- Remo veConnecti on ------- ---------- ------- | |
| 1361 | Result of this funct ion will b e False, i f there ar e no more connection s | |
| 1362 | to the sam e server/l istenerpor t as the p assed in B roker. If at least | |
| 1363 | one other connection is found to the sam e server:l istenerpor t, then Re sult | |
| 1364 | will be Tr ue. | |
| 1365 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1366 | function R emoveConne ction(Brok er: TRPCBr oker): boo lean; | |
| 1367 | var | |
| 1368 | Index: i nteger; | |
| 1369 | begin | |
| 1370 | Result : = False; | |
| 1371 | if Assig ned(Broker Connection s) then | |
| 1372 | begin | |
| 1373 | {remov e connecti on record of passed in Broker component} | |
| 1374 | Broker Connection s.Delete(B rokerConne ctions.Ind exOfObject (Broker)); | |
| 1375 | {look for one ot her connec tion to th e same ser ver/port} | |
| 1376 | Result := Broker Connection s.Find(Int ToStr(Brok er.Socket) , Index); | |
| 1377 | if Bro kerConnect ions.Count = 0 then | |
| 1378 | begin {if last e ntry remov ed,} | |
| 1379 | Brok erConnecti ons.Free; {des troy whole list stru cture} | |
| 1380 | Brok erConnecti ons := nil ; | |
| 1381 | end; / /if | |
| 1382 | end; //i f Assigned (BrokerCon nections) | |
| 1383 | if Assig ned(Broker AllConnect ions) then | |
| 1384 | begin | |
| 1385 | Broker AllConnect ions.Delet e(BrokerAl lConnectio ns.IndexOf Object(Bro ker)); | |
| 1386 | if Bro kerAllConn ections.Co unt = 0 th en | |
| 1387 | begin | |
| 1388 | Brok erAllConne ctions.Fre e; | |
| 1389 | Brok erAllConne ctions := nil; | |
| 1390 | end; / /if | |
| 1391 | end; // if Assigne d(BrokerAl lConnectio ns) | |
| 1392 | end; //fun ction Remo veConnecti on | |
| 1393 | ||
| 1394 | ||
| 1395 | {--------- ---------- ------ Exi stingSocke t -------- ---------- ------- | |
| 1396 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1397 | function E xistingSoc ket(Broker : TRPCBrok er): integ er; | |
| 1398 | begin | |
| 1399 | Result : = Broker.S ocket; | |
| 1400 | end; //fun ction Exis tingSocket | |
| 1401 | ||
| 1402 | ||
| 1403 | {--------- ---------- ----- Auth enticateUs er ------- ---------- ------- | |
| 1404 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1405 | procedure Authentica teUser(Con nectingBro ker: TRPCB roker); | |
| 1406 | var | |
| 1407 | SaveClea rParmeters , SaveClea rResults: boolean; | |
| 1408 | SavePara m: TParams ; | |
| 1409 | SaveRemo teProcedur e, SaveRpc Version: s tring; | |
| 1410 | SaveResu lts: TStri ngs; | |
| 1411 | blnSigne dOn: boole an; | |
| 1412 | SaveKern elLogin: b oolean; | |
| 1413 | SaveVist aLogin: TV istaLogin; | |
| 1414 | OldExcep tionHandle r: TExcept ionEvent; | |
| 1415 | OldHandl e: THandle ; | |
| 1416 | thisSSOi Token: TXW BSSOiToken ; | |
| 1417 | currentS SOiToken: String; | |
| 1418 | begin | |
| 1419 | with Con nectingBro ker do | |
| 1420 | begin | |
| 1421 | SavePa ram := TPa rams.Creat e(nil); | |
| 1422 | SavePa ram.Assign (Param); //sa ve off set tings | |
| 1423 | SaveRe moteProced ure := Rem oteProcedu re; | |
| 1424 | SaveRp cVersion : = RpcVersi on; | |
| 1425 | SaveRe sults := R esults; | |
| 1426 | SaveCl earParmete rs := Clea rParameter s; | |
| 1427 | SaveCl earResults := ClearR esults; | |
| 1428 | ClearP arameters := True; //se t'em as I need'em | |
| 1429 | ClearR esults := True; | |
| 1430 | SaveKe rnelLogin := KernelL ogin; // p13 | |
| 1431 | SaveVi staLogin : = FLogin; // p13 | |
| 1432 | end; //w ith | |
| 1433 | try | |
| 1434 | curren tSSOiToken := ''; | |
| 1435 | blnSig nedOn := F alse; //I nitialize to bad sig n-on | |
| 1436 | //Sile nt AV Code start | |
| 1437 | if Con nectingBro ker.Access VerifyCode s <> '' th en | |
| 1438 | begin | |
| 1439 | Conn ectingBrok er.Login.A ccessCode := Piece(C onnectingB roker.Acce ssVerifyCo des, ';', 1); | |
| 1440 | Conn ectingBrok er.Login.V erifyCode := Piece(C onnectingB roker.Acce ssVerifyCo des, ';', 2); | |
| 1441 | Conn ectingBrok er.Login.M ode := lmA VCodes; | |
| 1442 | Conn ectingBrok er.KernelL ogIn := Fa lse; | |
| 1443 | end; | |
| 1444 | //Sile nt AV Code end | |
| 1445 | //CCOW start | |
| 1446 | if Con nectingBro ker.Kernel LogIn and (not (Conn ectingBrok er.Context or = nil)) then | |
| 1447 | begin | |
| 1448 | CCOW token := C onnectingB roker.GetC COWtoken(C onnectingB roker.Cont extor); | |
| 1449 | if l ength(CCOW token)>0 t hen | |
| 1450 | begi n | |
| 1451 | Co nnectingBr oker.Login .LogInHand le := CCOW token; | |
| 1452 | Co nnectingBr oker.Login .Mode := l mAppHandle ; | |
| 1453 | Co nnectingBr oker.Kerne lLogIn := False; | |
| 1454 | end; | |
| 1455 | end; | |
| 1456 | //CCOW end | |
| 1457 | //Try a silent l ogin | |
| 1458 | if not Connectin gBroker.Ke rnelLogin then | |
| 1459 | begin | |
| 1460 | if C onnectingB roker.FLog in <> nil then | |
| 1461 | bl nSignedOn := SilentL ogin(Conne ctingBroke r); //Si lentLogin in RpcSLog in unit | |
| 1462 | if n ot blnSign edOn then //Fa il over to SSOi | |
| 1463 | begi n | |
| 1464 | Co nnectingBr oker.Kerne lLogIn := True; | |
| 1465 | Co nnectingBr oker.Login .Mode := l mSSOi; | |
| 1466 | Co nnectingBr oker.Conte xtor := ni l; //Set Contextor nil so it won't try to set tok en | |
| 1467 | end //if not blnSignedO n | |
| 1468 | else //if blnS ignedOn | |
| 1469 | Ge tBrokerInf o(Connecti ngBroker); | |
| 1470 | end; / /if not Co nnectingBr oker.FKern elLogIn (s ilent logi n) | |
| 1471 | //SSOi start | |
| 1472 | //TODO - Login.M ode is set to lmAVCo des before it gets h ere for al l connecti ons. Not s ure why. S hould give developer s a choice . | |
| 1473 | //if ( not blnsig nedon) and (Connecti ngBroker.K ernelLogin ) and (not (Connecti ngBroker.L ogin.Mode = lmAVCode s)) then | |
| 1474 | if (no t blnsigne don) and ( Connecting Broker.Ker nelLogIn = True) the n | |
| 1475 | begin | |
| 1476 | //Se t SSOi tok en values (get token from IAM) . | |
| 1477 | try | |
| 1478 | th isSSOiToke n := TXWBS SOiToken.C reate(Appl ication); | |
| 1479 | cu rrentSSOiT oken := th isSSOiToke n.SSOiToke n; | |
| 1480 | Co nnectingBr oker.SSOiT oken := cu rrentSSOiT oken; | |
| 1481 | Co nnectingBr oker.SSOiS ECID := th isSSOiToke n.SSOiSECI D; | |
| 1482 | Co nnectingBr oker.SSOiA DUPN := th isSSOiToke n.SSOiADUP N; | |
| 1483 | Co nnectingBr oker.SSOiL ogonName : = thisSSOi Token.SSOi LogonName; | |
| 1484 | th isSSOiToke n.Free; | |
| 1485 | fina lly | |
| 1486 | if currentSS OiToken <> '' then | |
| 1487 | be gin | |
| 1488 | Connecting Broker.Log in.LogInHa ndle := Co nnectingBr oker.SSOiT oken; | |
| 1489 | Connecting Broker.Log in.Mode := lmSSOi; | |
| 1490 | Connecting Broker.Ker nelLogIn : = False; | |
| 1491 | en d; | |
| 1492 | end; //try | |
| 1493 | //Tr y a silent login for SSOi | |
| 1494 | if ( Connecting Broker.Log in.Mode = lmSSOi) an d (Connect ingBroker. KernelLogI n = False) then | |
| 1495 | begi n | |
| 1496 | if Connectin gBroker.FL ogin <> ni l then | |
| 1497 | blnSignedO n := Silen tLogin(Con nectingBro ker); // SilentLogi n in RpcSL ogin unit | |
| 1498 | if not blnSi gnedOn the n // Fail over to Access/ Verify Cod es | |
| 1499 | be gin | |
| 1500 | Connecting Broker.Ker nelLogIn : = True; | |
| 1501 | Connecting Broker.Log in.Mode := lmAVCodes ; | |
| 1502 | Connecting Broker.Con textor := nil; // Set Contex tor nil so it won't try to set token | |
| 1503 | en d //if no t blnSigne dOn | |
| 1504 | el se //if bl nSignedOn | |
| 1505 | be gin | |
| 1506 | GetBrokerI nfo(Connec tingBroker ); | |
| 1507 | frmSignonM sg := Tfrm SignonMsg. Create(App lication); //Crea te in frmS ignonMessa ge unit | |
| 1508 | try | |
| 1509 | //ShowAp plicationA ndFocusOK( Applicatio n); | |
| 1510 | OldHandl e := GetFo regroundWi ndow; | |
| 1511 | SetForeg roundWindo w(frmSigno nMsg.Handl e); | |
| 1512 | PrepareS ignonMessa ge(Connect ingBroker) ; | |
| 1513 | if SetUp Message th en //S etUpMessag e in frmSi gnonMessag e unit | |
| 1514 | begin //T rue if Mes sage shoul d be displ ayed | |
| 1515 | frmSig nonMsg.Sho wModal; //S how Sign-o n Message (VA Handbo ok 6500 re quirement) | |
| 1516 | end; | |
| 1517 | finally | |
| 1518 | frmSigno nMsg.Free; | |
| 1519 | ShowAppl icationAnd FocusOK(Ap plication) ; | |
| 1520 | end; //try | |
| 1521 | if not Sel Div.Choose Div('',Con nectingBro ker) then | |
| 1522 | begin | |
| 1523 | blnSigne dOn := Fal se; | |
| 1524 | Connecti ngBroker.K ernelLogIn := False; //Do no t fail ove r to A/V c odes | |
| 1525 | Connecti ngBroker.L ogin.Error Text := 'F ailed to s elect Divi sion'; // p13 set s ome text i ndicating problem | |
| 1526 | end; | |
| 1527 | SetForegro undWindow( OldHandle) ; | |
| 1528 | en d; //if bl nSignedOn | |
| 1529 | end; //if not Connecting Broker.FKe rnelLogIn (silent lo gin) | |
| 1530 | end; | |
| 1531 | //SSOi end | |
| 1532 | //Fall back to A ccess/Veri fy code lo gin (promp ted login) | |
| 1533 | if (no t blnsigne don) and ( Connecting Broker.Ker nelLogIn = True) the n | |
| 1534 | begin //p13 | |
| 1535 | CCOW Token := ' '; //Didn 't sign on with Toke n; clear i t so can g et new one | |
| 1536 | if A ssigned(Ap plication. OnExceptio n) then | |
| 1537 | Ol dException Handler := Applicati on.OnExcep tion | |
| 1538 | else | |
| 1539 | Ol dException Handler := nil; | |
| 1540 | Appl ication.On Exception := TfrmErr Msg.RPCBSh owExceptio n; | |
| 1541 | try | |
| 1542 | fr mSignon := TfrmSigno n.Create(A pplication ); //Cre ate in Log infrm unit | |
| 1543 | // ShowApplic ationAndFo cusOK(Appl ication); | |
| 1544 | Ol dHandle := GetForegr oundWindow ; | |
| 1545 | Se tForegroun dWindow(fr mSignon.Ha ndle); | |
| 1546 | Pr epareSigno nForm(Conn ectingBrok er); | |
| 1547 | if SetUpSign On then //SetUp SignOn in Loginfrm u nit. | |
| 1548 | be gin //True if signon needed | |
| 1549 | frmSignOn. ShowModal; //do inte ractive lo gon // p 13 | |
| 1550 | if frmSign On.Tag = 1 then //Tag=1 f or good lo gon | |
| 1551 | blnSigne dOn := Tru e; //Success ful logon | |
| 1552 | en d //if Set UpSignOn | |
| 1553 | el se | |
| 1554 | blnSignedO n := False ; | |
| 1555 | if blnSigned On then //If lo gged on, r etrieve us er info. | |
| 1556 | be gin | |
| 1557 | GetBrokerI nfo(Connec tingBroker ); | |
| 1558 | if not Sel Div.Choose Div('',Con nectingBro ker) then | |
| 1559 | begin | |
| 1560 | blnSigne dOn := Fal se; | |
| 1561 | Connecti ngBroker.L ogin.Error Text := 'F ailed to s elect Divi sion'; // Set some t ext indica ting probl em | |
| 1562 | end; //if | |
| 1563 | en d; //if bl nSignedOn | |
| 1564 | Se tForegroun dWindow(Ol dHandle); | |
| 1565 | fina lly | |
| 1566 | fr mSignon.Fr ee; | |
| 1567 | Sh owApplicat ionAndFocu sOK(Applic ation); | |
| 1568 | end; //try | |
| 1569 | if A ssigned(Ol dException Handler) t hen | |
| 1570 | Ap plication. OnExceptio n := OldEx ceptionHan dler; | |
| 1571 | //Bi nd user to Active Di rectory fo r test acc ounts only | |
| 1572 | if ( currentSSO iToken <> '') and (C onnectingB roker.LogI n.IsProduc tionAccoun t = False) then | |
| 1573 | SS OiBindUser (Connectin gBroker); | |
| 1574 | end; / /if Connec tingBroker .FKernelLo gIn | |
| 1575 | finally | |
| 1576 | //rese t the Brok er | |
| 1577 | with C onnectingB roker do | |
| 1578 | begin | |
| 1579 | Clea rParameter s := SaveC learParmet ers; | |
| 1580 | Clea rResults : = SaveClea rResults; | |
| 1581 | Para m.Assign(S aveParam); // restore se ttings | |
| 1582 | Save Param.Free ; | |
| 1583 | Remo teProcedur e := SaveR emoteProce dure; | |
| 1584 | RpcV ersion := SaveRpcVer sion; | |
| 1585 | Resu lts := Sav eResults; | |
| 1586 | FKer nelLogin : = SaveKern elLogin; // p13 | |
| 1587 | FLog in := Save VistaLogin ; // p13 | |
| 1588 | end; / /with | |
| 1589 | end; //t ry | |
| 1590 | if not b lnSignedOn then //Fl ag for uns uccessful signon. | |
| 1591 | begin | |
| 1592 | TXWBWi nsock(Conn ectingBrok er.XWBWins ock).Netwo rkDisconne ct(Connect ingBroker. FSocket); | |
| 1593 | TXWBWi nsock(Conn ectingBrok er.XWBWins ock).NetEr ror('',XWB _BadSignOn ); //W ill raise error. | |
| 1594 | end; | |
| 1595 | end; //pro cedure Aut henticateU ser | |
| 1596 | ||
| 1597 | ||
| 1598 | {--------- ---------- ----- GetB rokerInfo ---------- ---------- ------ | |
| 1599 | P6 Retrie ve informa tion about user with XWB GET B ROKER INFO | |
| 1600 | RPC. F or now, on ly Timeout value is retrieved in Results [0]. | |
| 1601 | P65 Also s aves IPpro tocol info rmation fo r Connecte dBroker. | |
| 1602 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1603 | procedure GetBrokerI nfo(Connec tedBroker: TRPCBroke r); | |
| 1604 | begin | |
| 1605 | GetUserI nfo(Connec tedBroker) ; // p13 Get User info into User prop erty (TVis taUser obj ect) | |
| 1606 | with Con nectedBrok er do //(dcm) Use one o f objects below | |
| 1607 | begin // and skip this RPC? or ma ke this an d | |
| 1608 | Connec tedBroker. IPprotocol := TXWBWi nsock(Conn ectedBroke r.XWBWinso ck).IPprot ocol; | |
| 1609 | Remote Procedure := 'XWB GE T BROKER I NFO'; // others be low as com ponents | |
| 1610 | try | |
| 1611 | Call ; | |
| 1612 | if R esults.Cou nt > 0 the n | |
| 1613 | if StrToInt( Results[0] ) > MINIMU M_TIMEOUT then | |
| 1614 | FPulse.Int erval := ( StrToInt(R esults[0]) * 10 * PU LSE_PERCEN TAGE); | |
| 1615 | except | |
| 1616 | on e : EBrokerE rror do | |
| 1617 | Sh owMessage( 'A problem was encou ntered get ting Broke r informat ion. '+e. Message); //TODO | |
| 1618 | end; / /try | |
| 1619 | end; //w ith | |
| 1620 | end; //pro cedure Get BrokerInfo | |
| 1621 | ||
| 1622 | ||
| 1623 | {--------- ---------- ----- NoSi gnOnNeeded --------- ---------- ----- | |
| 1624 | Currently a placehol der for ac tions that may be ne eded in co nnection | |
| 1625 | with authe nticating a user who needn't s ign on (Si ngle Sign on feature ). | |
| 1626 | Returns Tr ue if no s ignon is n eeded | |
| 1627 | Fa lse if sig non is nee ded. | |
| 1628 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1629 | function N oSignOnNee ded : Bool ean; | |
| 1630 | begin | |
| 1631 | Result : = True; | |
| 1632 | end; //fun ction NoSi gnOnNeeded | |
| 1633 | ||
| 1634 | ||
| 1635 | {--------- ---------- ------ Pro cessExecut e -------- ---------- ------- | |
| 1636 | This funct ion is bor rowed from "Delphi 2 Developer 's Guide" by Pacheco & Teixera . | |
| 1637 | See chapte r 11, page 406. It encapsulat es and sim plifies us e of | |
| 1638 | Windows Cr eateProces s function . | |
| 1639 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1640 | function P rocessExec ute(Comman d: string; cShow: Wo rd): Integ er; | |
| 1641 | { This met hod encaps ulates the call to C reateProce ss() which creates | |
| 1642 | a new pr ocess and its primar y thread. This is th e method u sed in | |
| 1643 | Win32 to execute a nother app lication, This metho d requires the use | |
| 1644 | of the T StartInfo and TProce ssInformat ion struct ures. Thes e structur es | |
| 1645 | are not documented as part o f the Delp hi 2.0 onl ine help b ut rather | |
| 1646 | the Win3 2 help as STARTUPINF O and PROC ESS_INFORM ATION. | |
| 1647 | ||
| 1648 | The Comm andLine pa remeter sp ecifies th e pathname of the fi le to | |
| 1649 | execute. | |
| 1650 | ||
| 1651 | The cSho w paremete r specifie s one of t he SW_XXXX constants which | |
| 1652 | specifie s how to d isplay the window. T his value is assigne d to the | |
| 1653 | sShowWin dow field of the TSt artupInfo structure. } | |
| 1654 | var | |
| 1655 | Rslt: Lo ngBool; | |
| 1656 | StartUpI nfo: TStar tUpInfo; // documen ted as STA RTUPINFO | |
| 1657 | ProcessI nfo: TProc essInforma tion; // d ocumented as PROCESS _INFORMATI ON | |
| 1658 | begin | |
| 1659 | { Clear the Startu pInfo stru cture } | |
| 1660 | FillChar (StartupIn fo, SizeOf (TStartupI nfo), 0); | |
| 1661 | { Initia lize the S tartupInfo structure with requ ired data. | |
| 1662 | Here, we assign the SW_XXX X constant to the wS howWindow field | |
| 1663 | of Sta rtupInfo. When speci fing a val ue to this field the | |
| 1664 | STARTF _USESSHOWW INDOW flag must be s et in the dwFlags fi eld. | |
| 1665 | Additi onal infor mation on the TStart upInfo is provided i n the Win3 2 | |
| 1666 | online help unde r STARTUPI NFO. } | |
| 1667 | with Sta rtupInfo d o | |
| 1668 | begin | |
| 1669 | cb := SizeOf(TSt artupInfo) ; // Speci fy size of structure | |
| 1670 | dwFlag s := START F_USESHOWW INDOW or S TARTF_FORC EONFEEDBAC K; | |
| 1671 | wShowW indow := c Show | |
| 1672 | end; //w ith | |
| 1673 | { Create the proce ss by call ing Create Process(). This func tion | |
| 1674 | fills the Proces sInfo stru cture with informati on about t he new | |
| 1675 | proces s and its primary th read. Deta iled infor mation is provided | |
| 1676 | in the Win32 onl ine help f or the TPr ocessInfo structure under | |
| 1677 | PROCES S_INFORMAT ION. } | |
| 1678 | Rslt := CreateProc ess(PChar( Command), nil, nil, nil, False , | |
| 1679 | NORMAL _PRIORITY_ CLASS, nil , nil, Sta rtupInfo, ProcessInf o); | |
| 1680 | { If Rsl t is true, then the CreateProc ess call w as success ful. | |
| 1681 | Otherw ise, GetLa stError wi ll return an error c ode repres enting the | |
| 1682 | error which occu rred. } | |
| 1683 | if Rslt then | |
| 1684 | with P rocessInfo do | |
| 1685 | begin | |
| 1686 | { Wa it until t he process is in idl e. } | |
| 1687 | Wait ForInputId le(hProces s, INFINIT E); | |
| 1688 | Clos eHandle(hT hread); // Free the hThread h andle | |
| 1689 | Clos eHandle(hP rocess);// Free the hProcess h andle | |
| 1690 | Resu lt := 0; // Set Resul t to 0, me aning succ essful | |
| 1691 | end // with | |
| 1692 | else | |
| 1693 | Result := GetLas tError; // Set resul t to the e rror code. | |
| 1694 | end; //fun ction Proc essExecute | |
| 1695 | ||
| 1696 | ||
| 1697 | {--------- ---------- ---- GetAp pHandle -- ---------- ---------- ---- | |
| 1698 | Library fu nction to return an Applicatio n Handle f rom the se rver | |
| 1699 | which can be passed as a comma nd line ar gument to an applica tion | |
| 1700 | the curren t applicat ion is sta rting. Th e new appl ication ca n use | |
| 1701 | this AppHa ndle to pe rform a si lent login via the l mAppHandle mode | |
| 1702 | ---------- ---------- ---------- ---------- ---------- ---------- ----} | |
| 1703 | function G etAppHandl e(Connecte dBroker : TRPCBroker ): String; // p13 | |
| 1704 | begin | |
| 1705 | Result : = ''; | |
| 1706 | with Con nectedBrok er do | |
| 1707 | begin | |
| 1708 | Remo teProcedur e := 'XUS GET TOKEN' ; | |
| 1709 | Call ; | |
| 1710 | Resu lt := Resu lts[0]; | |
| 1711 | end; / /with | |
| 1712 | end; //fun ction GetA ppHandle | |
| 1713 | ||
| 1714 | ||
| 1715 | {--------- ---------- ---- TRPCB roker.DoPu lseOnTimer ---------- ------- | |
| 1716 | Called fro m the OnTi mer event of the Pul se propert y. | |
| 1717 | Broker env ironment s hould be t he same af ter the pr ocedure as before. | |
| 1718 | Note: Resu lts is not changed b y strCall; so, Resul ts needn't be saved. | |
| 1719 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1720 | procedure TRPCBroker .DoPulseOn Timer(Send er: TObjec t); //P6 | |
| 1721 | var | |
| 1722 | SaveClea rParameter s : Boolea n; | |
| 1723 | SavePara m : TParam s; | |
| 1724 | SaveRemo teProcedur e, SaveRPC Version : string; | |
| 1725 | begin | |
| 1726 | SaveClea rParameter s := Clear Parameters ; //Save existing p roperties | |
| 1727 | SavePara m := TPara ms.Create( nil); | |
| 1728 | SavePara m.Assign(P aram); | |
| 1729 | SaveRemo teProcedur e := Remot eProcedure ; | |
| 1730 | SaveRPCV ersion := RPCVe rsion; | |
| 1731 | RemotePr ocedure := 'XWB IM H ERE'; //Set Pr operties f or IM HERE | |
| 1732 | ClearPar ameters : = True; //Erase existing P ARAMs | |
| 1733 | RPCVersi on := '1.106'; | |
| 1734 | try | |
| 1735 | try | |
| 1736 | strC all; //Ma ke the cal l | |
| 1737 | except | |
| 1738 | on e : EBrokerE rror do | |
| 1739 | begi n | |
| 1740 | // Connected := False; // se t the conn ection as disconnect ed | |
| 1741 | if Assigned( FOnPulseEr ror) then | |
| 1742 | FOnPulseEr ror(Self, e.Message) | |
| 1743 | el se | |
| 1744 | raise e; | |
| 1745 | end; //on | |
| 1746 | end; / /try | |
| 1747 | finally | |
| 1748 | ClearP arameters := SaveCle arParamete rs; //Res tore pre-e xisting pr operties. | |
| 1749 | Param. Assign(Sav eParam); | |
| 1750 | SavePa ram.Free; | |
| 1751 | Remote Procedure := SaveRem oteProcedu re; | |
| 1752 | RPCVer sion := SaveRPC Version; | |
| 1753 | end; //t ry | |
| 1754 | end; //pro cedure TRP CBroker.Do PulseOnTim er | |
| 1755 | ||
| 1756 | ||
| 1757 | {--------- ---------- ---- TRPCB roker.SetK ernelLogIn --------- -------- | |
| 1758 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1759 | procedure TRPCBroker .SetKernel LogIn(cons t Value: B oolean); // p13 | |
| 1760 | begin | |
| 1761 | FKernelL ogIn := Va lue; | |
| 1762 | end; //pro cedure TRP CBroker.Se tKernelLog In | |
| 1763 | ||
| 1764 | ||
| 1765 | {--------- ---------- ---- TRPCB roker.SetU ser ------ ---------- - | |
| 1766 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1767 | procedure TRPCBroker .SetUser(c onst Value : TVistaUs er); // p13 | |
| 1768 | begin | |
| 1769 | FUser := Value; | |
| 1770 | end; //pro cedure TRP CBroker.Se tUser | |
| 1771 | ||
| 1772 | ||
| 1773 | {--------- ---------- ---- TVist aLogin.Cre ate ------ ---------- - | |
| 1774 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1775 | constructo r TVistaLo gin.Create (AOwner: T Component) ; // p13 | |
| 1776 | begin | |
| 1777 | inherite d create; | |
| 1778 | FDivLst := TString List.Creat e; | |
| 1779 | end; //con structor T VistaLogin .Create | |
| 1780 | ||
| 1781 | ||
| 1782 | {--------- ---------- ---- TVist aLogin.Des troy ----- ---------- -- | |
| 1783 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1784 | destructor TVistaLog in.Destroy ; // p13 | |
| 1785 | begin | |
| 1786 | FDivLst. Free; | |
| 1787 | FDivLst := nil; | |
| 1788 | inherite d; | |
| 1789 | end; //des tructor TV istaLogin. Destroy | |
| 1790 | ||
| 1791 | ||
| 1792 | {--------- ---------- ---- TVist aLogin.Fai ledLogin - ---------- ------ | |
| 1793 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1794 | procedure TVistaLogi n.FailedLo gin(Sender : TObject) ; // p13 | |
| 1795 | begin | |
| 1796 | if Assig ned(FOnFai ledLogin) then | |
| 1797 | FOnFai ledLogin(S elf) | |
| 1798 | else | |
| 1799 | TXWBWi nsock(TRPC Broker(Sen der).XWBWi nsock).Net Error('',X WB_BadSign On); | |
| 1800 | end; //pro cedure TVi staLogin.F ailedLogin | |
| 1801 | ||
| 1802 | ||
| 1803 | {--------- ---------- ---- TVist aLogin.Set AccessCode --------- -------- | |
| 1804 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1805 | procedure TVistaLogi n.SetAcces sCode(cons t Value: S tring); // p13 | |
| 1806 | begin | |
| 1807 | FAccessC ode := Val ue; | |
| 1808 | end; //pro cedure TVi staLogin.S etAccessCo de | |
| 1809 | ||
| 1810 | ||
| 1811 | {--------- ---------- ---- TVist aLogin.Set Division - ---------- ------ | |
| 1812 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1813 | procedure TVistaLogi n.SetDivis ion(const Value: Str ing); // p13 | |
| 1814 | begin | |
| 1815 | FDivisio n := Value ; | |
| 1816 | end; //pro cedure TVi staLogin.S etDivision | |
| 1817 | ||
| 1818 | ||
| 1819 | {--------- ---------- ---- TVist aLogin.Set Duz ------ ---------- - | |
| 1820 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1821 | procedure TVistaLogi n.SetDuz(c onst Value : string); // p13 | |
| 1822 | begin | |
| 1823 | FDUZ := Value; | |
| 1824 | end; //pro cedure TVi staLogin.S etDuz | |
| 1825 | ||
| 1826 | ||
| 1827 | {--------- ---------- ---- TVist aLogin.Set ErrorTex - ---------- ------ | |
| 1828 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1829 | procedure TVistaLogi n.SetError Text(const Value: st ring); // p13 | |
| 1830 | begin | |
| 1831 | FErrorTe xt := Valu e; | |
| 1832 | end; //pro cedure TVi staLogin.S etErrorTex | |
| 1833 | ||
| 1834 | ||
| 1835 | {--------- ---------- ---- TVist aLogin.Set LogInHandl e -------- --------- | |
| 1836 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1837 | procedure TVistaLogi n.SetLogIn Handle(con st Value: String); // p13 | |
| 1838 | begin | |
| 1839 | FLogInHa ndle := Va lue; | |
| 1840 | end; //pro cedure TVi staLogin.S etLogInHan dle | |
| 1841 | ||
| 1842 | ||
| 1843 | {--------- ---------- ---- TVist aLogin.Set Mode ----- ---------- -- | |
| 1844 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1845 | procedure TVistaLogi n.SetMode( const Valu e: TLoginM ode); // p13 | |
| 1846 | begin | |
| 1847 | FMode := Value; | |
| 1848 | end; //pro cedure TVi staLogin.S etMode | |
| 1849 | ||
| 1850 | ||
| 1851 | {--------- ---------- ---- TVist aLogin.Set MultiDivis ion ------ ---------- - | |
| 1852 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1853 | procedure TVistaLogi n.SetMulti Division(V alue: Bool ean); // p13 | |
| 1854 | begin | |
| 1855 | FMultiDi vision := Value; | |
| 1856 | end; //pro cedure TVi staLogin.S etMultiDiv ision | |
| 1857 | ||
| 1858 | ||
| 1859 | {--------- ---------- ---- TVist aLogin.Set NTToken -- ---------- ----- | |
| 1860 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1861 | procedure TVistaLogi n.SetNTTok en(const V alue: Stri ng); // p13 | |
| 1862 | begin | |
| 1863 | FNTToken := Value; | |
| 1864 | end; //pro cedure TVi staLogin.S etNTToken | |
| 1865 | ||
| 1866 | ||
| 1867 | {--------- ---------- ---- TVist aLogin.Set PromptDiv ---------- ------- | |
| 1868 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1869 | procedure TVistaLogi n.SetPromp tDiv(const Value: bo olean); // p13 | |
| 1870 | begin | |
| 1871 | FPromptD iv := Valu e; | |
| 1872 | end; //pro cedure TVi staLogin.S etPromptDi v | |
| 1873 | ||
| 1874 | ||
| 1875 | {--------- ---------- ---- TVist aLogin.Set VerifyCode --------- -------- | |
| 1876 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1877 | procedure TVistaLogi n.SetVerif yCode(cons t Value: S tring); // p13 | |
| 1878 | begin | |
| 1879 | FVerifyC ode := Val ue; | |
| 1880 | end; //pro cedure TVi staLogin.S etVerifyCo de | |
| 1881 | ||
| 1882 | ||
| 1883 | {--------- ---------- ---- TVist aUser.SetD ivision -- ---------- ----- | |
| 1884 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1885 | procedure TVistaUser .SetDivisi on(const V alue: Stri ng); // p13 | |
| 1886 | begin | |
| 1887 | FDivisio n := Value ; | |
| 1888 | end; //pro cedure TVi staUser.Se tDivision | |
| 1889 | ||
| 1890 | ||
| 1891 | {--------- ---------- ---- TVist aUser.SetD Time ----- ---------- -- | |
| 1892 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1893 | procedure TVistaUser .SetDTime( const Valu e: string) ; // p13 | |
| 1894 | begin | |
| 1895 | FDTime : = Value; | |
| 1896 | end; //pro cedure TVi staUser.Se tDTime | |
| 1897 | ||
| 1898 | ||
| 1899 | {--------- ---------- ---- TVist aUser.SetD UZ ------- ---------- | |
| 1900 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1901 | procedure TVistaUser .SetDUZ(co nst Value: String); // p13 | |
| 1902 | begin | |
| 1903 | FDUZ := Value; | |
| 1904 | end; //pro cedure TVi staUser.Se tDUZ | |
| 1905 | ||
| 1906 | ||
| 1907 | {--------- ---------- ---- TVist aUser.SetL anguage -- ---------- ----- | |
| 1908 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1909 | procedure TVistaUser .SetLangua ge(const V alue: stri ng); // p13 | |
| 1910 | begin | |
| 1911 | FLanguag e := Value ; | |
| 1912 | end; //pro cedure TVi staUser.Se tLanguage | |
| 1913 | ||
| 1914 | ||
| 1915 | {--------- ---------- ---- TVist aUser.SetN ame ------ ---------- - | |
| 1916 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1917 | procedure TVistaUser .SetName(c onst Value : String); // p13 | |
| 1918 | begin | |
| 1919 | FName := Value; | |
| 1920 | end; //pro cedure TVi staUser.Se tName | |
| 1921 | ||
| 1922 | ||
| 1923 | {--------- ---------- ---- TVist aUser.SetS erviceSect ion ------ ---------- - | |
| 1924 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1925 | procedure TVistaUser .SetServic eSection(c onst Value : string); // p13 | |
| 1926 | begin | |
| 1927 | FService Section := Value; | |
| 1928 | end; //pro cedure TVi staUser.Se tServiceSe ction | |
| 1929 | ||
| 1930 | ||
| 1931 | {--------- ---------- ---- TVist aUser.SetS tandardNam e -------- --------- | |
| 1932 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1933 | procedure TVistaUser .SetStanda rdName(con st Value: String); // p13 | |
| 1934 | begin | |
| 1935 | FStandar dName := V alue; | |
| 1936 | end; //pro cedure TVi staUser.Se tStandardN ame | |
| 1937 | ||
| 1938 | ||
| 1939 | {--------- ---------- ---- TVist aUser.SetT itle ----- ---------- -- | |
| 1940 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1941 | procedure TVistaUser .SetTitle( const Valu e: string) ; // p13 | |
| 1942 | begin | |
| 1943 | FTitle : = Value; | |
| 1944 | end; //pro cedure TVi staUser.Se tTitle | |
| 1945 | ||
| 1946 | ||
| 1947 | {--------- ---------- ---- TVist aUser.SetV erifyCodeC hngd ----- ---------- -- | |
| 1948 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1949 | procedure TVistaUser .SetVerify CodeChngd( const Valu e: Boolean ); // p1 3 | |
| 1950 | begin | |
| 1951 | FVerifyC odeChngd : = Value; | |
| 1952 | end; //pro cedure TVi staUser.Se tVerifyCod eChngd | |
| 1953 | ||
| 1954 | ||
| 1955 | {--------- ---------- ---- ShowA pplication AndFocusOK --------- -------- | |
| 1956 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1957 | function S howApplica tionAndFoc usOK(anApp lication: TApplicati on): boole an; | |
| 1958 | var | |
| 1959 | j: integ er; | |
| 1960 | Stat2: s et of (sWi nVisForm,s WinVisApp, sIconized) ; | |
| 1961 | hFGWnd: THandle; | |
| 1962 | begin | |
| 1963 | Stat2 := []; {sWin VisForm,sW inVisApp,s Iconized} | |
| 1964 | if anApp lication.M ainForm <> nil then | |
| 1965 | if IsW indowVisib le(anAppli cation.Mai nForm.Hand le) then | |
| 1966 | Stat 2 := Stat2 + [sWinVi sForm]; | |
| 1967 | if IsWin dowVisible (anApplica tion.Handl e) then | |
| 1968 | Stat2 := Stat2 + [sWinVisA pp]; | |
| 1969 | if IsIco nic(anAppl ication.Ha ndle) then | |
| 1970 | Stat2 := Stat2 + [sIconize d]; | |
| 1971 | Result : = true; | |
| 1972 | if sIcon ized in St at2 then | |
| 1973 | begin {A } | |
| 1974 | j := S endMessage (anApplica tion.Handl e,WM_SYSCO MMAND,SC_R ESTORE,0); | |
| 1975 | Result := j<>0; | |
| 1976 | end; //i f | |
| 1977 | if Stat2 * [sWinVi sForm,sIco nized] = [ ] then | |
| 1978 | begin {S } | |
| 1979 | if anA pplication .MainForm <> nil the n | |
| 1980 | anAp plication. MainForm.S how; | |
| 1981 | end; //i f | |
| 1982 | if (Stat 2 * [sWinV isForm,sIc onized] <> []) or (s WinVisApp in Stat2) then | |
| 1983 | begin {G } | |
| 1984 | hFGWnd := GetFor egroundWin dow; | |
| 1985 | try | |
| 1986 | Atta chThreadIn put(GetWin dowThreadP rocessId(h FGWnd, nil ), GetCurr entThreadI d,True); | |
| 1987 | Resu lt := SetF oregroundW indow(anAp plication. Handle); | |
| 1988 | finall y | |
| 1989 | Atta chThreadIn put(GetWin dowThreadP rocessId(h FGWnd, nil ), GetCurr entThreadI d, False); | |
| 1990 | end; / /try | |
| 1991 | end; //i f sIconize d | |
| 1992 | end; //fun ction Show Applicatio nAndFocusO K | |
| 1993 | ||
| 1994 | ||
| 1995 | {--------- ---------- ---- TRPCB roker.WasU serDefined --------- -------- | |
| 1996 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1997 | function T RPCBroker. WasUserDef ined: Bool ean; | |
| 1998 | begin | |
| 1999 | Result : = FWasUser Defined; | |
| 2000 | end; //fun ction TRPC Broker.Was UserDefine d | |
| 2001 | ||
| 2002 | ||
| 2003 | {--------- ---------- ---- TRPCB roker.IsUs erCleared ---------- ------- | |
| 2004 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 2005 | function T RPCBroker. IsUserClea red: Boole an; | |
| 2006 | var | |
| 2007 | CCOWcont extItem: I ContextIte mCollectio n; // CCOW | |
| 2008 | CCOWdata Item1: ICo ntextItem; // CCOW | |
| 2009 | Name: St ring; | |
| 2010 | begin | |
| 2011 | Result : = False; | |
| 2012 | Name := CCOW_LOGON _ID; | |
| 2013 | if (Cont extor <> n il) then | |
| 2014 | try | |
| 2015 | //Se e if conte xt contain s the ID i tem | |
| 2016 | CCOW contextIte m := Conte xtor.Curre ntContext; | |
| 2017 | CCOW DataItem1 := CCowCon textItem.P resent(Nam e); | |
| 2018 | if ( CCOWdataIt em1 <> nil ) then //1 | |
| 2019 | begi n | |
| 2020 | if CCOWdataI tem1.Value = '' then | |
| 2021 | Result := True | |
| 2022 | el se | |
| 2023 | FWasUserDe fined := T rue; | |
| 2024 | end //if | |
| 2025 | else | |
| 2026 | Re sult := Tr ue; | |
| 2027 | finall y | |
| 2028 | end; / /try | |
| 2029 | end; //fun ction TRPC Broker.IsU serCleared | |
| 2030 | ||
| 2031 | ||
| 2032 | {--------- ---------- ---- GetCC OWHandle - ---------- ---------- ----- | |
| 2033 | Private fu nction to return a s pecial CCO W Handle f rom the se rver | |
| 2034 | which is s et into th e CCOW con text. | |
| 2035 | The Broker of a new applicatio n can get the CCOWHa ndle from the contex t | |
| 2036 | and use it to do a I mAPPHandle Sign-on. | |
| 2037 | ---------- ---------- ---------- ---------- ---------- ---------- ----} | |
| 2038 | function T RPCBroker. GetCCOWHan dle(Connec tedBroker : TRPCBrok er): Strin g; // p1 3 | |
| 2039 | begin | |
| 2040 | Result : = ''; | |
| 2041 | with Con nectedBrok er do | |
| 2042 | try // to per mit it to work corre ctly if CC OW is not installed on the ser ver. | |
| 2043 | Remote Procedure := 'XUS GE T CCOW TOK EN'; | |
| 2044 | Call; | |
| 2045 | Result := Result s[0]; | |
| 2046 | Domain := Result s[1]; | |
| 2047 | Remote Procedure := 'XUS CC OW VAULT P ARAM'; | |
| 2048 | Call; | |
| 2049 | PassCo de1 := Res ults[0]; | |
| 2050 | PassCo de2 := Res ults[1]; | |
| 2051 | except | |
| 2052 | Result := ''; | |
| 2053 | end; //t ry | |
| 2054 | end; //fun ction TRPC Broker.Get CCOWHandle | |
| 2055 | ||
| 2056 | ||
| 2057 | {--------- ---------- ---- TRPCB roker.CCOW setUser -- ---------- ----- | |
| 2058 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 2059 | procedure TRPCBroker .CCOWsetUs er(Uname, token, Dom ain, Vpid: string; C ontextor: | |
| 2060 | TConte xtorContro l); | |
| 2061 | var | |
| 2062 | CCOWdata : IContext ItemCollec tion; // CCOW | |
| 2063 | CCOWdata Item1,CCOW dataItem2, CCOWdataIt em3: ICont extItem; | |
| 2064 | CCOWdata Item4,CCOW dataItem5: IContextI tem; // CCOW | |
| 2065 | Cname: s tring; | |
| 2066 | begin | |
| 2067 | if Conte xtor <> ni l then | |
| 2068 | try | |
| 2069 | //Pa rt 1 | |
| 2070 | Cont extor.Star tContextCh ange; | |
| 2071 | //Pa rt 2 Set t he new pro posed cont ext data | |
| 2072 | CCOW data := Co ContextIte mCollectio n.Create; | |
| 2073 | CCOW dataItem1 := CoConte xtItem.Cre ate; | |
| 2074 | Cnam e := CCOW_ LOGON_ID; | |
| 2075 | CCOW dataItem1. Name := Cn ame; | |
| 2076 | CCOW dataItem1. Value := d omain; | |
| 2077 | CCOW Data.Add(C COWdataIte m1); | |
| 2078 | CCOW dataItem2 := CoConte xtItem.Cre ate; | |
| 2079 | Cnam e := CCOW_ LOGON_TOKE N; | |
| 2080 | CCOW dataItem2. Name := Cn ame; | |
| 2081 | CCOW dataItem2. Value := t oken; | |
| 2082 | CCOW data.Add(C COWdataIte m2); | |
| 2083 | CCOW dataItem3 := CoConte xtItem.Cre ate; | |
| 2084 | Cnam e := CCOW_ LOGON_NAME ; | |
| 2085 | CCOW dataItem3. Name := Cn ame; | |
| 2086 | CCOW dataItem3. Value := U name; | |
| 2087 | CCOW data.Add(C COWdataIte m3); | |
| 2088 | // | |
| 2089 | CCOW dataItem4 := CoConte xtItem.Cre ate; | |
| 2090 | Cnam e := CCOW_ LOGON_VPID ; | |
| 2091 | CCOW dataItem4. Name := Cn ame; | |
| 2092 | CCOW dataItem4. Value := V pid; | |
| 2093 | CCOW data.Add(C COWdataIte m4); | |
| 2094 | // | |
| 2095 | CCOW dataItem5 := CoConte xtItem.Cre ate; | |
| 2096 | Cnam e := CCOW_ USER_NAME; | |
| 2097 | CCOW dataItem5. Name := Cn ame; | |
| 2098 | CCOW dataItem5. Value := U name; | |
| 2099 | CCOW data.Add(C COWdataIte m5); | |
| 2100 | //Pa rt 3 Make change | |
| 2101 | Cont extor.EndC ontextChan ge(true, C COWdata); | |
| 2102 | //We don't nee d to check CCOWrespo nce | |
| 2103 | finall y | |
| 2104 | end; //try | |
| 2105 | end; //pro cedure TRP CBroker.CC OWsetUser | |
| 2106 | ||
| 2107 | ||
| 2108 | {--------- ---------- ---- TRPCB roker.GetC COWtoken - ---------- ------ | |
| 2109 | Get Token from CCOW context | |
| 2110 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 2111 | function T RPCBroker. GetCCOWtok en(Context or: TConte xtorContro l): string ; | |
| 2112 | var | |
| 2113 | CCOWdata Item1: ICo ntextItem; //C COW | |
| 2114 | CCOWcont extItem: I ContextIte mCollectio n; // CCOW | |
| 2115 | name: st ring; | |
| 2116 | begin | |
| 2117 | result : = ''; | |
| 2118 | name := CCOW_LOGON _TOKEN; | |
| 2119 | if (Cont extor <> n il) then | |
| 2120 | try | |
| 2121 | CCOWco ntextItem := Context or.Current Context; | |
| 2122 | //See if context contains the ID ite m | |
| 2123 | CCOWda taItem1 := CCOWconte xtItem.Pre sent(name) ; | |
| 2124 | if (CC OWdataItem 1 <> nil) then // 1 | |
| 2125 | begin | |
| 2126 | resu lt := CCOW dataItem1. Value; | |
| 2127 | if n ot (result = '') the n | |
| 2128 | FW asUserDefi ned := Tru e; | |
| 2129 | end; / /if | |
| 2130 | FCCOWL ogonIDName := CCOW_L OGON_ID; | |
| 2131 | FCCOWL ogonName : = CCOW_LOG ON_NAME; | |
| 2132 | FCCOWL ogonVpid : = CCOW_LOG ON_VPID; | |
| 2133 | CCOWda taItem1 := CCOWconte xtItem.Pre sent(CCOW_ LOGON_ID); | |
| 2134 | if CCO WdataItem1 <> nil th en | |
| 2135 | FCCO WLogonIdVa lue := CCO WdataItem1 .Value; | |
| 2136 | CCOWda taItem1 := CCOWconte xtItem.Pre sent(CCOW_ LOGON_NAME ); | |
| 2137 | if CCO WdataItem1 <> nil th en | |
| 2138 | FCCO WLogonName Value := C COWdataIte m1.Value; | |
| 2139 | CCOWda taItem1 := CCOWconte xtItem.Pre sent(CCOW_ LOGON_VPID ); | |
| 2140 | if CCO WdataItem1 <> nil th en | |
| 2141 | FCCO WLogonVpid Value := C COWdataIte m1.Value; | |
| 2142 | finall y | |
| 2143 | end; //t ry | |
| 2144 | end; //fun ction TRPC Broker.Get CCOWtoken | |
| 2145 | ||
| 2146 | ||
| 2147 | {--------- ---------- ---- TRPCB roker.GetC COWduz --- ---------- ---- | |
| 2148 | Get Name f rom CCOW c ontext | |
| 2149 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 2150 | function T RPCBroker. GetCCOWduz (Contextor : TContext orControl) : string; | |
| 2151 | var | |
| 2152 | CCOWdata Item1: ICo ntextItem; // CCOW | |
| 2153 | CCOWcont extItem: I ContextIte mCollectio n; // CCOW | |
| 2154 | name: st ring; | |
| 2155 | begin | |
| 2156 | result : = ''; | |
| 2157 | name := CCOW_LOGON _ID; | |
| 2158 | if (Cont extor <> n il) then | |
| 2159 | try | |
| 2160 | CCOWco ntextItem := Context or.Current Context; | |
| 2161 | //See if context contains the ID ite m | |
| 2162 | CCOWda taItem1 := CCOWconte xtItem.Pre sent(name) ; | |
| 2163 | if (CC OWdataItem 1 <> nil) then // 1 | |
| 2164 | begin | |
| 2165 | resu lt := CCOW dataItem1. Value; | |
| 2166 | if r esult <> ' ' then | |
| 2167 | FW asUserDefi ned := Tru e; | |
| 2168 | end; / /if | |
| 2169 | finally | |
| 2170 | end; //t ry | |
| 2171 | end; //fun ction TRPC Broker.Get CCOWduz | |
| 2172 | ||
| 2173 | ||
| 2174 | {--------- ---------- ---- TRPCB roker.IsUs erContextP ending --- ---------- ---- | |
| 2175 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 2176 | function T RPCBroker. IsUserCont extPending (aContextI temCollect ion: | |
| 2177 | IConte xtItemColl ection): B oolean; | |
| 2178 | var | |
| 2179 | CCOWdata Item1: ICo ntextItem; // CCOW | |
| 2180 | Val1: St ring; | |
| 2181 | begin | |
| 2182 | result : = false; | |
| 2183 | if WasUs erDefined( ) then // indicates data was d efined | |
| 2184 | begin | |
| 2185 | Val1 : = ''; // look for a ny USER Co ntext item s defined | |
| 2186 | result := True; | |
| 2187 | // | |
| 2188 | CCOWda taItem1 := aContextI temCollect ion.Presen t(CCOW_LOG ON_ID); | |
| 2189 | if CCO WdataItem1 <> nil th en | |
| 2190 | if n ot (CCOWda taItem1.Va lue = FCCO WLogonIDVa lue) then | |
| 2191 | Va l1 := '^' + CCOWdata Item1.Valu e; | |
| 2192 | // | |
| 2193 | CCOWda taItem1 := aContextI temCollect ion.Presen t(CCOW_LOG ON_NAME); | |
| 2194 | if CCO WdataItem1 <> nil th en | |
| 2195 | if n ot (CCOWda taItem1.Va lue = FCCO WLogonName Value) the n | |
| 2196 | Va l1 := Val1 + '^' + C COWdataIte m1.Value; | |
| 2197 | // | |
| 2198 | CCOWda taItem1 := aContextI temCollect ion.Presen t(CCOW_LOG ON_VPID); | |
| 2199 | if CCO WdataItem1 <> nil th en | |
| 2200 | if n ot (CCOWda taItem1.Va lue = FCCO WLogonVpid Value) the n | |
| 2201 | Va l1 := Val1 + '^' + C COWdataIte m1.Value; | |
| 2202 | // | |
| 2203 | CCOWda taItem1 := aContextI temCollect ion.Presen t(CCOW_USE R_NAME); | |
| 2204 | if CCO WdataItem1 <> nil th en | |
| 2205 | if n ot (CCOWda taItem1.Va lue = user .Name) the n | |
| 2206 | Va l1 := Val1 + '^' + C COWdataIte m1.Value; | |
| 2207 | // | |
| 2208 | if Val 1 = '' the n // no thing defi ned or all matches, so not use r context change | |
| 2209 | resu lt := Fals e; | |
| 2210 | end; //i f | |
| 2211 | end; //fun ction TRPC Broker.IsU serContext Pending | |
| 2212 | ||
| 2213 | ||
| 2214 | {--------- ---------- ---- TRpcB roker.Chec kSSH ----- ---------- -- | |
| 2215 | procedu re CheckSS H was extr acted to r emove dupl icate code | |
| 2216 | in the SetConnect ed method of Trpcb a nd derived classes | |
| 2217 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 2218 | procedure TRpcBroker .CheckSSH; | |
| 2219 | var | |
| 2220 | ParamNum : Integer; | |
| 2221 | ParamVal : String; | |
| 2222 | ParamVal Normal: St ring; | |
| 2223 | begin | |
| 2224 | FIPsecSe curity:= 0 ; | |
| 2225 | ParamNum := 1; | |
| 2226 | while (n ot (ParamS tr(ParamNu m) = '')) do | |
| 2227 | begin | |
| 2228 | ParamV alNormal : = ParamStr (ParamNum) ; | |
| 2229 | ParamV al := Uppe rCase(Para mValNormal ); | |
| 2230 | // che ck for com mand line specificti on of conn ection | |
| 2231 | // met hod if not set as a property | |
| 2232 | if FUs eSecureCon nection = secureNone then | |
| 2233 | begin | |
| 2234 | if P aramVal = 'SSH' then | |
| 2235 | FU seSecureCo nnection : = secureAt tachmate; | |
| 2236 | if P aramVal = 'PLINK' th en | |
| 2237 | FU seSecureCo nnection : = securePl ink; | |
| 2238 | end; / /if FUseSe cureConnec tion | |
| 2239 | // che ck for SSH specifica tions on c ommand lin e | |
| 2240 | if Pos ('SSHPORT= ',ParamVal ) = 1 then | |
| 2241 | FSSH Port := Co py(ParamVa l,9,Length (ParamVal) ); | |
| 2242 | if Pos ('SSHUSER= ',ParamVal ) = 1 then | |
| 2243 | FSSH User := Co py(ParamVa lNormal,9, Length(Par amVal)); | |
| 2244 | if Pos ('SSHPW=', ParamVal) = 1 then | |
| 2245 | FSSH pw := Copy (ParamValN ormal,7,Le ngth(Param Val)); | |
| 2246 | if Par amVal = 'S SHHIDE' th en | |
| 2247 | FSSH hide := tr ue; | |
| 2248 | ParamN um := Para mNum + 1; | |
| 2249 | end; //w hile | |
| 2250 | end; //pro cedure TRp cBroker.Ch eckSSH | |
| 2251 | ||
| 2252 | ||
| 2253 | {--------- ---------- ---- TRPCB roker.getS SHUsername --------- -------- | |
| 2254 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 2255 | function T RPCBroker. getSSHUser name: stri ng; | |
| 2256 | var | |
| 2257 | Username Entry: TSS HUsername; | |
| 2258 | begin | |
| 2259 | Username Entry := T SSHUsernam e.Create(S elf); | |
| 2260 | Username Entry.Show Modal; | |
| 2261 | Result : = Username Entry.Edit 1.Text; | |
| 2262 | Username Entry.Free ; | |
| 2263 | end; //fun ction TRPC Broker.get SSHUsernam e | |
| 2264 | ||
| 2265 | ||
| 2266 | {--------- ---------- ---- TRPCB roker.getS SHPassWord --------- -------- | |
| 2267 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 2268 | function T RPCBroker. getSSHPass Word: stri ng; | |
| 2269 | var | |
| 2270 | Password Entry: TfP linkPasswo rd; | |
| 2271 | begin | |
| 2272 | Password Entry := T fPlinkPass word.Creat e(Self); | |
| 2273 | Password Entry.Show Modal; | |
| 2274 | Result : = Password Entry.Edit 1.Text; | |
| 2275 | Password Entry.Free ; | |
| 2276 | end; //fun ction TRPC Broker.get SSHPassWor d | |
| 2277 | ||
| 2278 | ||
| 2279 | {--------- ---------- ---- TRPCB roker.Star tSecureCon nection -- ---------- ----- | |
| 2280 | Use Micro Focus (for merly Atta chmate) Re flection o r Plink tu nneling fo r encrypte d connecti on | |
| 2281 | ||
| 2282 | Reflection Usage: ss h2 [option s] [user@] host[#port ] [command ] | |
| 2283 | ||
| 2284 | Options: | |
| 2285 | -A Enab le authent ication ag ent forwar ding. | |
| 2286 | -a Disa ble authen tication a gent forwa rding (def ault). | |
| 2287 | -b Loca l IP addre ss. | |
| 2288 | -c ciphe r[,cipher] Select encryption algorithm s (comma s eparated l ist). | |
| 2289 | -C Enab le compres sion. | |
| 2290 | -D port Enab le dynamic applicati on-level p ort forwar ding via S OCKS4/5 | |
| 2291 | -e char Set escape cha racter; `` none'' = d isable (de fault: ~). | |
| 2292 | -E prov Use 'prov' as the extern al key pro vider. | |
| 2293 | -f Plac es client in backgro und just b efore comm and execut ion. | |
| 2294 | -F file Read an altern ative conf iguration file. | |
| 2295 | -g Allo w remote h osts to co nnect to f orwarded p orts. | |
| 2296 | -H schem e Use the specif ied scheme name in t he config file. | |
| 2297 | -i keyfi le Iden tity file for public key authe ntication. | |
| 2298 | -k dir Cust om configu ration dir where con fig file, hostkeys a nd | |
| 2299 | user keys are l ocated. | |
| 2300 | -l user Log in using t his user n ame. | |
| 2301 | -L [FTP/ |TCP/]list en-port:ho st:port Forward lo cal port t o remote a ddress. | |
| 2302 | Thes e cause ss h to liste n for conn ections on a port, a nd | |
| 2303 | forw ard them t o the othe r side by connecting to host:p ort. | |
| 2304 | -m macs Spec ify MAC al gorithms f or protoco l version 2. | |
| 2305 | -n Redi rect stdin from null . | |
| 2306 | -N Do n ot execute a shell o r command. | |
| 2307 | -o "opti on" Sets any optio n supporte d in the s sh configu ration fil e. | |
| 2308 | -p port Conn ect to thi s port. S erver must be on the same port . | |
| 2309 | -q Quie t; don't d isplay any warning m essages. | |
| 2310 | -R liste n-port:hos t:port F orward rem ote port t o local ad dress | |
| 2311 | -S Do n ot execute a shell. | |
| 2312 | -t Tty; allocate a tty even if comman d is given . | |
| 2313 | -T Do n ot allocat e a tty. | |
| 2314 | -v[vv] Verb ose, debug level; di splay verb ose debugg ing messag es. | |
| 2315 | Mult iple v's i ncreases v erbosity. | |
| 2316 | -V Disp lay versio n number o nly. | |
| 2317 | -X Enab le X11 con nection fo rwarding U NTRUSTED. | |
| 2318 | -x Disa ble X11 co nnection f orwarding (default). | |
| 2319 | -1 Forc e protocol version 1 . | |
| 2320 | -2 Forc e protocol version 2 . | |
| 2321 | -4 Use IPv4 only. | |
| 2322 | -6 Use IPv6 only. | |
| 2323 | -? Disp lay this u sage help | |
| 2324 | ||
| 2325 | Command ca n be eithe r: | |
| 2326 | remote_c ommand [ar guments] . .. Run command in remote ho st. | |
| 2327 | -s servi ce Enab le a servi ce in remo te server. | |
| 2328 | ||
| 2329 | Default ci phers in F IPS mode: | |
| 2330 | aes128-c tr,aes128- cbc,aes192 -ctr,aes19 2-cbc,aes2 56-ctr,aes 256-cbc,3d es-cbc | |
| 2331 | ||
| 2332 | Default MA C algorith ms in FIPS mode: | |
| 2333 | hmac-sha 1,hmac-sha 256,hmac-s ha512 | |
| 2334 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 2335 | function T RPCBroker. StartSecur eConnectio n(var Pseu doServer, PseudoPort : | |
| 2336 | String ): Boolean ; | |
| 2337 | var | |
| 2338 | CmndLine : String; | |
| 2339 | TunnelCo nn: String ; | |
| 2340 | begin | |
| 2341 | FIPsecSe curity:= 0 ; | |
| 2342 | PseudoPo rt := FSSH Port; | |
| 2343 | if FSSHP ort = '' t hen | |
| 2344 | Pseudo Port := In tToStr(Lis tenerPort) ; | |
| 2345 | PseudoSe rver := Se rver; | |
| 2346 | if FSSHU ser = '' t hen | |
| 2347 | FSSHUs er := getS SHUsername ; | |
| 2348 | if FUseS ecureConne ction = se cureAttach mate then | |
| 2349 | begin | |
| 2350 | if Ans iContainsT ext(FServe r,':') the n | |
| 2351 | Tunn elConn := PseudoPort +'/'+FServ er+'/'+Int ToStr(List enerPort) //Alternat ive syntax for IPv6 address | |
| 2352 | else | |
| 2353 | Tunn elConn := PseudoPort +':'+FServ er+':'+Int ToStr(List enerPort); | |
| 2354 | CmndLi ne := 'SSH -L '+Tunn elConn+' - S -o "TryE mptyPasswo rd yes"' | |
| 2355 | +' -o "FipsM ode yes"' | |
| 2356 | +' -o "Stric tHostKeyCh ecking no" -o "conne ctionReuse no" ' | |
| 2357 | +F SSHUser+'@ '+Server | |
| 2358 | end; //i f | |
| 2359 | if FUseS ecureConne ction = se curePlink then | |
| 2360 | begin | |
| 2361 | if FSS Hpw = '' t hen | |
| 2362 | FSSH pw := getS SHPassWord ; | |
| 2363 | Tunnel Conn := Ps eudoPort+' :'+PseudoS erver+':'+ IntToStr(L istenerPor t); | |
| 2364 | CmndLi ne := 'pli nk.exe -L '+TunnelCo nn+' '+FSS HUser+'@'+ FServer +' -pw '+ FS SHpw; | |
| 2365 | end; //i f | |
| 2366 | if FSSHh ide then | |
| 2367 | StartP rogSLogin( CmndLine, nil, SW_HI DE) | |
| 2368 | else | |
| 2369 | StartP rogSLogin( CmndLine, nil, SW_SH OWMINIMIZE D); | |
| 2370 | Sleep(50 00); | |
| 2371 | if FSSHU ser <> '' then | |
| 2372 | FIPsec Security:= 2; | |
| 2373 | result : = true; | |
| 2374 | end; //fun ction TRPC Broker.Sta rtSecureCo nnection | |
| 2375 | ||
| 2376 | ||
| 2377 | {--------- ---------- ---- SSOiB indUser -- ---------- ---------- ---- | |
| 2378 | Procedure to Bind an Active Di rectory ac count to a VistA use r | |
| 2379 | using the attributes in an Ide ntity and Access Man agement ST S SAML tok en. | |
| 2380 | ---------- ---------- ---------- ---------- ---------- ---------- ----} | |
| 2381 | procedure SSOiBindUs er(Connect edBroker : TRPCBroke r); // p 65 | |
| 2382 | begin | |
| 2383 | with Con nectedBrok er do | |
| 2384 | if SSOiS ECID <> '' then | |
| 2385 | try | |
| 2386 | Remote Procedure := 'XUS IA M BIND USE R'; | |
| 2387 | Param[ 0].PType : = literal; | |
| 2388 | Param[ 0].Value : = SSOiSECI D; | |
| 2389 | Param[ 1].PType : = literal; | |
| 2390 | Param[ 1].Value : = Decrypt( IAM_Bindin g); | |
| 2391 | if SSO iADUPN <> '' then //option al paramet er | |
| 2392 | begin | |
| 2393 | Para m[2].PType := litera l; | |
| 2394 | Para m[2].Value := SSOiAD UPN; | |
| 2395 | end; | |
| 2396 | Call; | |
| 2397 | except | |
| 2398 | end; //t ry | |
| 2399 | end; //fun ction TRPC Broker.SSO iBindUser | |
| 2400 | ||
| 2401 | end. | |
| 2402 |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.