Home | History | Annotate | Download | only in test
      1 /* This test is called in lieu of tlsdate by tlsdated
      2  * and it returns a timestamp that matches the proxy
      3  * ordering - global, dynamic, etc.
      4  * For use, see tlsdated-unittests.c
      5  */
      6 #include "config.h"
      7 
      8 #include <string.h>
      9 #include <stdio.h>
     10 
     11 int main (int argc, char *argv[])
     12 {
     13   /* Unsigned int to match what tlsdate -Vraw returns, not time_t */
     14   /* TODO(wad) move tlsdated -Vraw to emitting time_t */
     15   unsigned int t = RECENT_COMPILE_DATE + 1;
     16   int saw_good_proxy = 0;
     17   while (argc--)
     18     {
     19       if (!strcmp (argv[0], "socks5://good.proxy"))
     20         saw_good_proxy = 1;
     21       if (!strcmp (argv[0], "socks5://bad.proxy"))
     22         {
     23           t = RECENT_COMPILE_DATE + 3;
     24           break;
     25         }
     26       argv++;
     27     }
     28   if (saw_good_proxy)
     29     t = RECENT_COMPILE_DATE + 2;
     30   fwrite (&t, sizeof (t), 1, stdout);
     31   return 0;
     32 }
     33