/*
- * $Id: afp_asp.c,v 1.26 2009-10-14 02:24:05 didg Exp $
+ * $Id: afp_asp.c,v 1.27 2009-10-25 07:18:11 didg Exp $
*
* Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
* Copyright (c) 1990,1993 Regents of The University of Michigan.
{
ASP asp = obj->handle;
+ 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->options.authprintdir) afp_authprint_remove(obj);
/*
- * $Id: afp_dsi.c,v 1.46 2009-10-25 06:12:51 didg Exp $
+ * $Id: afp_dsi.c,v 1.47 2009-10-25 07:18:12 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)();
/*
- * $Id: auth.c,v 1.68 2009-10-15 10:43:13 didg Exp $
+ * $Id: auth.c,v 1.69 2009-10-25 07:18:12 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
uuid = pwd->pw_uid;
set_auth_switch(expired);
-
+ /* save our euid, we need it for preexec_close */
+ obj->uid = geteuid();
obj->logout = logout;
#ifdef FORCE_UIDGID
/*
- * $Id: globals.h,v 1.28 2009-10-15 10:43:13 didg Exp $
+ * $Id: globals.h,v 1.29 2009-10-25 07:18:12 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
char oldtmp[AFPOBJ_TMPSIZ + 1], newtmp[AFPOBJ_TMPSIZ + 1];
void *uam_cookie; /* cookie for uams */
struct session_info sinfo;
+ uid_t uid; /* client running user id */
#ifdef FORCE_UIDGID
int force_uid;