X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=etc%2Fafpd%2Funix.c;h=6880f3a650826ece14b1ebf5889ddd1afc68b112;hb=edefad2f0703ed2f6a21025d615600ed18c83d18;hp=5ab23eeafe453de2a3b1865b7bb9c628f6f699e1;hpb=9f013bf0ce828ff7c61db4f5a404d9029ed82999;p=netatalk.git diff --git a/etc/afpd/unix.c b/etc/afpd/unix.c index 5ab23eea..6880f3a6 100644 --- a/etc/afpd/unix.c +++ b/etc/afpd/unix.c @@ -1,5 +1,5 @@ /* - * $Id: unix.c,v 1.55 2009-10-14 15:04:01 franklahm Exp $ + * $Id: unix.c,v 1.59 2009-10-29 10:04:35 didg Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -30,15 +30,14 @@ char *strchr (), *strrchr (); #endif /* STDC_HEADERS */ #include -#include #include #include -#include #include #include #include #include #include +#include #include "auth.h" #include "directory.h" @@ -597,45 +596,3 @@ recursive_chown_end: } #endif -/* This is equivalent of unix rename(). */ -int unix_rename(const char *oldpath, const char *newpath) -{ -#if 0 - char pd_name[PATH_MAX+1]; - int i; - struct stat pd_stat; - uid_t uid; -#endif - - if (rename(oldpath, newpath) < 0) - return -1; -#if 0 - for (i = 0; i <= PATH_MAX && newpath[i] != '\0'; i++) - pd_name[i] = newpath[i]; - pd_name[i] = '\0'; - - while (i > 0 && pd_name[i] != '/') i--; - if (pd_name[i] == '/') i++; - - pd_name[i++] = '.'; pd_name[i++] = '\0'; - - if (stat(pd_name, &pd_stat) < 0) { - LOG(log_error, logtype_afpd, "stat() of parent dir failed: pd_name = %s, uid = %d: %s", - pd_name, geteuid(), strerror(errno)); - return 0; - } - - /* So we have SGID bit set... */ - if ((S_ISGID & pd_stat.st_mode) != 0) { - uid = geteuid(); - if (seteuid(0) < 0) - LOG(log_error, logtype_afpd, "seteuid() failed: %s", strerror(errno)); - if (recursive_chown(newpath, uid, pd_stat.st_gid) < 0) - LOG(log_error, logtype_afpd, "chown() of parent dir failed: newpath=%s, uid=%d: %s", - pd_name, geteuid(), strerror(errno)); - seteuid(uid); - } -#endif - return 0; -} -