test
This commit is contained in:
@@ -102,7 +102,7 @@ char *komodo_issuemethod(char *method,char *params)
|
|||||||
}
|
}
|
||||||
return(retstr);
|
return(retstr);
|
||||||
}
|
}
|
||||||
//curl --url "http://127.0.0.1:14555" --user "user782512472:pass1476445872" --data "{\"method\":\"getinfo\",\"params\":[]}"
|
//curl --url "http://127.0.0.1:13033" --user "user1557335368:pass111720054" --data "{\"method\":\"getinfo\",\"params\":[]}"
|
||||||
|
|
||||||
uint32_t komodo_txtime(uint256 hash)
|
uint32_t komodo_txtime(uint256 hash)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -976,41 +976,50 @@ void komodo_configfile(char *symbol,uint16_t port)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rpcuser = rpcpassword = rpcport = 0;
|
|
||||||
while ( fgets(line,sizeof(line),fp) != 0 )
|
|
||||||
{
|
|
||||||
if ( line[0] == '#' )
|
|
||||||
continue;
|
|
||||||
//printf("line.(%s) %p %p\n",line,strstr(line,(char *)"rpcuser"),strstr(line,(char *)"rpcpassword"));
|
|
||||||
if ( (str= strstr(line,(char *)"rpcuser")) != 0 )
|
|
||||||
rpcuser = parse_conf_line(str,(char *)"rpcuser");
|
|
||||||
else if ( (str= strstr(line,(char *)"rpcpassword")) != 0 )
|
|
||||||
rpcpassword = parse_conf_line(str,(char *)"rpcpassword");
|
|
||||||
else if ( (str= strstr(line,(char *)"rpcport")) != 0 )
|
|
||||||
rpcport = parse_conf_line(str,(char *)"rpcport");
|
|
||||||
}
|
|
||||||
if ( rpcuser != 0 && rpcpassword != 0 )
|
|
||||||
{
|
|
||||||
sprintf(USERPASS,"%s:%s",rpcuser,rpcpassword);
|
|
||||||
}
|
|
||||||
if ( rpcport != 0 )
|
|
||||||
{
|
|
||||||
if ( port != atoi(rpcport) )
|
|
||||||
printf("port.%u mismatch (%s)\n",port,rpcport);
|
|
||||||
//if ( serverport[0] == 0 )
|
|
||||||
// sprintf(serverport,"127.0.0.1:%s",rpcport);
|
|
||||||
free(rpcport);
|
|
||||||
}
|
|
||||||
printf("rpcuser.(%s) rpcpassword.(%s) port.(%s) USERPASS.(%s) port.%u vs %u\n",rpcuser,rpcpassword,rpcport,USERPASS,atoi(rpcport!=0?rpcport:0),port);
|
|
||||||
if ( rpcuser != 0 )
|
|
||||||
free(rpcuser);
|
|
||||||
if ( rpcpassword != 0 )
|
|
||||||
free(rpcpassword);
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
strcpy(fname,GetDataDir(false).string().c_str());
|
||||||
|
#ifdef WIN32
|
||||||
|
while ( fname[strlen(fname)-1] != '\\' )
|
||||||
|
fname[strlen(fname)-1] = 0;
|
||||||
|
strcat(fname,".komodo/komodo.conf");
|
||||||
|
#else
|
||||||
|
while ( fname[strlen(fname)-1] != '/' )
|
||||||
|
fname[strlen(fname)-1] = 0;
|
||||||
|
strcat(fname,".komodo/komodo.conf");
|
||||||
|
#endif
|
||||||
|
if ( (fp= fopen(fname,"rb")) != 0 )
|
||||||
|
{
|
||||||
|
rpcuser = rpcpassword = rpcport = 0;
|
||||||
|
while ( fgets(line,sizeof(line),fp) != 0 )
|
||||||
|
{
|
||||||
|
if ( line[0] == '#' )
|
||||||
|
continue;
|
||||||
|
//printf("line.(%s) %p %p\n",line,strstr(line,(char *)"rpcuser"),strstr(line,(char *)"rpcpassword"));
|
||||||
|
if ( (str= strstr(line,(char *)"rpcuser")) != 0 )
|
||||||
|
rpcuser = parse_conf_line(str,(char *)"rpcuser");
|
||||||
|
else if ( (str= strstr(line,(char *)"rpcpassword")) != 0 )
|
||||||
|
rpcpassword = parse_conf_line(str,(char *)"rpcpassword");
|
||||||
|
else if ( (str= strstr(line,(char *)"rpcport")) != 0 )
|
||||||
|
rpcport = parse_conf_line(str,(char *)"rpcport");
|
||||||
|
}
|
||||||
|
if ( rpcuser != 0 && rpcpassword != 0 )
|
||||||
|
{
|
||||||
|
sprintf(USERPASS,"%s:%s",rpcuser,rpcpassword);
|
||||||
|
}
|
||||||
|
if ( rpcport != 0 )
|
||||||
|
{
|
||||||
|
if ( port != atoi(rpcport) )
|
||||||
|
printf("port.%u mismatch (%s)\n",port,rpcport);
|
||||||
|
//if ( serverport[0] == 0 )
|
||||||
|
// sprintf(serverport,"127.0.0.1:%s",rpcport);
|
||||||
|
free(rpcport);
|
||||||
|
}
|
||||||
|
printf("rpcuser.(%s) rpcpassword.(%s) port.(%s) USERPASS.(%s) port.%u vs %u\n",rpcuser,rpcpassword,rpcport,USERPASS,atoi(rpcport!=0?rpcport:0),port);
|
||||||
|
if ( rpcuser != 0 )
|
||||||
|
free(rpcuser);
|
||||||
|
if ( rpcpassword != 0 )
|
||||||
|
free(rpcpassword);
|
||||||
|
fclose(fp);
|
||||||
|
} else printf("couldnt open.(%s)\n",fname);
|
||||||
}
|
}
|
||||||
/*if ( (retstr= komodo_issuemethod((char *)"getinfo",0)) != 0 )
|
|
||||||
{
|
|
||||||
printf("GETINFO.%s (%s) USERPASS.%s\n",symbol,retstr,USERPASS);
|
|
||||||
free(retstr);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user