diff --git a/Makefile.am b/Makefile.am index c409e8d..13675a2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -132,7 +132,6 @@ include_subdirs := \ src/apps/manager \ src/apps/sendmail \ src/apps/setup \ - src/apps/tzcache \ src/apps/mdbtool \ src/apps/queuetool \ src/apps/storetool \ @@ -198,7 +197,6 @@ include src/apps/config/Bongo.rules include src/apps/manager/Bongo.rules include src/apps/sendmail/Bongo.rules include src/apps/setup/Bongo.rules -include src/apps/tzcache/Bongo.rules include src/apps/mdbtool/Bongo.rules # include src/apps/migrate/Bongo.rules include src/apps/queuetool/Bongo.rules diff --git a/configure.ac b/configure.ac index 21c2c11..67425ed 100644 --- a/configure.ac +++ b/configure.ac @@ -693,7 +693,6 @@ src/apps/manager/Makefile src/apps/admin/Makefile src/apps/config/Makefile src/apps/sendmail/Makefile -src/apps/tzcache/Makefile src/apps/backup/Makefile src/apps/mdbtool/Makefile src/apps/queuetool/Makefile diff --git a/src/apps/config/config.c b/src/apps/config/config.c index 0a3cac6..7698945 100644 --- a/src/apps/config/config.c +++ b/src/apps/config/config.c @@ -24,11 +24,20 @@ usage() { " install do the initial Bongo install\n" " crypto generate data needed for encryption\n" " checkversion see if a newer Bongo is available\n" + " tzcache regenerate cached timezone information\n" ""; XplConsolePrintf("%s", usage); } +void +RunAsBongoUser() { + if (XplSetRealUser(MsgGetUnprivilegedUser()) < 0) { + printf("bongotzcache: Could not drop to unpriviliged user '%s'\n", MsgGetUnprivilegedUser()); + exit(-1); + } +} + BOOL NMAPSimpleCommand(StoreClient *client, char *command) { CCode ccode; @@ -269,6 +278,19 @@ CheckVersion() { } } +void +TzCache() { + char path[PATH_MAX]; + char *dbfdir = XPL_DEFAULT_DBF_DIR; + + RunAsBongoUser(); + + snprintf(path, PATH_MAX, "%s/%s", dbfdir, "bongo-tz.cache"); + unlink(path); + + BongoCalInit(dbfdir); +} + int main(int argc, char *argv[]) { int next_arg = 0; @@ -301,6 +323,8 @@ main(int argc, char *argv[]) { command = 2; } else if (!strcmp(argv[next_arg], "checkversion")) { command = 3; + } else if (!strcmp(argv[next_arg], "tzcache")) { + command = 4; } else { printf("Unrecognized command: %s\n", argv[next_arg]); } @@ -327,6 +351,9 @@ main(int argc, char *argv[]) { case 3: CheckVersion(); break; + case 4: + TzCache(); + break; default: break; } diff --git a/src/apps/tzcache/Bongo.rules b/src/apps/tzcache/Bongo.rules deleted file mode 100644 index b825993..0000000 --- a/src/apps/tzcache/Bongo.rules +++ /dev/null @@ -1,23 +0,0 @@ -# -*- Makefile -*- -sbin_PROGRAMS += bongo-tzcache - -bongo_tzcache_SOURCES := \ - src/apps/tzcache/tzcache.c - -bongo_tzcache_LDADD := \ - libbongomdb.la \ - libbongoconnio.la \ - libbongomemmgr.la \ - libbongoutil.la \ - libbongoxpl.la \ - libbongomsgapi.la \ - libbongocal.la \ - libbongoconnio.la \ - $(top_builddir)/import/log4c/log4c/libbongolog4c.la \ - $(PTHREAD_LIBS) \ - $(ALL_LIBS) - -src/apps/tzcache/all: bongo-tzcache -src/apps/tzcache/clean: clean -src/apps/tzcache/install: - @cd $(top_builddir) && $(MAKE) $(MFLAGS) sbin_PROGRAMS=bongo-tzcache install-sbinPROGRAMS diff --git a/src/apps/tzcache/Makefile.am b/src/apps/tzcache/Makefile.am deleted file mode 100644 index 8830401..0000000 --- a/src/apps/tzcache/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -# -*- Makefile -*- -# -# Do not edit! -# -# (unless this is Makefile.am.subdir) -# -# This file is a copy of the toplevel Makefile.am.subdir. If changes -# need to be made, edit that file, and make update-makefiles, and -# check the new files in. -# -# This is a skeletal automake file. The real automake fules for -# building the targets for this directory can be found in the -# Bongo.rules file. This file is simply here so that 'make all' can -# work in each subdirectory. - -all clean install: - @cd $(top_builddir) && $(MAKE) $(MFLAGS) $(subdir)/$@ diff --git a/src/apps/tzcache/tzcache.c b/src/apps/tzcache/tzcache.c deleted file mode 100644 index ff3d831..0000000 --- a/src/apps/tzcache/tzcache.c +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include -#include - -int -main(int argc, char **argv) -{ - char path[PATH_MAX]; - - if (XplSetRealUser(MsgGetUnprivilegedUser()) < 0) { - printf("bongotzcache: Could not drop to unpriviliged user '%s'\n", MsgGetUnprivilegedUser()); - return 1; - } - - MemoryManagerOpen("bongotzcache"); - - MsgInit(); - - snprintf(path, PATH_MAX, "%s/%s", MsgGetDBFDir(NULL), "bongo-tz.cache"); - unlink(path); - - BongoCalInit(MsgGetDBFDir(NULL)); - - return 0; -}