annotate Demo/pdist/README @ 5817:48b94de85bf3 legacy-trunk

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