Пример #1
0
/*
** If the "proxy" setting is defined, then change the URL settings
** (initialized by a prior call to url_parse()) so that the HTTP
** header will be appropriate for the proxy and so that the TCP/IP
** connection will be opened to the proxy rather than to the server.
**
** If zMsg is not NULL and a proxy is used, then print zMsg followed
** by the canonical name of the proxy (with userid and password suppressed).
*/
void url_enable_proxy(const char *zMsg){
  const char *zProxy;
  zProxy = zProxyOpt;
  if( zProxy==0 ){
    zProxy = db_get("proxy", 0);
    if( zProxy==0 || zProxy[0]==0 || is_truth(zProxy) ){
      zProxy = fossil_getenv("http_proxy");
    }
  }
  if( zProxy && zProxy[0] && !is_false(zProxy) ){
    char *zOriginalUrl = g.urlCanonical;
    char *zOriginalHost = g.urlHostname;
    char *zOriginalUser = g.urlUser;
    char *zOriginalPasswd = g.urlPasswd;
    g.urlUser = 0;
    g.urlPasswd = "";
    url_parse(zProxy);
    if( zMsg ) fossil_print("%s%s\n", zMsg, g.urlCanonical);
    g.urlPath = zOriginalUrl;
    g.urlHostname = zOriginalHost;
    if( g.urlUser ){
      char *zCredentials1 = mprintf("%s:%s", g.urlUser, g.urlPasswd);
      char *zCredentials2 = encode64(zCredentials1, -1);
      g.urlProxyAuth = mprintf("Basic %z", zCredentials2);
      free(zCredentials1);
    }
    g.urlUser = zOriginalUser;
    g.urlPasswd = zOriginalPasswd;
  }
}
Пример #2
0
/**
 * Read data from config file
 */
static void
read_config (void)
{
  double t = 0;
  char dummy[1024];

  INF_INT_KEY (checker_memory_limit, "Checker/Limits/RSS");

  INF_FLOAT_KEY (t, "Checker/Limits/Time");
  checker_time_limit = t * USEC_COUNT;

  INF_INT_KEY (t, "MaxThreads");
  if (t > 0)
    {
      max_threads = t;
    }

  INF_PCHAR_KEY (testing_dir, "TestingDir");
  INF_PCHAR_KEY (data_dir, "DataDir");
  INF_PCHAR_KEY (problems_dir, "ProblemsDir");

  INF_SAFE_PCHAR_KEY (source_file, "SourceFile", INFORMATICS_SOURCE);
  INF_SAFE_PCHAR_KEY (file_to_exec, "FileToExec", INFORMATICS_EXEC);

  /* Tests' files extensions  */
  INF_SAFE_PCHAR_KEY (tst_ext, "Tests/InputExtension", INFORMATICS_TSTEXT);
  INF_SAFE_PCHAR_KEY (ans_ext, "Tests/OutputExtension", INFORMATICS_ANSEXT);

  INF_SAFE_PCHAR_KEY (checker_cmd_template, "Checker/Command", "");

  INF_INT_KEY (unlink_interval, "UnlinkInterval");
  INF_INT_KEY (keep_alive_testdirs, "KeepAliveTestdirs");

  INF_PCHAR_KEY (dummy, "ChRoot");
  use_chroot = is_truth (dummy);

  /* Get security info */

  INF_SAFE_PCHAR_KEY (solution_exec_user, "SolutionExec-User", "");
  solution_exec_uid = uid_by_name (solution_exec_user);
  INF_SAFE_PCHAR_KEY (solution_exec_group, "SolutionExec-Group", "");
  solution_exec_gid = gid_by_name (solution_exec_group);

  INF_SAFE_INT_KEY (max_output_store_size, "MaxOutputStoreSize", 0);
}
Пример #3
0
/*
** This routine determines if files should be case-sensitive or not.
** In other words, this routine determines if two filenames that
** differ only in case should be considered the same name or not.
**
** The case-sensitive setting determines the default value.  If
** the case-sensitive setting is undefined, then case sensitivity
** defaults on for Mac and Windows and off for all other unix.
**
** The --case-sensitive BOOLEAN command-line option overrides any
** setting.
*/
int filenames_are_case_sensitive(void){
  static int caseSensitive;
  static int once = 1;

  if( once ){
    once = 0;
    if( zCaseSensitive ){
      caseSensitive = is_truth(zCaseSensitive);
    }else{
#if !defined(_WIN32) && !defined(__DARWIN__) && !defined(__APPLE__)
      caseSensitive = 1;  /* Unix */
#else
      caseSensitive = 0;  /* Windows and Mac */
#endif
      caseSensitive = db_get_boolean("case-sensitive",caseSensitive);
    }
  }
  return caseSensitive;
}
Пример #4
0
/**
 * Get data from config file
 */
static void
read_config (void)
{
  char dummy[1024];

  strcpy (host, WT_IPC_HOST);
  CONFIG_PCHAR_KEY (host, "Server/IPC/Host");
  CONFIG_INT_KEY (port, "Server/IPC/Port");
  CONFIG_FLOAT_KEY (delay, "Server/IPC/Delay");

  CONFIG_INT_KEY (reset_timeout, "Server/IPC/Blacklisting/ResetTimeout");

  CONFIG_PCHAR_KEY (dummy, "Server/IPC/Blacklisting/Enabled");
  blacklisting = is_truth (dummy);

  CONFIG_PCHAR_KEY (blacklist_file, "Server/IPC/Blacklisting/BlacklistFile");

  RESET_LEZ (port, WT_IPC_PORT);
  RESET_LEZ (delay, WT_IPC_DELAY);
}