SOURCES=utils/citmail.c utils/setup.c utils/chkpw.c \
utils/sendcommand.c utils/ctdlmigrate.c utils/chkpwd.c \
- utillib/citadel_dirs.c \
+ citadel_dirs.c \
citserver.c clientsocket.c config.c control.c $(DATABASE) \
domain.c serv_extensions.c genstamp.c \
housekeeping.c default_timezone.c internet_addressing.c \
@for d in `/bin/ls $(VPATH)/user_modules/`; do \
(mkdir -p user_modules/$$d ) ; \
done
- mkdir -p utils utillib
+ mkdir -p utils
mkdir locale
svn_revision.c: ${SOURCES}
modules_upgrade.c: modules_init.c
-SERV_OBJS = server_main.o utillib/citadel_dirs.o \
+SERV_OBJS = server_main.o citadel_dirs.o \
user_ops.o citserver.o sysdep.o serv_extensions.o \
$(DATABASE:.c=.o) domain.o \
control.o config.o support.o room_ops.o \
echo "CC $<"
$(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $< -o $@
-citmail$(EXEEXT): utils/citmail.o utillib/citadel_dirs.o
- $(CC) utils/citmail.o utillib/citadel_dirs.o \
+citmail$(EXEEXT): utils/citmail.o citadel_dirs.o
+ $(CC) utils/citmail.o citadel_dirs.o \
$(LDFLAGS) -o citmail$(EXEEXT) $(LIBS)
# setup does need LIBS defined, because it uses network functions which are in -lsocket -lnsl on Solaris.
-setup$(EXEEXT): utils/setup.o utillib/citadel_dirs.o
- $(CC) utils/setup.o utillib/citadel_dirs.o \
+setup$(EXEEXT): utils/setup.o citadel_dirs.o
+ $(CC) utils/setup.o citadel_dirs.o \
$(LDFLAGS) -o setup$(EXEEXT) $(LIBS) $(SETUP_LIBS)
-ctdlmigrate$(EXEEXT): utils/ctdlmigrate.o utillib/citadel_dirs.o
- $(CC) utils/ctdlmigrate.o utillib/citadel_dirs.o \
+ctdlmigrate$(EXEEXT): utils/ctdlmigrate.o citadel_dirs.o
+ $(CC) utils/ctdlmigrate.o citadel_dirs.o \
$(LDFLAGS) -o ctdlmigrate$(EXEEXT) $(LIBS)
chkpwd$(EXEEXT): utils/chkpwd.o auth.o
$(CC) utils/chkpwd.o auth.o $(LDFLAGS) -o chkpwd$(EXEEXT) $(chkpwd_LIBS)
-chkpw$(EXEEXT): utils/chkpw.o auth.o utillib/citadel_dirs.o
- $(CC) utils/chkpw.o auth.o utillib/citadel_dirs.o \
+chkpw$(EXEEXT): utils/chkpw.o auth.o citadel_dirs.o
+ $(CC) utils/chkpw.o auth.o citadel_dirs.o \
$(LDFLAGS) -o chkpw$(EXEEXT) $(chkpwd_LIBS)
-sendcommand$(EXEEXT): utils/sendcommand.o utillib/citadel_dirs.o $(LIBOBJS)
- $(CC) utils/sendcommand.o utillib/citadel_dirs.o \
+sendcommand$(EXEEXT): utils/sendcommand.o citadel_dirs.o $(LIBOBJS)
+ $(CC) utils/sendcommand.o citadel_dirs.o \
$(LIBOBJS) $(LDFLAGS) -o sendcommand$(EXEEXT) $(LIBS)
.PHONY: install-data install-doc install-exec clean cleaner distclean
rm -vfr locale/*
rm -vf *.o
rm -vf utils/*.o ;\
- rm -vf utillib/*.o ;\
+ rm -vf *.o ;\
for i in $(srcdir)/modules/* ; do \
rm -vf $$i/*.o ;\
done
rm -vf po/Makefile
rm -vf Makefile configure sysdep.h config.cache config.log config.status *.d package-version.txt
rm -vf utils/*.d ;
- rm -vf utillib/*.d ;
for i in $(srcdir)/modules/* ; do \
rm -vf $$i/*.d ;\
done
--- /dev/null
+/*
+ * citadel_dirs.c : calculate pathnames for various files used in the Citadel system
+ *
+ * Copyright (c) 1987-2021 by the citadel.org team
+ *
+ * This program is open source software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3.
+ *
+ * This program 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 General Public License for more details.
+ */
+#include <unistd.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <ctype.h>
+#include <string.h>
+#include <limits.h>
+#include <time.h>
+#include <errno.h>
+#include <syslog.h>
+#include <libcitadel.h>
+#include "citadel.h"
+#include "citadel_dirs.h"
+
+/*
+ * Generate an associated file name for a room
+ */
+size_t assoc_file_name(char *buf, size_t n, struct ctdlroom *qrbuf, const char *prefix) {
+ return snprintf(buf, n, "%s%ld", prefix, qrbuf->QRnumber);
+}
+
+
+int create_dir(char *which, long ACCESS, long UID, long GID) {
+ int rv;
+ rv = mkdir(which, ACCESS);
+ if ((rv == -1) && (errno != EEXIST)) {
+ syslog(LOG_ERR,
+ "failed to create directory %s: %s",
+ which,
+ strerror(errno));
+ return rv;
+ }
+ rv = chmod(which, ACCESS);
+ if (rv == -1) {
+ syslog(LOG_ERR,
+ "failed to set permissions for directory %s: %s",
+ which,
+ strerror(errno));
+ return rv;
+ }
+ rv = chown(which, UID, GID);
+ if (rv == -1) {
+ syslog(LOG_ERR,
+ "failed to set owner for directory %s: %s",
+ which,
+ strerror(errno));
+ return rv;
+ }
+ return rv;
+}
+
+
+int create_run_directories(long UID, long GID) {
+ int rv = 0;
+ rv += create_dir(ctdl_message_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
+ rv += create_dir(ctdl_file_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
+ rv += create_dir(ctdl_key_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
+ rv += create_dir(ctdl_run_dir , S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH, UID, GID);
+ return rv;
+}
* (What can I say, I'm in a weird mood today...)
*/
void remove_any_whitespace_to_the_left_or_right_of_at_symbol(char *name) {
- unsigned int i;
+ char *ptr;
+ if (!name) return;
- for (i = 0; i < strlen(name); ++i) {
- if (name[i] == '@') {
- while (isspace(name[i - 1]) && i > 0) {
- strcpy(&name[i - 1], &name[i]);
- --i;
- }
- while (isspace(name[i + 1])) {
- strcpy(&name[i + 1], &name[i + 2]);
- }
+ for (ptr=name; *ptr; ++ptr) {
+ while ( (isspace(*ptr)) && (*(ptr+1)=='@') ) {
+ strcpy(ptr, ptr+1);
+ if (ptr > name) --ptr;
+ }
+ while ( (*ptr=='@') && (*(ptr+1)!=0) && (isspace(*(ptr+1))) ) {
+ strcpy(ptr+1, ptr+2);
}
}
}
+++ /dev/null
-/*
- * citadel_dirs.c : calculate pathnames for various files used in the Citadel system
- *
- * Copyright (c) 1987-2021 by the citadel.org team
- *
- * This program is open source software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3.
- *
- * This program 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 General Public License for more details.
- */
-#include <unistd.h>
-#include <stdio.h>
-#include <sys/stat.h>
-#include <ctype.h>
-#include <string.h>
-#include <limits.h>
-#include <time.h>
-#include <errno.h>
-#include <syslog.h>
-#include <libcitadel.h>
-#include "citadel.h"
-#include "citadel_dirs.h"
-
-/*
- * Generate an associated file name for a room
- */
-size_t assoc_file_name(char *buf, size_t n, struct ctdlroom *qrbuf, const char *prefix) {
- return snprintf(buf, n, "%s%ld", prefix, qrbuf->QRnumber);
-}
-
-
-int create_dir(char *which, long ACCESS, long UID, long GID) {
- int rv;
- rv = mkdir(which, ACCESS);
- if ((rv == -1) && (errno != EEXIST)) {
- syslog(LOG_ERR,
- "failed to create directory %s: %s",
- which,
- strerror(errno));
- return rv;
- }
- rv = chmod(which, ACCESS);
- if (rv == -1) {
- syslog(LOG_ERR,
- "failed to set permissions for directory %s: %s",
- which,
- strerror(errno));
- return rv;
- }
- rv = chown(which, UID, GID);
- if (rv == -1) {
- syslog(LOG_ERR,
- "failed to set owner for directory %s: %s",
- which,
- strerror(errno));
- return rv;
- }
- return rv;
-}
-
-
-int create_run_directories(long UID, long GID) {
- int rv = 0;
- rv += create_dir(ctdl_message_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
- rv += create_dir(ctdl_file_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
- rv += create_dir(ctdl_key_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
- rv += create_dir(ctdl_run_dir , S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH, UID, GID);
- return rv;
-}