On Wed, May 04, 2005 at 11:41:38PM +0000, Luciano Bello wrote:
> Sorry, but where do you put the patch?
> 
> The upstream is working on it and have a solution in the CVS. I just
> want to offer him your solution.
Forgot to attach the patch, sorry. BTW would you accept another patch
that additionally to the 2.6 version also builds against kernel 2.4
headers (and coda), so that it can work with old kernels? Would close
303533.
Cheers,
 -- Guido
diff -u -Naur bla/davfs2-0.2.3/src/mount.c davfs2-0.2.3/src/mount.c
--- bla/davfs2-0.2.3/src/mount.c        2004-11-02 06:45:26.000000000 +0100
+++ davfs2-0.2.3/src/mount.c    2005-04-30 19:15:38.000000000 +0200
@@ -276,6 +276,34 @@
     return dav_delete_mtab(mopt->dev);
 }
 
+int parse_env(dav_mount_opt *mopt)
+{
+    char *p;
+
+    if( (p=getenv("USER")) ) {
+       mopt->password = ne_strdup(p);
+    }
+    if( (p=getenv("PASSWD")) ) {
+       mopt->password = ne_strdup(p);
+    }
+    if( (p=getenv("http_proxy")) ) {
+       
+       if(!strncmp("http://",p,7)) {
+               char *port_str;
+               p=&(p[7]); // Skip http://
+               if((port_str = strchr(p, ':'))) 
+                   *port_str++ = 0;
+       
+               mopt->proxy_host = ne_strdup(p);
+               if(port_str)
+                   mopt->proxy_port = atoi(port_str);
+               else
+                   mopt->proxy_port = DEFAULT_PROXY_PORT;
+       }
+    }
+    return OK;
+}
+
 #include <getopt.h>
 
 int parse_args(int argc, char *argv[], 
@@ -334,7 +362,13 @@
 
     /* Clear mopt */
     memset(mopt, 0x00, sizeof(*mopt));
-    
+   
+    if (parse_env(mopt) != OK) {
+       usage(argv[0]);
+       printf("Error parsing environment\n");
+       return dav_mount_exit(DAV_E_WRARG);
+    }
+
     if (parse_args(argc, argv, mopt)!=OK) {
        usage(argv[0]);
        return dav_mount_exit(DAV_E_WRARG);

Reply via email to