/*
* This file is part of rasdaman community.
*
* Rasdaman community is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Rasdaman community is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with rasdaman community. If not, see .
*
* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
rasdaman GmbH.
*
* For more information please see
* or contact Peter Baumann via .
/
/**
* SOURCE: raspasswd.cc
*
* MODULE: rascontrol
* CLASS:
*
* PURPOSE:
* RasDaMan password utility
*
* COMMENTS:
*
*
*/
// for trace macros
#define DEBUG_MAIN
#include "debug-clt.hh"
#include "globals.hh"
#include "rascontrol.hh"
#include "raspasswd.hh"
#include "rasmgr_utils_comm.hh"
#ifndef RMANVERSION
#error "Please specify the RMANVERSION variable!"
#endif
#ifndef COMPDATE
#error "Please specify the COMPDATE variable!"
/*
COMPDATE=`date +"%d.%m.%Y %H:%M:%S"`
and -DCOMPDATE="\"$(COMPDATE)\"" when compiling
*/
#endif
RasPasswdConfig config;
UserLogin userLogin;
RasMgrClientComm rasmgrComm;
char message[100];
char encrNewPass1[35];
char encrNewPass2[35];
int main(int argc, char **argv)
{
cout << "raspasswd: rasdaman password utility. rasdaman v" << RMANVERSION / 1000. << " -- generated on " << COMPDATE << "." < name of host where master rasmgr runs", DEFAULT_HOSTNAME)),
cmlPort (cmlInter.addLongParameter(CommandLineParser::noShortName,"port", " the rasmgr port", DEFAULT_PORT )),
cmlHelp (cmlInter.addFlagParameter('h',"help","this help"))
{
// done by default value of commandlineparser
// strcpy(rasmgrHost,RASMGRHOST.c_str());
// rasmgrPort = RASMGRPORT;
}
bool RasPasswdConfig::interpretArguments(int argc, char **argv)
{
try {
cmlInter.processCommandLine(argc, argv);
}
catch(CmlException& err) {
cerr << "Command Line Parsing Error:" << endl << err.what() << endl;
return false;
}
if( cmlHelp.isPresent() ) {
printHelp();
return false;
}
try {
rasmgrPort = cmlPort.getValueAsLong();
}
catch(CmlException& err) {
cerr << "Command Line Parsing Error:" << endl << err.what() << endl;
return false;
}
strcpy(rasmgrHost, cmlHost.getValueAsString());
return true;
}
void RasPasswdConfig::printHelp()
{
cout << "Usage: raspasswd [options]"<