/*
- * $Id: afp_dsi.c,v 1.53 2010-03-30 12:55:26 franklahm Exp $
+ * $Id: afp_dsi.c,v 1.53 2010/03/30 12:55:26 franklahm Exp $
*
* Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
* Copyright (c) 1990,1993 Regents of The University of Michigan.
#include "switch.h"
#include "auth.h"
#include "fork.h"
+#include "dircache.h"
#ifdef FORCE_UIDGID
#warning UIDGID
* 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);
+ if (geteuid() != obj->uid) {
+ if (seteuid( obj->uid ) < 0) {
+ LOG(log_error, logtype_afpd, "can't seteuid(%u) back %s: uid: %u, euid: %u",
+ obj->uid, strerror(errno), getuid(), geteuid());
+ exit(EXITERR_SYS);
+ }
}
+
close_all_vol();
if (obj->logout)
(*obj->logout)();
}
#endif /* DEBUGGING */
+ if (dircache_init(obj->options.dircachesize) != 0)
+ afp_dsi_die(EXITERR_SYS);
+
/* get stuck here until the end */
while ((cmd = dsi_receive(dsi))) {
child.tickle = 0;
if (reload_request) {
reload_request = 0;
load_volumes(child.obj);
+ dircache_dump();
}
if (debug_request) {