Wed Oct 21 22:24:48 EDT 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
* Mail rooms now hide their owner-prefix from the client.
+ * proxy.c: added configurability and primitive message expiry
1998-10-20 Nathan Bryant <bryant@cs.usm.maine.edu>
* Makefile.tmpl: fix to build client with old Configure script
*
*/
+/* Directory to put the message cache in */
#define CACHE_DIR "/var/citadelproxy"
+/* Number of days to keep messages in the cache */
+#define CACHE_EXPIRE 60
+
+/* Uncomment to enable prefetch */
+/* #define ENABLE_PREFETCH */
+
+/* Name and password to use for caching */
+#define PREFETCH_USER_NAME "cypherpunks"
+#define PREFETCH_USER_PASSWORD "cypherpunks"
+
+
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
close(1);
close(2);
-
serv_gets(buf);
if (buf[0] != '2') {
exit(0);
}
-
/* Log in (this is kind of arbitrary) */
- serv_puts("USER cypherpunks");
+ sprintf(buf, "USER %s", PREFETCH_USER_NAME);
+ serv_puts(buf);
serv_gets(buf);
if (buf[0]=='3') {
- serv_puts("PASS cypherpunks");
+ sprintf(buf, "PASS %s", PREFETCH_USER_PASSWORD);
+ serv_puts(buf);
serv_gets(buf);
if (buf[0] != '2') exit(1);
}
else {
- serv_puts("NEWU cypherpunks");
+ sprintf(buf, "NEWU %s", PREFETCH_USER_NAME);
+ serv_puts(buf);
serv_gets(buf);
if (buf[0] != '2') exit(1);
- serv_puts("SETP cypherpunks");
+ sprintf(buf, "SETP %s", PREFETCH_USER_PASSWORD);
+ serv_puts(buf);
serv_gets(buf);
if (buf[0] != '2') exit(1);
}
serv_puts("QUIT");
printf("%d Proxy says: Bye!\n", OK);
fflush(stdout);
+ sprintf(buf,
+ "/usr/bin/find %s -mtime +%d -exec rm -f {} \\; &",
+ CACHE_DIR, CACHE_EXPIRE);
+ system(buf);
exit(0);
}
/* Now go there */
if (chdir(CACHE_DIR) != 0) exit(errno);
+#ifdef ENABLE_PREFETCH
pid = fork();
+#endif
attach_to_server(argc, argv);
+#ifdef ENABLE_PREFETCH
if (pid == 0) do_prefetch();
+#endif
serv_gets(buf);
strcat(buf, " (VIA PROXY)");