]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/afp_dsi.c
don't create an adouble file in ad_metadata for noadouble volume
[netatalk.git] / etc / afpd / afp_dsi.c
index 3a73159aed1bf8c3ad08786f60ac42f9844ef566..9fc2beb970b383ce1f1b65f1bb9d21313f331164 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: afp_dsi.c,v 1.46 2009-10-25 06:12:51 didg Exp $
+ * $Id: afp_dsi.c,v 1.48 2009-11-14 05:18:50 didg Exp $
  *
  * Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
@@ -59,7 +59,14 @@ static void afp_dsi_close(AFPObj *obj)
 {
     DSI *dsi = obj->handle;
 
-    /* XXX we have to check we are not root here */
+    /* we may have been called from a signal handler caught when afpd was running
+     * as uid 0, that's the wrong user for volume's prexec_close scripts if any,
+     * restore our login user
+     */
+    if (seteuid( obj->uid ) < 0) {
+        LOG(log_error, logtype_afpd, "can't seteuid back %s", strerror(errno));
+        exit(EXITERR_SYS);
+    }
     close_all_vol();
     if (obj->logout)
         (*obj->logout)();
@@ -242,7 +249,6 @@ void afp_over_dsi(AFPObj *obj)
     u_int32_t err, cmd;
     u_int8_t function;
     struct sigaction action;
-    const char *afpcmpstr;
 
     obj->exit = afp_dsi_die;
     obj->reply = (int (*)()) dsi_cmdreply;
@@ -375,14 +381,13 @@ void afp_over_dsi(AFPObj *obj)
                 dsi->datalen = DSI_DATASIZ;
                 child.flags |= CHILD_RUNNING;
 
-                afpcmpstr = AfpNum2name(function);
-                LOG(log_debug, logtype_afpd, "=> Start AFP command: %s", afpcmpstr);
+                LOG(log_debug, logtype_afpd, "=> Start AFP command: %s", AfpNum2name(function));
 
                 err = (*afp_switch[function])(obj,
                                               (char *)&dsi->commands, dsi->cmdlen,
                                               (char *)&dsi->data, &dsi->datalen);
 
-                LOG(log_debug, logtype_afpd, "=> Finished AFP command: %s", afpcmpstr);
+                LOG(log_debug, logtype_afpd, "=> Finished AFP command: %s", AfpNum2name(function));
 #ifdef FORCE_UIDGID
                /* bring everything back to old euid, egid */
                 if (obj->force_uid)