Indy 9
TIdRSHServer
Hierarchy, Properties, Methods, Events, See Also, Unit: IdRSHServer
Implements a RSH Daemon.
TIdRSHServer = class(TIdRemoteCMDServer)
Unit
IdRSHServer
Description
TIdRSHServer is a TIdRemoteCMDServer descendant that implements a Remote Shell Daemon (RSHD), and allows remote client connections to connect and execute commands or service requests. TIdRSHServer specifies Properties, Methods, and Events that allow the server to implement and execute command requests using the RSH Protocol.

By convention, TIdRSHServer forces all client connection requests to use port numbers outside the reserved range 0 through 1023. TIdRSHServer allows creation of a secondary client connection to be used for redirecting standard error output to the RSH client. A secondary connection is created when a non-null valid port number is provided in the connection request.

TIdRSHServer uses the source address of the client connection request to determine the name of the client host. If the name cannot be determined, the rshd daemon uses the dotted decimal representation of the client host address.

When a client thread is executed for TIdRSHServer, values are read from the client connection for the user name on the client host, user name on the local server, and the password for use on the local server.

TIdRSHServer provides the OnCommand event handler to allow the implementation to control platform-specific authentication and execution of the command for the RSH session.


TIdRSHServer.DefaultPort
TIdRSHServer, See Also
The port number used when listening for new client connections.
property DefaultPort: integer;
Description
DefaultPort is an Integer property that represent the default port number used to listen for new client connections. The value of DefaultPort is provided for use with TIdSocketHandles. TIdTCPServer and descendant classes use the DefaultPort number to bind allocated sockets handles when the Active property to set to True.

The default value for DefaultPort is Id_PORT_cmd as assigned in the Create method.


TIdRSHServer.ForcePortsInRange
TIdRSHServer
This property indicates if the server should disconnect clients that do not connect from the port range (512 - 1023).
property ForcePortsInRange: Boolean;
Description
This property indicates if the server should disconnect clients that do not connect from the port range (512 - 1023). If this property is true, the RSH Server component will automatically disconnect clients that do not do connect to the server from ports in this range. Setting this to False will permit the client to use the RSH server even if they do not connect from this port range.

Usually, this should be set to true to prevent non-administrative users from using the RSH server. Setting this to false should be done with the utmost caution as it will increase the likelihood for abuse. The reason RSH requires clients to connect from ports in the 512-1023 range is because on most multi-user operating systems, this ensures some security as only administrators on those systems could use it. However, "security" is somewhat limited because many single user operating systems will not prevent non-administrator users from using those reserved ports and it is possible for hackers to alter port numbers on packets.


TIdRSHServer.Create
TIdRSHServer, See Also
Constructor for the object instance.
constructor Create(AOwner: TComponent); override;
Parameters
AOwner: TComponent
Owner of the object instance.
Description
Create is the constructor for the object instance. Create calls the inherited Create method. Create sets the value for DefaultPort to IdPORT_cmd, as used by convention in the RSH protocol. Create sets ForcePortsInRange to RSH_FORCEPORTSINRANGE propr to exiting from the method.

TIdRSHServer.OnCommand
TIdRSHServer, See Also
Allows authentication and execution of the command for the RSH session.
property OnCommand: TIdRSHCommandEvent;
Description
OnCommand is a TIdRSHCommandEvent property that represents the event handler signalled when a threaded RSH client connection needs to perform authentication and execution of a service request. OnCommand is triggered during execution of the threaded client connection, and uses arguments to the event handler to identify values needed during authentication and command execution.

OnCommand is signalled after the optional connection for redirected standard error output has been created, bound, and successfully connected. In addition, null terminated values for the client user name, host user name, and the RSH command have been read from the request connection prior to triggering OnCommand.

Applications must assign a procedure to the event handler to allow responding to the event notification. The event handler can be used to authenticate the client and host user name values, to execute the command, and to send error or result values using the optional connection for redirected standard error output.


Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.