/*
- * $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.
{
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)();
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;
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)