afs_int32 BlocksSpare = 1024; /* allow 1 MB overruns */
afs_int32 PctSpare;
extern afs_int32 implicitAdminRights;
+extern afs_int32 readonlyServer;
static TryLocalVLServer();
/* Lookup the new file */
if (!(Lookup(&newdir, NewName, &newFileFid))) {
+ if (readonlyServer) {
+ errorCode = VREADONLY;
+ goto Bad_Rename;
+ }
if (!(newrights & PRSFS_DELETE)) {
errorCode = EACCES;
goto Bad_Rename;
* to do this.
*/
if ((InStatus->Mask & AFS_SETMODE) && !(InStatus->UnixModeBits & 0111)) {
+ if (readonlyServer) {
+ errorCode = VREADONLY;
+ goto Bad_SymLink;
+ }
/*
* We have a mountpoint, 'cause we're trying to set the Unix mode
* bits to something with some x bits missing (default mode bits
&client, READ_LOCK, &rights, &anyrights)))
goto Bad_SetVolumeStatus;
+ if (readonlyServer) {
+ errorCode = VREADONLY;
+ goto Bad_SetVolumeStatus;
+ }
if (VanillaUser(client)) {
errorCode = EACCES;
goto Bad_SetVolumeStatus;
* unless you are a system administrator */
/****** InStatus->Owner && UnixModeBits better be SET!! */
if ( CHOWN(InStatus, targetptr) || CHGRP(InStatus, targetptr)) {
- if (VanillaUser (client))
+ if (readonlyServer)
+ return(VREADONLY);
+ else if (VanillaUser (client))
return(EPERM); /* Was EACCES */
else
osi_audit( PrivilegeEvent, 0, AUD_INT, (client ? client->ViceId : 0),
AUD_INT, CallingRoutine, AUD_END);
}
else {
+ if (readonlyServer) {
+ return(VREADONLY);
+ }
if (CallingRoutine == CHK_STOREACL) {
if (!(rights & PRSFS_ADMINISTER) &&
!VolumeOwner(client, targetptr)) return(EACCES);
else { /* store data or status */
/* watch for chowns and chgrps */
if (CHOWN(InStatus, targetptr) || CHGRP(InStatus, targetptr)) {
- if (VanillaUser (client))
+ if (readonlyServer)
+ return(VREADONLY);
+ else if (VanillaUser (client))
return(EPERM); /* Was EACCES */
else
osi_audit(PrivilegeEvent, 0,
#else
(InStatus->UnixModeBits & (S_ISUID|S_ISGID)) != 0) {
#endif
+ if (readonlyServer)
+ return(VREADONLY);
if (VanillaUser(client))
return(EACCES);
else osi_audit( PrivSetID, 0, AUD_INT, (client ? client->ViceId : 0),
AUD_INT, CallingRoutine, AUD_END);
}
if (CallingRoutine == CHK_STOREDATA) {
+ if (readonlyServer)
+ return(VREADONLY);
if (!(rights & PRSFS_WRITE))
return(EACCES);
/* Next thing is tricky. We want to prevent people
#endif
if ((targetptr->disk.type != vDirectory)
&& (!(targetptr->disk.modeBits & OWNERWRITE)))
+ if (readonlyServer)
+ return(VREADONLY);
if (VanillaUser(client))
return(EACCES);
else osi_audit( PrivilegeEvent, 0, AUD_INT, (client ? client->ViceId : 0),
AUD_INT, CallingRoutine, AUD_END);
}
else { /* a status store */
+ if (readonlyServer)
+ return(VREADONLY);
if (targetptr->disk.type == vDirectory) {
if (!(rights & PRSFS_DELETE) && !(rights & PRSFS_INSERT))
return(EACCES);
afs_int32 rights;
int Prfs_Mode;
{
+ if (readonlyServer)
+ return(VREADONLY);
if (!(rights & Prfs_Mode))
return(EACCES);
if ((targetptr->disk.type != vDirectory) && (!(targetptr->disk.modeBits & OWNERWRITE)))
int rxJumbograms = 1; /* default is to send and receive jumbograms. */
afs_int32 implicitAdminRights = PRSFS_LOOKUP; /* The ADMINISTER right is
already implied */
+afs_int32 readonlyServer = 0;
int stack = 24;
int stackSize = 24000;
strcat(buffer, "[-banner (print banner every 10 minutes)] ");
strcat(buffer, "[-novbc (whole volume cbs disabled)] ");
strcat(buffer, "[-implicit <admin mode bits: rlidwka>] ");
+ strcat(buffer, "[-readonly (read-only file server)] ");
strcat(buffer, "[-hr <number of hours between refreshing the host cps>] ");
strcat(buffer, "[-busyat <redirect clients when queue > n>] ");
strcat(buffer, "[-rxpck <number of rx extra packets>] ");
if (!strcmp(argv[i], "-implicit")) {
implicitAdminRights = ParseRights(argv[++i]);
if (implicitAdminRights < 0) return implicitAdminRights;
+ } else
+ if (!strcmp(argv[i], "-readonly")) {
+ readonlyServer = 1;
} else
if (!strcmp(argv[i], "-L")) {
SawL = 1;