]> arthur.barton.de Git - netatalk.git/commitdiff
added dropbox as a volume option when DROPKLUDGE is compiled in
authorrufustfirefly <rufustfirefly>
Wed, 28 Feb 2001 16:53:23 +0000 (16:53 +0000)
committerrufustfirefly <rufustfirefly>
Wed, 28 Feb 2001 16:53:23 +0000 (16:53 +0000)
ChangeLog
etc/afpd/directory.c
etc/afpd/file.c
etc/afpd/filedir.c
etc/afpd/unix.c
etc/afpd/unix.h
etc/afpd/volume.c
etc/afpd/volume.h
man/man5/AppleVolumes.default.5.tmpl

index 965141adc0f24791bdf76c3adeea51336ec74f2b..174db22ba9a81cbc524929a28a737b3ed15c5a86 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,12 @@
-($Id: ChangeLog,v 1.12 2001-02-27 21:32:26 rufustfirefly Exp $)
+($Id: ChangeLog,v 1.13 2001-02-28 16:53:23 rufustfirefly Exp $)
+
+2001-02-28  jeff b  <jeff@univrel.pr.uconn.edu>  
+
+       * etc/afpd/directory.c, etc/afpd/file.c, etc/afpd/filedir.c,
+       etc/afpd/unix.c, etc/afpd/unix.h, etc/afpd/volume.h,
+       etc/afpd/volume.c, man/man5/AppleVolumes.default.5.tmpl: added
+       "dropbox" to available option if DROPKLUDGE is used during
+       compile 
 
 2001-02-27  jeff b  <jeff@univrel.pr.uconn.edu>  
 
index eb91a13be015c00275799cf5256ec750375d338d..92c4f549bafcb8c69a59347481bf329f0a91c18b 100644 (file)
@@ -1297,7 +1297,8 @@ int setdirparams(vol, path, bitmap, buf )
            }
 #endif
 
-           if ( setdirmode( mtoumode( &ma ), vol_noadouble(vol)) < 0 ) {
+           if ( setdirmode( mtoumode( &ma ), vol_noadouble(vol),
+                             (vol->v_flags & AFPVOL_DROPBOX)) < 0 ) {
                switch ( errno ) {
                case EPERM :
                case EACCES :
index d68fac2ec04836dd908d5f8310e3091cfaf3b4f7..b96bc2f224aea639b59b961d810ecc4d9ee97fba 100644 (file)
@@ -445,7 +445,9 @@ int afp_createfile(obj, ibuf, ibuflen, rbuf, rbuflen )
 createfile_done:
 
 #ifdef DROPKLUDGE
-    retvalue=matchfile2dirperms(upath, vol, did);
+    if (vol->v_flags & AFPVOL_DROPBOX) {
+         retvalue=matchfile2dirperms(upath, vol, did);
+    }
 #endif DROPKLUDGE
 
     setvoltime(obj, vol );
@@ -885,7 +887,9 @@ int afp_copyfile(obj, ibuf, ibuflen, rbuf, rbuflen )
     setvoltime(obj, vol );
 
 #ifdef DROPKLUDGE
-    retvalue=matchfile2dirperms(newname, vol, sdid);
+    if (vol->v_flags & AFPVOL_DROPBOX) {
+         retvalue=matchfile2dirperms(newname, vol, sdid);
+    }
 #endif DROPKLUDGE
 
 #ifdef DEBUG
index 367e94b47fbaae4cef35ff9c1815073671a7e815..e57bfc15d0d769f84c75fb7856f39b2322e83511 100644 (file)
@@ -674,8 +674,11 @@ int afp_moveandrename(obj, ibuf, ibuflen, rbuf, rbuflen )
     }
 
 #ifdef DROPKLUDGE
-    if (retvalue=matchfile2dirperms (newname, vol, did) != AFP_OK)
-       return retvalue;
+    if (vol->v_flags & AFPVOL_DROPBOX) {
+        if (retvalue=matchfile2dirperms (newname, vol, did) != AFP_OK) {
+           return retvalue;
+        }
+    }
 #endif DROPKLUDGE
 
     if ( rc == AFP_OK ) {
index 707a56d0d6dba644d68c56f54bbe81b6a78df605..d8378f638d105b9485cb45db7094ec317315b340 100644 (file)
@@ -208,39 +208,43 @@ mode_t mtoumode( ma )
     return( mode );
 }
 
-inline int stickydirmode(name, mode)
-char * name;
-const mode_t mode;
+inline int stickydirmode(name, mode, dropbox)
+    char * name;
+    const mode_t mode;
+    const int dropbox;
 {
   int uid, retval;
 
 /* Turn on the sticky bit if this is a drop box, also turn off the setgid bit */
    retval=0;
 #ifdef DROPKLUDGE
-   if (mode & S_IWOTH) 
+   if (dropbox) {
+    if (mode & S_IWOTH) { 
       if (mode & S_IROTH); 
-      else /* if S_IWOTH and not S_IROTH */
-      {
+      else { /* if S_IWOTH and not S_IROTH */
         uid=geteuid();
-        if ( seteuid(0) < 0)
+        if ( seteuid(0) < 0) {
           syslog( LOG_ERR, "stickydirmode: unable to seteuid root: %m");
-        if ( retval=chmod( name, ( DIRBITS | mode | S_ISVTX) ) < 0)
-        {
+        }
+        if ( retval=chmod( name, ( DIRBITS | mode | S_ISVTX) ) < 0) {
            syslog( LOG_ERR, "stickydirmode: chmod \"%s\": %m", name );
            return(AFPERR_ACCESS);
-        }
-        else
-        {
+        } else {
 #ifdef DEBUG
            syslog( LOG_INFO, "stickydirmode: (debug) chmod \"%s\": %m", name );
 #endif
            seteuid(uid);
-        }
-      }
-   else 
+        } /* end getting retval */
+      } /* end if not & S_IROTH */
+   } else { /* end if S_IWOTH and not S_IROTH */
 #endif DROPKLUDGE
-       if ( retval=chmod( name, DIRBITS | mode ) < 0 ) 
+       if ( retval=chmod( name, DIRBITS | mode ) < 0 )  {
           syslog( LOG_ERR, "stickydirmode: chmod \"%s\": %m", name );
+       }
+#ifdef DROPKLUDGE
+     } /* end if not mode */
+   } /* end checking for "dropbox" */
+#endif /* DROPKLUDGE */
    return retval;
 }
 
@@ -316,9 +320,10 @@ int setdeskmode( mode )
     return( 0 );
 }
 
-int setdirmode( mode, noadouble )
+int setdirmode( mode, noadouble, dropbox )
     const mode_t mode;
     const int noadouble;
+    const int dropbox;
 {
     char               buf[ MAXPATHLEN + 1];
     struct stat                st;
@@ -343,9 +348,9 @@ int setdirmode( mode, noadouble )
        if (S_ISREG(st.st_mode)) {
            /* XXX: need to preserve special modes */
            if (S_ISDIR(st.st_mode)) {
-              if (stickydirmode(dirp->d_name, DIRBITS | mode) < 0)
+              if (stickydirmode(dirp->d_name, DIRBITS | mode, dropbox) < 0)
                return (-1);
-           } else if (stickydirmode(dirp->d_name, mode) < 0)
+           } else if (stickydirmode(dirp->d_name, mode, dropbox) < 0)
                return (-1);
        }
     }
@@ -373,21 +378,21 @@ int setdirmode( mode, noadouble )
        }
 
        if (S_ISDIR(st.st_mode)) {
-           stickydirmode( buf, DIRBITS | mode );
+           stickydirmode( buf, DIRBITS | mode, dropbox );
        } else 
-           stickydirmode( buf, mode );
+           stickydirmode( buf, mode, dropbox );
     } /* end for */
     closedir( dir );
 
     /* XXX: use special bits to tag directory permissions */
       
     /* XXX: need to preserve special modes */
-    if ( stickydirmode(".AppleDouble", DIRBITS | mode) < 0 )
+    if ( stickydirmode(".AppleDouble", DIRBITS | mode, dropbox) < 0 )
        return( -1 );
 
 setdirmode_noadouble:
     /* XXX: need to preserve special modes */
-    if ( stickydirmode(".", DIRBITS | mode) < 0 )
+    if ( stickydirmode(".", DIRBITS | mode, dropbox) < 0 )
        return( -1 );
     return( 0 );
 }
index 79ce68f067c0058378a2a0a2258eb4c04519212e..f6b299457bf44fba07dac9266c73c58db109d22c 100644 (file)
@@ -93,7 +93,7 @@ extern int uquota_getvolspace __P((const struct vol *, VolSpace *, VolSpace *,
 
 extern int gmem         __P((const gid_t));
 extern int setdeskmode  __P((const mode_t));
-extern int setdirmode   __P((const mode_t, const int));
+extern int setdirmode   __P((const mode_t, const int, const int));
 extern int setdeskowner __P((const uid_t, const gid_t));
 extern int setdirowner  __P((const uid_t, const gid_t, const int));
 
index 6c286851d959aadcccf64206858acfb7a4634e46..5da659af887eae22077ef810ff4511affa633451 100644 (file)
@@ -1,4 +1,6 @@
 /*
+ * $Id: volume.c,v 1.5 2001-02-28 16:53:24 rufustfirefly Exp $
+ *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
  */
@@ -327,6 +329,11 @@ static void volset(struct vol_option *options, char *volname, int vlen,
        options[VOLOPT_FLAGS].i_value |= AFPVOL_USEDOTS;
       else if (strcasecmp(p, "limitsize") == 0)
        options[VOLOPT_FLAGS].i_value |= AFPVOL_LIMITSIZE;
+      /* support for either "dropbox" or "dropkludge" */
+      else if (strcasecmp(p, "dropbox") == 0)
+       options[VOLOPT_FLAGS].i_value |= AFPVOL_DROPBOX;
+      else if (strcasecmp(p, "dropkludge") == 0)
+       options[VOLOPT_FLAGS].i_value |= AFPVOL_DROPBOX;
 
       p = strtok(NULL, ",");
     }
index 67ac2d0b1a49ca3d42e3bcccdb2e202179c62575..4c4dc0b1d44bf6e5e9bd8ef8b4f02ffed4a9ae63 100644 (file)
@@ -1,4 +1,6 @@
 /*
+ * $Id: volume.h,v 1.3 2001-02-28 16:53:24 rufustfirefly Exp $
+ *
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
  */
@@ -83,6 +85,7 @@ typedef u_int64_t VolSpace;
 #define AFPVOL_USEDOTS   (1 << 11)  /* use real dots */
 #define AFPVOL_LIMITSIZE (1 << 12)  /* limit size for older macs */
 #define AFPVOL_MAPASCII  (1 << 13)  /* map the ascii range as well */
+#define AFPVOL_DROPBOX   (1 << 14)  /* dropkludge dropbox support */
 
 /* FPGetSrvrParms options */
 #define AFPSRVR_CONFIGINFO     (1 << 0)
index 2b361f75bd908df7b57c7d3f36a870928ee88ca7..b31d78c0012eb63f0cfa1ce30921493eae06f374 100644 (file)
@@ -1,4 +1,4 @@
-.\" $Id: AppleVolumes.default.5.tmpl,v 1.1 2000-09-22 15:18:44 arichard Exp $
+.\" $Id: AppleVolumes.default.5.tmpl,v 1.2 2001-02-28 16:53:24 rufustfirefly Exp $
 .TH AppleVolumes.default 5 "20 September 2000" "netatalk 1.5"
 .UC 4
 .SH NAME
@@ -76,6 +76,10 @@ The available options are:
 
 \fBcrlf\fR - Enables crlf translation for TEXT files.
 
+\fBdropbox\fR - Allows a volume to be declared as being a "dropbox." Note
+that netatalk must be compiled with dropkludge support for this to
+function.
+
 \fBlimitsize\fR - Hack for older Macintoshes using newer Appleshare
 clients to limit the disk size reporting to 2 GB.