move the read only daemon test to after the protocol setup
authorAndrew Tridgell <tridge@samba.org>
Sat, 29 Jan 2000 05:02:23 +0000 (05:02 +0000)
committerAndrew Tridgell <tridge@samba.org>
Sat, 29 Jan 2000 05:02:23 +0000 (05:02 +0000)
clientserver.c
main.c

index 2cd2c40a947d7e2a62340faf89ca9c09ac07b837..df847ffcafdd0739980925a08b6dd78c5fbc2edb 100644 (file)
@@ -101,8 +101,10 @@ int start_socket_client(char *host, char *path, int argc, char *argv[])
        }
        io_printf(fd,"\n");
 
-       if (remote_version == 22 || (remote_version > 17 && !am_sender))
-               io_start_multiplex_in(fd);
+       if (remote_version < 23) {
+               if (remote_version == 22 || (remote_version > 17 && !am_sender))
+                       io_start_multiplex_in(fd);
+       }
 
        return client_run(fd, fd, -1, argc, argv);
 }
@@ -163,9 +165,6 @@ static int rsync_module(int fd, int i)
 
        module_id = i;
 
-       if (lp_read_only(i))
-               read_only = 1;
-
        am_root = (getuid() == 0);
 
        if (am_root) {
@@ -316,15 +315,9 @@ static int rsync_module(int fd, int i)
        argp = argv + optind;
        optind = 0;
 
-       if (remote_version == 22 || (remote_version > 17 && am_sender))
-               io_start_multiplex_out(fd);
-
-       if (read_only) {
-               extern int am_sender;
-               if (!am_sender) {
-                       rprintf(FERROR,"ERROR: module is read only\n");
-                       return -1;
-               }
+       if (remote_version < 23) {
+               if (remote_version == 22 || (remote_version > 17 && am_sender))
+                       io_start_multiplex_out(fd);
        }
 
        if (!ret) {
diff --git a/main.c b/main.c
index 914ab243fedbf70a781a00ed487895cf43e1903f..11344eb2b12743f88b246a3e7935bb2bb1622d25 100644 (file)
--- a/main.c
+++ b/main.c
@@ -350,9 +350,18 @@ static void do_server_recv(int f_in, int f_out, int argc,char *argv[])
        extern int delete_mode;
        extern int delete_excluded;
        extern int am_daemon;
+       extern int module_id;
+       extern int am_sender;
 
        if (verbose > 2)
                rprintf(FINFO,"server_recv(%d) starting pid=%d\n",argc,(int)getpid());
+
+       if (am_daemon && lp_read_only(module_id) && !am_sender) {
+               rprintf(FERROR,"ERROR: module is read only\n");
+               exit_cleanup(RERR_SYNTAX);
+               return;
+       }
+
        
        if (argc > 0) {
                dir = argv[0];