#endif
/* Imported functions */
-int authenticate_director(JCR *jcr, DIRRES *director);
+int authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons);
}
if (tty_input) {
stat = get_cmd(input, prompt, UA_sock, 30);
- clrbrk();
+ if (usrbrk() == 1) {
+ clrbrk();
+ }
+ if (usrbrk()) {
+ break;
+ }
} else {
+ /* Reading input from a file */
int len = sizeof_pool_memory(UA_sock->msg) - 1;
- if (fgets(UA_sock->msg, len, input) == NULL || usrbrk()) {
+ if (usrbrk()) {
+ break;
+ }
+ if (fgets(UA_sock->msg, len, input) == NULL) {
stat = -1;
} else {
sendit(UA_sock->msg); /* echo to terminal */
sendit(UA_sock->msg);
}
}
+ if (usrbrk() > 1) {
+ break;
+ } else {
+ clrbrk();
+ }
if (!stop) {
fflush(stdout);
}
if (ndir > 1) {
- UA_sock = init_bsock(NULL, 0, "", "", 0);
+ struct sockaddr_in client_addr;
+ memset(&client_addr, 0, sizeof(client_addr));
+ UA_sock = init_bsock(NULL, 0, "", "", 0, &client_addr);
try_again:
sendit(_("Available Directors:\n"));
LockRes();
return 1;
}
jcr.dir_bsock = UA_sock;
- if (!authenticate_director(&jcr, dir)) {
+
+ LockRes();
+ CONRES *cons = (CONRES *)GetNextRes(R_CONSOLE, (RES *)NULL);
+ UnlockRes();
+ /* If cons==NULL, default console will be used */
+ if (!authenticate_director(&jcr, dir, cons)) {
fprintf(stderr, "ERR=%s", UA_sock->msg);
terminate_console(0);
return 1;