mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-15 02:44:20 -05:00
added commandline option '-U' to allow user to access different profile
- in the situation where autologin is enabled - BUG found (or rather autologin induced it), if one asks to make friends to a peer (in ConfCertDialg) 'within' a session that uses autologin it freezes git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2703 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c6c8e63e91
commit
aef367ebff
@ -296,100 +296,107 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored)
|
|||||||
#endif
|
#endif
|
||||||
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
||||||
|
|
||||||
int c;
|
int c;
|
||||||
/* getopt info: every availiable option is listet here. if it is followed by a ':' it
|
std::string prefPgpName = "";
|
||||||
needs an argument. If it is followed by a '::' the argument is optional.
|
/* getopt info: every availiable option is listed here. if it is followed by a ':' it
|
||||||
*/
|
needs an argument. If it is followed by a '::' the argument is optional.
|
||||||
while((c = getopt(argc, argv,"hesamui:p:c:w:l:d:")) != -1)
|
*/
|
||||||
{
|
while((c = getopt(argc, argv,"hesamui:p:c:w:l:d:U:")) != -1)
|
||||||
switch (c)
|
{
|
||||||
{
|
switch (c)
|
||||||
case 'a':
|
{
|
||||||
RsInitConfig::autoLogin = true;
|
case 'a':
|
||||||
RsInitConfig::startMinimised = true;
|
RsInitConfig::autoLogin = true;
|
||||||
std::cerr << "AutoLogin Allowed / Start Minimised On";
|
RsInitConfig::startMinimised = true;
|
||||||
std::cerr << std::endl;
|
std::cerr << "AutoLogin Allowed / Start Minimised On";
|
||||||
break;
|
std::cerr << std::endl;
|
||||||
case 'm':
|
break;
|
||||||
RsInitConfig::startMinimised = true;
|
case 'm':
|
||||||
std::cerr << "Start Minimised On";
|
RsInitConfig::startMinimised = true;
|
||||||
std::cerr << std::endl;
|
std::cerr << "Start Minimised On";
|
||||||
break;
|
std::cerr << std::endl;
|
||||||
case 'l':
|
break;
|
||||||
strncpy(RsInitConfig::logfname, optarg, 1024);
|
case 'l':
|
||||||
std::cerr << "LogFile (" << RsInitConfig::logfname;
|
strncpy(RsInitConfig::logfname, optarg, 1024);
|
||||||
std::cerr << ") Selected" << std::endl;
|
std::cerr << "LogFile (" << RsInitConfig::logfname;
|
||||||
RsInitConfig::haveLogFile = true;
|
std::cerr << ") Selected" << std::endl;
|
||||||
break;
|
RsInitConfig::haveLogFile = true;
|
||||||
case 'w':
|
break;
|
||||||
RsInitConfig::passwd = optarg;
|
case 'w':
|
||||||
std::cerr << "Password Specified(" << RsInitConfig::passwd;
|
RsInitConfig::passwd = optarg;
|
||||||
std::cerr << ") Selected" << std::endl;
|
std::cerr << "Password Specified(" << RsInitConfig::passwd;
|
||||||
RsInitConfig::havePasswd = true;
|
std::cerr << ") Selected" << std::endl;
|
||||||
break;
|
RsInitConfig::havePasswd = true;
|
||||||
case 'i':
|
break;
|
||||||
strncpy(RsInitConfig::inet, optarg, 256);
|
case 'i':
|
||||||
std::cerr << "New Inet Addr(" << RsInitConfig::inet;
|
strncpy(RsInitConfig::inet, optarg, 256);
|
||||||
std::cerr << ") Selected" << std::endl;
|
std::cerr << "New Inet Addr(" << RsInitConfig::inet;
|
||||||
RsInitConfig::forceLocalAddr = true;
|
std::cerr << ") Selected" << std::endl;
|
||||||
break;
|
RsInitConfig::forceLocalAddr = true;
|
||||||
case 'p':
|
break;
|
||||||
RsInitConfig::port = atoi(optarg);
|
case 'p':
|
||||||
std::cerr << "New Listening Port(" << RsInitConfig::port;
|
RsInitConfig::port = atoi(optarg);
|
||||||
std::cerr << ") Selected" << std::endl;
|
std::cerr << "New Listening Port(" << RsInitConfig::port;
|
||||||
break;
|
std::cerr << ") Selected" << std::endl;
|
||||||
case 'c':
|
break;
|
||||||
RsInitConfig::basedir = optarg;
|
case 'c':
|
||||||
std::cerr << "New Base Config Dir(";
|
RsInitConfig::basedir = optarg;
|
||||||
std::cerr << RsInitConfig::basedir;
|
std::cerr << "New Base Config Dir(";
|
||||||
std::cerr << ") Selected" << std::endl;
|
std::cerr << RsInitConfig::basedir;
|
||||||
break;
|
std::cerr << ") Selected" << std::endl;
|
||||||
case 's':
|
break;
|
||||||
RsInitConfig::outStderr = true;
|
case 's':
|
||||||
RsInitConfig::haveLogFile = false;
|
RsInitConfig::outStderr = true;
|
||||||
std::cerr << "Output to Stderr";
|
RsInitConfig::haveLogFile = false;
|
||||||
std::cerr << std::endl;
|
std::cerr << "Output to Stderr";
|
||||||
break;
|
std::cerr << std::endl;
|
||||||
case 'd':
|
break;
|
||||||
RsInitConfig::haveDebugLevel = true;
|
case 'd':
|
||||||
RsInitConfig::debugLevel = atoi(optarg);
|
RsInitConfig::haveDebugLevel = true;
|
||||||
std::cerr << "Opt for new Debug Level";
|
RsInitConfig::debugLevel = atoi(optarg);
|
||||||
std::cerr << std::endl;
|
std::cerr << "Opt for new Debug Level";
|
||||||
break;
|
std::cerr << std::endl;
|
||||||
case 'u':
|
break;
|
||||||
RsInitConfig::udpListenerOnly = true;
|
case 'u':
|
||||||
std::cerr << "Opt for only udpListener";
|
RsInitConfig::udpListenerOnly = true;
|
||||||
std::cerr << std::endl;
|
std::cerr << "Opt for only udpListener";
|
||||||
break;
|
std::cerr << std::endl;
|
||||||
case 'e':
|
break;
|
||||||
RsInitConfig::forceExtPort = true;
|
case 'e':
|
||||||
std::cerr << "Opt for External Port Mode";
|
RsInitConfig::forceExtPort = true;
|
||||||
std::cerr << std::endl;
|
std::cerr << "Opt for External Port Mode";
|
||||||
break;
|
std::cerr << std::endl;
|
||||||
case 'h':
|
break;
|
||||||
std::cerr << "Help: " << std::endl;
|
case 'U':
|
||||||
std::cerr << "The commandline options are for retroshare-nogui, a headless server in a shell, or systems without QT." << std::endl << std::endl;
|
prefPgpName = optarg;
|
||||||
std::cerr << "-l [logfile] Set the logfilename" << std::endl;
|
std::cerr << "Opt for User Id ";
|
||||||
std::cerr << "-w [password] Set the password" << std::endl;
|
std::cerr << std::endl;
|
||||||
std::cerr << "-i [ip_adress] Set IP Adress to use" << std::endl;
|
break;
|
||||||
std::cerr << "-p [port] Set the Port to listen on" << std::endl;
|
case 'h':
|
||||||
std::cerr << "-c [basedir] Set the config basdir" << std::endl;
|
std::cerr << "Help: " << std::endl;
|
||||||
std::cerr << "-s Output to Stderr" << std::endl;
|
std::cerr << "The commandline options are for retroshare-nogui, a headless server in a shell, or systems without QT." << std::endl << std::endl;
|
||||||
std::cerr << "-d [debuglevel] Set the debuglevel" << std::endl;
|
std::cerr << "-l [logfile] Set the logfilename" << std::endl;
|
||||||
std::cerr << "-a AutoLogin (Windows Only) + StartMinimised" << std::endl;
|
std::cerr << "-w [password] Set the password" << std::endl;
|
||||||
std::cerr << "-m StartMinimised" << std::endl;
|
std::cerr << "-i [ip_adress] Set IP Adress to use" << std::endl;
|
||||||
std::cerr << "-u Only listen to UDP" << std::endl;
|
std::cerr << "-p [port] Set the Port to listen on" << std::endl;
|
||||||
std::cerr << "-e Use a forwarded external Port" << std::endl << std::endl;
|
std::cerr << "-c [basedir] Set the config basdir" << std::endl;
|
||||||
std::cerr << "Example" << std::endl;
|
std::cerr << "-s Output to Stderr" << std::endl;
|
||||||
std::cerr << "./retroshare-nogui -wmysecretpassword -e" << std::endl;
|
std::cerr << "-d [debuglevel] Set the debuglevel" << std::endl;
|
||||||
exit(1);
|
std::cerr << "-a AutoLogin (Windows Only) + StartMinimised" << std::endl;
|
||||||
break;
|
std::cerr << "-m StartMinimised" << std::endl;
|
||||||
default:
|
std::cerr << "-u Only listen to UDP" << std::endl;
|
||||||
std::cerr << "Unknown Option!" << std::endl;
|
std::cerr << "-e Use a forwarded external Port" << std::endl << std::endl;
|
||||||
std::cerr << "Use '-h' for help." << std::endl;
|
std::cerr << "-U [User Name] Sets Account to Use, Useful when Autologin is enabled" << std::endl;
|
||||||
exit(1);
|
std::cerr << "Example" << std::endl;
|
||||||
}
|
std::cerr << "./retroshare-nogui -wmysecretpassword -e" << std::endl;
|
||||||
}
|
exit(1);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
std::cerr << "Unknown Option!" << std::endl;
|
||||||
|
std::cerr << "Use '-h' for help." << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// set the default Debug Level...
|
// set the default Debug Level...
|
||||||
@ -479,6 +486,27 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored)
|
|||||||
std::list<accountId>::iterator it;
|
std::list<accountId>::iterator it;
|
||||||
getAvailableAccounts(RsInitConfig::accountIds);
|
getAvailableAccounts(RsInitConfig::accountIds);
|
||||||
|
|
||||||
|
// if a different user id has been passed to cmd line check for that instead
|
||||||
|
|
||||||
|
bool pgpNameFound = false;
|
||||||
|
if(prefPgpName != ""){
|
||||||
|
|
||||||
|
for(it = RsInitConfig::accountIds.begin() ; it!= RsInitConfig::accountIds.end() ; it++){
|
||||||
|
|
||||||
|
if(prefPgpName == it->pgpName){
|
||||||
|
|
||||||
|
RsInitConfig::preferedId = it->sslId;
|
||||||
|
pgpNameFound = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!pgpNameFound){
|
||||||
|
std::cerr << "Invalid User name -U pgpName not Found" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* check that preferedId */
|
/* check that preferedId */
|
||||||
std::string userName;
|
std::string userName;
|
||||||
std::string userId;
|
std::string userId;
|
||||||
@ -498,6 +526,7 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored)
|
|||||||
{
|
{
|
||||||
std::cerr << "No Existing User" << std::endl;
|
std::cerr << "No Existing User" << std::endl;
|
||||||
RsInitConfig::preferedId == "";
|
RsInitConfig::preferedId == "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user