IdRexec.pas 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. { $HDR$}
  2. {**********************************************************************}
  3. { Unit archived using Team Coherence }
  4. { Team Coherence is Copyright 2002 by Quality Software Components }
  5. { }
  6. { For further information / comments, visit our WEB site at }
  7. { http://www.TeamCoherence.com }
  8. {**********************************************************************}
  9. {}
  10. { $Log: 10307: IdRexec.pas
  11. {
  12. { Rev 1.0 2002.11.12 10:50:30 PM czhower
  13. }
  14. unit IdRexec;
  15. (*******************************************************}
  16. -2001.05.18 - J. Peter Mugaas
  17. I removed the property for forcing client ports
  18. into a specific range. This was not necessary
  19. for Rexec. It is required for the TIdRSH Component
  20. -2001.02.15 - J. Peter Mugaas
  21. I moved most of the Rexec code to
  22. TIdRemoteCMDClient and TIdRexec now inherits
  23. from that class. This change was necessary to
  24. reduce duplicate code with a new addition, IdRSH.
  25. -2001.02.14 - J. Peter Mugaas
  26. Made it more complient with Rexec servers
  27. and handled the #0 or error indicator
  28. -2001.02.13 - Modified by Kudzu
  29. -2000.10.24 - Original Author: Laurence LIew
  30. { }
  31. { Indy Rexec Client TIdRexec }
  32. { }
  33. { Copyright (C) 2001 Winshoes Working Group }
  34. { Original author Laurence LIew }
  35. { 2000-October-24 }
  36. { }
  37. {*******************************************************)
  38. interface
  39. uses
  40. Classes,
  41. IdAssignedNumbers,
  42. IdRemoteCMDClient,
  43. IdTCPClient;
  44. type
  45. TIdRexec = class(TIdRemoteCMDClient)
  46. public
  47. constructor Create(AOwner: TComponent); override;
  48. Function Execute(ACommand: String): String; override;
  49. published
  50. property Username;
  51. property Password;
  52. property Port default Id_PORT_exec;
  53. end;
  54. implementation
  55. uses
  56. IdComponent,
  57. IdGlobal,
  58. IdSimpleServer,
  59. IdTCPConnection,
  60. IdThread,
  61. SysUtils;
  62. constructor TIdRexec.Create(AOwner: TComponent);
  63. begin
  64. inherited;
  65. Port := Id_PORT_exec;
  66. {Rexec does not require ports to be in a specific range}
  67. FUseReservedPorts := False;
  68. end;
  69. function TIdRexec.Execute(ACommand: String): String;
  70. begin
  71. Result := InternalExec(UserName,Password,ACommand);
  72. end;
  73. end.