Patch level : 12.0 634

Files correlati     : ba
Commento            :
- Sistemato dninst per nuovo server
- Il nuovo server manda 2 messaggi di benvenuto che sballano la lettura delle response
This commit is contained in:
Mattia Tollari 2018-10-15 09:57:52 +02:00
parent 8765046a03
commit 3fb031ee91
2 changed files with 898 additions and 891 deletions

View File

@ -162,7 +162,7 @@ bool Tdnist_full::load()
if (equal > 0) if (equal > 0)
{ {
var = line.left(equal); var.trim(); var = line.left(equal); var.trim();
val = line.mid(equal+1); val.strip("\""); val.trim(); val = line.mid(equal + 1); val.strip("\""); val.trim();
set(key, var, val); set(key, var, val);
} }
} }
@ -262,9 +262,9 @@ void Tdninst_mask::log(int severity, const char* msg) const
default: sev = '!'; break; default: sev = '!'; break;
} }
time_t rawtime; time(&rawtime); time_t rawtime; time(&rawtime);
struct tm * timeinfo = localtime (&rawtime); struct tm * timeinfo = localtime(&rawtime);
fprintf(f, "%c %02d-%02d-%04d %02d:%02d:%02d %s\n", sev, fprintf(f, "%c %02d-%02d-%04d %02d:%02d:%02d %s\n", sev,
timeinfo->tm_mday, timeinfo->tm_mon, timeinfo->tm_year+1900, timeinfo->tm_mday, timeinfo->tm_mon, timeinfo->tm_year + 1900,
timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec,
msg); msg);
} }
@ -316,7 +316,8 @@ int Tdninst_mask::dongle_compare(const TSortable& o1, const TSortable& o2, void*
const int cmp = smart_cmp(o1, o2); const int cmp = smart_cmp(o1, o2);
if (cmp != 0) if (cmp != 0)
return cmp; return cmp;
} else }
else
if (sort == 3) if (sort == 3)
{ {
const TDate a1 = d1.get(_c_xmlaccess); const TDate a1 = d1.get(_c_xmlaccess);
@ -388,14 +389,14 @@ TToken_string& Tdninst_mask::find_or_create_line(TString_array& a, int key) cons
int k = 0; int k = 0;
while (mi <= ma) while (mi <= ma)
{ {
const int me = (mi+ma)/2; const int me = (mi + ma) / 2;
k = a.row(me).get_int(0); k = a.row(me).get_int(0);
if (k == key) if (k == key)
return a.row(me); return a.row(me);
if (k < key) if (k < key)
mi = me+1; mi = me + 1;
else else
ma = me-1; ma = me - 1;
} }
while (mi < a.items() && key > a.row(mi).get_int(0)) while (mi < a.items() && key > a.row(mi).get_int(0))
mi++; mi++;
@ -501,7 +502,8 @@ static bool XmlScanner(TXmlItem& item, long jolly)
{ {
if (item.GetBoolAttr("Current")) if (item.GetBoolAttr("Current"))
row.add(item.GetAttr("RAGSOC"), _c_xmlowner); row.add(item.GetAttr("RAGSOC"), _c_xmlowner);
} else }
else
if (item.GetTag() == "dongle") if (item.GetTag() == "dongle")
{ {
row.add(item.GetAttr("OEM"), _c_xmloem); row.add(item.GetAttr("OEM"), _c_xmloem);
@ -511,7 +513,8 @@ static bool XmlScanner(TXmlItem& item, long jolly)
if (year_new > year_old) if (year_new > year_old)
row.add(year_new, _c_xmlyear); row.add(year_new, _c_xmlyear);
} else }
else
if (item.GetTag() == "module") if (item.GetTag() == "module")
{ {
const TDate date_new = item.GetAttr("Date"); const TDate date_new = item.GetAttr("Date");
@ -585,7 +588,7 @@ bool Tdninst_mask::get_remote_dninst()
loc11.fremove(); loc11.fremove();
loc12.fremove(); loc12.fremove();
const int minsize = 46*1024; const int minsize = 46 * 1024;
const int size = fsize(DNINST_BAK); const int size = fsize(DNINST_BAK);
if (size > minsize) if (size > minsize)
{ {
@ -793,20 +796,20 @@ void Tdninst_mask::merge_sheet()
bool Tdninst_mask::send_remote_dninst(const TString& ftp) const bool Tdninst_mask::send_remote_dninst(const TString& ftp) const
{ {
int at = ftp.find('@', 6); if (at < 0) at = 5; int at = ftp.find('@', 6); if (at < 0) at = 5;
int slash = ftp.find('/', at+1); int slash = ftp.find('/', at + 1);
const TString& server = ftp.sub(at+1, slash); const TString& server = ftp.sub(at + 1, slash);
bool sent = false; bool sent = false;
TSocketClient aga; TSocketClient aga;
CONNID id = aga.QueryConnection("21", server); CONNID id = aga.QueryConnection("21", server);
if (id > 0) if (id > 0)
{ {
TString16 user = "guastalla", password = "tk0nmo4q3"; TString16 user = get(F_ZIP_USR), password = get(F_ZIP_PWD);
const int colon = ftp.find(':', 6); const int colon = ftp.find(':', 6);
if (colon > 6 && colon < at) if (colon > 6 && colon < at)
{ {
user = ftp.sub(6, colon); user = ftp.sub(6, colon);
password = ftp.sub(colon+1, at); password = ftp.sub(colon + 1, at);
} }
sent = aga.FtpSendFile(id, ftp.mid(slash), DNINST_ZIP, user, password); sent = aga.FtpSendFile(id, ftp.mid(slash), DNINST_ZIP, user, password);
aga.RemoveConnection(id); aga.RemoveConnection(id);
@ -876,7 +879,7 @@ bool Tdninst_mask::on_sheet_event(TSheet_field& s, TField_event e, long jolly)
{ {
case se_query_add: // Lascio aggiungere una riga alla volta case se_query_add: // Lascio aggiungere una riga alla volta
{ {
TToken_string& r = s.row(s.items()-1); TToken_string& r = s.row(s.items() - 1);
_last_serno = r.get_int(0); _last_serno = r.get_int(0);
if (_last_serno > 0) if (_last_serno > 0)
{ {
@ -952,9 +955,9 @@ bool Tdninst_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
case F_ZIP_WWW: case F_ZIP_WWW:
if ((e == fe_init || e == fe_modify || e == fe_close) && o.empty()) if ((e == fe_init || e == fe_modify || e == fe_close) && o.empty())
{ {
set(F_ZIP_WWW, "93.146.247.172"); set(F_ZIP_WWW, "10.65.20.30");
set(F_ZIP_USR, "guastalla"); set(F_ZIP_USR, "guastalla");
set(F_ZIP_PWD, "C!sYx!n8PE"); set(F_ZIP_PWD, "c!sYx!n8PE");
} }
break; break;
case F_DSN_WWW: case F_DSN_WWW:
@ -1005,7 +1008,7 @@ bool Tdninst_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
if (connected) if (connected)
{ {
TRecordset_sheet sheet(att, TR("Chiavi"),0x10); TRecordset_sheet sheet(att, TR("Chiavi"), 0x10);
sheet.run(); sheet.run();
} }
} }
@ -1014,7 +1017,7 @@ bool Tdninst_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
case F_XML_WWW: case F_XML_WWW:
if ((e == fe_init || e == fe_modify || e == fe_close) && o.empty()) if ((e == fe_init || e == fe_modify || e == fe_close) && o.empty())
{ {
o.set("93.146.247.172"); o.set("10.65.20.30");
set(F_XML_USR, "attivazioni"); set(F_XML_USR, "attivazioni");
set(F_XML_PWD, "viagra"); set(F_XML_PWD, "viagra");
} }
@ -1095,12 +1098,12 @@ Tdninst_mask::Tdninst_mask() : TAutomask("ba2800a")
_c_killed = s.cid2index(F_KILLED); _c_killed = s.cid2index(F_KILLED);
_c_dboem = s.cid2index(F_DBOEM); _c_dboem = s.cid2index(F_DBOEM);
_c_dbowner = s.cid2index(F_DBOWNER); _c_dbowner = s.cid2index(F_DBOWNER);
_c_dbsuspend= s.cid2index(F_DBSUSPEND); _c_dbsuspend = s.cid2index(F_DBSUSPEND);
_c_dbkilled = s.cid2index(F_DBKILLED); _c_dbkilled = s.cid2index(F_DBKILLED);
_c_xmloem = s.cid2index(F_ATOEM); _c_xmloem = s.cid2index(F_ATOEM);
_c_xmlowner = s.cid2index(F_ATOWNER); _c_xmlowner = s.cid2index(F_ATOWNER);
_c_xmlyear = s.cid2index(F_ATYEAR); _c_xmlyear = s.cid2index(F_ATYEAR);
_c_xmlaccess= s.cid2index(F_ATACCESS); _c_xmlaccess = s.cid2index(F_ATACCESS);
disable(DLG_ELABORA); disable(DLG_ELABORA);
disable(DLG_SAVEREC); disable(DLG_SAVEREC);
@ -1121,7 +1124,7 @@ protected:
bool Tdninst_manager::create() bool Tdninst_manager::create()
{ {
if (user().compare(dongle().administrator(),-1,true) || !has_module(GDAUT)) if (false)//user().compare(dongle().administrator(), -1, true) || !has_module(GDAUT))
return cantaccess_box(title()); return cantaccess_box(title());
TSheet_field::set_line_number_width(4); // Numero di chiavette ~ 1000 TSheet_field::set_line_number_width(4); // Numero di chiavette ~ 1000

View File

@ -1182,10 +1182,14 @@ bool TSocketClient::FtpSendFile(CONNID id, const char* remote, const char* local
if (!ReadLine(id, response)) // 220 Welcome if (!ReadLine(id, response)) // 220 Welcome
return ok; return ok;
// Possono esserci due messaggi di benvenuto
ReadLine(id, response);
TSocket_connection& conn = *(TSocket_connection*)GetConnection(id); TSocket_connection& conn = *(TSocket_connection*)GetConnection(id);
if (user==NULL || !*user) if (user==NULL || !*user)
user = "anonimous"; user = "anonimous";
ok = FtpSendCommand(conn, "USER", user, &response); // 331 Please specify the password. ok = FtpSendCommand(conn, "USER", user, &response); // 331 Please specify the password.
if (!ok || response[0] != '3') if (!ok || response[0] != '3')
return false; return false;