Skip to content
Snippets Groups Projects
Commit 1fc0aef7 authored by deuce's avatar deuce
Browse files

Set no recycle flags in server options before starting servers

Prevents detection of recycle semaphore before option is set
(First noticed on OpenBSD)
parent 7236fd56
No related branches found
No related tags found
No related merge requests found
......@@ -36,6 +36,12 @@ ifdef DEBUG
else
BUILD = release
endif
BUILDPATH := $(BUILD)
ifeq ($(shell hostname),dmjunk.kingcole.local)
THREADS_ACTUALLY_WORK=1
BUILDPATH := redhat
endif
ifdef bcc
CC = bc++ -q
......@@ -94,8 +100,8 @@ else
endif
endif
LIBODIR := $(CCPRE).$(os).lib.$(BUILD)
EXEODIR := $(CCPRE).$(os).exe.$(BUILD)
LIBODIR := $(CCPRE).$(os).lib.$(BUILDPATH)
EXEODIR := $(CCPRE).$(os).exe.$(BUILDPATH)
DELETE = rm -f
......@@ -196,7 +202,11 @@ ifdef USE_CURSES
ifeq ($(os),qnx)
UIFC_LFLAGS += -lncurses
else
UIFC_LFLAGS += -lcurses
ifeq ($(os),netbsd)
UIFC_LFLAGS += -lncurses
else
UIFC_LFLAGS += -lcurses
endif
endif
UIFC_OBJS += $(LIBODIR)/uifcc.o
endif
......@@ -206,7 +216,11 @@ ifdef USE_UIFC32
ifeq ($(os),qnx)
UIFC_LFLAGS += -lncurses
else
UIFC_LFLAGS += -lcurses
ifeq ($(os),netbsd)
UIFC_LFLAGS += -lncurses
else
UIFC_LFLAGS += -lcurses
endif
endif
UIFC_OBJS += $(LIBODIR)/uifc32.o
UIFC_OBJS += $(LIBODIR)/ciowrap.o
......
......@@ -1524,6 +1524,26 @@ int main(int argc, char** argv)
signal(SIGPIPE, SIG_IGN); /* Ignore "Broken Pipe" signal (Also used for broken socket etc.) */
signal(SIGALRM, SIG_IGN); /* Ignore "Alarm" signal */
_beginthread((void(*)(void*))handle_sigs,0,NULL);
if(new_uid_name[0]!=0) { /* check the user arg, if we have uid 0 */
/* Can't recycle servers (re-bind ports) as non-root user */
/* If DONT_BLAME_SYNCHRONET is set, keeps root credentials laying around */
#if !defined(DONT_BLAME_SYNCHRONET)
if(bbs_startup.telnet_port < IPPORT_RESERVED
|| (bbs_startup.options & BBS_OPT_ALLOW_RLOGIN
&& bbs_startup.rlogin_port < IPPORT_RESERVED))
bbs_startup.options|=BBS_OPT_NO_RECYCLE;
if(ftp_startup.port < IPPORT_RESERVED)
ftp_startup.options|=FTP_OPT_NO_RECYCLE;
if(web_startup.port < IPPORT_RESERVED)
web_startup.options|=BBS_OPT_NO_RECYCLE;
if((mail_startup.options & MAIL_OPT_ALLOW_POP3
&& mail_startup.pop3_port < IPPORT_RESERVED)
|| mail_startup.smtp_port < IPPORT_RESERVED)
mail_startup.options|=MAIL_OPT_NO_RECYCLE;
/* Perhaps a BBS_OPT_NO_RECYCLE_LOW option? */
services_startup.options|=BBS_OPT_NO_RECYCLE;
}
#endif
#endif
if(run_bbs)
......@@ -1584,24 +1604,6 @@ int main(int argc, char** argv)
sprintf(str,"Successfully changed user_id to %s", new_uid_name);
bbs_lputs(NULL,LOG_INFO,str);
/* Can't recycle servers (re-bind ports) as non-root user */
/* If DONT_BLAME_SYNCHRONET is set, keeps root credentials laying around */
#if !defined(DONT_BLAME_SYNCHRONET)
if(bbs_startup.telnet_port < IPPORT_RESERVED
|| (bbs_startup.options & BBS_OPT_ALLOW_RLOGIN
&& bbs_startup.rlogin_port < IPPORT_RESERVED))
bbs_startup.options|=BBS_OPT_NO_RECYCLE;
if(ftp_startup.port < IPPORT_RESERVED)
ftp_startup.options|=FTP_OPT_NO_RECYCLE;
if(web_startup.port < IPPORT_RESERVED)
web_startup.options|=BBS_OPT_NO_RECYCLE;
if((mail_startup.options & MAIL_OPT_ALLOW_POP3
&& mail_startup.pop3_port < IPPORT_RESERVED)
|| mail_startup.smtp_port < IPPORT_RESERVED)
mail_startup.options|=MAIL_OPT_NO_RECYCLE;
/* Perhaps a BBS_OPT_NO_RECYCLE_LOW option? */
services_startup.options|=BBS_OPT_NO_RECYCLE;
#endif
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment