/*
- * $Id: filedir.c,v 1.16 2001-12-03 05:03:38 jmarcus Exp $
+ * $Id: filedir.c,v 1.19 2002-01-03 17:49:38 sibaz Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#endif /* HAVE_CONFIG_H */
#include <errno.h>
-#include <sys/syslog.h>
+#include <syslog.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
int uid;
#ifdef DEBUG
- syslog (LOG_INFO, "begin matchfile2dirperms:");
+ syslog(LOG_INFO, "begin matchfile2dirperms:");
#endif /* DEBUG */
if (stat(upath, &st ) < 0)
strcpy (adpath, "./.AppleDouble/");
strcat (adpath, upath);
if (( dir = dirsearch( vol, did )) == NULL ) {
- syslog (LOG_ERR, "matchfile2dirperms: Unable to get directory info.");
+ syslog(LOG_ERR, "matchfile2dirperms: Unable to get directory info.");
return( AFPERR_NOOBJ );
}
else if (stat(".", &sb) < 0) {
- syslog (LOG_ERR,
+ syslog(LOG_ERR,
"matchfile2dirperms: Error checking directory \"%s\": %s",
dir->d_name, strerror(errno));
return(AFPERR_NOOBJ );
seteuid(0);
if (lchown(upath, sb.st_uid, sb.st_gid) < 0)
{
- syslog (LOG_ERR,
+ syslog(LOG_ERR,
"matchfile2dirperms: Error changing owner/gid of %s: %s",
upath, strerror(errno));
return (AFPERR_ACCESS);
}
if (chmod(upath,(st.st_mode&0777&~default_options.umask)| S_IRGRP| S_IROTH) < 0)
{
- syslog (LOG_ERR,
+ syslog(LOG_ERR,
"matchfile2dirperms: Error adding file read permissions: %s",
strerror(errno));
return (AFPERR_ACCESS);
}
#ifdef DEBUG
else
- syslog (LOG_INFO,
+ syslog(LOG_INFO,
"matchfile2dirperms: Added S_IRGRP and S_IROTH: %s",
strerror(errno));
#endif /* DEBUG */
if (lchown(adpath, sb.st_uid, sb.st_gid) < 0)
{
- syslog (LOG_ERR,
+ syslog(LOG_ERR,
"matchfile2dirperms: Error changing AppleDouble owner/gid %s: %s",
adpath, strerror(errno));
return (AFPERR_ACCESS);
}
if (chmod(adpath, (st.st_mode&0777&~default_options.umask)| S_IRGRP| S_IROTH) < 0)
{
- syslog (LOG_ERR,
+ syslog(LOG_ERR,
"matchfile2dirperms: Error adding AD file read permissions: %s",
strerror(errno));
return (AFPERR_ACCESS);
}
#ifdef DEBUG
else
- syslog (LOG_INFO,
+ syslog(LOG_INFO,
"matchfile2dirperms: Added S_IRGRP and S_IROTH to AD: %s",
strerror(errno));
#endif /* DEBUG */
}
#ifdef DEBUG
else
- syslog (LOG_INFO,
+ syslog(LOG_INFO,
"matchfile2dirperms: No ownership change necessary.");
#endif /* DEBUG */
} /* end else if stat success */
seteuid(uid); /* Restore process ownership to normal */
#ifdef DEBUG
- syslog (LOG_INFO, "end matchfile2dirperms:");
+ syslog(LOG_INFO, "end matchfile2dirperms:");
#endif /* DEBUG */
return (AFP_OK);
return AFP_OK;
/* check for illegal characters */
- if ((vol->v_flags & AFPVOL_MSWINDOWS) &&
- strpbrk(ibuf, MSWINDOWS_BADCHARS))
+ if (!wincheck(vol, ibuf))
return AFPERR_PARAM;
newpath = obj->oldtmp;
}
/* check for illegal characters */
- if ((vol->v_flags & AFPVOL_MSWINDOWS) &&
- strpbrk(newname, MSWINDOWS_BADCHARS))
+ if (!wincheck(vol, newname))
return AFPERR_PARAM;
upath = mtoupath(vol, newname);