Hello Autofs Developers,

Here is a small patch i fixed up while trying to make autofs mount smb 
shares. It fixes two things:

  * autofs inability to recognize smb //server/share references (by 
Nicholas J. Leon <[EMAIL PROTECTED]>)
  * Escaping whitespaces in the entry core

I hope this will be of some use. Certainly I can now make automounts to 
shares with spaces in their names with smbfs 2.0.7 and autofs 3.1.4.

Yours Curne
--
!knihT
Curne
diff -ru autofs-3.1.4.orig/modules/mount_generic.c autofs-3.1.4/modules/mount_generic.c
--- autofs-3.1.4.orig/modules/mount_generic.c   Fri Jan 21 20:08:09 2000
+++ autofs-3.1.4/modules/mount_generic.c        Sat Jan 13 17:03:29 2001
@@ -31,6 +31,23 @@
 #define MODPREFIX "mount(generic): "
 int mount_version = AUTOFS_MOUNT_VERSION; /* Required by protocol */
 
+/* Copies a string eliminating '\\' chars */
+char *copyunescaped (char *st)
+{
+  char * temp;
+  char * tempp;
+  temp = malloc (strlen (st));
+  tempp = temp;
+  do {
+    if (*st == '\\') 
+      st++;
+    *tempp = *st;
+    st++;
+    tempp++;
+  } while (*st);
+  return temp;
+}
+
 int mount_init(void **context)
 {
   return 0;
@@ -55,17 +72,19 @@
     syslog(LOG_NOTICE, MODPREFIX "mkdir %s failed: %m", name);
     return 1;
   }
-    
+  
+  whatmark = copyunescaped(what);
+
   if ( options ) {
     syslog(LOG_DEBUG, MODPREFIX "calling mount -t %s " SLOPPY "-o %s %s %s",
-          fstype, options, what, fullpath);
+          fstype, options, whatmark, fullpath);
     err = spawnl(LOG_NOTICE, PATH_MOUNT, PATH_MOUNT, "-t", fstype,
-                SLOPPYOPT "-o", options, what, fullpath, NULL);
+                SLOPPYOPT "-o", options, whatmark, fullpath, NULL);
   } else {
     syslog(LOG_DEBUG, MODPREFIX "calling mount -t %s %s %s",
-          fstype, what, fullpath);
+          fstype, whatmark, fullpath);
       err = spawnl(LOG_NOTICE, PATH_MOUNT, PATH_MOUNT, "-t", fstype,
-                  what, fullpath, NULL);
+                  whatmark, fullpath, NULL);
   }
   if ( err ) {
     rmdir(fullpath);
Only in autofs-3.1.4/modules: mount_generic.c.orig
diff -ru autofs-3.1.4.orig/modules/parse_sun.c autofs-3.1.4/modules/parse_sun.c
--- autofs-3.1.4.orig/modules/parse_sun.c       Fri Jan 21 20:08:09 2000
+++ autofs-3.1.4/modules/parse_sun.c    Sat Jan 13 17:04:53 2001
@@ -216,6 +216,10 @@
   int n = 0;
   while(1) {
     switch(*whence) {
+    case '\\':
+      whence+=2;
+      n+=2;
+      break;
     case ' ':
     case '\b':
     case '\t':
@@ -423,7 +427,7 @@
       options = noptions;
       p += l;
       syslog(LOG_DEBUG, MODPREFIX "gathered options: %s", options);
-    } else if ( *p == '/' ) {
+    } else if ( *p == '/' && *(p+1) != '/') {
       /* Uh-oh, a multientry; don't support now, but ****FIXME**** */
       /* We do tolerate "multientries" that only contain / though... */
       if ( chunklen(p) == 1 ) {

Reply via email to