# config.mk is generated by ./configure
include config.mk
-all := ctdldump ctdlload citserver setup sendcommand citmail chkpw chkpwd
+all := dbnothing ctdldump ctdlload citserver setup sendcommand citmail chkpw chkpwd
all: $(all)
SERVER_SOURCES := $(wildcard server/*.c server/modules/*/*.c)
chkpwd: utils/chkpwd.c utils/auth.c utils/*.h server/*.h
cc ${CFLAGS} ${LDFLAGS} utils/chkpwd.c utils/auth.c -lcrypt -o chkpwd
+dbnothing: utils/dbnothing.c utils/*.h server/*.h ${BACKEND_OBJECTS}
+ cc ${CFLAGS} ${LDFLAGS} utils/dbnothing.c ${BACKEND_OBJECTS} -lcitadel -lz ${BACKEND_LDFLAGS} -lpthread -o dbnothing
+
ctdldump: utils/ctdldump.c utils/*.h server/*.h ${BACKEND_OBJECTS}
cc ${CFLAGS} ${LDFLAGS} utils/ctdldump.c ${BACKEND_OBJECTS} -lcitadel -lz ${BACKEND_LDFLAGS} -lpthread -o ctdldump
--- /dev/null
+// Don't run this. It doesn't work and if you try to run it you will immediately die.
+//
+// Copyright (c) 2023 by Art Cancro citadel.org
+//
+// This program is open source software. Use, duplication, or disclosure
+// is subject to the terms of the GNU General Public License, version 3.
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <netdb.h>
+#include <string.h>
+#include <pwd.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <limits.h>
+#include <syslog.h>
+#include <libcitadel.h>
+#include <zlib.h>
+#include "../server/sysdep.h"
+#include "../server/citadel_defs.h"
+#include "../server/server.h"
+#include "../server/citadel_dirs.h"
+#include "../server/database.h"
+
+uid_t ctdluid = 0;
+
+
+int main(int argc, char **argv) {
+ int i = 0;
+ int confirmed = 0;
+ char *ctdldir = CTDLDIR;
+
+ // display the greeting
+ fprintf(stderr, "\033[44m\033[33m\033[1m \033[K\033[0m\n"
+ "\033[44m\033[33m\033[1m dbnothing utility for Citadel \033[K\033[0m\n"
+ "\033[44m\033[33m\033[1m Copyright (c) 2023 by citadel.org et al. \033[K\033[0m\n"
+ "\033[44m\033[33m\033[1m This program is open source software. Use, duplication, or disclosure \033[K\033[0m\n"
+ "\033[44m\033[33m\033[1m is subject to the terms of the GNU General Public license v3. \033[K\033[0m\n"
+ "\033[44m\033[33m\033[1m \033[K\033[0m\n");
+
+ // Parse command line
+ int a;
+ while ((a = getopt(argc, argv, "h:y")) != EOF) {
+ switch (a) {
+ case 'h':
+ ctdldir = optarg;
+ break;
+ default:
+ fprintf(stderr, "%s: usage: %s -s citadel_dir [>dumpfile]\n", argv[0], argv[0]);
+ exit(2);
+ }
+ }
+
+ if (chdir(ctdldir) != 0) {
+ fprintf(stderr, "ctdlload: unable to change directory to [%s]: %m", ctdldir);
+ exit(2);
+ }
+
+ // backend modules use syslog -- redirect to stderr
+ openlog("dbnothing", LOG_PERROR , LOG_DAEMON);
+
+ // initialize the database backend
+ cdb_init_backends();
+ cdb_open_databases();
+
+ // do nothing
+ fprintf(stderr, "dbnothing: doing nothing\n");
+
+ // close databases
+ cdb_close_databases();
+
+ fprintf(stderr, "dbnothing: \033[32m\033[1mfinished\033[0m\n");
+ exit(0);
+}