Commit c85c0455 authored by rswindell's avatar rswindell
Browse files

Added 'U' (Upload Files) exemption, allows uploads to any directory (regardless

of configured upload requirements) and exceed the "max files" settings per dir.
Also, directory operators now always have upload permissions.
parent 94dd133a
......@@ -289,6 +289,7 @@ int sbbs_t::exec_file(csi_t *csi)
if(usrlibs) {
i=usrdir[curlib][curdir[curlib]];
if(cfg.upload_dir!=INVALID_DIR
&& !dir_op(i) && !(useron.exempt&FLAG('U'))
&& !chk_ar(cfg.dir[i]->ul_ar,&useron,&client))
i=cfg.upload_dir;
} else
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2009 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -113,6 +113,7 @@ JSObject* DLLCALL js_CreateFileAreaObject(JSContext* cx, JSObject* parent, scfg_
jsuint lib_index;
jsuint dir_index;
uint l,d;
BOOL is_op;
/* Return existing object if it's already been created */
if(JS_GetProperty(cx,parent,"file_area",&val) && val!=JSVAL_VOID)
......@@ -407,8 +408,16 @@ JSObject* DLLCALL js_CreateFileAreaObject(JSContext* cx, JSObject* parent, scfg_
if(!JS_SetProperty(cx, dirobj, "link", &val))
return(NULL);
if(user!=NULL
&& (user->level>=SYSOP_LEVEL
|| (cfg->dir[d]->op_ar[0]!=0
&& chk_ar(cfg,cfg->dir[d]->op_ar,user,client))))
is_op=TRUE;
else
is_op=FALSE;
if(user==NULL
|| (chk_ar(cfg,cfg->dir[d]->ul_ar,user,client) && !(user->rest&FLAG('U'))))
|| ((is_op || user->exempt&FLAG('U') || chk_ar(cfg,cfg->dir[d]->ul_ar,user,client)) && !(user->rest&FLAG('U'))))
val=JSVAL_TRUE;
else
val=JSVAL_FALSE;
......@@ -430,10 +439,7 @@ JSObject* DLLCALL js_CreateFileAreaObject(JSContext* cx, JSObject* parent, scfg_
if(!JS_SetProperty(cx, dirobj, "is_exempt", &val))
return(NULL);
if(user!=NULL
&& (user->level>=SYSOP_LEVEL
|| (cfg->dir[d]->op_ar[0]!=0
&& chk_ar(cfg,cfg->dir[d]->op_ar,user,client))))
if(is_op)
val=JSVAL_TRUE;
else
val=JSVAL_FALSE;
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2010 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -266,14 +266,16 @@ bool sbbs_t::upload(uint dirnum)
bputs(text[CantUploadHere]);
return(false);
}
if(!chk_ar(cfg.dir[dirnum]->ul_ar,&useron,&client)) {
bputs(dirnum==cfg.user_dir ? text[CantUploadToUser] :
dirnum==cfg.sysop_dir ? text[CantUploadToSysop] : text[CantUploadHere]);
return(false);
}
if(getfiles(&cfg,dirnum)>=cfg.dir[dirnum]->maxfiles) {
bputs(dirnum==cfg.user_dir ? text[UserDirFull] : text[DirFull]);
return(false);
if(!(useron.exempt&FLAG('U')) && !dir_op(dirnum)) {
if(!chk_ar(cfg.dir[dirnum]->ul_ar,&useron,&client)) {
bputs(dirnum==cfg.user_dir ? text[CantUploadToUser] :
dirnum==cfg.sysop_dir ? text[CantUploadToSysop] : text[CantUploadHere]);
return(false);
}
if(cfg.dir[dirnum]->maxfiles && getfiles(&cfg,dirnum)>=cfg.dir[dirnum]->maxfiles) {
bputs(dirnum==cfg.user_dir ? text[UserDirFull] : text[DirFull]);
return(false);
}
}
if(sys_status&SS_EVENT && online==ON_REMOTE && !dir_op(dirnum))
......@@ -574,10 +576,6 @@ bool sbbs_t::bulkupload(uint dirnum)
SYNC;
dir=opendir(path);
while(dir!=NULL && (dirent=readdir(dir))!=NULL && !msgabort()) {
if(getfiles(&cfg,dirnum)>=cfg.dir[dirnum]->maxfiles) {
bputs(text[DirFull]);
break;
}
sprintf(str,"%s%s",path,dirent->d_name);
if(isdir(str))
continue;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment