return false;
}
+ // early check if auth interaction finish
+ if (dir->msg[0] == UA_AUTH_INTERACTIVE_FINISH){
+ // break the loop
+ break;
+ }
+
pm_strcpy(msg, NULL);
pm_strcpy(msg, dir->msg + 1);
strip_trailing_junk(msg.c_str());
// now we should return it to director
strip_trailing_junk(buf.c_str());
- dir->fsend("%s", buf.c_str());
+ dir->fsend("%c%s", UA_AUTH_INTERACTIVE_RESPONSE, buf.c_str());
break;
case UA_AUTH_INTERACTIVE_HIDDEN:
bstrncpy(buf.c_str(), passwd, buf.size());
#endif
// now we should get a hidden response at `buf` class, return it to director
- dir->fsend("%s", buf.c_str());
+ dir->fsend("%c%s", UA_AUTH_INTERACTIVE_RESPONSE, buf.c_str());
break;
case UA_AUTH_INTERACTIVE_MESSAGE:
break;
case UA_AUTH_INTERACTIVE_FINISH:
- return true;
+ // well it is not possible that we will reach this code, so report insanity
+ return false;
default:
bmicrosleep(5, 0); // original cram_md5_respond() wait for 5s here
return false;
}
}
+
+ // now check if authorized
+ if (bsock->wait_data(180) <= 0 || bsock->recv() <= 0) {
+ Dmsg1(1, "Receive auth confirmation failed. ERR=%s\n", bsock->bstrerror());
+ bmicrosleep(5, 0);
+ return false;
+ }
+ if (strcmp(bsock->msg, "1000 OK auth\n") == 0) {
+ // authorization ok
+ return true;
+ }
+ Dmsg1(1, "Received bad response: %s\n", bsock->msg);
+ bmicrosleep(5, 0);
+ return false;
}
}
}
/* Timeout Hello after 15 secs */
- StartAuthTimeout(15);
+ StartAuthTimeout(1500);
dir->fsend(hello, bashed_name, UA_VERSION, tlspsk_local_need);
legacy_auth = false;
Dmsg1(dbglvl, "authenticate with Plugin=%s\n", cons->authenticationplugin);
if (ua_version < UA_VERSION_PLUGINAUTH || !authenticate_with_plugin(cons)){
+ auth_success = false;
goto auth_done;
}
}
}
if (dir_authplugin_authenticate(uac->jcr, bsock, authData->name) != bRC_OK){
+ bsock->fsend(_("1999 Authorization failed !!!.\n"));
+ bmicrosleep(5, 0);
return false;
}
+ bsock->fsend("1000 OK auth\n");
return true;
}
\ No newline at end of file
return bRC_Error;
}
+ // check if it is a response packet
+ if (bsock->msg[0] != UA_AUTH_INTERACTIVE_RESPONSE){
+ Dmsg1(dbglvl, "Receive auth response packet error. Sig=%d\n", (int)bsock->msg[0]);
+ bmicrosleep(5, 0);
+ return bRC_Error;
+ }
+
// forward response to plugin
value.seqdata = seqdata;
- value.response = bsock->msg;
+ value.response = bsock->msg + 1; // we have to omit a first character which is a packet mark
return dir_authplugin_generate_plugin_event(jcr, pluginname, bDirEventAuthenticationResponse, (void*)&value);
}