示例#1
0
文件: sfsconst.C 项目: okws/sfslite
str
sfsconst_etcfile_required (const char *name, const char *const *path, bool ftl)
{
  str file = sfsconst_etcfile (name, path);
  if (!file) {
    strbuf msg ("Could not find '%s'. Searched:\n", name);
    for (const char *const *d = path; *d; d++) {
      msg << "  " << *d << "/" << name << "\n";
    }
    str m = msg;
    if (ftl) fatal ("%s", m.cstr ());
    else warn ("%s", m.cstr ());
  }
  return file;
}
示例#2
0
文件: okconst.C 项目: aosmith/okws
str 
okws_etcfile (const char *f, const char *env_var, 
	      const char **cfg_path)
{
  vec<str> v1;
  vec<const char *> v2;

  if (cfg_path == NULL)
    cfg_path = ok_cfg_path;

  get_cfg_path (&v1, env_var, cfg_path);
  vec2vec (&v2, v1);

  return sfsconst_etcfile (f, v2.base ());
}
示例#3
0
bool
get_srp_params (ptr<aclnt> c, bigint *Np, bigint *gp)
{
  bool valid = false;
  bigint N,g;
  str srpfile, parms;
  if ((srpfile = sfsconst_etcfile ("sfs_srp_parms")) &&
      (parms = file2str (srpfile)) &&
      import_srp_params (parms, &N, &g) ) {
    if (!srp_base::checkparam (N, g)) {
      warn << "Invalid SRP parameters read from file: "
	   << srpfile << "\n";
    }
    else
      valid = true;
  }

  if (!valid && c) {
    sfsauth2_query_arg aqa;
    sfsauth2_query_res aqr;
    aqa.type = SFSAUTH_SRPPARMS;
    aqa.key.set_type (SFSAUTH_DBKEY_NULL);
    clnt_stat err = c->scall (SFSAUTH2_QUERY, &aqa, &aqr);
    if (!err && aqr.type == SFSAUTH_SRPPARMS &&
	import_srp_params (aqr.srpparms->parms, &N, &g)) {
      if (!srp_base::checkparam (N, g)) {
	warn << "Invalid SRP parameters read from sfsauthd.\n";
	return false;
      } else {
	valid = true;
      }
    }
  }
  if (valid) {
    *Np = N;
    *gp = g;
    return true;
  }
  return false;
}
示例#4
0
文件: sfsconst.C 项目: okws/sfslite
str
sfsconst_etcfile (const char *name)
{
  const char *path[] = { etc1dir, etc2dir, etc3dir, NULL };
  return sfsconst_etcfile (name, path);
}
示例#5
0
文件: const.C 项目: imosts/flume
str flume_etcfile (const char *f) 
{ return sfsconst_etcfile (f, flume_cfg_path); }