diff -u -r --new-file --exclude=CVS rsync-2.0.7/authenticate.c rsync-2.0.8/authenticate.c --- rsync-2.0.7/authenticate.c Fri May 15 20:57:36 1998 +++ rsync-2.0.8/authenticate.c Mon May 18 00:57:19 1998 @@ -125,21 +125,28 @@ } /* possible negotiate authentication with the client. Use "leader" to - start off the auth if necessary */ -int auth_server(int fd, int module, char *addr, char *leader) + start off the auth if necessary + + return NULL if authentication failed + + return "" if anonymous access + + otherwise return username +*/ +char *auth_server(int fd, int module, char *addr, char *leader) { char *users = lp_auth_users(module); char challenge[16]; char b64_challenge[30]; char line[MAXPATHLEN]; - char user[100]; + static char user[100]; char secret[100]; char pass[30]; char pass2[30]; char *tok; /* if no auth list then allow anyone in! */ - if (!users || !*users) return 1; + if (!users || !*users) return ""; gen_challenge(addr, challenge); @@ -148,18 +155,18 @@ io_printf(fd,"%s%s\n", leader, b64_challenge); if (!read_line(fd, line, sizeof(line)-1)) { - return 0; + return NULL; } memset(user, 0, sizeof(user)); memset(pass, 0, sizeof(pass)); if (sscanf(line,"%99s %29s", user, pass) != 2) { - return 0; + return NULL; } users = strdup(users); - if (!users) return 0; + if (!users) return NULL; for (tok=strtok(users," ,\t"); tok; tok = strtok(NULL," ,\t")) { if (strcmp(tok, user) == 0) break; @@ -167,19 +174,22 @@ free(users); if (!tok) { - return 0; + return NULL; } memset(secret, 0, sizeof(secret)); if (!get_secret(module, user, secret, sizeof(secret)-1)) { memset(secret, 0, sizeof(secret)); - return 0; + return NULL; } generate_hash(secret, b64_challenge, pass2); memset(secret, 0, sizeof(secret)); - return (strcmp(pass, pass2) == 0); + if (strcmp(pass, pass2) == 0) + return user; + + return NULL; } diff -u -r --new-file --exclude=CVS rsync-2.0.7/clientserver.c rsync-2.0.8/clientserver.c --- rsync-2.0.7/clientserver.c Sat May 16 15:26:28 1998 +++ rsync-2.0.8/clientserver.c Mon May 18 00:57:19 1998 @@ -109,6 +109,7 @@ char *addr = client_addr(fd); char *host = client_name(fd); char *name = lp_name(i); + char *user; int start_glob=0; char *request=NULL; extern int am_sender; @@ -121,13 +122,6 @@ return -1; } - if (!auth_server(fd, i, addr, "@RSYNCD: AUTHREQD ")) { - rprintf(FERROR,"auth failed on module %s from %s (%s)\n", - name, client_name(fd), client_addr(fd)); - io_printf(fd,"@ERROR: auth failed on module %s\n",name); - return -1; - } - if (!claim_connection(lp_lock_file(), lp_max_connections())) { rprintf(FERROR,"max connections (%d) reached\n", lp_max_connections()); @@ -136,6 +130,15 @@ } + user = auth_server(fd, i, addr, "@RSYNCD: AUTHREQD "); + + if (!user) { + rprintf(FERROR,"auth failed on module %s from %s (%s)\n", + name, client_name(fd), client_addr(fd)); + io_printf(fd,"@ERROR: auth failed on module %s\n",name); + return -1; + } + module_id = i; if (lp_read_only(i)) @@ -233,9 +236,15 @@ parse_arguments(argc, argv); if (request) { - rprintf(FINFO,"rsync %s %s from %s (%s)\n", - am_sender?"on":"to", - request, host, addr); + if (*user) { + rprintf(FINFO,"rsync %s %s from %s@%s (%s)\n", + am_sender?"on":"to", + request, user, host, addr); + } else { + rprintf(FINFO,"rsync %s %s from %s (%s)\n", + am_sender?"on":"to", + request, host, addr); + } free(request); } diff -u -r --new-file --exclude=CVS rsync-2.0.7/cvs.log rsync-2.0.8/cvs.log --- rsync-2.0.7/cvs.log Sat May 16 15:38:44 1998 +++ rsync-2.0.8/cvs.log Mon May 18 01:19:05 1998 @@ -4205,3 +4205,182 @@ Log Message: preparing for release of 2.0.7 + +**************************************** +Date: Saturday May 16, 1998 @ 17:45 +Author: tridge + +Update of /data/cvs/rsync +In directory samba:/tmp/cvs-serv28607 + +Modified Files: + authenticate.c clientserver.c proto.h +Log Message: +for authenticated access record the authenticated username in the logs + + + +**************************************** +Date: Sunday May 17, 1998 @ 1:18 +Author: tridge + +Update of /data/cvs/rsync +In directory samba:/tmp/cvs-serv5310 + +Modified Files: + main.c +Log Message: +check for right number of arguments _after_ the option parsing. + +this stops "rsync -v" causing a segv. + + + + +**************************************** +Date: Sunday May 17, 1998 @ 11:24 +Author: tridge + +Update of /data/cvs/rsync +In directory samba:/tmp/cvs-serv19356 + +Modified Files: + main.c +Log Message: +close the other half of the pipe in do_recv(). This fixes the problem +where a rsync receive process could hang around after the connection +has gone away if a fatal error occurs (such as someone killing the +other end) + + + +**************************************** +Date: Sunday May 17, 1998 @ 13:51 +Author: tridge + +Update of /data/cvs/rsync +In directory samba:/tmp/cvs-serv19859 + +Modified Files: + main.c +Log Message: +moved usage mesage after am_daemon test (I'd broken daemon mode) + + + +**************************************** +Date: Sunday May 17, 1998 @ 15:56 +Author: tridge + +Update of /data/cvs/rsync +In directory samba:/tmp/cvs-serv16848 + +Modified Files: + io.c rsync.h +Log Message: +put a limit (default 1MB) on the read buffer size. This stops it +growing too much if the sender is much faster than the receiver + + + + +**************************************** +Date: Sunday May 17, 1998 @ 17:22 +Author: tridge + +Update of /data/cvs/rsync +In directory samba:/tmp/cvs-serv19388 + +Modified Files: + io.c main.c +Log Message: +close some unnecessary file descriptors in do_recv() + + + +**************************************** +Date: Monday May 18, 1998 @ 0:32 +Author: tridge + +Update of /data/cvs/rsync/packaging/redhat/5.0 +In directory samba:/tmp/cvs-serv15511 + +Modified Files: + rsync.spec.tmpl +Log Message: +updated so I can auto-build rsync packages + + + + +**************************************** +Date: Monday May 18, 1998 @ 0:58 +Author: rsync-bu + +Update of /data/cvs/rsync +In directory samba:/data/people/rsync-bugs/rsync + +Modified Files: + version.h +Log Message: +preparing for release of 2.0.8 + + +**************************************** +Date: Monday May 18, 1998 @ 0:58 +Author: rsync-bu + +Update of /data/cvs/rsync/packaging/redhat/5.0 +In directory samba:/data/people/rsync-bugs/rsync/packaging/redhat/5.0 + +Modified Files: + rsync.spec +Log Message: +preparing for release of 2.0.8 + + +**************************************** +Date: Monday May 18, 1998 @ 1:10 +Author: tridge + +Update of /data/cvs/rsync/packaging/redhat/5.0 +In directory samba:/tmp/cvs-serv11757 + +Modified Files: + rsync.spec.tmpl +Log Message: +rpm is fussy about changelog formats + + + + + +**************************************** +Date: Monday May 18, 1998 @ 1:10 +Author: rsync-bu + +Update of /data/cvs/rsync/packaging/redhat/5.0 +In directory samba:/data/people/rsync-bugs/rsync/packaging/redhat/5.0 + +Modified Files: + rsync.spec +Log Message: +preparing for release of 2.0.8 + + +**************************************** +Date: Monday May 18, 1998 @ 1:18 +Author: tridge + +Update of /data/cvs/rsync +In directory samba:/tmp/cvs-serv8741 + +Modified Files: + main.c +Log Message: +if f_in == f_out then don't close one of them + + + + + diff -u -r --new-file --exclude=CVS rsync-2.0.7/io.c rsync-2.0.8/io.c --- rsync-2.0.7/io.c Fri May 15 20:57:36 1998 +++ rsync-2.0.8/io.c Mon May 18 00:57:19 1998 @@ -45,8 +45,8 @@ void setup_nonblocking(int f_in,int f_out) { - set_blocking(f_out,0); - buffer_f_in = f_in; + set_blocking(f_out,0); + buffer_f_in = f_in; } @@ -61,39 +61,42 @@ * ssh will clag up. Uggh. */ static void read_check(int f) { - int n; + int n; - if (f == -1) return; + if (f == -1) return; - if (read_buffer_len == 0) { - read_buffer_p = read_buffer; - } + if (read_buffer_len == 0) { + read_buffer_p = read_buffer; + } - if ((n=num_waiting(f)) <= 0) - return; + if ((n=num_waiting(f)) <= 0) + return; - /* things could deteriorate if we read in really small chunks */ - if (n < 10) n = 1024; + /* things could deteriorate if we read in really small chunks */ + if (n < 10) n = 1024; - if (read_buffer_p != read_buffer) { - memmove(read_buffer,read_buffer_p,read_buffer_len); - read_buffer_p = read_buffer; - } + if (n > MAX_READ_BUFFER/4) + n = MAX_READ_BUFFER/4; - if (n > (read_buffer_size - read_buffer_len)) { - read_buffer_size += n; - if (!read_buffer) - read_buffer = (char *)malloc(read_buffer_size); - else - read_buffer = (char *)realloc(read_buffer,read_buffer_size); - if (!read_buffer) out_of_memory("read check"); - read_buffer_p = read_buffer; - } + if (read_buffer_p != read_buffer) { + memmove(read_buffer,read_buffer_p,read_buffer_len); + read_buffer_p = read_buffer; + } - n = read(f,read_buffer+read_buffer_len,n); - if (n > 0) { - read_buffer_len += n; - } + if (n > (read_buffer_size - read_buffer_len)) { + read_buffer_size += n; + if (!read_buffer) + read_buffer = (char *)malloc(read_buffer_size); + else + read_buffer = (char *)realloc(read_buffer,read_buffer_size); + if (!read_buffer) out_of_memory("read check"); + read_buffer_p = read_buffer; + } + + n = read(f,read_buffer+read_buffer_len,n); + if (n > 0) { + read_buffer_len += n; + } } static time_t last_io; @@ -334,38 +337,40 @@ if (ret == -1) { - read_check(buffer_f_in); + if (read_buffer_len < MAX_READ_BUFFER) + read_check(buffer_f_in); - fd_count = fd+1; - FD_ZERO(&w_fds); - FD_ZERO(&r_fds); - FD_SET(fd,&w_fds); - if (buffer_f_in != -1) { - FD_SET(buffer_f_in,&r_fds); - if (buffer_f_in > fd) - fd_count = buffer_f_in+1; - } - - tv.tv_sec = BLOCKING_TIMEOUT; - tv.tv_usec = 0; - count = select(fd_count,buffer_f_in == -1? NULL: &r_fds, - &w_fds,NULL,&tv); - if (count == -1 && errno != EINTR) { - if (verbose > 1) - rprintf(FERROR,"select error: %s\n", strerror(errno)); - exit_cleanup(1); - } - - if (count == 0) { - check_timeout(); - continue; - } + fd_count = fd+1; + FD_ZERO(&w_fds); + FD_ZERO(&r_fds); + FD_SET(fd,&w_fds); + if (buffer_f_in != -1) { + FD_SET(buffer_f_in,&r_fds); + if (buffer_f_in > fd) + fd_count = buffer_f_in+1; + } + + tv.tv_sec = BLOCKING_TIMEOUT; + tv.tv_usec = 0; + count = select(fd_count,buffer_f_in == -1? NULL: &r_fds, + &w_fds,NULL,&tv); + + if (count == -1 && errno != EINTR) { + if (verbose > 1) + rprintf(FERROR,"select error: %s\n", strerror(errno)); + exit_cleanup(1); + } + + if (count == 0) { + check_timeout(); + continue; + } - if (FD_ISSET(fd, &w_fds)) { - got_select = 1; - } + if (FD_ISSET(fd, &w_fds)) { + got_select = 1; + } } else { - total += ret; + total += ret; } } diff -u -r --new-file --exclude=CVS rsync-2.0.7/main.c rsync-2.0.8/main.c --- rsync-2.0.7/main.c Sat May 16 15:26:28 1998 +++ rsync-2.0.8/main.c Mon May 18 01:18:40 1998 @@ -242,11 +242,15 @@ if ((pid=do_fork()) == 0) { + close(recv_pipe[0]); + if (f_in != f_out) close(f_out); recv_files(f_in,flist,local_name,recv_pipe[1]); if (am_daemon) report(-1); exit_cleanup(0); } + close(recv_pipe[1]); + if (f_in != f_out) close(f_in); generate_files(f_out,flist,local_name,recv_pipe[0]); waitpid(pid, &status, 0); @@ -499,6 +503,11 @@ if (am_daemon) { return daemon_main(); + } + + if (argc < 1) { + usage(FERROR); + exit(1); } if (dry_run) diff -u -r --new-file --exclude=CVS rsync-2.0.7/packaging/redhat/5.0/rsync.spec rsync-2.0.8/packaging/redhat/5.0/rsync.spec --- rsync-2.0.7/packaging/redhat/5.0/rsync.spec Sat May 16 15:38:31 1998 +++ rsync-2.0.8/packaging/redhat/5.0/rsync.spec Mon May 18 01:18:57 1998 @@ -1,12 +1,12 @@ Summary: Program for efficient remote updates of files. Name: rsync -Version: 2.0.7 +Version: 2.0.8 Release: 1 Copyright: GPL Group: Applications/Networking -Source: ftp://samba.anu.edu.au/pub/rsync/ +Source: ftp://samba.anu.edu.au/pub/rsync/rsync-2.0.8.tar.gz URL: http://samba.anu.edu.au/rsync/ -Packager: John H Terpstra +Packager: Andrew Tridgell BuildRoot: /tmp/rsync %description @@ -21,6 +21,9 @@ this package. %changelog +* Mon May 18 1998 Andrew Tridgell + reworked for auto-building when I release rsync (tridge@samba.anu.edu.au) + * Sat May 16 1998 John H Terpstra Upgraded to Rsync 2.0.6 -new feature anonymous rsync @@ -57,8 +60,6 @@ ./configure --prefix=/usr make CFLAGS=$RPM_OPT_FLAGS strip rsync -latex tech_report -dvips tech_report -o %install mkdir -p $RPM_BUILD_ROOT/usr/{bin,man/{man1,man5}} @@ -73,7 +74,6 @@ %attr(-,root,root) /usr/bin/rsync %attr(-,root,root) /usr/man/man1/rsync.1 %attr(-,root,root) /usr/man/man5/rsyncd.conf.5 -%attr(-,root,root) %doc tech_report.ps %attr(-,root,root) %doc tech_report.tex %attr(-,root,root) %doc README %attr(-,root,root) %doc COPYING diff -u -r --new-file --exclude=CVS rsync-2.0.7/packaging/redhat/5.0/rsync.spec.tmpl rsync-2.0.8/packaging/redhat/5.0/rsync.spec.tmpl --- rsync-2.0.7/packaging/redhat/5.0/rsync.spec.tmpl Sat May 16 15:35:25 1998 +++ rsync-2.0.8/packaging/redhat/5.0/rsync.spec.tmpl Mon May 18 01:10:21 1998 @@ -4,9 +4,9 @@ Release: PRELEASE Copyright: GPL Group: Applications/Networking -Source: ftp://samba.anu.edu.au/pub/rsync/ +Source: ftp://samba.anu.edu.au/pub/rsync/rsync-PVERSION.tar.gz URL: http://samba.anu.edu.au/rsync/ -Packager: John H Terpstra +Packager: Andrew Tridgell BuildRoot: /tmp/rsync %description @@ -21,6 +21,9 @@ this package. %changelog +* Mon May 18 1998 Andrew Tridgell + reworked for auto-building when I release rsync (tridge@samba.anu.edu.au) + * Sat May 16 1998 John H Terpstra Upgraded to Rsync 2.0.6 -new feature anonymous rsync @@ -57,8 +60,6 @@ ./configure --prefix=/usr make CFLAGS=$RPM_OPT_FLAGS strip rsync -latex tech_report -dvips tech_report -o %install mkdir -p $RPM_BUILD_ROOT/usr/{bin,man/{man1,man5}} @@ -73,7 +74,6 @@ %attr(-,root,root) /usr/bin/rsync %attr(-,root,root) /usr/man/man1/rsync.1 %attr(-,root,root) /usr/man/man5/rsyncd.conf.5 -%attr(-,root,root) %doc tech_report.ps %attr(-,root,root) %doc tech_report.tex %attr(-,root,root) %doc README %attr(-,root,root) %doc COPYING diff -u -r --new-file --exclude=CVS rsync-2.0.7/proto.h rsync-2.0.8/proto.h --- rsync-2.0.7/proto.h Sat May 16 00:10:48 1998 +++ rsync-2.0.8/proto.h Mon May 18 00:57:20 1998 @@ -2,7 +2,7 @@ int allow_access(char *addr, char *host, char *allow_list, char *deny_list); void generate_hash(char *in, char *challenge, char *out); -int auth_server(int fd, int module, char *addr, char *leader); +char *auth_server(int fd, int module, char *addr, char *leader); void auth_client(int fd, char *user, char *challenge); uint32 get_checksum1(char *buf1,int len); void get_checksum2(char *buf,int len,char *sum); diff -u -r --new-file --exclude=CVS rsync-2.0.7/rsync.h rsync-2.0.8/rsync.h --- rsync-2.0.7/rsync.h Fri May 15 17:35:41 1998 +++ rsync-2.0.8/rsync.h Mon May 18 00:57:20 1998 @@ -52,6 +52,7 @@ #define CHUNK_SIZE (32*1024) #define MAX_MAP_SIZE (4*1024*1024) #define IO_BUFFER_SIZE (4096) +#define MAX_READ_BUFFER (1024*1024) #define MAX_ARGS 1000 diff -u -r --new-file --exclude=CVS rsync-2.0.7/version.h rsync-2.0.8/version.h --- rsync-2.0.7/version.h Sat May 16 15:38:29 1998 +++ rsync-2.0.8/version.h Mon May 18 01:18:55 1998 @@ -1 +1 @@ -#define VERSION "2.0.7" +#define VERSION "2.0.8"