1Filesystem, RCS and CVS client and server classes 2================================================= 3 4*** See the security warning at the end of this file! *** 5 6This directory contains various modules and classes that support 7remote file system operations. 8 9CVS stuff 10--------- 11 12rcvs Script to put in your bin directory 13rcvs.py Remote CVS client command line interface 14 15cvslib.py CVS admin files classes (used by rrcs) 16cvslock.py CVS locking algorithms 17 18RCS stuff 19--------- 20 21rrcs Script to put in your bin directory 22rrcs.py Remote RCS client command line interface 23 24rcsclient.py Return an RCSProxyClient instance 25 (has reasonable default server/port/directory) 26 27RCSProxy.py RCS proxy and server classes (on top of rcslib.py) 28 29rcslib.py Local-only RCS base class (affects stdout & 30 local work files) 31 32FSProxy stuff 33------------- 34 35sumtree.py Old demo for FSProxy 36cmptree.py First FSProxy client (used to sync from the Mac) 37FSProxy.py Filesystem interface classes 38 39Generic client/server stuff 40--------------------------- 41 42client.py Client class 43server.py Server class 44 45security.py Security mix-in class (not very secure I think) 46 47Other generic stuff 48------------------- 49 50cmdfw.py CommandFrameWork class 51 (used by rcvs, should be used by rrcs as well) 52 53 54Client/Server operation 55----------------------- 56 57The Client and Server classes implement a simple-minded RPC protocol, 58using Python's pickle module to transfer arguments, return values and 59exceptions with the most generality. The Server class is instantiated 60with a port number on which it should listen for requests; the Client 61class is instantiated with a host name and a port number where it 62should connect to. Once a client is connected, a TCP connection is 63maintained between client and server. 64 65The Server class currently handles only one connection at a time; 66however it could be rewritten to allow various modes of operations, 67using multiple threads or processes or the select() system call as 68desired to serve multiple clients simultaneously (when using select(), 69still handling one request at a time). This would not require 70rewriting of the Client class. It may also be possible to adapt the 71code to use UDP instead of TCP, but then both classes will have to be 72rewritten (and unless extensive acknowlegements and request serial 73numbers are used, the server should handle duplicate requests, so its 74semantics should be idempotent -- shrudder). 75 76Even though the FSProxy and RCSProxy modules define client classes, 77the client class is fully generic -- what methods it supports is 78determined entirely by the server. The server class, however, must be 79derived from. This is generally done as follows: 80 81 from server import Server 82 from client import Client 83 84 # Define a class that performs the operations locally 85 class MyClassLocal: 86 def __init__(self): ... 87 def _close(self): ... 88 89 # Derive a server class using multiple inheritance 90 class MyClassServer(MyClassLocal, Server): 91 def __init__(self, address): 92 # Must initialize MyClassLocal as well as Server 93 MyClassLocal.__init__(self) 94 Server.__init__(self, address) 95 def _close(self): 96 Server._close() 97 MyClassLocal._close() 98 99 # A dummy client class 100 class MyClassClient(Client): pass 101 102Note that because MyClassLocal isn't used in the definition of 103MyClassClient, it would actually be better to place it in a separate 104module so the definition of MyClassLocal isn't executed when we only 105instantiate a client. 106 107The modules client and server should probably be renamed to Client and 108Server in order to match the class names. 109 110 111*** Security warning: this version requires that you have a file 112$HOME/.python_keyfile at the server and client side containing two 113comma- separated numbers. The security system at the moment makes no 114guarantees of actuallng being secure -- however it requires that the 115key file exists and contains the same numbers at both ends for this to 116work. (You can specify an alternative keyfile in $PYTHON_KEYFILE). 117Have a look at the Security class in security.py for details; 118basically, if the key file contains (x, y), then the security server 119class chooses a random number z (the challenge) in the range 12010..100000 and the client must be able to produce pow(z, x, y) 121(i.e. z**x mod y). 122