--- ftpd.c.orig Wed Oct 8 16:39:07 1997 +++ ftpd.c Tue Oct 14 17:09:05 1997 @@ -2011,6 +2011,9 @@ uid_t oldid; int valid = 0; + struct group *grent; + char buf[BUFSIZ]; + #endif /* UPLOAD */ if (unique && stat(name, &st) == 0 && @@ -2055,9 +2058,19 @@ * that mode. We must take care to not let the umask affect the file * mode. * - * else open the file and let the default umask determine the file mode. */ - if (f_mode >= 0) { + * else open the file and let the default umask determine the file mode. + * + * second case (or) - if the user's a guest then check if permissions + * the file should be changed. + * TODO: check whether the argument to guestgroupperm makes sense + * Tomas Pospisek + */ + entry = (struct aclmember *) NULL; + if ((f_mode >= 0) || (guest && getaclentry("guestgroupperm", &entry))) { oldmask = umask(0000); + if( ! (f_mode >= 0) && guest ) { /* if >only< guest */ + f_mode = strtol(ARG0, NULL, 0); + } fdout = open(name, open_flags, f_mode); umask(oldmask); } else @@ -2067,12 +2080,27 @@ perror_reply(553, name); return; } - /* if we have a uid and gid, then use them. */ - if (valid > 0) { + /* if we have a uid and gid, then use them. + * + * second case (or) - if the user's a guest then check if the grouid of + * the file should be changed. + * TODO: check whether the argument to guestgroupid makes sense, + * enable passing of text-groupnames (the problem is, that here + * I don't have access to /etc/groups since we're allready chrooted + * Tomas Pospisek + */ + + entry = (struct aclmember *) NULL; + if ((valid > 0) || (guest && getaclentry("guestgroupid", &entry))) { oldid = geteuid(); delay_signaling(); /* we can't allow any signals while euid==0: kinch */ (void) seteuid((uid_t) 0); + system("date >> /tmp/ftpdlog"); system("echo 1 >> /tmp/ftpdlog"); + if( ! (valid > 0) && guest ) { /* if >only< guest */ + uid = (uid_t) -1; + gid = atoi(ARG0); + } if ((fchown(fdout, uid, gid)) < 0) { (void) seteuid(oldid); enable_signaling(); /* we can allow signals once again: kinch */