Monotone-Parent: 9710b121b6d2a9cb6c458ece855761137e8fb6dc

Monotone-Revision: 0500c2697b10470788d9a9fc3204a2b0df84dc8d

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-06-21T21:16:03
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2007-06-21 21:16:03 +00:00
parent fdb0e30073
commit a1154d05aa
2 changed files with 27 additions and 9 deletions
+4
View File
@@ -1,3 +1,7 @@
2007-06-21 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Main/sogod.m (main): prevent SOGo from running as root.
2007-06-19 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/SOGo/SOGoUser.m ([SOGoUser
+23 -9
View File
@@ -19,6 +19,8 @@
02111-1307, USA.
*/
#import <unistd.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSTimeZone.h>
@@ -31,21 +33,33 @@ main (int argc, char **argv, char **env)
NSString *tzName;
NSUserDefaults *ud;
NSAutoreleasePool *pool;
int rc;
pool = [NSAutoreleasePool new];
if (getuid() > 0)
{
rc = 0;
#if LIB_FOUNDATION_LIBRARY
[NSProcessInfo initializeWithArguments: argv count: argc environment: env];
[NSProcessInfo initializeWithArguments: argv count: argc environment: env];
#endif
[NGBundleManager defaultBundleManager];
[NGBundleManager defaultBundleManager];
ud = [NSUserDefaults standardUserDefaults];
tzName = [ud stringForKey: @"SOGoServerTimeZone"];
if (!tzName)
tzName = @"Canada/Eastern";
[NSTimeZone setDefaultTimeZone: [NSTimeZone timeZoneWithName: tzName]];
ud = [NSUserDefaults standardUserDefaults];
tzName = [ud stringForKey: @"SOGoServerTimeZone"];
if (!tzName)
tzName = @"Canada/Eastern";
[NSTimeZone setDefaultTimeZone: [NSTimeZone timeZoneWithName: tzName]];
WOWatchDogApplicationMain (@"SOGo", argc, (void *) argv);
WOWatchDogApplicationMain (@"SOGo", argc, (void *) argv);
}
else
{
NSLog (@"Don't run SOGo as root!");
rc = -1;
}
[pool release];
return 0;
return rc;
}