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
395f7309
Commit
395f7309
authored
23 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Added mechanism to protect against specifying user-id after group-id.
parent
06f776c2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sbbs3/sbbscon.c
+10
-8
10 additions, 8 deletions
src/sbbs3/sbbscon.c
with
10 additions
and
8 deletions
src/sbbs3/sbbscon.c
+
10
−
8
View file @
395f7309
...
...
@@ -111,8 +111,6 @@ static const char* usage = "usage: %s [[option] [...]]\n"
#ifdef __unix__
"
\t
un<user> set username for BBS to run as
\n
"
"
\t
ug<group> set group for BBS to run as
\n
"
"
\t
must NOT be followed by un
\n
"
"
\t
ie: put un first or not at all
\n
"
#endif
"
\t
gi get user identity (using IDENT protocol)
\n
"
"
\t
nh disable hostname lookups
\n
"
...
...
@@ -179,7 +177,7 @@ static BOOL do_seteuid(BOOL to_new)
pthread_mutex_lock
(
&
mutex
);
if
(
to_new
)
if
(
to_new
)
if
(
!
setegid
(
new_gid
)
&&
!
seteuid
(
new_uid
))
result
=
TRUE
;
else
...
...
@@ -469,8 +467,8 @@ int main(int argc, char** argv)
char
*
ctrl_dir
;
BOOL
quit
=
FALSE
;
#ifdef __unix__
char
*
new_uid_name
;
char
*
new_gid_name
;
char
*
new_uid_name
=
NULL
;
char
*
new_gid_name
=
NULL
;
struct
passwd
*
pw_entry
;
struct
group
*
gr_entry
;
#endif
...
...
@@ -706,7 +704,11 @@ int main(int argc, char** argv)
switch
(
toupper
(
*
(
arg
++
)))
{
case
'N'
:
/* username */
#ifdef __unix__
if
(
strlen
(
arg
)
>
1
)
if
(
new_gid_name
!=
NULL
)
{
printf
(
"!Must specify user before group"
);
break
;
}
if
(
strlen
(
arg
)
>
1
)
{
new_uid_name
=
arg
;
old_uid
=
getuid
();
...
...
@@ -725,7 +727,7 @@ int main(int argc, char** argv)
break
;
case
'G'
:
/* groupname */
#ifdef __unix__
if
(
strlen
(
arg
)
>
1
)
if
(
strlen
(
arg
)
>
1
)
{
new_gid_name
=
arg
;
old_gid
=
getgid
();
...
...
@@ -828,7 +830,7 @@ int main(int argc, char** argv)
||
(
run_mail
&&
!
mail_running
)
||
(
run_services
&&
!
services_running
))
mswait
(
1
);
if
(
!
do_setuid
())
if
(
!
do_setuid
())
/* actually try to change the uid of this process */
bbs_lputs
(
"!Setting new user_id failed! (Does the user exist?)"
);
...
...
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