Bug#307096: davfs2: parse environment for password, username and proxy
On Wed, May 04, 2005 at 11:41:38PM +, 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.c2004-11-02 06:45:26.0 +0100 +++ davfs2-0.2.3/src/mount.c2005-04-30 19:15:38.0 +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);
Bug#307096: davfs2: parse environment for password, username and proxy
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. Thx for your contribution. -- Luciano Bello luciano at linux dot org.ar Linux Argetina signature.asc Description: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada digitalmente
Bug#307096: davfs2: parse environment for password, username and proxy
Package: davfs2 Version: 0.2.3-1 Severity: wishlist Tags: patch Hi, attached patch parses the environment for $USER,$PASSWD (like e.g. mount.{smbfs,cifs} does) and uses these values as default (can still be overridden on the command line of course). This solves the problem of the password being visible via (ps awux). Additionally http_proxy is parsed for a proxy, this variable is used by wget, w3m, etc and is pretty much standard. Does the patch look o.k.? -- Guido -- System Information: Debian Release: 3.1 APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: powerpc (ppc) Kernel: Linux 2.6.11.6-agx0 Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Versions of packages davfs2 depends on: ii libc6 2.3.2.ds1-21 GNU C Library: Shared libraries an ii libneon24 0.24.7.dfsg-1 An HTTP and WebDAV client library ii libssl0.9.70.9.7e-3 SSL shared libraries ii libxml22.6.16-7 GNOME XML library ii zlib1g 1:1.2.2-4 compression library - runtime -- no debconf information -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]