diff -rcb ./fam/Cred.c++ ../porters_fam-oss-2.6.2/fam/Cred.c++ *** ./fam/Cred.c++ Thu Mar 2 00:51:17 2000 --- ../porters_fam-oss-2.6.2/fam/Cred.c++ Tue Apr 11 13:26:39 2000 *************** *** 193,199 **** if (nimpl >= nimpl_alloc) { nimpl_alloc = nimpl_alloc * 3 / 2 + 3; Implementation **nl = new Implementation *[nimpl_alloc]; ! for (int i = 0; i < nimpl; i++) nl[i] = impllist[i]; delete [] impllist; impllist = nl; --- 193,199 ---- if (nimpl >= nimpl_alloc) { nimpl_alloc = nimpl_alloc * 3 / 2 + 3; Implementation **nl = new Implementation *[nimpl_alloc]; ! for (unsigned int i = 0; i < nimpl; i++) nl[i] = impllist[i]; delete [] impllist; impllist = nl; *************** *** 318,324 **** #endif groups = new gid_t[ng]; ! for (int i = 0; i < ng; i++) groups[i] = gs[i]; } --- 318,324 ---- #endif groups = new gid_t[ng]; ! for (unsigned int i = 0; i < ng; i++) groups[i] = gs[i]; } *************** *** 342,348 **** #ifdef HAVE_MAC if ((use_mac) && (mac_equal(this->mac, mac) == 0)) return -1; #endif ! for (int i = 0; i < ng; i++) if (gs[i] != groups[i]) return gs[i] - groups[i]; return 0; --- 342,348 ---- #ifdef HAVE_MAC if ((use_mac) && (mac_equal(this->mac, mac) == 0)) return -1; #endif ! for (unsigned int i = 0; i < ng; i++) if (gs[i] != groups[i]) return gs[i] - groups[i]; return 0; *************** *** 351,357 **** bool Cred::Implementation::groups_change() const { ! for (int i = 0; i < ngroups; i++) if (groups[i] != last->groups[i]) return true; return false; --- 351,357 ---- bool Cred::Implementation::groups_change() const { ! for (unsigned int i = 0; i < ngroups; i++) if (groups[i] != last->groups[i]) return true; return false; *************** *** 377,383 **** ret = new char[11*(ngroups-1)]; char * p = ret; p += snprintf(p, 10, "%d", ngroups-1); ! for (int i = 1; i < ngroups; i++) { p += snprintf(p, 11, " %d", groups[i]); } --- 377,383 ---- ret = new char[11*(ngroups-1)]; char * p = ret; p += snprintf(p, 10, "%d", ngroups-1); ! for (unsigned int i = 1; i < ngroups; i++) { p += snprintf(p, 11, " %d", groups[i]); } *************** *** 398,404 **** { /* Temporarily become root */ ! if (setreuid((uid_t)-1, 0) != 0) { Log::perror("failed to set 0 uid"); exit(1); } --- 398,404 ---- { /* Temporarily become root */ ! if (seteuid(0) != 0) { Log::perror("failed to set 0 uid"); exit(1); } *************** *** 413,423 **** if (current_uid != myuid) { if (current_uid) { ! (void) setreuid((uid_t)-1, 0); Log::debug("Setting euid to 0"); } if (myuid) { ! if (setreuid((uid_t)-1, myuid)) { Log::perror("failed to set uid %d", myuid); exit(1); } else { --- 413,423 ---- if (current_uid != myuid) { if (current_uid) { ! (void) seteuid(0); Log::debug("Setting euid to 0"); } if (myuid) { ! if (seteuid(myuid)) { Log::perror("failed to set uid %d", myuid); exit(1); } else { diff -rcb ./fam/Event.h ../porters_fam-oss-2.6.2/fam/Event.h *** ./fam/Event.h Thu Mar 2 00:51:22 2000 --- ../porters_fam-oss-2.6.2/fam/Event.h Sat Apr 8 18:40:50 2000 *************** *** 67,73 **** }; Event(Type n) : which(n){}; ! const char which; // We don't want anyone using any Events that aren't the static // constant ones, so make it so Events can't be created or copied --- 67,73 ---- }; Event(Type n) : which(n){}; ! const unsigned char which; // We don't want anyone using any Events that aren't the static // constant ones, so make it so Events can't be created or copied diff -rcb ./fam/IMonLinux.c++ ../porters_fam-oss-2.6.2/fam/IMonLinux.c++ *** ./fam/IMonLinux.c++ Fri Mar 24 01:34:21 2000 --- ../porters_fam-oss-2.6.2/fam/IMonLinux.c++ Sat Apr 8 18:28:45 2000 *************** *** 28,33 **** --- 28,36 ---- #include #include + #include + #include + #include #include #include diff -rcb ./fam/Listener.c++ ../porters_fam-oss-2.6.2/fam/Listener.c++ *** ./fam/Listener.c++ Thu Mar 2 00:51:19 2000 --- ../porters_fam-oss-2.6.2/fam/Listener.c++ Tue Apr 11 13:27:17 2000 *************** *** 153,159 **** // Get the new socket. struct sockaddr_in addr; ! int addrlen = sizeof addr; int client_fd = accept(rendezvous_fd, (struct sockaddr *) &addr, &addrlen); if (client_fd < 0) { --- 153,159 ---- // Get the new socket. struct sockaddr_in addr; ! socklen_t addrlen = sizeof addr; int client_fd = accept(rendezvous_fd, (struct sockaddr *) &addr, &addrlen); if (client_fd < 0) { *************** *** 272,278 **** // Get the new socket. struct sockaddr_un sun = { AF_UNIX, "" }; ! int sunlen = sizeof(sun); int client_fd = accept(ofd, (struct sockaddr *) &sun, &sunlen); if (client_fd < 0) { --- 272,278 ---- // Get the new socket. struct sockaddr_un sun = { AF_UNIX, "" }; ! socklen_t sunlen = sizeof(sun); int client_fd = accept(ofd, (struct sockaddr *) &sun, &sunlen); if (client_fd < 0) { *************** *** 400,406 **** // Accept a new ugly connection. struct sockaddr_un sun; ! int sunlen = sizeof sun; int sock = accept(ugly, (struct sockaddr *)(&sun), &sunlen); if (sock < 0) { Log::perror("accept"); --- 400,406 ---- // Accept a new ugly connection. struct sockaddr_un sun; ! socklen_t sunlen = sizeof sun; int sock = accept(ugly, (struct sockaddr *)(&sun), &sunlen); if (sock < 0) { Log::perror("accept"); *************** *** 466,476 **** // Remove the temp file uid_t preveuid = geteuid(); ! if (preveuid) setreuid(-1, 0); ! setreuid(-1, nc->uid); unlink(nc->sun.sun_path); ! if (nc->uid) setreuid(-1, 0); ! setreuid(-1, preveuid); delete nc; } --- 466,476 ---- // 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); delete nc; } diff -rcb ./fam/NFSFileSystem.c++ ../porters_fam-oss-2.6.2/fam/NFSFileSystem.c++ *** ./fam/NFSFileSystem.c++ Thu Mar 2 00:51:19 2000 --- ../porters_fam-oss-2.6.2/fam/NFSFileSystem.c++ Sat Apr 8 18:28:45 2000 *************** *** 26,31 **** --- 26,32 ---- #include #include #include + #include #include #include "Log.h" diff -rcb ./fam/Scheduler.c++ ../porters_fam-oss-2.6.2/fam/Scheduler.c++ *** ./fam/Scheduler.c++ Thu Mar 2 00:51:20 2000 --- ../porters_fam-oss-2.6.2/fam/Scheduler.c++ Tue Apr 11 20:56:56 2000 *************** *** 232,238 **** Scheduler::trim_fdinfo() { for (FDInfo *fp = &fdinfo[nfds - 1]; nfds > 0; --nfds, --fp) ! if (fp->read.handler || fp->write.handler) break; if (!nfds) --- 232,238 ---- Scheduler::trim_fdinfo() { for (FDInfo *fp = &fdinfo[nfds - 1]; nfds > 0; --nfds, --fp) ! if (fp->read.iohandler || fp->write.iohandler) break; if (!nfds) *************** *** 243,256 **** } Scheduler::IOHandler ! Scheduler::install_io_handler(int fd, IOHandler handler, void *closure, IOTypeInfo *iotype) { assert(fd >= 0); ! assert(handler); FDInfo *fp = fd_to_info(fd); ! IOHandler old_handler = (fp->*(iotype->iotype)).handler; ! (fp->*(iotype->iotype)).handler = handler; (fp->*(iotype->iotype)).closure = closure; assert(!old_handler || FD_ISSET(fd, &iotype->fds)); if (!FD_ISSET(fd, &iotype->fds)) --- 243,256 ---- } Scheduler::IOHandler ! Scheduler::install_io_handler(int fd, IOHandler fdinfo_handler, void *closure, IOTypeInfo *iotype) { assert(fd >= 0); ! assert(fdinfo_handler); FDInfo *fp = fd_to_info(fd); ! IOHandler old_handler = (fp->*(iotype->iotype)).iohandler; ! (fp->*(iotype->iotype)).iohandler = fdinfo_handler; (fp->*(iotype->iotype)).closure = closure; assert(!old_handler || FD_ISSET(fd, &iotype->fds)); if (!FD_ISSET(fd, &iotype->fds)) *************** *** 266,273 **** { assert(fd >= 0 && fd < nfds); FDInfo *fp = fd_to_info(fd); ! IOHandler old_handler = (fp->*(iotype->iotype)).handler; ! (fp->*(iotype->iotype)).handler = NULL; (fp->*(iotype->iotype)).closure = NULL; trim_fdinfo(); assert(old_handler); --- 266,273 ---- { assert(fd >= 0 && fd < nfds); FDInfo *fp = fd_to_info(fd); ! IOHandler old_handler = (fp->*(iotype->iotype)).iohandler; ! (fp->*(iotype->iotype)).iohandler = NULL; (fp->*(iotype->iotype)).closure = NULL; trim_fdinfo(); assert(old_handler); *************** *** 280,288 **** } Scheduler::IOHandler ! Scheduler::install_read_handler(int fd, IOHandler handler, void *closure) { ! return install_io_handler(fd, handler, closure, &read); } Scheduler::IOHandler --- 280,288 ---- } Scheduler::IOHandler ! Scheduler::install_read_handler(int fd, IOHandler fdinfo_handler, void *closure) { ! return install_io_handler(fd, fdinfo_handler, closure, &read); } Scheduler::IOHandler *************** *** 292,300 **** } Scheduler::IOHandler ! Scheduler::install_write_handler(int fd, IOHandler handler, void *closure) { ! return install_io_handler(fd, handler, closure, &write); } Scheduler::IOHandler --- 292,300 ---- } Scheduler::IOHandler ! Scheduler::install_write_handler(int fd, IOHandler fdinfo_handler, void *closure) { ! return install_io_handler(fd, fdinfo_handler, closure, &write); } Scheduler::IOHandler *************** *** 307,317 **** Scheduler::handle_io(const fd_set *fds, FDInfo::handler FDInfo::* iotype) { if (fds) ! for (int fd = 0; fd < nfds; fd++) if (FD_ISSET(fd, fds)) { FDInfo *fp = &fdinfo[fd]; assert(iotype == &FDInfo::read || iotype == &FDInfo::write); ! (fp->*iotype).handler(fd, (fp->*iotype).closure); // Remember, handler may move fdinfo array. } } --- 307,317 ---- Scheduler::handle_io(const fd_set *fds, FDInfo::handler FDInfo::* iotype) { if (fds) ! for (unsigned int fd = 0; fd < nfds; fd++) if (FD_ISSET(fd, fds)) { FDInfo *fp = &fdinfo[fd]; assert(iotype == &FDInfo::read || iotype == &FDInfo::write); ! (fp->*iotype).iohandler(fd, (fp->*iotype).closure); // Remember, handler may move fdinfo array. } } diff -rcb ./fam/Scheduler.h ../porters_fam-oss-2.6.2/fam/Scheduler.h *** ./fam/Scheduler.h Thu Mar 2 00:51:24 2000 --- ../porters_fam-oss-2.6.2/fam/Scheduler.h Tue Apr 11 21:01:09 2000 *************** *** 91,100 **** // Per-filedescriptor info is the set of three handlers and their // closures. - struct FDInfo { struct handler { ! IOHandler handler; void *closure; } read, write; }; --- 91,99 ---- // Per-filedescriptor info is the set of three handlers and their // closures. struct FDInfo { struct handler { ! IOHandler iohandler; void *closure; } read, write; }; *************** *** 140,146 **** static FDInfo *fd_to_info(int fd); static void trim_fdinfo(); static IOHandler install_io_handler(int fd, ! IOHandler handler, void *closure, IOTypeInfo *iotype); static IOHandler remove_io_handler(int fd, IOTypeInfo *iotype); static void handle_io(const fd_set *fds, FDInfo::handler FDInfo::* iotype); --- 139,145 ---- static FDInfo *fd_to_info(int fd); static void trim_fdinfo(); static IOHandler install_io_handler(int fd, ! IOHandler fdinfo_handler, void *closure, IOTypeInfo *iotype); static IOHandler remove_io_handler(int fd, IOTypeInfo *iotype); static void handle_io(const fd_set *fds, FDInfo::handler FDInfo::* iotype); diff -rcb ./libfam/Client.c++ ../porters_fam-oss-2.6.2/libfam/Client.c++ *** ./libfam/Client.c++ Wed Mar 15 04:54:48 2000 --- ../porters_fam-oss-2.6.2/libfam/Client.c++ Sat Apr 8 18:35:01 2000 *************** *** 40,46 **** static void getword(const char *p, u_int32_t *l); ! Client::Client(long host, int prog, int vers) : sock(0), haveCompleteEvent(false), userData(NULL), endExist(NULL), inend(inbuf) { --- 40,46 ---- static void getword(const char *p, u_int32_t *l); ! Client::Client(long host, unsigned int prog, unsigned int vers) : sock(0), haveCompleteEvent(false), userData(NULL), endExist(NULL), inend(inbuf) { *************** *** 133,139 **** sun.sun_family = AF_UNIX; // We will block here, waiting for response from fam. ! int nread = 0; char inbuf[sizeof(sun.sun_path)]; while(nread < sizeof(u_int32_t)) { --- 133,139 ---- sun.sun_family = AF_UNIX; // We will block here, waiting for response from fam. ! unsigned int nread = 0; char inbuf[sizeof(sun.sun_path)]; while(nread < sizeof(u_int32_t)) { diff -rcb ./libfam/Client.h ../porters_fam-oss-2.6.2/libfam/Client.h *** ./libfam/Client.h Wed Mar 15 04:55:00 2000 --- ../porters_fam-oss-2.6.2/libfam/Client.h Sat Apr 8 18:34:28 2000 *************** *** 33,39 **** class Client { public: ! Client(long hostaddr, int prog, int vers); ~Client(); int writeToServer(char *msg, int nbytes); int getSock() { return sock; } --- 33,39 ---- class Client { public: ! Client(long hostaddr, unsigned int prog, unsigned int vers); ~Client(); int writeToServer(char *msg, int nbytes); int getSock() { return sock; }