Sophie

Sophie

distrib > Mandriva > 2009.0 > i586 > by-pkgid > fe8d566fa3bebb74f68f8791eb6a5877 > files > 7

davfs-0.2.4-13.3mdv2009.0.src.rpm

--- davfs-0.2.4/mount/mount.davfs.c.pix	2002-08-13 21:47:14.000000000 +0200
+++ davfs-0.2.4/mount/mount.davfs.c	2002-08-13 22:16:59.000000000 +0200
@@ -234,7 +234,16 @@
     int c, array_size;
     extern char *optarg;
     extern int optind, opterr, optopt;
+    struct passwd *passwd;
+    struct group *group;
     
+    /* url */
+    strcpy( buf, url );
+    if(*(buf+strlen(buf)-1)!='/') 
+      strcat(buf, "/");
+    strcpy( url, buf );
+    mount_parseurl( buf, in_clargs );
+
     /* mount point */
     if(argv[2]) 
       strcpy(in_clargs->mpoint, argv[2]);
@@ -277,17 +286,34 @@
  	   strcpy( in_clargs->amode, "r" );
        }
        else {
- 	 if( !strcmp( optname, "host" ) ) {
+	 /*
+	 if( !strcmp( optname, "host" ) ) {
  	    strcpy( buf, optvalue );
  	    if(*(buf+strlen(buf)-1)!='/') 
  	      strcat(buf, "/");
  	    strcpy( url, buf );
  	    mount_parseurl( buf, in_clargs );
- 	 }
- 	 if( !strcmp( optname, "user" ) )
+	 }
+	 */
+ 	 if( !strcmp( optname, "username" ) )
  	   strcpy( in_clargs->id, optvalue );
- 	 if( !strcmp( optname, "pass" ) )
+ 	 if( !strcmp( optname, "password" ) )
  	   strcpy( in_clargs->pass, optvalue );
+ 	 if( !strcmp( optname, "proxy" ) )
+ 	   strcpy( in_clargs->proxy, optvalue );
+
+ 	 if( !strcmp( optname, "U" ) ) {    /* Grant option */
+	   passwd = getpwnam(optarg);
+	   if(passwd) {
+	     in_clargs->uid = passwd->pw_uid;
+	   }      
+	 }
+ 	 if( !strcmp( optname, "G" ) ) {    /* Grant option */
+	   group = getgrnam(optarg);
+	   if(group) {
+	     in_clargs->gid = group->gr_gid;
+	   }      
+	 }
        }
     }
     dprintf("Parsed Args: url=%s host=%s, path=%s, local_mountpoint=%s, amode=%s, port=%d\n", 
@@ -549,7 +575,6 @@
     exit(1);
   }
 
-#ifndef AUTOFS
   strcpy(url, argv[1]);
   
   /* add end slash */
@@ -558,6 +583,7 @@
   
   memset(&data, 0, sizeof(data));
   
+#ifndef AUTOFS
   if ((ret = parse_args(argc, argv, &data))) {
 		  fprintf(stderr, "ERROR: problem parsing cmdline args\n");
 		  return (ret);