Check in built-in copy of libpopt in preparation for switching
[rsync/rsync.git] / csprotocol.txt
CommitLineData
84f69dad
MP
1This is kind of informal and may be wrong, but it helped me. It's
2basically a summary of clientserver.c and authenticate.c.
3
4 -- Martin Pool <mbp@samba.org>
5
6
7
8
9This is the protocol used for rsync --daemon; i.e. connections to port
10873 rather than invocations over a remote shell.
11
12When the server accepts a connection, it prints a greeting
13
14 @RSYNCD: <version>
15
16where <version> is the numeric version; currently 24. It follows this
17with a free text message-of-the-day. It expects to see a similar
18greeting back from the client.
19
20The server is now in the connected state. The client can either send
21the command
22
23 #list
24
25to get a listing of modules, or the name of a module. After this, the
26connection is now bound to a particular module. Access per host for
27this module is now checked, as is per-module connection limits.
28
29If authentication is required to use this module, the server will say
30
31 @RSYNCD: AUTHREQD <challenge>
32
33where <challenge> is a random string of base64 characters. The client
34must respond with
35
36 <user> <response>
37
38where <user> is the username they claim to be, and <response> is the
39base64 form of the MD4 hash of challenge+password.
40
41At this point the server applies all remaining constraints before
42handing control to the client, including switching uid/gid, setting up
43include and exclude lists, moving to the root of the module, and doing
44chroot.
45
46If the login is acceptable, then the server will respond with
47
48 @RSYNCD: OK
49
50The client now writes some rsync options, as if it were remotely
51executing the command. The server parses these arguments as if it had
52just been invoked with them, but they're added to the existing state.
53So if the client specifies a list of files to be included or excluded,
54they'll defer to existing limits specified in the server
55configuration.
56
57The server then talks to the client as normal across the socket,
58passing checksums, file lists and so on. For documentation of that,
59stay tuned (or write it yourself!).
60