Re: [Bug 2583] rsync fails with authentication failure

2005-04-09 Thread Vidar Madsen
Quoting the comment from the bugtracker;

 --- Additional Comments From [EMAIL PROTECTED]  2005-04-09 11:19 ---
 Serendipitously, you'll be glad to know that I just finished checking in some
 changes to the authorization code that makes it log the reason for why the
 authorization failed (e.g. unauthorized user, missing secret for user, 
 password
 mismatch).

Is that really a good idea? At least, please make that optional, as
I'm not too keen on revealing to a potential attacker if certain
usernames are valid or not. (Or will this be logged on the server side
only? If so, I'm all for it. :)

Vidar
-- 
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Re: patch for replacing non-printable chars in filenames

2005-04-01 Thread Vidar Madsen
Hi.

 After trying this a bit, I now think it would read better to use 3-digit
 octal escaping.

I would be perfectly fine with that. And octal is probably more in the
line of how escaping is traditionally done. As long as I can process
the files in the log, I'm all for it.

Btw, will this change make it into a later rsync version (2.4.7?) ? I
would rather not depend on using a custom patched rsync, but if it
will become a standard feature at some point it feels less hacky. ;)

Anyway, thanks. :)

Vidar
-- 
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Re: patch for replacing non-printable chars in filenames

2005-03-31 Thread Vidar Madsen
Hi.

Sorry about picking up a rather ancient thread, but this didn't bite
me until now (when I upgraded to 2.6.4);

Wayne wrote:
 I've also checked
 in an improvement to safe_fname() that makes it use isprint() (instead
 of just looking for newlines).

Is there a chance that this feature will become selectable? I have
some scripts that rely on a specially formatted log (made with
--log-format) to do some post-processing after (or during) the
transfer, and these now fail, since several files (whose names contain
non-ascii chars) might be squashed into the same string.

Alternatively, how about escaping the chars instead of just munging
them? I.e. output files like two-line\x0afile name or P\xe5ske
(norwegian for easter, for the curious;), or something like that?

Vidar
-- 
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Re: patch for replacing non-printable chars in filenames

2005-03-31 Thread Vidar Madsen
Oops, I should have added that for isprint() (in safe_fname()) to be
locale-aware at all, you need to add a call to setlocale(LC_CTYPE,
).

Vidar
-- 
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Some files not logged when using --compare-dest. Bug?

2005-03-31 Thread Vidar Madsen
Hi again.

I just spotted another peculiarity when inspecting the rsync log. When
using --compare-dest, source files that have permissions that differ
from the comparables are not logged, unless you're using -i.

Here's a testing session:

  $ ls -lR
  .:
  total 12
  drwxr-xr-x  2 vidar users 4096 2005-03-31 14:16 cmp/
  drwxr-xr-x  2 vidar users 4096 2005-03-31 14:23 dst/
  drwxr-xr-x  2 vidar users 4096 2005-03-31 14:16 src/
  
  ./cmp:
  total 4
  -rwxr-xr-x  1 vidar users 17 2005-03-31 14:16 slackware-version*
  
  ./dst:
  total 0
  
  ./src:
  total 4
  -rw-r--r--  1 vidar users 17 2005-03-31 14:16 slackware-version

Note the permissions; the cmp file has been chmodded a+x.

  $ rsync -av --compare-dest=../cmp src/ dst/ 
  building file list ... done
  ./

  sent 115 bytes  received 32 bytes  294.00 bytes/sec
  total size is 17  speedup is 0.12
  $ ls -l dst
  total 4
  -rw-r--r--  1 vidar users 17 2005-03-31 14:16 slackware-version

So the file was copied despite not being listed

  $ rm dst/slackware-version 
  $ rsync -avi --compare-dest=../cmp src/ dst/ 
  building file list ... done
  .d..t ./
  .f...p... slackware-version
  
  sent 115 bytes  received 32 bytes  294.00 bytes/sec
  total size is 17  speedup is 0.12
  $ 

The same behaviour can be seen when using --log-format instead of -v;
if there's an %i present, everything is logged correctly, but
without, files with different permissions are silently left out.

Vidar
-- 
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Re: Multiple --compare-dest args again

2004-06-23 Thread Vidar Madsen
Thanks for your comments. :)

I'll throw in another usage example, while I'm at it. I have several
machines, all of which I'm backup with rsync. When I upgrade or
install something, it will usually be done on all the machines, as
they are supposed to be somewhat identical.

What I'd like to do is this;
  rsync --link-dest=machine1 --link-dest=machine2 ...
rsync://machine3/.../ machine3/

This will, in many cases, save the transfer of all the changes files.
As soon as machine1 is backed up, the rest will get a match on the
hardlink. (This will also speed up the first and initial backup, by
the way. All machines but the first would be hardlink almost in its
entirety.)

Anyway, thanks again for yours comments. Maybe the patch is really not
necessary, but it would save me a lot of post-processing. :)
(Currently I have a script that scans the backups for files to
hardlink, a rather lengthy process.)

Yours,
Vidar
-- 
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Multiple --compare-dest args again

2004-06-22 Thread Vidar Madsen
Hi all.

A while ago (April 15th or so) I posted a patch that allows rsync to
take multiple --compare-dest or --link-dest arguments, allowing
fetching of files not present in multiple trees. I never got any
feedback on it, though, so I'm picking it up again. :) Is there any
interest in such a patch at all?

Below is the usage example i outlined back then;

--start--
[...] Its primary usage is to do incremental
backups on top of eachother. (My current backup system stores each
incremental as a set of files that differ from the latest full.) 

Example:

  First full backup:
  rsync -a somedir full-20040415/

  First incremental:
  rsync -a --compare-dest=../full-20040415 \
somedir incr-20040416/

  Second incremental, on top of first:
  rsync -a --compare-dest=../incr-20040416 --compare-dest=../full-20040415
somedir incr-20040417/

(The args must be given in the correct order; Latest incremental first,
last resort last.)

It scratches my itch, at least. Perhaps it can be of use to others as
well. :)
--end--

I'll skip attaching the patch for now, as I haven't updated it to fit
CVS, but I'll update it should there be any interest.

Yours,
Vidar
-- 
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Daemon + ipv6 bug report

2004-06-06 Thread Vidar Madsen

Hi all.

I'm just reporting some strange (fatal) behaviour when running
rsync --daemon on an IPv6-enabled box. It gets a fatal error
when trying to bind to the same address twice.

strace output:

bind(4, {sa_family=AF_INET6, sin6_port=htons(873), inet_pton(AF_INET6, ::, 
sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 0
bind(5, {sa_family=AF_INET, sin_port=htons(873), sin_addr=inet_addr(0.0.0.0)}, 16) = 0
listen(4, 5)= 0
listen(5, 5)= -1 EADDRINUSE (Address already in use)

The workaround is very simple; use --address 0.0.0.0 (or ::) to keep it
from binding twice.

Thanks,
Vidar

-- 
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Daemon and IPv6 bug report

2004-06-06 Thread Vidar Madsen

Hi all.

I'm just reporting some strange (fatal) behaviour when running
rsync --daemon on an IPv6-enabled box. It gets a fatal error
when trying to bind to the same address twice.

strace output:

bind(4, {sa_family=AF_INET6, sin6_port=htons(873), inet_pton(AF_INET6, ::, 
sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 0
bind(5, {sa_family=AF_INET, sin_port=htons(873), sin_addr=inet_addr(0.0.0.0)}, 16) = 0
listen(4, 5)= 0
listen(5, 5)= -1 EADDRINUSE (Address already in use)

The workaround is very simple; use --address 0.0.0.0 (or ::) to keep it
from binding twice.

Thanks,
Vidar

-- 
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Oops, sorry

2004-06-06 Thread Vidar Madsen

Sorry about the double post.

I got an error on the first one (something about an invalid Subject field,
in Spanish, no less), but I realized after sending it again that the error
came from one of the other recipients on the list, not from the list
server.

Vidar
-- 
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Multiple compare-dest args

2004-04-15 Thread Vidar Madsen

Hi all.

I have just finished a small patch that adds support for multiple
--compare-dest or --link-dest args. Its primary usage is to do incremental
backups on top of eachother. (My current backup system stores each
incremental as a single diff of the latest full.) 

Example:

  First full backup:
  rsync -a somedir full-20040415/

  First incremental:
  rsync -a --compare-dest=../full-20040415 \
somedir incr-20040416/

  Second incremental, on top of first:
  rsync -a --compare-dest=../incr-20040416 --compare-dest=../full-20040415
somedir incr-20040417/

The args must be given in the correct order; Latest incremental first,
last resort last.

It scratches my itch, at least. Perhaps it can be of use to others as
well. :)

Vidar

diff -ru rsync-2.6.1pre-1/generator.c rsync-2.6.1pre-1-vidar/generator.c
--- rsync-2.6.1pre-1/generator.c2004-03-07 21:29:59.0 +0100
+++ rsync-2.6.1pre-1-vidar/generator.c  2004-04-15 11:23:17.0 +0200
@@ -41,7 +41,7 @@
 extern int io_timeout;
 extern int protocol_version;
 extern int always_checksum;
-extern char *compare_dest;
+extern char *compare_dest[];
 extern int link_dest;
 
 
@@ -69,13 +69,13 @@
if (always_checksum  S_ISREG(st-st_mode)) {
char sum[MD4_SUM_LENGTH];
char fnamecmpdest[MAXPATHLEN];
+   int i = 0;
 
-   if (compare_dest != NULL) {
-   if (access(fname, 0) != 0) {
-   pathjoin(fnamecmpdest, sizeof fnamecmpdest,
-compare_dest, fname);
-   fname = fnamecmpdest;
-   }
+   while ((access(fname, 0) != 0)  compare_dest[i] != NULL) {
+   pathjoin(fnamecmpdest, sizeof fnamecmpdest,
+   compare_dest[i], fname);
+   fname = fnamecmpdest;
+   i++;
}
file_checksum(fname,sum,st-st_size);
return memcmp(sum, file-u.sum, protocol_version  21 ? 2
@@ -270,7 +270,7 @@
int statret;
char *fnamecmp;
char fnamecmpbuf[MAXPATHLEN];
-   extern char *compare_dest;
+   extern char *compare_dest[];
extern int list_only;
extern int only_existing;
extern int orig_umask;
@@ -408,11 +408,15 @@
 
fnamecmp = fname;
 
-   if (statret == -1  compare_dest != NULL) {
+   if (statret == -1  compare_dest[0] != NULL) {
/* try the file at compare_dest instead */
int saveerrno = errno;
-   pathjoin(fnamecmpbuf, sizeof fnamecmpbuf, compare_dest, fname);
-   statret = link_stat(fnamecmpbuf,st);
+   int i = 0;
+   while (statret == -1  compare_dest[i] != NULL) {
+   pathjoin(fnamecmpbuf, sizeof fnamecmpbuf, compare_dest[i], 
fname);
+   statret = link_stat(fnamecmpbuf,st);
+   i++;
+   }
if (!S_ISREG(st.st_mode))
statret = -1;
if (statret == -1)
Only in rsync-2.6.1pre-1-vidar/lib: dummy
diff -ru rsync-2.6.1pre-1/options.c rsync-2.6.1pre-1-vidar/options.c
--- rsync-2.6.1pre-1/options.c  2004-02-22 09:56:43.0 +0100
+++ rsync-2.6.1pre-1-vidar/options.c2004-04-15 11:29:35.0 +0200
@@ -112,7 +112,8 @@
 
 char *backup_suffix = NULL;
 char *tmpdir = NULL;
-char *compare_dest = NULL;
+char *compare_dest[MAX_COMP_DEST+1];
+int num_comp_dest = 0;
 char *config_file = NULL;
 char *shell_cmd = NULL;
 char *log_format = NULL;
@@ -301,7 +302,7 @@
 }
 
 enum {OPT_VERSION = 1000, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
-  OPT_DELETE_AFTER, OPT_DELETE_EXCLUDED, OPT_LINK_DEST,
+  OPT_DELETE_AFTER, OPT_DELETE_EXCLUDED, OPT_COMPARE_DEST, OPT_LINK_DEST,
   OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW,
   OPT_READ_BATCH, OPT_WRITE_BATCH,
   OPT_REFUSED_BASE = 9000};
@@ -358,7 +359,7 @@
   {max-delete,   0,  POPT_ARG_INT,max_delete, 0, 0, 0 },
   {timeout,  0,  POPT_ARG_INT,io_timeout, 0, 0, 0 },
   {temp-dir,'T', POPT_ARG_STRING, tmpdir, 0, 0, 0 },
-  {compare-dest, 0,  POPT_ARG_STRING, compare_dest, 0, 0, 0 },
+  {compare-dest, 0,  POPT_ARG_STRING, 0, 
OPT_COMPARE_DEST, 0, 0 },
   {link-dest,0,  POPT_ARG_STRING, 0,  OPT_LINK_DEST, 0, 0 },
   /* TODO: Should this take an optional int giving the compression level? */
   {compress,'z', POPT_ARG_NONE,   do_compression, 0, 0, 0 },
@@ -564,9 +565,31 @@
checksum_seed = FIXED_CHECKSUM_SEED;
break;
 
+   case OPT_COMPARE_DEST:
+#if HAVE_LINK
+   if (num_comp_dest = MAX_COMP_DEST-1) {
+   rprintf(FERROR, ERROR: %s\n, too many 
--compare-dest args given);
+