Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

timebomb.C

Go to the documentation of this file.
00001 #include "timebomb.h"
00002 #include <stdio.h>
00003 #include <sys/stat.h>
00004 #include <stdlib.h>
00005 
00006 #define LASTYEAR 2001
00007 #define LASTDAY 1
00008 #define LASTMONTH 10
00009 #define EXCUSE \
00010 "To reduce support liability this release had an expiration date.\n" \
00011 "The expiration date of this release has expired.\n"
00012 
00013 static char *files[] = 
00014 {
00015         "/usr/lib/libcinelerra.so",
00016         "/usr/bin/cinelerra"
00017 };
00018 
00019 TimeBomb::TimeBomb()
00020 {
00021         struct stat fileinfo;
00022         time_t system_time;
00023         int result;
00024 
00025         result = stat("/etc", &fileinfo);
00026         system_time = time(0);
00027 
00028 printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);
00029 printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);
00030 printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);
00031 printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);
00032 printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);
00033 printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);
00034 printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);
00035 printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);
00036 printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);
00037 printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);
00038 printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);
00039 printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);
00040 
00041         if(test_time(fileinfo.st_mtime) ||
00042                 test_time(system_time))
00043         {
00044                 printf(EXCUSE);
00045                 disable_system();
00046                 exit(1);
00047         }
00048 }
00049 
00050 
00051 int TimeBomb::test_time(time_t testtime)
00052 {
00053         struct tm *currenttime;
00054         currenttime = localtime(&testtime);
00055 
00056         if(currenttime->tm_year >= LASTYEAR - 1900 &&
00057                 currenttime->tm_mday >= LASTDAY &&
00058                 currenttime->tm_mon >= LASTMONTH - 1) return 1;
00059         else return 0;
00060 }
00061 
00062 void TimeBomb::disable_system()
00063 {
00064 //printf("TimeBomb::disable_system %d\n", sizeof(files));
00065         for(int i = 0; i < sizeof(files) / sizeof(char*); i++)
00066         {
00067                 remove((const char*)files[i]);
00068         }
00069 }
00070 
00071 TimeBomb::~TimeBomb()
00072 {
00073 }
00074 

Generated on Sun Jan 8 13:39:00 2006 for Cinelerra-svn by  doxygen 1.4.4