$Log$
+ Revision 572.3 2000/06/03 05:47:57 ajc
+ * Replaced most of the very repetitive and very redundant access level checks
+ in most commands with a single API call: CtdlAccessLevelCheck()
+ * serv_moderate.c: added (not finished)
+
Revision 572.2 2000/06/02 03:38:50 ajc
* Bind unix socket prior to TCP socket for citadel protocol
* Fixed bug in sendcommand.c which was causing it to crash on attach
Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
* Initial CVS import
+
modules/serv_smtp$(SO) modules/serv_pop3$(SO) \
modules/serv_inetcfg$(SO) \
modules/serv_rwho$(SO) \
+ modules/serv_moderate$(SO) \
modules/serv_bio$(SO) \
modules/serv_expire$(SO) $(SERV_ICQ)
UTIL_TARGETS=aidepost netmailer netproc netsetup msgform readlog rcit \
auth.c chkpwd.c client_icq.c html.c vcard.c serv_upgrade.c \
serv_smtp.c serv_pop3.c internet_addressing.c parsedate.c genstamp.c \
domain.c clientsocket.c serv_inetcfg.c serv_rwho.c serv_bio.c \
- client_passwords.c
+ serv_moderate.c client_passwords.c
DEP_FILES=$(SOURCES:.c=.d)
modules/serv_rwho.mo: serv_rwho.mo
ln -f serv_rwho.mo modules
+modules/serv_moderate.so: serv_moderate.mo
+ $(LINK_SHARED) -o modules/serv_moderate.so serv_moderate.mo
+
+modules/serv_moderate.mo: serv_moderate.mo
+ ln -f serv_moderate.mo modules
+
modules/serv_bio.so: serv_bio.mo
$(LINK_SHARED) -o modules/serv_bio.so serv_bio.mo
char *dirs[2];
int a;
- if (CC->usersupp.axlevel < 6) {
- cprintf("%d You must be an Aide to edit system messages.\n",
- ERROR+HIGHER_ACCESS_REQUIRED);
- return;
- }
+ if (CtdlAccessCheck(ac_aide)) return;
extract(buf,mname,0);
for (a=0; a<strlen(buf); ++a) { /* security measure */
}
+/*
+ * Convenience function.
+ */
+int CtdlAccessCheck(int required_level) {
+
+ if (CC->internal_pgm) return(0);
+ if (required_level >= ac_internal) {
+ cprintf("%d This is not a user-level command.\n",
+ ERROR+HIGHER_ACCESS_REQUIRED);
+ return(-1);
+ }
+
+ if (CC->usersupp.axlevel >= 6) return(0);
+ if (required_level >= ac_aide) {
+ cprintf("%d This command requires Aide access.\n",
+ ERROR+HIGHER_ACCESS_REQUIRED);
+ return(-1);
+ }
+
+ if (is_room_aide()) return(0);
+ if (required_level >= ac_room_aide) {
+ cprintf("%d This command requires Aide or Room Aide access.\n",
+ ERROR + HIGHER_ACCESS_REQUIRED);
+ return(-1);
+ }
+
+ if (CC->logged_in) return(0);
+ if (required_level >= ac_logged_in) {
+ cprintf("%d Not logged in.\n", ERROR+NOT_LOGGED_IN);
+ return(-1);
+ }
+
+ /* shhh ... succeed quietly */
+ return(0);
+}
+
/*
struct CitContext *ccptr;
int found_it = 0;
- if (!CC->logged_in) {
- cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
- return;
- }
-
- if (CC->usersupp.axlevel < 6) {
- cprintf("%d You must be an Aide to terminate sessions.\n",
- ERROR+HIGHER_ACCESS_REQUIRED);
- return;
- }
+ if (CtdlAccessCheck(ac_aide)) return;
session_num = extract_int(cmdbuf, 0);
if (session_num == CC->cs_pid) {
* Shut down the server
*/
void cmd_down(void) {
- if (!CC->logged_in) {
- cprintf("%d Not logged in.\n", ERROR+NOT_LOGGED_IN);
- return;
- }
- if (CC->usersupp.axlevel < 6) {
- cprintf("%d You must be an Aide to shut down the server.\n",
- ERROR+HIGHER_ACCESS_REQUIRED);
- return;
- }
+ if (CtdlAccessCheck(ac_aide)) return;
cprintf("%d Shutting down server. Goodbye.\n", OK);
master_cleanup();
{
int new_state;
- if (!CC->logged_in) {
- cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
- return;
- }
-
- if (CC->usersupp.axlevel < 6) {
- cprintf("%d You must be an Aide to schedule a shutdown.\n",
- ERROR+HIGHER_ACCESS_REQUIRED);
- return;
- }
+ if (CtdlAccessCheck(ac_aide)) return;
new_state = extract_int(argbuf, 0);
if ((new_state == 0) || (new_state == 1)) {
struct CitContext *viewer);
extern int do_defrag;
char CtdlCheckExpress(void);
+
+int CtdlAccessCheck(int);
+
+/* 'required access level' values which may be passed to CtdlAccessCheck()
+ */
+enum {
+ ac_none,
+ ac_logged_in,
+ ac_room_aide,
+ ac_aide,
+ ac_internal
+};
+
+
+
+
#include "room_ops.h"
#include "msgbase.h"
#include "tools.h"
+#include "citserver.h"
void cmd_delf(char *filename)
{
char pathname[64];
int a;
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
- return;
- }
-
- if (!is_room_aide()) {
- cprintf("%d Higher access required.\n",
- ERROR+HIGHER_ACCESS_REQUIRED);
- return;
- }
-
+ if (CtdlAccessCheck(ac_room_aide)) return;
if ((CC->quickroom.QRflags & QR_DIRECTORY) == 0) {
cprintf("%d No directory in this room.\n",ERROR+NOT_HERE);
extract(filename,cmdbuf,0);
extract(newroom,cmdbuf,1);
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
- return;
- }
-
- if (!is_room_aide()) {
- cprintf("%d Higher access required.\n",
- ERROR+HIGHER_ACCESS_REQUIRED);
- return;
- }
+ if (CtdlAccessCheck(ac_room_aide)) return;
if ((CC->quickroom.QRflags & QR_DIRECTORY) == 0) {
cprintf("%d No directory in this room.\n",ERROR+NOT_HERE);
extract(filename,cmdbuf,0);
extract(destsys,cmdbuf,1);
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
- return;
- }
-
- if (!is_room_aide()) {
- cprintf("%d Higher access required.\n",
- ERROR+HIGHER_ACCESS_REQUIRED);
- return;
- }
+ if (CtdlAccessCheck(ac_room_aide)) return;
if ((CC->quickroom.QRflags & QR_DIRECTORY) == 0) {
cprintf("%d No directory in this room.\n",ERROR+NOT_HERE);
extract(filename,cmdbuf,0);
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
- return;
- }
+ if (CtdlAccessCheck(ac_logged_in)) return;
if ((CC->quickroom.QRflags & QR_DIRECTORY) == 0) {
cprintf("%d No directory in this room.\n",ERROR+NOT_HERE);
extract(CC->upl_file,cmdbuf,0);
extract(CC->upl_comment,cmdbuf,1);
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
- return;
- }
+ if (CtdlAccessCheck(ac_logged_in)) return;
if ((CC->quickroom.QRflags & QR_DIRECTORY) == 0) {
cprintf("%d No directory in this room.\n",ERROR+NOT_HERE);
if (strlen(argbuf) > 0)
FloorBeingSearched = extract_int(argbuf, 0);
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n", ERROR + NOT_LOGGED_IN);
- return;
- }
+ if (CtdlAccessCheck(ac_logged_in)) return;
+
if (getuser(&CC->usersupp, CC->curr_user)) {
cprintf("%d Can't locate user!\n", ERROR + INTERNAL_ERROR);
return;
if (strlen(argbuf) > 0)
FloorBeingSearched = extract_int(argbuf, 0);
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n", ERROR + NOT_LOGGED_IN);
- return;
- }
+ if (CtdlAccessCheck(ac_logged_in)) return;
+
if (getuser(&CC->usersupp, CC->curr_user)) {
cprintf("%d Can't locate user!\n", ERROR + INTERNAL_ERROR);
return;
if (strlen(argbuf) > 0)
FloorBeingSearched = extract_int(argbuf, 0);
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n", ERROR + NOT_LOGGED_IN);
- return;
- }
+ if (CtdlAccessCheck(ac_logged_in)) return;
+
if (getuser(&CC->usersupp, CC->curr_user)) {
cprintf("%d Can't locate user!\n", ERROR + INTERNAL_ERROR);
return;
if (strlen(argbuf) > 0)
FloorBeingSearched = extract_int(argbuf, 0);
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n", ERROR + NOT_LOGGED_IN);
- return;
- }
+ if (CtdlAccessCheck(ac_logged_in)) return;
+
if (getuser(&CC->usersupp, CC->curr_user)) {
cprintf("%d Can't locate user!\n", ERROR + INTERNAL_ERROR);
return;
if (strlen(argbuf) > 0)
FloorBeingSearched = extract_int(argbuf, 0);
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n", ERROR + NOT_LOGGED_IN);
- return;
- }
+ if (CtdlAccessCheck(ac_logged_in)) return;
+
if (getuser(&CC->usersupp, CC->curr_user)) {
cprintf("%d Can't locate user!\n", ERROR + INTERNAL_ERROR);
return;
char towhere[256];
char password[256];
- if ((!(CC->logged_in)) && (!(CC->internal_pgm))) {
- cprintf("%d not logged in\n", ERROR + NOT_LOGGED_IN);
- return;
- }
+ if (CtdlAccessCheck(ac_logged_in)) return;
extract(towhere, gargs, 0);
extract(password, gargs, 1);
struct usersupp temp;
struct cdbdata *cdbus;
- if ((!(CC->logged_in)) && (!(CC->internal_pgm))) {
- cprintf("%d Not logged in.\n", ERROR + NOT_LOGGED_IN);
- return;
- }
getuser(&CC->usersupp, CC->curr_user);
+ if (CtdlAccessCheck(ac_room_aide)) return;
- if ((!is_room_aide()) && (!(CC->internal_pgm))) {
- cprintf("%d Higher access required.\n",
- ERROR + HIGHER_ACCESS_REQUIRED);
- return;
- }
cprintf("%d Who knows room:\n", LISTING_FOLLOWS);
cdb_rewind(CDB_USERSUPP);
while (cdbus = cdb_next_item(CDB_USERSUPP), cdbus != NULL) {
FILE *ls, *fd;
struct stat statbuf;
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n", ERROR + NOT_LOGGED_IN);
- return;
- }
+ if (CtdlAccessCheck(ac_logged_in)) return;
+
getroom(&CC->quickroom, CC->quickroom.QRname);
getuser(&CC->usersupp, CC->curr_user);
*/
void cmd_getr(void)
{
- if ((!(CC->logged_in)) && (!(CC->internal_pgm))) {
- cprintf("%d Not logged in.\n", ERROR + NOT_LOGGED_IN);
- return;
- }
- if ((!is_room_aide()) && (!(CC->internal_pgm))) {
- cprintf("%d Higher access required.\n",
- ERROR + HIGHER_ACCESS_REQUIRED);
- return;
- }
+ if (CtdlAccessCheck(ac_room_aide)) return;
/********
if (is_noneditable(&CC->quickroom)) {
int new_order = 0;
int ne = 0;
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n", ERROR + NOT_LOGGED_IN);
- return;
- }
- if (!is_room_aide()) {
- cprintf("%d Higher access required.\n",
- ERROR + HIGHER_ACCESS_REQUIRED);
- return;
- }
-
+ if (CtdlAccessCheck(ac_room_aide)) return;
if (is_noneditable(&CC->quickroom)) {
ne = 1;
{
struct usersupp usbuf;
- if ((!(CC->logged_in)) && (!(CC->internal_pgm))) {
- cprintf("%d Not logged in.\n", ERROR + NOT_LOGGED_IN);
- return;
- }
+ if (CtdlAccessCheck(ac_logged_in)) return;
+
if (is_noneditable(&CC->quickroom)) {
cprintf("%d Can't edit this room.\n", ERROR + NOT_HERE);
return;
char buf[256];
int post_notice;
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n", ERROR + NOT_LOGGED_IN);
- return;
- }
- if (!is_room_aide()) {
- cprintf("%d Higher access required.\n",
- ERROR + HIGHER_ACCESS_REQUIRED);
- return;
- }
+ if (CtdlAccessCheck(ac_room_aide)) return;
+
if (getuser(&usbuf, new_ra) != 0) {
newu = (-1L);
} else {
kill_ok = extract_int(argbuf, 0);
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n", ERROR + NOT_LOGGED_IN);
- return;
- }
- if (!is_room_aide()) {
- cprintf("%d Higher access required.\n",
- ERROR + HIGHER_ACCESS_REQUIRED);
- return;
- }
+ if (CtdlAccessCheck(ac_room_aide)) return;
+
if (is_noneditable(&CC->quickroom)) {
cprintf("%d Can't edit this room.\n", ERROR + NOT_HERE);
return;
}
}
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n", ERROR + NOT_LOGGED_IN);
- return;
- }
+ if (CtdlAccessCheck(ac_logged_in)) return;
if (CC->usersupp.axlevel < config.c_createax) {
cprintf("%d You need higher access to create rooms.\n",
char infofilename[256];
char buf[256];
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n", ERROR + NOT_LOGGED_IN);
- return;
- }
- if (!is_room_aide()) {
- cprintf("%d Higher access required.\n",
- ERROR + HIGHER_ACCESS_REQUIRED);
- return;
- }
+ if (CtdlAccessCheck(ac_room_aide)) return;
+
if (atoi(ok) == 0) {
cprintf("%d Ok.\n", OK);
return;
int a;
struct floor flbuf;
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n", ERROR + NOT_LOGGED_IN);
- return;
- }
- /* if (getuser(&CC->usersupp,CC->curr_user)) {
- cprintf("%d Can't locate user!\n",ERROR+INTERNAL_ERROR);
- return;
- }
- */
+ if (CtdlAccessCheck(ac_logged_in)) return;
cprintf("%d Known floors:\n", LISTING_FOLLOWS);
cflr_ok = extract_int(argbuf, 1);
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n", ERROR + NOT_LOGGED_IN);
- return;
- }
- if (CC->usersupp.axlevel < 6) {
- cprintf("%d You need higher access to create rooms.\n",
- ERROR + HIGHER_ACCESS_REQUIRED);
- return;
- }
+ if (CtdlAccessCheck(ac_aide)) return;
+
for (a = 0; a < MAXFLOORS; ++a) {
getfloor(&flbuf, a);
floor_to_delete = extract_int(argbuf, 0);
kflr_ok = extract_int(argbuf, 1);
+ if (CtdlAccessCheck(ac_aide)) return;
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n", ERROR + NOT_LOGGED_IN);
- return;
- }
- if (CC->usersupp.axlevel < 6) {
- cprintf("%d You need higher access to delete floors.\n",
- ERROR + HIGHER_ACCESS_REQUIRED);
- return;
- }
lgetfloor(&flbuf, floor_to_delete);
delete_ok = 1;
cprintf("%d Usage error.\n", ERROR);
return;
}
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n", ERROR + NOT_LOGGED_IN);
- return;
- }
- if (CC->usersupp.axlevel < 6) {
- cprintf("%d You need higher access to edit floors.\n",
- ERROR + HIGHER_ACCESS_REQUIRED);
- return;
- }
+
+ if (CtdlAccessCheck(ac_aide)) return;
+
floor_num = extract_int(argbuf, 0);
lgetfloor(&flbuf, floor_num);
if ((flbuf.f_flags & F_INUSE) == 0) {
char cmd[256];
int retval;
-
- if ((!(CC->logged_in))&&(!(CC->internal_pgm))) {
- cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
- return;
- }
-
- if ((!is_room_aide()) && (!(CC->internal_pgm)) ) {
- cprintf("%d Higher access required.\n",
- ERROR+HIGHER_ACCESS_REQUIRED);
- return;
- }
+ if (CtdlAccessCheck(ac_aide)) return;
extract(cmd, argbuf, 0);
if (!strcasecmp(cmd, "users")) {
struct roomref *ptr;
int realcount;
- if ( (!CC->logged_in) || (CC->usersupp.axlevel < 6) ) {
- cprintf("%d Higher access required\n",
- ERROR+HIGHER_ACCESS_REQUIRED);
- return;
- }
+ if (CtdlAccessCheck(ac_aide)) return;
/* Lame way of checking whether anyone else is doing this now */
if (rr != NULL) {
--- /dev/null
+/*
+ * $Id$
+ *
+ *
+ */
+
+#include "sysdep.h"
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <pwd.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/wait.h>
+#include <string.h>
+#include <limits.h>
+#include "citadel.h"
+#include "server.h"
+#include <time.h>
+#include "sysdep_decls.h"
+#include "citserver.h"
+#include "support.h"
+#include "config.h"
+#include "control.h"
+#include "dynloader.h"
+#include "room_ops.h"
+#include "user_ops.h"
+#include "policy.h"
+#include "database.h"
+#include "msgbase.h"
+#include "tools.h"
+
+
+
+/*
+ * moderate a message
+ */
+void cmd_mmod(char *argbuf) {
+ long msgnum;
+ int newlevel;
+
+ /* user must be at least a Room Aide to moderate */
+ if (CtdlAccessCheck(ac_room_aide)) return;
+
+ msgnum = extract_long(argbuf, 0);
+ newlevel = extract_int(argbuf, 1);
+
+ if ( (newlevel < (-63)) || (newlevel > (+63)) ) {
+ cprintf("%d %d is not a valid moderation level.\n",
+ newlevel, ERROR+ILLEGAL_VALUE);
+ }
+
+ cprintf("%d FIXME ... actually do this!!!!!!!!\n", OK);
+}
+
+
+char *Dynamic_Module_Init(void)
+{
+ CtdlRegisterProtoHook(cmd_mmod, "MMOD", "Moderate a message");
+ return "$Id$";
+}
extract(newusername, argbuf, 0);
- if (CC->usersupp.axlevel < 6) {
- cprintf("%d You must be an Aide to masquerade your name.\n",
- ERROR+HIGHER_ACCESS_REQUIRED);
- return;
- }
+ if (CtdlAccessCheck(ac_aide)) return;
if (strlen(newusername) > 0) {
CC->cs_flags &= ~CS_STEALTH;
requested_mode = extract_int(cmdbuf,0);
if (requested_mode !=0) requested_mode = 1;
- if (!CC->logged_in) {
- cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
- return;
- }
-
- if (CC->usersupp.axlevel < 6) {
- cprintf("%d You must be an Aide to use stealth mode.\n",
- ERROR+HIGHER_ACCESS_REQUIRED);
- return;
- }
+ if (CtdlAccessCheck(ac_aide)) return;
if (CC->cs_flags & CS_STEALTH) {
if (requested_mode == 0)
#include "config.h"
#include "dynloader.h"
#include "tools.h"
+#include "citserver.h"
/*
* Is the user currently logged in an Aide *or* the room aide for this room?
*/
int is_room_aide(void) {
+
+ if (!CC->logged_in) return(0);
+
if ( (CC->usersupp.axlevel >= 6)
|| (CC->quickroom.QRroomaide == CC->usersupp.usernum) ) {
return(1);
*/
void cmd_setp(char *new_pw)
{
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
- return;
- }
+ if (CtdlAccessCheck(ac_logged_in)) return;
+
if (CC->usersupp.uid != BBSUID) {
cprintf("%d Not allowed. Use the 'passwd' command.\n",ERROR);
return;
* get user parameters
*/
void cmd_getu(void) {
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
- return;
- }
+
+ if (CtdlAccessCheck(ac_logged_in)) return;
+
getuser(&CC->usersupp,CC->curr_user);
cprintf("%d %d|%d|%d|%d\n",
OK,
{
int new_mod;
+ if (CtdlAccessCheck(ac_logged_in)) return;
+
if (num_parms(new_parms) < 3) {
cprintf("%d Usage error.\n",ERROR);
return;
}
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
- return;
- }
+
lgetuser(&CC->usersupp,CC->curr_user);
CC->usersupp.USscreenwidth = extract_int(new_parms,0);
CC->usersupp.USscreenheight = extract_int(new_parms,1);
long newlr;
struct visit vbuf;
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
- return;
- }
+ if (CtdlAccessCheck(ac_logged_in)) return;
if (!strncasecmp(new_ptr,"highest",7)) {
newlr = CC->quickroom.QRhighest;
char bbb[256];
struct visit vbuf;
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
- return;
- }
-
- if (is_room_aide()==0) {
- cprintf("%d Higher access required.\n",
- ERROR+HIGHER_ACCESS_REQUIRED);
- return;
- }
+ if (CtdlAccessCheck(ac_room_aide)) return;
if (lgetuser(&USscratch,iuser)!=0) {
cprintf("%d No such user.\n",ERROR);
void cmd_forg(void) {
struct visit vbuf;
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
- return;
- }
+ if (CtdlAccessCheck(ac_logged_in)) return;
if (is_aide()) {
cprintf("%d Aides cannot forget rooms.\n",ERROR);
struct cdbdata *cdbus;
struct usersupp usbuf;
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
- return;
- }
-
- if (CC->usersupp.axlevel < 6) {
- cprintf("%d Higher access required.\n",
- ERROR+HIGHER_ACCESS_REQUIRED);
- return;
- }
+ if (CtdlAccessCheck(ac_aide)) return;
if ((CitControl.MMflags&MM_VALID)==0) {
cprintf("%d There are no unvalidated users.\n",OK);
extract(user,v_args,0);
newax = extract_int(v_args,1);
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
- return;
- }
-
- if (CC->usersupp.axlevel < 6) {
- cprintf("%d Higher access required.\n",
- ERROR+HIGHER_ACCESS_REQUIRED);
- return;
- }
+ if (CtdlAccessCheck(ac_aide)) return;
if (lgetuser(&userbuf,user)!=0) {
cprintf("%d '%s' not found.\n",ERROR+NO_SUCH_USER,user);
int regis = 0;
int vali = 0;
- if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
- return;
- }
+ if (CtdlAccessCheck(ac_logged_in)) return;
getuser(&CC->usersupp,CC->curr_user); /* no lock is needed here */
if ((REGISCALL!=0)&&((CC->usersupp.flags&US_REGIS)==0)) regis = 1;
struct usersupp usbuf;
char requested_user[256];
- if ( (CC->internal_pgm==0)
- && ( (CC->logged_in == 0) || (is_aide()==0) ) ) {
- cprintf("%d Higher access required.\n",
- ERROR + HIGHER_ACCESS_REQUIRED);
- return;
- }
+ if (CtdlAccessCheck(ac_aide)) return;
extract(requested_user, cmdbuf, 0);
if (getuser(&usbuf, requested_user) != 0) {
int newax;
int deleted = 0;
- if ( (CC->internal_pgm==0)
- && ( (CC->logged_in == 0) || (is_aide()==0) ) ) {
- cprintf("%d Higher access required.\n",
- ERROR + HIGHER_ACCESS_REQUIRED);
- return;
- }
+ if (CtdlAccessCheck(ac_aide)) return;
extract(requested_user, cmdbuf, 0);
if (lgetuser(&usbuf, requested_user) != 0) {