Patch level : 10.0

Files correlati     : ba0 ba1 ba8
Ricompilazione Demo : [ ]
Commento            :
Corretta gestione firma digitale e marcatura temporale


git-svn-id: svn://10.65.10.50/trunk@18892 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2009-05-20 15:36:38 +00:00
parent b3a8f42760
commit da391e0167
12 changed files with 90 additions and 112 deletions

View File

@ -612,7 +612,7 @@ bool TApplication::has_module(int module, int checktype) const
#endif
// Testa bit di attivazione dell'utente
if (ok && checktype != CHK_DONGLE && module != EEAUT)
if (ok && checktype != CHK_DONGLE)
ok = _user_aut[module];
return ok;
}
@ -819,7 +819,7 @@ bool TApplication::get_next_pdf(int anno, long ditta, const char* codnum,
bool TApplication::get_next_mail(TToken_string& to, TToken_string& cc, TToken_string& ccn,
TString& subj, TString& text, TToken_string& attach, bool& ui) const
{
bool ok = dongle().active(RSAUT) && dongle().active(EEAUT);
bool ok = dongle().active(RSAUT);
ui = ok && to.blank();
return ok;
}

View File

@ -104,7 +104,7 @@ public:
// @cmember Setta il tipo di file di configurazione al quale e' associata l'applicazione
void set_config(int which);
// @cmember Costruttore
TConfig_application(int which_config = CONFIG_GENERAL) ;
TConfig_application(int which_config) ;
// @cmember Distruttore
virtual ~TConfig_application() ;
};

View File

@ -686,6 +686,9 @@ static void cfg2file(int which_config, TFilename& file)
{
switch (which_config)
{
case CONFIG_GENERAL:
file = "./install.ini";
break;
case CONFIG_DITTA:
file = firm2dir(prefix().get_codditta());
file.add("ditta.ini");

View File

@ -7,7 +7,7 @@
class TConfig;
// questo sara' il principale, per ora non c'e'
// file lista moduli installati (install.ini)
#define CONFIG_GENERAL 0
// file campo.ini
#define CONFIG_INSTALL 1
@ -167,7 +167,7 @@ public:
// @cmember Costruttore (il paragrafo iniziale e' il modulo corrente
// salvo diversa indicazione)
TConfig(int which_config = CONFIG_GENERAL, const char* paragraph = NULL);
TConfig(int which_config, const char* paragraph = NULL);
// @cmember Costruttore (il paragrafo iniziale e' il modulo corrente
// salvo diversa indicazione)
TConfig(const char* file, const char* paragraph = NULL);

View File

@ -140,7 +140,7 @@ inline void reset_bit(word& w, byte b)
TDongle::TDongle()
: _hardware(_dongle_unknown), _type(_no_dongle), _serno(0xFFFF),
_max_users(1), _year_assist(2006), _dirty(false)
_max_users(1), _year_assist(2009), _dirty(false), _OEM(-1)
{
memset(_eprom, 0, sizeof(_eprom));
memset(_assist, 0, sizeof(_assist));
@ -155,49 +155,7 @@ TDongle::~TDongle()
const TString& TDongle::administrator(TString* pwd) const
{
if (_admin.blank())
{
TString& admin = (TString&)_admin; // Sorry
TString& admpwd = (TString&)_admpwd; // Sorry
//nuovo metodo di rilevamento administrator (dalla 10.0 in avanti); l'admin sta nel file oem.ini sotto la cartella
//setup, sia nel CD che soprattutto nel programma installato
int oem = -1;
if (oem < 0)
{
TConfig ini(CONFIG_OEM, "MAIN");
oem = ini.get_int("OEM", NULL, -1, -1);
if (oem >= 0)
{
TString8 para; para << "OEM_" << oem;
admin = ini.get("Administrator", para);
admpwd = ini.get("Password", para);
}
}
//vecchio metodo di rilevamento dell'admin e della sua password: sta in install.ini
//administrator
if (oem < 0)
{
TConfig ini("install.ini", "Main");
admin = ini.get("Administrator");
admpwd = ini.get("Password");
}
if (admin.blank())
admin = "ADMIN";
else
admin = ::decode(_admin);
//password
if (admpwd.blank())
{
admpwd = admin;
admpwd.lower();
admpwd.insert(".", 2);
}
else
admpwd = ::decode(admpwd);
}
oem();
if (pwd)
*pwd = _admpwd;
return _admin;
@ -511,9 +469,7 @@ int TDongle::can_try_server() const
{
if (xvt_sys_dongle_server_is_running())
return 3;
TConfig ini(CONFIG_INSTALL, "Server");
const TString& dongle = ini.get("Dongle");
const TString& dongle = ini_get_string(CONFIG_INSTALL, "Server", "Dongle");
return dongle.full();
}
@ -688,43 +644,38 @@ bool TDongle::write_words(word reg, word len, word* data) const
return ok;
}
// Ritorna il nome della ditta che vende il programma attuale
const TString& TDongle::reseller() const
int TDongle::oem() const
{
if (_reseller.blank())
if (_OEM < 0)
{
TString& firm = (TString&) _reseller;
TString& campo = (TString&) _product;
TString& breve = (TString&) _shortname;
TString& admin = (TString&)_admin;
TString& admpwd = (TString&)_admpwd;
int& oem = (int&)_OEM;
//nuovo metodo di rilevamento producer (dalla 10.0 in avanti); il producer sta nel file oem.ini sotto la cartella
//setup, sia nel CD che soprattutto nel programma installato
int oem = -1;
if (oem < 0)
TConfig ini(CONFIG_OEM, "MAIN");
oem = ini.get_int("OEM", NULL, -1, -1);
if (oem >= 0)
{
TConfig ini(CONFIG_OEM, "MAIN");
oem = ini.get_int("OEM", NULL, -1, -1);
if (oem >= 0)
{
TString8 para; para << "OEM_" << oem;
campo = ini.get("Product", para);
firm = ini.get("Reseller", para);
breve = ini.get("Name", para);
}
TString8 para; para << "OEM_" << oem;
ini.set_paragraph(para);
campo = decode(ini.get("Product"));
firm = decode(ini.get("Reseller"));
breve = decode(ini.get("Name"));
admin = decode(ini.get("Administrator"));
admpwd = decode(ini.get("Password"));
}
if (firm.blank()) //vecchio metodo di rilevamento del producer: sta in install.ini
{
TConfig ini("install.ini", "Main");
firm = ini.get("Producer");
firm = decode(ini_get_string(CONFIG_GENERAL, "Main", "Producer"));
campo = breve = " ";
}
//nuovo metodo: cerca produttore (Name) e prodotto (Product)
if (firm.full())
{
firm = decode(firm);
campo = decode(campo);
breve = decode(breve);
}
if (firm.blank())
{
ignore_xvt_errors(true);
@ -733,41 +684,65 @@ const TString& TDongle::reseller() const
ignore_xvt_errors(false);
}
if (admin.blank())
{
admin = decode(ini_get_string(CONFIG_GENERAL, "Main", "Administrator"));
if (admin.blank())
{
admin = "ADMIN";
admpwd = "ad.min";
}
}
if (admpwd.blank())
{
admpwd = decode(ini_get_string(CONFIG_GENERAL, "Main", "Password"));
if (admpwd.blank())
{
admpwd = admin;
admpwd.lower();
admpwd.insert(".", 2);
}
}
if (campo.blank())
campo = "Campo Enterprise";
if (firm.blank())
firm = "AGA informatica s.r.l.";
if (breve.blank())
breve = "Campo";
if (oem < 0)
oem = firm.starts_with("AGA ") ? 0 : 1;
}
return _OEM;
}
// Ritorna il nome della ditta che vende il programma attuale
const TString& TDongle::reseller() const
{
if (_reseller.empty())
oem();
return _reseller;
}
const TString& TDongle::product() const
{
if (_product.empty())
reseller();
oem();
return _product;
}
const TString& TDongle::shortname() const
{
if (_shortname.empty())
reseller();
oem();
return _shortname;
}
bool TDongle::active(word module) const
{
bool yes = false;
if (module == EEAUT)
{
const TString& r = reseller();
yes = r.starts_with("AGA ");
}
else
yes = (module < ENDAUT) && _module[module] && shown(module);
const bool yes = (module < ENDAUT) && _module[module] && shown(module);
return yes;
}
@ -1037,25 +1012,13 @@ const TString& TDongle::module_code2name(word mod) const
const TString_array& modinfo = info();
if (mod < modinfo.items())
return modinfo.row(mod).left(2);
else
{
if (mod == EEAUT)
return get_tmp_string() = "ee";
}
return EMPTY_STRING;
}
const TString& TDongle::module_code2desc(word mod) const
{
const TString_array& modinfo = info();
if (mod < modinfo.items())
return modinfo.row(mod).mid(3);
else
{
if (mod == EEAUT)
return get_tmp_string() = "Enterprise Edition";
}
return EMPTY_STRING;
return mod < modinfo.items() ? modinfo.row(mod).mid(3) : EMPTY_STRING;
}
const TString& TDongle::module_name2desc(const char* mod) const
@ -1079,13 +1042,16 @@ bool TDongle::shown(word code) const
{
const TString4 mod = module_code2name(code);
yes = mod.not_empty();
if (yes && code > BAAUT)
if (yes && code > BAAUT && code < ENDAUT)
{
bool do_test = true;
if (code != EEAUT)
do_test = ini_get_bool("install.ini", mod, "Ee");
if (do_test)
yes = active(EEAUT);
TAuto_token_string ee = ini_get_string(CONFIG_GENERAL, mod, "OEM"); // Modern OEM handling
if (ee.full())
yes = ee.get_pos(oem()) >= 0;
else
{
if (ini_get_bool(CONFIG_GENERAL, mod, "Ee")) // Legacy Enterprise Edition
yes = oem() == 0;
}
}
if (yes)
((TBit_array&)_shown).set(code); // Setto il flag di visibilta' per la prossima volta

View File

@ -19,6 +19,7 @@ class TDongle : public TObject
TDongleType _type;
TString _admin, _admpwd, _reseller, _product, _shortname;
int _OEM;
word _serno, _max_users, _year_assist;
word _eprom[64];
@ -87,6 +88,7 @@ public:
bool pay_assist(int index, real imp, bool lire);
const TString& administrator(TString* pwd = NULL) const;
int oem() const;
const TString& reseller() const;
const TString& product() const;
const TString& shortname() const;

View File

@ -254,7 +254,7 @@ HIDDEN int find_relapp(TConfig& cfg, void* jolly)
bool get_relapp(int logicnum, TString& app)
{
TConfig ini("install.ini");
TConfig ini(CONFIG_GENERAL);
TCallbackFileinfo fi;
fi._var.format("Edit_%d", logicnum);
ini.for_each_paragraph(find_relapp, &fi);
@ -300,7 +300,7 @@ HIDDEN int find_tabapp(TConfig& cfg, void* jolly)
bool get_tabapp(const char * tabname, TString& app)
{
TConfig ini("install.ini");
TConfig ini(CONFIG_GENERAL);
TCallbackTableinfo fi;
TTable t(tabname);
fi._var1.format("Edit_%s", t.name());

View File

@ -48,7 +48,4 @@
#define ESAUT 47
#define ENDAUT 48
// Enterprise Edition :-)
#define EEAUT 99
#endif // __MODAUT_H

View File

@ -2833,7 +2833,7 @@ void TSheet_field::highlight() const
if (s->_check_enabled)
{
int rows; xi_get_list_info(s->_obj, &rows);
if (rows > 0)
if (rows > 0 && s->_cur_rec >= 0 && s->_cur_rec < rows)
{
if (s->notify(s->_cur_rec, K_TAB))
{

View File

@ -1433,6 +1433,16 @@ bool TBook::print_page(TWindow& win, size_t page)
else
thickness = width * _phr / 72; // Converte width in 72' di pollice
}
else
{
if (preview)
{
const TPrint_preview_window& pw = (const TPrint_preview_window&)win;
const double alpha = pw.log2dev(20)/100.0;
if (alpha < 1.0)
col = blend_colors(col, COLOR_WHITE, alpha);
}
}
win.set_pen(col, thickness);
}
continue;

View File

@ -263,7 +263,7 @@ bool TModule_table::get_relapp(TString& app) const
if (_customer > 0L)
para.format("%s%06ld", (const char*)_module, _customer);
para.lower();
TConfig ini("install.ini", para);
TConfig ini(CONFIG_GENERAL, para);
TString8 var;
var << "Edit_" << _tabname;

View File

@ -270,7 +270,7 @@ HIDDEN int find_relapp(TConfig& cfg, void* jolly)
bool TTable::get_relapp(TString& app) const
{
TConfig ini("install.ini");
TConfig ini(CONFIG_GENERAL);
TCallbackTableinfo fi;
fi._var1.format("Edit_%s", (const char*)_tabname);
fi._var2.format("Edit_%d", num());