Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
67c1b25d
Commit
67c1b25d
authored
2 years ago
by
Rob Swindell
Browse files
Options
Downloads
Patches
Plain Diff
Add/use new helper function is_user_sysop()
parent
98949dd4
No related branches found
No related tags found
1 merge request
!463
MRC mods by Codefenix (2024-10-20)
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/sbbs3/js_bbs.cpp
+3
-3
3 additions, 3 deletions
src/sbbs3/js_bbs.cpp
src/sbbs3/js_user.c
+1
-1
1 addition, 1 deletion
src/sbbs3/js_user.c
src/sbbs3/userdat.c
+14
-4
14 additions, 4 deletions
src/sbbs3/userdat.c
src/sbbs3/userdat.h
+1
-0
1 addition, 0 deletions
src/sbbs3/userdat.h
with
19 additions
and
8 deletions
src/sbbs3/js_bbs.cpp
+
3
−
3
View file @
67c1b25d
...
...
@@ -3235,7 +3235,7 @@ js_put_node_message(JSContext *cx, uintN argc, jsval *arglist)
if
(
nodenum
>=
1
)
{
/* !all */
sbbs
->
getnodedat
(
nodenum
,
&
node
,
false
);
usernumber
=
node
.
useron
;
if
((
node
.
misc
&
NODE_POFF
)
&&
sbbs
->
useron
.
level
<
SYSOP_LEVEL
)
{
if
((
node
.
misc
&
NODE_POFF
)
&&
!
is_user_sysop
(
&
sbbs
->
useron
)
)
{
sbbs
->
bprintf
(
sbbs
->
text
[
CantPageNode
]
,
node
.
misc
&
NODE_ANON
?
sbbs
->
text
[
UNKNOWN_USER
]
:
username
(
&
sbbs
->
cfg
,
node
.
useron
,
tmp
));
return
JS_TRUE
;
...
...
@@ -3281,8 +3281,8 @@ js_put_node_message(JSContext *cx, uintN argc, jsval *arglist)
continue
;
sbbs
->
getnodedat
(
i
,
&
node
,
false
);
if
((
node
.
status
==
NODE_INUSE
||
(
sbbs
->
useron
.
level
>=
SYSOP_LEVEL
&&
node
.
status
==
NODE_QUIET
))
&&
(
sbbs
->
useron
.
level
>=
SYSOP_LEVEL
||
!
(
node
.
misc
&
NODE_POFF
)))
||
(
is_user_sysop
(
&
sbbs
->
useron
)
&&
node
.
status
==
NODE_QUIET
))
&&
(
is_user_sysop
(
&
sbbs
->
useron
)
||
!
(
node
.
misc
&
NODE_POFF
)))
if
(
putnmsg
(
&
sbbs
->
cfg
,
i
,
msg
)
!=
0
)
success
=
FALSE
;
}
...
...
This diff is collapsed.
Click to expand it.
src/sbbs3/js_user.c
+
1
−
1
View file @
67c1b25d
...
...
@@ -408,7 +408,7 @@ static JSBool js_user_get(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
return
(
JS_TRUE
);
/* intentional early return */
case
USER_PROP_IS_SYSOP
:
*
vp
=
BOOLEAN_TO_JSVAL
(
p
->
user
->
level
>=
SYSOP_LEVEL
);
*
vp
=
BOOLEAN_TO_JSVAL
(
is_user_sysop
(
p
->
user
)
);
JS_RESUMEREQUEST
(
cx
,
rc
);
return
(
JS_TRUE
);
/* intentional early return */
...
...
This diff is collapsed.
Click to expand it.
src/sbbs3/userdat.c
+
14
−
4
View file @
67c1b25d
...
...
@@ -1917,7 +1917,7 @@ static BOOL ar_exp(scfg_t* cfg, uchar **ptrptr, user_t* user, client_t* client)
else
result
=!
not
;
break
;
case
AR_SYSOP
:
if
(
user
==
NULL
||
user
->
level
<
SYSOP_LEVEL
)
if
(
!
is_user_sysop
(
user
)
)
result
=
not
;
else
result
=!
not
;
break
;
...
...
@@ -2671,7 +2671,7 @@ BOOL user_downloaded_file(scfg_t* cfg, user_t* user, client_t* client,
u64toac
(
mod
,
tmp
,
','
);
const
char
*
alias
=
user
->
alias
[
0
]
?
user
->
alias
:
cfg
->
text
[
UNKNOWN_USER
];
char
username
[
64
];
if
(
client
!=
NULL
&&
uploader
.
level
>=
SYSOP_LEVEL
)
{
if
(
client
!=
NULL
&&
is_user_sysop
(
&
uploader
)
)
{
if
(
client
->
host
[
0
]
!=
'\0'
&&
strcmp
(
client
->
host
,
STR_NO_HOSTNAME
)
!=
0
)
SAFEPRINTF2
(
username
,
"%s [%s]"
,
alias
,
client
->
host
);
else
...
...
@@ -3348,6 +3348,16 @@ BOOL can_user_send_mail(scfg_t* cfg, enum smb_net_type net_type, uint usernumber
return
TRUE
;
}
/****************************************************************************/
/* Determine if the specified user is a system operator */
/****************************************************************************/
BOOL
is_user_sysop
(
user_t
*
user
)
{
if
(
user
==
NULL
)
return
FALSE
;
return
user
->
level
>=
SYSOP_LEVEL
;
}
/****************************************************************************/
/* Determine if the specified user is a sub-board operator */
/****************************************************************************/
...
...
@@ -3357,7 +3367,7 @@ BOOL is_user_subop(scfg_t* cfg, uint subnum, user_t* user, client_t* client)
return
FALSE
;
if
(
!
can_user_access_sub
(
cfg
,
subnum
,
user
,
client
))
return
FALSE
;
if
(
user
->
level
>=
SYSOP_LEVEL
)
if
(
is_
user
_sysop
(
user
)
)
return
TRUE
;
return
cfg
->
sub
[
subnum
]
->
op_ar
[
0
]
!=
0
&&
chk_ar
(
cfg
,
cfg
->
sub
[
subnum
]
->
op_ar
,
user
,
client
);
...
...
@@ -3372,7 +3382,7 @@ BOOL is_user_dirop(scfg_t* cfg, uint dirnum, user_t* user, client_t* client)
return
FALSE
;
if
(
!
can_user_access_dir
(
cfg
,
dirnum
,
user
,
client
))
return
FALSE
;
if
(
user
->
level
>=
SYSOP_LEVEL
)
if
(
is_
user
_sysop
(
user
)
)
return
TRUE
;
return
(
cfg
->
dir
[
dirnum
]
->
op_ar
[
0
]
!=
0
&&
chk_ar
(
cfg
,
cfg
->
dir
[
dirnum
]
->
op_ar
,
user
,
client
))
...
...
This diff is collapsed.
Click to expand it.
src/sbbs3/userdat.h
+
1
−
0
View file @
67c1b25d
...
...
@@ -126,6 +126,7 @@ DLLEXPORT BOOL can_user_post(scfg_t*, uint subnum, user_t*, client_t* client, ui
DLLEXPORT
BOOL
can_user_upload
(
scfg_t
*
,
uint
dirnum
,
user_t
*
,
client_t
*
client
,
uint
*
reason
);
DLLEXPORT
BOOL
can_user_download
(
scfg_t
*
,
uint
dirnum
,
user_t
*
,
client_t
*
client
,
uint
*
reason
);
DLLEXPORT
BOOL
can_user_send_mail
(
scfg_t
*
,
enum
smb_net_type
,
uint
usernumber
,
user_t
*
,
uint
*
reason
);
DLLEXPORT
BOOL
is_user_sysop
(
user_t
*
);
DLLEXPORT
BOOL
is_user_subop
(
scfg_t
*
,
uint
subnum
,
user_t
*
,
client_t
*
client
);
DLLEXPORT
BOOL
is_user_dirop
(
scfg_t
*
,
uint
dirnum
,
user_t
*
,
client_t
*
client
);
DLLEXPORT
BOOL
is_download_free
(
scfg_t
*
,
uint
dirnum
,
user_t
*
,
client_t
*
client
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment