There is a stupid error in patchfile davfs2-1.4.6-system.diff which was
submitted by me. Please don't use it.
Appended is the corrected patchfile davfs2-1.4.6-system-2.diff.

Werner
diff -ur davfs2-1.4.6/ChangeLog davfs2-1.4.6.new/ChangeLog
--- davfs2-1.4.6/ChangeLog	2010-04-30 21:17:15.000000000 +0200
+++ davfs2-1.4.6.new/ChangeLog	2013-09-15 11:05:42.000000000 +0200
@@ -1,6 +1,11 @@
 ChangeLog for davfs2
 --------------------
 
+2013-09-08 Werner Baumann (werner.baum...@onlinehome.de)
+    * kernel_interface.c, mount_davfs.c:
+      Don't create /dev/coda and /dev/fuse.
+      Remove insecure calls of system().
+
 2010-04-30 Werner Baumann (werner.baum...@onlinehome.de)
     * Released version 1.4.6
 
diff -ur davfs2-1.4.6/src/kernel_interface.c davfs2-1.4.6.new/src/kernel_interface.c
--- davfs2-1.4.6/src/kernel_interface.c	2010-02-16 20:29:54.000000000 +0100
+++ davfs2-1.4.6.new/src/kernel_interface.c	2013-09-25 20:24:05.000000000 +0200
@@ -168,27 +168,6 @@
     }
 
     if (*dev <= 0) {
-        system("/sbin/modprobe coda &>/dev/null");
-        minor = 0;
-        while (*dev <= 0 && minor < MAX_CODADEVS) {
-            char *path;
-            if (asprintf(&path, "%s/%s%i",
-                         DAV_DEV_DIR, CODA_DEV_NAME, minor) < 0)
-                abort();
-            *dev = open(path, O_RDWR | O_NONBLOCK);
-            if (*dev <= 0) {
-                if (mknod(path, S_IFCHR, makedev(CODA_MAJOR, minor)) == 0) {
-                    chown(path, 0, 0);
-                    chmod(path, S_IRUSR | S_IWUSR);
-                    *dev = open(path, O_RDWR | O_NONBLOCK);
-                }
-            }
-            free(path);
-            ++minor;
-        }
-    }
-
-    if (*dev <= 0) {
         error(0, 0, _("no free coda device to mount"));
         return -1;
     }
@@ -223,18 +202,6 @@
             abort();
 
     *dev = open(path, O_RDWR | O_NONBLOCK);
-    if (*dev <= 0) {
-        system("/sbin/modprobe fuse &>/dev/null");
-        *dev = open(path, O_RDWR | O_NONBLOCK);
-    }
-    if (*dev <= 0) {
-        if (mknod(path, S_IFCHR, makedev(FUSE_MAJOR, FUSE_MINOR)) == 0) {
-            chown(path, 0, 0);
-            chmod(path, S_IRUSR | S_IWUSR);
-            *dev = open(path, O_RDWR | O_NONBLOCK);
-        }
-    }
-
     free(path);
     if (*dev <= 0) {
         error(0, 0, _("can't open fuse device"));
diff -ur davfs2-1.4.6/src/mount_davfs.c davfs2-1.4.6.new/src/mount_davfs.c
--- davfs2-1.4.6/src/mount_davfs.c	2010-01-21 19:50:15.000000000 +0100
+++ davfs2-1.4.6.new/src/mount_davfs.c	2013-09-15 11:13:18.000000000 +0200
@@ -170,6 +170,9 @@
 static int
 arg_to_int(const char *arg, int base, const char *opt);
 
+static void
+cp_file(const char *src, const char *dest);
+
 static int
 debug_opts(const char *s);
 
@@ -533,10 +536,7 @@
             char *file_name = ne_concat(path, "/", DAV_CONFIG, NULL);
             if (access(file_name, F_OK) != 0) {
                 char *template = ne_concat(DAV_DATA_DIR, "/", DAV_CONFIG, NULL);
-                char *command = ne_concat("cp ", template, " ", file_name,
-                                          NULL);
-                system(command);
-                free(command);
+                cp_file(template, file_name);
                 free(template);
             }
             free(file_name);
@@ -545,11 +545,7 @@
             if (access(file_name, F_OK) != 0) {
                 char *template = ne_concat(DAV_DATA_DIR, "/", DAV_SECRETS,
                                            NULL);
-                char *command = ne_concat("cp ", template, " ", file_name,
-                                          NULL);
-                if (system(command) == 0)
-                    chmod(file_name, S_IRUSR | S_IWUSR);
-                free(command);
+                cp_file(template, file_name);
                 free(template);
             }
             free(file_name);
@@ -1333,6 +1329,34 @@
 }
 
 
+/* Creates a copy of src with name dest. */
+static void
+cp_file(const char *src, const char *dest)
+{
+    FILE *in = fopen(src, "r");
+    if (!in)
+        error(EXIT_FAILURE, errno, _("can't open file %s"), src);
+
+    FILE *out = fopen(dest, "w");
+    if (!out)
+        error(EXIT_FAILURE, errno, _("can't open file %s"), dest);
+
+    size_t n = 0;
+    char *line = NULL;
+    int length = getline(&line, &n, in);
+    while (length > 0) {
+        if (fputs(line, out) == EOF) 
+            error(EXIT_FAILURE, errno, _("error writing to file %s"), dest);
+        length = getline(&line, &n, in);
+    }
+
+    if (line)
+        free(line);
+    fclose(out);
+    fclose(in);
+}
+
+
 /* Converts a debug option string s into numerical value. If s is not a
    valid debug option, it returns 0. */
 static int

Reply via email to