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
1f67e814
Commit
1f67e814
authored
23 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Calls setuid before spawning child threads (may not work on non-Linux OS).
Added debug output to do_setuid.
parent
8ad40480
Branches
Branches containing commit
Tags
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
+20
-16
20 additions, 16 deletions
src/sbbs3/sbbscon.c
with
20 additions
and
16 deletions
src/sbbs3/sbbscon.c
+
20
−
16
View file @
1f67e814
...
...
@@ -109,11 +109,9 @@ static void lputs(char *str)
}
#ifdef __unix__
/**********************************************************
* Change uid of the calling process to the user if specified
* **********************************************************/
BOOL
do_setuid
()
{
uid_t
new_uid
;
...
...
@@ -122,12 +120,14 @@ BOOL do_setuid()
if
(
new_uid_name
==
NULL
)
/* unspecified */
return
TRUE
;
if
((
pw_entry
=
getpwnam
(
new_uid_name
))
&&
(
new_uid
=
pw_entry
->
pw_uid
))
if
(
!
setuid
(
new_uid
))
if
(
!
setuid
(
new_uid
))
{
lputs
(
"setuid SUCCESSFUL"
);
return
TRUE
;
}
lputs
(
"!setuid FAILED"
);
return
FALSE
;
}
#endif
/* __unix__ */
static
void
thread_up
(
BOOL
up
)
...
...
@@ -588,18 +588,7 @@ int main(int argc, char** argv)
}
}
_beginthread
((
void
(
*
)(
void
*
))
bbs_thread
,
0
,
&
bbs_startup
);
_beginthread
((
void
(
*
)(
void
*
))
ftp_server
,
0
,
&
ftp_startup
);
_beginthread
((
void
(
*
)(
void
*
))
mail_server
,
0
,
&
mail_startup
);
_beginthread
((
void
(
*
)(
void
*
))
services_thread
,
0
,
&
services_startup
);
#ifdef __unix__
// Set up QUIT-type signals so they clean up properly.
signal
(
SIGHUP
,
_sighandler_quit
);
signal
(
SIGINT
,
_sighandler_quit
);
signal
(
SIGQUIT
,
_sighandler_quit
);
signal
(
SIGABRT
,
_sighandler_quit
);
signal
(
SIGTERM
,
_sighandler_quit
);
if
(
getuid
())
/* are we running as a normal user? */
fprintf
(
stderr
,
...
...
@@ -616,7 +605,22 @@ int main(int argc, char** argv)
else
printf
(
"*** Successfully changed to user %s.
\n
"
,
new_uid_name
);
#endif
_beginthread
((
void
(
*
)(
void
*
))
bbs_thread
,
0
,
&
bbs_startup
);
_beginthread
((
void
(
*
)(
void
*
))
ftp_server
,
0
,
&
ftp_startup
);
_beginthread
((
void
(
*
)(
void
*
))
mail_server
,
0
,
&
mail_startup
);
_beginthread
((
void
(
*
)(
void
*
))
services_thread
,
0
,
&
services_startup
);
#ifdef __unix__
// Set up QUIT-type signals so they clean up properly.
signal
(
SIGHUP
,
_sighandler_quit
);
signal
(
SIGINT
,
_sighandler_quit
);
signal
(
SIGQUIT
,
_sighandler_quit
);
signal
(
SIGABRT
,
_sighandler_quit
);
signal
(
SIGTERM
,
_sighandler_quit
);
if
(
!
isatty
(
fileno
(
stdin
)))
/* redirected */
select
(
0
,
NULL
,
NULL
,
NULL
,
NULL
);
/* so wait here until signaled */
else
/* interactive */
...
...
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