* All Rights Reserved. See COPYRIGHT.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int ibuflen, *rbuflen;
{
struct stat st;
+#ifdef DROPKLUDGE
+ struct stat sb;
+ char adpath[50];
+ int uid;
+#endif DROPKLUDGE
struct adouble ad, *adp;
struct vol *vol;
struct dir *dir;
ad_close( adp, ADFLAGS_DF|ADFLAGS_HF );
createfile_done:
+
+#ifdef DROPKLUDGE
+
+/* The below code is an experimental, untested, incomplete kludge which
+provides better dropbox support. It should NOT be turned on yet unless
+you are a developer who wants to try it out and fix it. */
+ if (stat(".", &sb) == -1)
+ syslog (LOG_ERR, "Error checking directory %s: %m", dir->d_name);
+ else {
+ uid=geteuid();
+ if ( uid != sb.st_uid )
+ {
+ strcpy (adpath, "./.AppleDouble/");
+ strcat (adpath, path);
+ seteuid(0); /* Become root to change the owner of the file */
+ if (chown(path, sb.st_uid, sb.st_gid) < 0)
+ {
+ syslog (LOG_ERR, "Error changing owner/gid: %m");
+ return (-1);
+ }
+ /* In order to write information to the file, the Mac client needs
+ to be able to read from it too, so read bits have to be turned on.
+ Directory permissions remain unchanged */
+ stat(upath, &st);
+ if (chmod(path,(st.st_mode&0x0FFFF)| S_IRGRP| S_IROTH) < 0)
+ {
+ syslog (LOG_ERR, "Error adding file read permissions: %m");
+ return (-1);
+ }
+ else syslog (LOG_DEBUG, "Added S_IRGRP and S_IROTH: %m");
+ if (chown(adpath, sb.st_uid, sb.st_gid) < 0)
+ {
+ syslog (LOG_ERR, "Error changing AppleDouble owner/gid: %m");
+ return (-1);
+ }
+ if (chmod(adpath,(st.st_mode&0x0FFFF)| S_IRGRP| S_IROTH) < 0)
+ {
+ syslog (LOG_ERR, "Error adding AD file read permissions: %m");
+ return (-1);
+ }
+ else syslog (LOG_DEBUG, "Added S_IRGRP and S_IROTH to AD: %m");
+ syslog (LOG_DEBUG, "Changing afpd owner back to %d", uid);
+ seteuid(uid); /* Restore process ownership to normal */
+ }
+ }
+
+#endif DROPKLUDGE
+
setvoltime(obj, vol );
return AFP_OK;
}
cnid_t did, id;
u_short vid;
-
*rbuflen = 0;
ibuf += 2;
cnid_t id;
u_int16_t vid, bitmap;
-
*rbuflen = 0;
ibuf += 2;
cnid_t id;
u_short vid;
-
*rbuflen = 0;
ibuf += 2;
cnid_t sid, did;
u_int16_t vid;
-
*rbuflen = 0;
ibuf += 2;