--- fam-2.6.7/fam/Listener.c++.cleanup Mon Dec 17 20:03:37 2001 +++ fam-2.6.7/fam/Listener.c++ Tue Jan 15 11:44:45 2002 @@ -287,10 +287,18 @@ // Keep the scheduler from helpfully cleaning this up. Scheduler::remove_onetime_task(cleanup_negotiation, nc); + // Remove the temp file + uid_t preveuid = geteuid(); + if (preveuid) seteuid(0); + seteuid(nc->uid); + unlink(nc->sun.sun_path); + if (nc->uid) seteuid(0); + seteuid(preveuid); + Log::debug("client fd %d is local/trusted (socket %s, uid %d).", client_fd, nc->sun.sun_path, nc->uid); Cred cred(nc->uid, client_fd); - new LocalClient(client_fd, &(nc->sun), cred); + new LocalClient(client_fd, cred); // We don't need a reference to this object. The constructor // takes care of registering it with the Scheduler. --- fam-2.6.7/fam/LocalClient.c++.cleanup Mon Dec 17 20:03:37 2001 +++ fam-2.6.7/fam/LocalClient.c++ Tue Jan 15 11:43:04 2002 @@ -29,17 +29,12 @@ #include "Log.h" #include "Cred.h" -LocalClient::LocalClient(int fd, const struct sockaddr_un *addr, Cred &cred) +LocalClient::LocalClient(int fd, Cred &cred) : TCP_Client(LOCALHOST(), fd, cred) { assert(cred.is_valid()); - sun.sun_family = AF_UNIX; - strncpy(sun.sun_path, addr->sun_path, sizeof(sun.sun_path)); - sun.sun_path[sizeof(sun.sun_path) - 1] = '\0'; } LocalClient::~LocalClient() { - if (geteuid() != cred.uid()) cred.become_user(); - unlink(sun.sun_path); } --- fam-2.6.7/fam/LocalClient.h.cleanup Mon Dec 17 20:03:37 2001 +++ fam-2.6.7/fam/LocalClient.h Tue Jan 15 11:43:04 2002 @@ -33,13 +33,8 @@ public: - LocalClient(int fd, const struct sockaddr_un *addr, Cred &cred); + LocalClient(int fd, Cred &cred); ~LocalClient(); - -private: - - struct sockaddr_un sun; - }; #endif /* !RemoteClient_included */