diff --git a/src/syncterm/conn_telnet.c b/src/syncterm/conn_telnet.c index fc62f50f12ac24eddf961589968b01e97429134b..60c298832c8d4a4d478c9da6632a3d613179c770 100644 --- a/src/syncterm/conn_telnet.c +++ b/src/syncterm/conn_telnet.c @@ -130,7 +130,8 @@ void telnet_output_thread(void *args) int telnet_connect(struct bbslist *bbs) { - init_uifc(TRUE, TRUE); + if (!bbs->hidepopups) + init_uifc(TRUE, TRUE); telnet_log_level = bbs->telnet_loglevel; @@ -166,7 +167,8 @@ int telnet_connect(struct bbslist *bbs) _beginthread(telnet_output_thread, 0, NULL); _beginthread(telnet_input_thread, 0, bbs); - uifc.pop(NULL); + if (!bbs->hidepopups) + uifc.pop(NULL); return(0); } diff --git a/src/syncterm/modem.c b/src/syncterm/modem.c index ce4798f7e7108b6fb93d26fe62bbb0c0d648baf6..81a8d2929ea95bf7f687f56216721ab9dcc80c9c 100644 --- a/src/syncterm/modem.c +++ b/src/syncterm/modem.c @@ -139,27 +139,31 @@ int modem_connect(struct bbslist *bbs) int ret; char respbuf[1024]; - init_uifc(TRUE, TRUE); + if (!bbs->hidepopups) + init_uifc(TRUE, TRUE); if(bbs->conn_type == CONN_TYPE_SERIAL) { if((com=comOpen(bbs->addr)) == COM_HANDLE_INVALID) { - uifcmsg("Cannot Open Port", "`Cannot Open Port`\n\n" - "Cannot open the specified serial device.\n"); + if (!bbs->hidepopups) + uifcmsg("Cannot Open Port", "`Cannot Open Port`\n\n" + "Cannot open the specified serial device.\n"); conn_api.terminate=-1; return(-1); } if(bbs->bpsrate) { if(!comSetBaudRate(com, bbs->bpsrate)) { - uifcmsg("Cannot Set Baud Rate", "`Cannot Set Baud Rate`\n\n" - "Cannot open the specified serial device.\n"); + if (!bbs->hidepopups) + uifcmsg("Cannot Set Baud Rate", "`Cannot Set Baud Rate`\n\n" + "Cannot open the specified serial device.\n"); conn_api.terminate=-1; comClose(com); return(-1); } } if(!comRaiseDTR(com)) { - uifcmsg("Cannot Raise DTR", "`Cannot Raise DTR`\n\n" - "comRaiseDTR() returned an error.\n"); + if (!bbs->hidepopups) + uifcmsg("Cannot Raise DTR", "`Cannot Raise DTR`\n\n" + "comRaiseDTR() returned an error.\n"); conn_api.terminate=-1; comClose(com); return(-1); @@ -167,23 +171,26 @@ int modem_connect(struct bbslist *bbs) } else { if((com=comOpen(settings.mdm.device_name)) == COM_HANDLE_INVALID) { - uifcmsg("Cannot Open Modem", "`Cannot Open Modem`\n\n" - "Cannot open the specified modem device.\n"); + if (!bbs->hidepopups) + uifcmsg("Cannot Open Modem", "`Cannot Open Modem`\n\n" + "Cannot open the specified modem device.\n"); conn_api.terminate=-1; return(-1); } if(settings.mdm.com_rate) { if(!comSetBaudRate(com, settings.mdm.com_rate)) { - uifcmsg("Cannot Set Baud Rate", "`Cannot Set Baud Rate`\n\n" - "Cannot open the specified modem device.\n"); + if (!bbs->hidepopups) + uifcmsg("Cannot Set Baud Rate", "`Cannot Set Baud Rate`\n\n" + "Cannot open the specified modem device.\n"); conn_api.terminate=-1; comClose(com); return(-1); } } if(!comRaiseDTR(com)) { - uifcmsg("Cannot Raise DTR", "`Cannot Raise DTR`\n\n" - "comRaiseDTR() returned an error.\n"); + if (!bbs->hidepopups) + uifcmsg("Cannot Raise DTR", "`Cannot Raise DTR`\n\n" + "comRaiseDTR() returned an error.\n"); conn_api.terminate=-1; comClose(com); return(-1); @@ -193,7 +200,8 @@ int modem_connect(struct bbslist *bbs) while(kbhit()) getch(); - uifc.pop("Initializing..."); + if (!bbs->hidepopups) + uifc.pop("Initializing..."); comWriteString(com, settings.mdm.init_string); comWriteString(com, "\r"); @@ -202,11 +210,13 @@ int modem_connect(struct bbslist *bbs) while(1) { if((ret=modem_response(respbuf, sizeof(respbuf), 5))!=0) { modem_close(); - uifc.pop(NULL); - if(ret<0) - uifcmsg("Modem Not Responding", "`Modem Not Responding`\n\n" - "The modem did not respond to the initializtion string\n" - "Check your init string and phone number.\n"); + if (!bbs->hidepopups) { + uifc.pop(NULL); + if(ret<0) + uifcmsg("Modem Not Responding", "`Modem Not Responding`\n\n" + "The modem did not respond to the initializtion string\n" + "Check your init string and phone number.\n"); + } conn_api.terminate=-1; return(-1); } @@ -217,15 +227,19 @@ int modem_connect(struct bbslist *bbs) if(!strstr(respbuf, "OK")) { modem_close(); - uifc.pop(NULL); - uifcmsg(respbuf, "`Initialization Error`\n\n" - "The modem did not respond favorably to your initialization string.\n"); + if (!bbs->hidepopups) { + uifc.pop(NULL); + uifcmsg(respbuf, "`Initialization Error`\n\n" + "The modem did not respond favorably to your initialization string.\n"); + } conn_api.terminate=-1; return(-1); } - uifc.pop(NULL); - uifc.pop("Dialing..."); + if (!bbs->hidepopups) { + uifc.pop(NULL); + uifc.pop("Dialing..."); + } comWriteString(com, settings.mdm.dial_string); comWriteString(com, bbs->addr); comWriteString(com, "\r"); @@ -234,10 +248,12 @@ int modem_connect(struct bbslist *bbs) while(1) { if((ret=modem_response(respbuf, sizeof(respbuf), 60))!=0) { modem_close(); - uifc.pop(NULL); - if(ret<0) - uifcmsg(respbuf, "`No Answer`\n\n" - "The modem did not connect within 60 seconds.\n"); + if (!bbs->hidepopups) { + uifc.pop(NULL); + if(ret<0) + uifcmsg(respbuf, "`No Answer`\n\n" + "The modem did not connect within 60 seconds.\n"); + } conn_api.terminate=-1; return(-1); } @@ -248,17 +264,21 @@ int modem_connect(struct bbslist *bbs) if(!strstr(respbuf, "CONNECT")) { modem_close(); - uifc.pop(NULL); - uifcmsg(respbuf, "`Connection Failed`\n\n" - "SyncTERM was unable to establish a connection.\n"); + if (!bbs->hidepopups) { + uifc.pop(NULL); + uifcmsg(respbuf, "`Connection Failed`\n\n" + "SyncTERM was unable to establish a connection.\n"); + } conn_api.terminate=-1; return(-1); } - uifc.pop(NULL); - uifc.pop(respbuf); - SLEEP(1000); - uifc.pop(NULL); + if (!bbs->hidepopups) { + uifc.pop(NULL); + uifc.pop(respbuf); + SLEEP(1000); + uifc.pop(NULL); + } } if(!create_conn_buf(&conn_inbuf, BUFFER_SIZE)) { @@ -295,7 +315,8 @@ int modem_connect(struct bbslist *bbs) _beginthread(modem_input_thread, 0, NULL); } - uifc.pop(NULL); + if (!bbs->hidepopups) + uifc.pop(NULL); return(0); } diff --git a/src/syncterm/ssh.c b/src/syncterm/ssh.c index 081af7696cbcc1db11dde2179b6bc203051b7a3e..0c357fe09b87fe54c870a29090e83d71f1068b4a 100644 --- a/src/syncterm/ssh.c +++ b/src/syncterm/ssh.c @@ -150,22 +150,25 @@ int ssh_connect(struct bbslist *bbs) int rows,cols; const char *term; - init_uifc(TRUE, TRUE); + if (!bbs->hidepopups) + init_uifc(TRUE, TRUE); pthread_mutex_init(&ssh_mutex, NULL); if(!crypt_loaded) { - uifcmsg("Cannot load cryptlib - SSH inoperative", "`Cannot load cryptlib`\n\n" - "Cannot load the file " + if (!bbs->hidepopups) { + uifcmsg("Cannot load cryptlib - SSH inoperative", "`Cannot load cryptlib`\n\n" + "Cannot load the file " #ifdef _WIN32 - "cl32.dll" + "cl32.dll" #else - "libcl.so" + "libcl.so" #endif - "\nThis file is required for SSH functionality.\n\n" - "The newest version is always available from:\n" - "http://www.cs.auckland.ac.nz/~pgut001/cryptlib/" - ); - return(conn_api.terminate=-1); + "\nThis file is required for SSH functionality.\n\n" + "The newest version is always available from:\n" + "http://www.cs.auckland.ac.nz/~pgut001/cryptlib/" + ); + return(conn_api.terminate=-1); + } } sock=conn_socket_connect(bbs); @@ -174,14 +177,17 @@ int ssh_connect(struct bbslist *bbs) ssh_active=FALSE; - uifc.pop("Creating Session"); + if (!bbs->hidepopups) + uifc.pop("Creating Session"); status=cl.CreateSession(&ssh_session, CRYPT_UNUSED, CRYPT_SESSION_SSH); if(cryptStatusError(status)) { char str[1024]; sprintf(str,"Error %d creating session",status); - uifcmsg("Error creating session",str); + if (!bbs->hidepopups) + uifcmsg("Error creating session",str); conn_api.terminate=1; - uifc.pop(NULL); + if (!bbs->hidepopups) + uifc.pop(NULL); return(-1); } @@ -191,95 +197,131 @@ int ssh_connect(struct bbslist *bbs) SAFECOPY(password,bbs->password); SAFECOPY(username,bbs->user); - uifc.pop(NULL); + if (!bbs->hidepopups) + uifc.pop(NULL); - if(!username[0]) + if(!username[0]) { + if (bbs->hidepopups) + init_uifc(FALSE, FALSE); uifcinput("UserID",MAX_USER_LEN,username,0,"No stored UserID."); + if (bbs->hidepopups) + uifcbail(); + } - uifc.pop("Setting Username"); + if (!bbs->hidepopups) + uifc.pop("Setting Username"); /* Add username/password */ status=cl.SetAttributeString(ssh_session, CRYPT_SESSINFO_USERNAME, username, strlen(username)); if(cryptStatusError(status)) { char str[1024]; sprintf(str,"Error %d setting username",status); - uifcmsg("Error setting username",str); + if (!bbs->hidepopups) + uifcmsg("Error setting username",str); conn_api.terminate=1; - uifc.pop(NULL); + if (!bbs->hidepopups) + uifc.pop(NULL); return(-1); } - uifc.pop(NULL); - if(!password[0]) + if (!bbs->hidepopups) + uifc.pop(NULL); + if(!password[0]) { + if (bbs->hidepopups) + init_uifc(FALSE, FALSE); uifcinput("Password",MAX_PASSWD_LEN,password,K_PASSWORD,"Incorrect password. Try again."); + if (bbs->hidepopups) + uifcbail(); + } - uifc.pop("Setting Password"); + if (!bbs->hidepopups) + uifc.pop("Setting Password"); status=cl.SetAttributeString(ssh_session, CRYPT_SESSINFO_PASSWORD, password, strlen(password)); if(cryptStatusError(status)) { char str[1024]; sprintf(str,"Error %d setting password",status); - uifcmsg("Error setting password",str); + if (!bbs->hidepopups) + uifcmsg("Error setting password",str); conn_api.terminate=1; - uifc.pop(NULL); + if (!bbs->hidepopups) + uifc.pop(NULL); return(-1); } - uifc.pop(NULL); - uifc.pop("Setting Username"); + if (!bbs->hidepopups) { + uifc.pop(NULL); + uifc.pop("Setting Username"); + } /* Pass socket to cryptlib */ status=cl.SetAttribute(ssh_session, CRYPT_SESSINFO_NETWORKSOCKET, sock); if(cryptStatusError(status)) { char str[1024]; sprintf(str,"Error %d passing socket",status); - uifcmsg("Error passing socket",str); + if (!bbs->hidepopups) + uifcmsg("Error passing socket",str); conn_api.terminate=1; - uifc.pop(NULL); + if (!bbs->hidepopups) + uifc.pop(NULL); return(-1); } - uifc.pop(NULL); - uifc.pop("Setting Terminal Type"); + if (!bbs->hidepopups) { + uifc.pop(NULL); + uifc.pop("Setting Terminal Type"); + } term = get_emulation_str(get_emulation(bbs)); status=cl.SetAttributeString(ssh_session, CRYPT_SESSINFO_SSH_TERMINAL, term, strlen(term)); get_term_win_size(&cols, &rows, &bbs->nostatus); - uifc.pop(NULL); - uifc.pop("Setting Terminal Width"); + if (!bbs->hidepopups) { + uifc.pop(NULL); + uifc.pop("Setting Terminal Width"); + } /* Pass socket to cryptlib */ status=cl.SetAttribute(ssh_session, CRYPT_SESSINFO_SSH_WIDTH, cols); - uifc.pop(NULL); - uifc.pop("Setting Terminal Height"); + if (!bbs->hidepopups) { + uifc.pop(NULL); + uifc.pop("Setting Terminal Height"); + } /* Pass socket to cryptlib */ status=cl.SetAttribute(ssh_session, CRYPT_SESSINFO_SSH_HEIGHT, rows); cl.SetAttribute(ssh_session, CRYPT_OPTION_NET_READTIMEOUT, 1); /* Activate the session */ - uifc.pop(NULL); - uifc.pop("Activating Session"); + if (!bbs->hidepopups) { + uifc.pop(NULL); + uifc.pop("Activating Session"); + } status=cl.SetAttribute(ssh_session, CRYPT_SESSINFO_ACTIVE, 1); if(cryptStatusError(status)) { - cryptlib_error_message(status, "activating session"); + if (!bbs->hidepopups) + cryptlib_error_message(status, "activating session"); conn_api.terminate=1; - uifc.pop(NULL); + if (!bbs->hidepopups) + uifc.pop(NULL); return(-1); } ssh_active=TRUE; - uifc.pop(NULL); - - /* Clear ownership */ - uifc.pop(NULL); - uifc.pop("Clearing Ownership"); + if (!bbs->hidepopups) { + /* Clear ownership */ + uifc.pop(NULL); // TODO: Why is this called twice? + uifc.pop(NULL); + uifc.pop("Clearing Ownership"); + } status=cl.SetAttribute(ssh_session, CRYPT_PROPERTY_OWNER, CRYPT_UNUSED); if(cryptStatusError(status)) { - cryptlib_error_message(status, "clearing session ownership"); + if (!bbs->hidepopups) + cryptlib_error_message(status, "clearing session ownership"); conn_api.terminate=1; - uifc.pop(NULL); + if (!bbs->hidepopups) + uifc.pop(NULL); return(-1); } - uifc.pop(NULL); + if (!bbs->hidepopups) + uifc.pop(NULL); create_conn_buf(&conn_inbuf, BUFFER_SIZE); create_conn_buf(&conn_outbuf, BUFFER_SIZE); @@ -291,7 +333,8 @@ int ssh_connect(struct bbslist *bbs) _beginthread(ssh_output_thread, 0, NULL); _beginthread(ssh_input_thread, 0, NULL); - uifc.pop(NULL); + if (!bbs->hidepopups) + uifc.pop(NULL); // TODO: Why is this called twice? return(0); }