[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fyi: FW: ports/3926: Patch FIX for Rsync 2.6.2: mknod can't creat e FIFO's and socks



fyi:

Best Wolfgang Anger

> -----Original Message-----
> From: owner-bugs_(_at_)_openbsd_(_dot_)_org [mailto:owner-bugs_(_at_)_openbsd_(_dot_)_org]
> On Behalf Of Anger, Wolfgang
> Sent: Tuesday, September 14, 2004 5:24 PM
> To: bugs_(_at_)_cvs_(_dot_)_openbsd_(_dot_)_org
> Cc: Anger, Wolfgang
> Subject: ports/3926: Patch FIX for Rsync 2.6.2: mknod can't 
> create FIFO's and socks
>Release:        rsync 2.6.2p1
>Environment:
        System      : OpenBSD 3.5 stabel
        Architecture: OpenBSD.i386
        Machine     : i386
>Description:
rsync can't create FIFO's and socks via mknod 
>How-To-Repeat:
rsync a dir with fifo and a socket
			Example:
			mkfifo /tmp/fifo
			root:/var/cron/tabs:40# ls -atlr .sock                                                                       
			srw-rw----  1 root  crontab  0 Sep 14 05:16 .sock=
			root:/var/cron/tabs:41#
 			rsync -avvv /var/cron/tabs /tmp/fifo /tmp/output/
			and you get a error like thes: mknod tmp/fifo : Invalid argument

>Fix:
add the patches to the rsync prot (testet on i386): root:/usr/ports/net/rsync/patches:6# cat patch-syscall.c # # enable copying of fifos/sockets #  <http://lists.samba.org/archive/rsync/2002-June/002966.html>
#  <http://www.freebsd.org/cgi/query-pr.cgi?pr=59814>
#
--- syscall.c.orig      Wed Feb 18 23:33:21 2004
+++ syscall.c   Tue Aug 24 17:56:25 2004
@@ -76,6 +76,31 @@
 {
        if (dry_run) return 0;
        RETURN_ERROR_IF_RO_OR_LO;
+#if HAVE_MKFIFO
+       if (S_ISFIFO(mode))
+               return mkfifo(pathname, mode);
+#endif
+#if HAVE_SYS_UN_H
+       if (S_ISSOCK(mode)) {
+               int fd;
+               struct sockaddr_un *su;
+               size_t len;
+               if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) == -1)
+                       return -1;
+               unlink(pathname);
+               len = sizeof(*su) - sizeof(su->sun_path) + strlen(pathname);
+               if ((su = calloc(1, len + 1)) == NULL)
+                       return -1;
+               su->sun_len = len;
+               su->sun_family = AF_UNIX;
+               strcpy(su->sun_path, pathname);
+               if (bind(fd, (const struct sockaddr *)su, len) < 0)
+                       return -1;
+               free(su);
+               close(fd);
+               return do_chmod(pathname, mode);
+       }
+#endif
        return mknod(pathname, mode, dev);
 }
 #endif

root:/usr/ports/net/rsync/patches:7# cat patch-rsync.h
#
# enable copying of fifos/sockets
#  <http://lists.samba.org/archive/rsync/2002-June/002966.html>
#  <http://www.freebsd.org/cgi/query-pr.cgi?pr=59814>
#
--- rsync.h.orig        Tue Aug 24 16:37:59 2004
+++ rsync.h     Tue Aug 24 16:38:28 2004
@@ -156,6 +156,10 @@
 #include <sys/socket.h>
 #endif
 
+#ifdef HAVE_SYS_UN_H
+#include <sys/un.h>
+#endif
+
 #ifdef HAVE_STRING_H
 #include <string.h>
 #endif

root:/usr/ports/net/rsync/patches:8# 


>Release-Note:
>Audit-Trail:
>Unformatted: