Пример #1
0
static int showInfo( int argc, char **argv )
{
    (void)argc;
    string rootDir = argv[1];
    if( !checkDir( rootDir ))
	return EXIT_FAILURE;

    EncfsConfig config;
    ConfigType type = readConfig( rootDir, config );

    // show information stored in config..
    switch(type)
    {
    case Config_None:
	// xgroup(diag)
	cout << _("Unable to load or parse config file\n");
	return EXIT_FAILURE;
    case Config_Prehistoric:
	// xgroup(diag)
	cout << _("A really old EncFS filesystem was found. \n"
	    "It is not supported in this EncFS build.\n");
	return EXIT_FAILURE;
    case Config_V3:
	// xgroup(diag)
	cout << "\n" << autosprintf(_("Version 3 configuration; "
            "created by %s\n"), config.creator().c_str());
	break;
    case Config_V4:
	// xgroup(diag)
	cout << "\n" << autosprintf(_("Version 4 configuration; "
            "created by %s\n"), config.creator().c_str());
	break;
    case Config_V5:
    case Config_V6:
    case Config_V7:
	// xgroup(diag)
	cout << "\n" << autosprintf(_("Version %i configuration; "
            "created by %s (revision %i)\n"), 
                type,
                config.creator().c_str(),
                config.revision());
	break;
    }

    showFSInfo( config );

    return EXIT_SUCCESS;
}
Пример #2
0
/* Passing a copy to rootDir is on purpose here */
static int isValidEncFS(std::string rootDir) {
    if( !checkDir( rootDir ))
	return EXIT_FAILURE;

#ifdef ENCFS_SVN
    EncfsConfig config;
#else
    shared_ptr<EncFSConfig> config(new EncFSConfig);
#endif
    ConfigType type = readConfig( rootDir, config );

#ifdef ENCFS_SVN
    std::string config_creator = config.creator();
    int config_revision = config.revision();
#else
    std::string config_creator = config->creator;
    int config_revision = config->subVersion;
#endif

    std::ostringstream info;
    // show information stored in config..
    switch(type)
    {
    case Config_None:
        info << "Unable to load or parse config file in " << rootDir;
	LOGI(info.str().c_str());
	return EXIT_FAILURE;
    case Config_Prehistoric:
	LOGI("A really old EncFS filesystem was found.\n"
             "It is not supported in this EncFS build.");
	return EXIT_FAILURE;
    case Config_V3:
        info << "Version 3 configuration; created by " << config_creator.c_str();
        break;
    case Config_V4:
        info << "Version 4 configuration; created by " << config_creator.c_str();
        break;
    case Config_V5:
        info << "Version 5 configuration; created by " << config_creator.c_str()
             << " (revision " << config_revision << ")";
	break;
    case Config_V6:
        info << "Version 6 configuration; created by " << config_creator.c_str()
             << " (revision " << config_revision << ")";
	break;
#ifdef ENCFS_SVN
    case Config_V7:
        info << "Version 7 configuration; created by " << config_creator.c_str()
             << " (revision " << config_revision << ")";
	break;
#endif
    }
    LOGI(info.str().c_str());

    showFSInfo( config );

    return EXIT_SUCCESS;
}