patch for plain tcp connection(for rdiff 1.0.4)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

patch for plain tcp connection(for rdiff 1.0.4)

gogu-2

Hi
I want that rdiff-backup connects direcly to a remote server using TCP
so since this is not supported on client side I did a small patch(below)
On remote side just use inetd/xinetd/whatever like this:

#cat /etc/xinetd.d/rdiff-backup
service rdiff-backup
{
         socket_type     = stream
         protocol        = tcp
         wait            = no
         user            = root
         only_from       = 192.168.0.34
         server          = /usr/bin/rdiff-backup
         server_args     = --server --restrict-read-only /
         port            = 499
         disable         = no
         bind            = 192.168.0.1
}

on local side:
# rdiff-backup  --remote-schema "tcp:%s:499" 192.168.0.1::/etc backups/etc

if remote-schema do not start with tcp: then behaviour is unchaged

and the patch:
  diff -u SetConnections.py_bak  SetConnections.py
--- SetConnections.py_bak       2006-03-08 14:02:31.000000000 +0200
+++ SetConnections.py   2006-03-08 17:29:22.000000000 +0200
@@ -25,7 +25,7 @@

  """

-import os, sys
+import os, sys, socket
  from log import Log
  import Globals, connection, rpath

@@ -129,7 +129,15 @@
         if not remote_cmd: return Globals.local_connection

         Log("Executing " + remote_cmd, 4)
-       stdin, stdout = os.popen2(remote_cmd)
+       a = remote_cmd.split(':')
+       if a[0] == "tcp":
+               s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+               s.connect((a[1], int(a[2])))
+               stdin = stdout = s.makefile()
+               s.close
+       else:
+               stdin, stdout = os.popen2(remote_cmd)
+
         conn_number = len(Globals.connections)
         conn = connection.PipeConnection(stdout, stdin, conn_number)



catam


_______________________________________________
rdiff-backup-users mailing list at [hidden email]
http://lists.nongnu.org/mailman/listinfo/rdiff-backup-users
Wiki URL: http://rdiff-backup.solutionsfirst.com.au/index.php/RdiffBackupWiki
Reply | Threaded
Open this post in threaded view
|

Re: patch for plain tcp connection(for rdiff 1.0.4)

dean gaudet-4
On Wed, 8 Mar 2006, catam wrote:

> on local side:
> # rdiff-backup  --remote-schema "tcp:%s:499" 192.168.0.1::/etc backups/etc

you could use netcat or similar tool...

-dean


_______________________________________________
rdiff-backup-users mailing list at [hidden email]
http://lists.nongnu.org/mailman/listinfo/rdiff-backup-users
Wiki URL: http://rdiff-backup.solutionsfirst.com.au/index.php/RdiffBackupWiki