/*
- * $Id: adouble.h,v 1.27 2005-05-25 18:19:33 didg Exp $
+ * $Id: adouble.h,v 1.28 2005-05-25 18:24:24 didg Exp $
* Copyright (c) 1990,1991 Regents of The University of Michigan.
* All Rights Reserved.
*
/* adouble v2 cnid cache */
#define ADVOL_NODEV (1 << 0)
#define ADVOL_CACHE (1 << 1)
+/* adouble unix priv */
+#define ADVOL_UNIXPRIV (1 << 2)
/* lock flags */
#define ADLOCK_CLR (0)
/*
- * $Id: ad_open.c,v 1.34 2005-05-14 12:54:55 didg Exp $
+ * $Id: ad_open.c,v 1.35 2005-05-25 18:24:24 didg Exp $
*
* Copyright (c) 1999 Adrian Sun (asun@u.washington.edu)
* Copyright (c) 1990,1991 Regents of The University of Michigan.
#if 0
mode |= S_IRUSR;
#endif
+ mode &= ~(S_IXUSR | S_IXGRP | S_IXOTH);
/* fnctl lock need write access */
if ((mode & S_IRUSR))
mode |= S_IWUSR;
struct stat st;
char *ad_p;
int hoflags, admode;
- int st_invalid;
+ int st_invalid = -1;
int open_df = 0;
if (ad->ad_inited != AD_INITED) {
if (ad_dfileno(ad) == -1) {
hoflags = (oflags & ~(O_RDONLY | O_WRONLY)) | O_RDWR;
admode = mode;
- st_invalid = ad_mode_st(path, &admode, &st);
+ if ((oflags & O_CREAT)) {
+ st_invalid = ad_mode_st(path, &admode, &st);
+ if ((ad->ad_options & ADVOL_UNIXPRIV)) {
+ admode = mode;
+ }
+ }
ad->ad_df.adf_fd =open( path, hoflags, admode );
if (ad->ad_df.adf_fd < 0 ) {
if ((errno == EACCES || errno == EROFS) && !(oflags & O_RDWR)) {
hoflags = oflags;
- ad->ad_df.adf_fd =open( path, hoflags, admode );
+ ad->ad_df.adf_fd = open( path, hoflags, admode );
}
}
if ( ad->ad_df.adf_fd < 0)
AD_SET(ad->ad_df.adf_off);
ad->ad_df.adf_flags = hoflags;
- if ((oflags & O_CREAT) && !st_invalid) {
+ if (!st_invalid) {
/* just created, set owner if admin (root) */
ad_chown(path, &st);
}
admode = mode;
errno = 0;
st_invalid = ad_mode_st(ad_p, &admode, &st);
+ if ((ad->ad_options & ADVOL_UNIXPRIV)) {
+ admode = mode;
+ }
admode = ad_hf_mode(admode);
if ( errno == ENOENT && !(adflags & ADFLAGS_NOADOUBLE) && ad->ad_flags != AD_VERSION2_OSX) {
if (ad->ad_mkrf( ad_p) < 0) {
}
admode = mode;
st_invalid = ad_mode_st(ad_p, &admode, &st);
+ if ((ad->ad_options & ADVOL_UNIXPRIV)) {
+ admode = mode;
+ }
admode = ad_hf_mode(admode);
}
/* retry with O_CREAT */