#include "mbconfig.h"
#include <unistd.h>
#include "dataman.h"
#include "auth.h"
#include "crypt.h"
Go to the source code of this file.
int get_auth_token |
( |
FILE * |
fd, |
|
|
char * |
user, |
|
|
char * |
cred, |
|
|
char ** |
nextline |
|
) |
| |
Definition at line 451 of file auth.cc.
References IncludeParser::GetLineData(), HighParser::GetStringWithDelims(), HighParser::GetWord(), HighParser::IsKeyWord(), LASTKEYWORD, MBDYN_EXCEPT_ARGS, SAFENEW, SAFENEWWITHCONSTRUCTOR, and SAFESTRDUP.
455 const char* sKeyWords[] = {
482 switch (CurrKeyWord) {
492 silent_cerr(
"ReadAuthMethod: user expected at line "
498 if (strlen(tmp) == 0) {
499 silent_cerr(
"ReadAuthMethod: Need a legal user id at line "
504 std::string user(tmp);
507 silent_cerr(
"ReadAuthMethod: credentials expected at line "
513 tmp = getpass(
"password: ");
518 if (tmp[0] ==
'\0') {
519 silent_cout(
"ReadAuthMethod: null credentials at line "
523 std::string cred(tmp);
524 memset((
char *)tmp,
'\0', strlen(tmp));
526 std::string salt_format;
534 PasswordAuth(user.c_str(), cred.c_str(), salt_format.c_str()));
535 memset(cred.c_str(),
'\0', cred.size());
539 silent_cerr(
"ReadAuthMethod: line " << HP.
GetLineData()
540 <<
": no working crypt(3)" << std::endl);
550 if (strlen(tmp) == 0) {
551 silent_cerr(
"ReadAuthMethod: Need a legal user id at line "
562 silent_cerr(
"ReadAuthMethod: line " << HP.
GetLineData()
563 <<
": no PAM support" << std::endl);
570 mbdyn_sasl_t mbdyn_sasl = MBDYN_SASL_INIT;
571 mbdyn_sasl.use_sasl = MBDYN_SASL_SERVER;
578 silent_cerr(
"ReadAuthMethod: unable to get SASL mech at line "
586 silent_cerr(
"ReadAuthMethod: line " << HP.
GetLineData()
587 <<
": no SASL2 support" << std::endl);
593 silent_cerr(
"ReadAuthMethod: PWDB not implemented yet" << std::endl);
#define MBDYN_EXCEPT_ARGS
#define SAFENEW(pnt, item)
virtual bool IsKeyWord(const char *sKeyWord)
virtual const char * GetStringWithDelims(enum Delims Del=DEFAULTDELIM, bool escape=true)
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
virtual int GetWord(void)
#define SAFESTRDUP(pnt, src)
virtual HighParser::ErrOut GetLineData(void) const