Now switches to the user/group that owns the executable on startup.

This commit is contained in:
mysticbbs 2012-08-13 18:54:00 -04:00
parent acfb1eebf7
commit c91a1c93cb
2 changed files with 27 additions and 0 deletions

View File

@ -337,6 +337,23 @@ Begin
SwitchFocus;
End;
{$IFDEF UNIX}
Procedure SetUserOwner;
Var
Info : Stat;
MysLoc : String;
Begin
MysLoc := GetEnv('mysticbbs');
If MysLoc <> '' Then MysLoc := DirSlash(MysLoc);
If fpStat(MysLoc + 'mis', Info) = 0 Then Begin
fpSetGID (Info.st_GID);
fpSetUID (Info.st_UID);
End;
End;
{$ENDIF}
Function ServerStartup : Boolean;
Begin
Result := False;
@ -393,6 +410,10 @@ Begin
Result := True;
End;
{$IFDEF UNIX}
SetUserOwner;
{$ENDIF}
End;
{$IFDEF UNIX}

View File

@ -182,7 +182,13 @@ Procedure Linux_Init;
Var
Count : Word;
TChat : ChatRec;
Info : Stat;
Begin
If fpStat('mystic', Info) = 0 Then Begin
fpSetGID (Info.st_GID);
fpSetUID (Info.st_UID);
End;
Session.NodeNum := 0;
For Count := 1 to Config.INetTNNodes Do Begin