2006-06-15 21:34:10 +02:00
|
|
|
/*
|
|
|
|
Copyright (C) 2004-2005 SKYRIX Software AG
|
2009-11-29 05:19:32 +01:00
|
|
|
Copyright (C) 2006-2009 Inverse inc.
|
2006-06-15 21:34:10 +02:00
|
|
|
|
|
|
|
This file is part of OpenGroupware.org.
|
|
|
|
|
|
|
|
OGo is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU Lesser General Public License as published by the
|
|
|
|
Free Software Foundation; either version 2, or (at your option) any
|
|
|
|
later version.
|
|
|
|
|
|
|
|
OGo is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
|
|
License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with OGo; see the file COPYING. If not, write to the
|
|
|
|
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2009-11-29 05:19:32 +01:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/types.h>
|
2007-06-21 23:16:03 +02:00
|
|
|
|
2007-06-29 23:55:16 +02:00
|
|
|
#import <Foundation/NSAutoreleasePool.h>
|
|
|
|
#import <Foundation/NSString.h>
|
2006-10-04 21:19:38 +02:00
|
|
|
#import <Foundation/NSTimeZone.h>
|
2006-06-15 21:34:10 +02:00
|
|
|
|
2007-06-29 23:55:16 +02:00
|
|
|
#import <NGObjWeb/SoApplication.h>
|
2006-10-04 21:19:38 +02:00
|
|
|
|
2009-11-29 05:19:32 +01:00
|
|
|
#import <SOGo/SOGoSystemDefaults.h>
|
2009-03-18 23:13:04 +01:00
|
|
|
|
2007-04-16 23:41:50 +02:00
|
|
|
int
|
|
|
|
main (int argc, char **argv, char **env)
|
2006-10-04 21:19:38 +02:00
|
|
|
{
|
2006-06-15 21:34:10 +02:00
|
|
|
NSAutoreleasePool *pool;
|
2009-11-29 05:19:32 +01:00
|
|
|
SOGoSystemDefaults *sd;
|
2007-06-21 23:16:03 +02:00
|
|
|
int rc;
|
2006-06-15 21:34:10 +02:00
|
|
|
|
2010-01-18 10:23:06 +01:00
|
|
|
/* Here we work around a bug in GNUstep which decode XML user defaults using
|
|
|
|
the system encoding, rather than honouring the encoding specified in the
|
|
|
|
file. */
|
|
|
|
putenv ("GNUSTEP_STRING_ENCODING=NSUTF8StringEncoding");
|
|
|
|
|
2007-02-08 17:24:59 +01:00
|
|
|
pool = [NSAutoreleasePool new];
|
2007-06-21 23:16:03 +02:00
|
|
|
|
|
|
|
if (getuid() > 0)
|
|
|
|
{
|
2007-06-29 23:55:16 +02:00
|
|
|
rc = 0;
|
2009-11-29 05:19:32 +01:00
|
|
|
sd = [SOGoSystemDefaults sharedSystemDefaults];
|
|
|
|
[NSTimeZone setDefaultTimeZone: [sd timeZone]];
|
2007-06-21 23:16:03 +02:00
|
|
|
WOWatchDogApplicationMain (@"SOGo", argc, (void *) argv);
|
|
|
|
}
|
|
|
|
else
|
2009-11-29 05:19:32 +01:00
|
|
|
{
|
|
|
|
rc = -1;
|
|
|
|
NSLog (@"Don't run SOGo as root!");
|
|
|
|
}
|
2006-06-15 21:34:10 +02:00
|
|
|
|
|
|
|
[pool release];
|
2007-06-21 23:16:03 +02:00
|
|
|
|
|
|
|
return rc;
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|