annotate expire.c @ 3:5a977ccbc7a9 default tip

Empty changelog
author darius
date Sat, 06 Dec 1997 05:41:29 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1 /* $Id: expire.c,v 1.1.1.1 1997/12/06 05:41:29 darius Exp $ */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
3 #ifndef hpux
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
4 #include <sys/time.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
5 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
6 #include <time.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
7 #include <stdio.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
8
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
9
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
10 /* Here's a handy perl script to set any timeout you want:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
11
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
12 perl -e 'require "timelocal.pl"; print &timelocal(0,0,0,9,9,93);'
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
13
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
14 The arguments to timelocal are (sec, min, hours, mday, mon, year).
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
15 These are all 0 based indexing so the 7th day of the month is
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
16 really 6 to the perl script.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
17 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
18
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
19 static time_t expire = 915091200;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
20
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
21 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
22 checkExpire(verbose)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
23 int verbose;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
24 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
25 time_t now;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
26
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
27 now = time(NULL);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
28 if (verbose) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
29 printf("This client expires on %s\n", ctime(&expire));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
30 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
31 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
32 if (now > expire) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
33 printf("\
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
34 I'm sorry. This client has expired. You may bypass the expire by\n\
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
35 using the -o option which disables RSA authentication. Expired\n\
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
36 clients are not supported by paradise-workers.\n\
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
37 You can find a new set of binaries on ftp.pnetrek.org OR ftp.cs.umn.edu \n\
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
38 in the directory /users/glamm/paradise/bin/. If you have any problems mail \n\
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
39 to paradise-workers@pnetrek.org\n");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
40 exit(0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
41
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
42 } else if (now + 10 * 24 * 60 * 60 > expire) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
43 printf("This client expires in %d days.\n", (int) (expire - now) / (60 * 60 * 24));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
44 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
45 }