From d92773ea567992bb5c895c918949b05939e9b483 Mon Sep 17 00:00:00 2001 From: anderson.peterle@previdencia.gov.br Date: Thu, 23 Sep 2010 18:26:21 +0000 Subject: [PATCH] Ajustes no srCACIC para retomada de conexão em caso de queda, ajustes para versão 2.6.0.2, pequenas correções. --- srcacic/VNCViewer/AuthDialog.cpp | 40 ++++++++++++++++++++++++++++++++++++++-- srcacic/VNCViewer/ClientConnection.cpp | 53 ++++++++++++++++++++++++++++++++--------------------- srcacic/VNCViewer/Res/resource.h | 5 ++++- srcacic/VNCViewer/Res/vncviewer.rc | 63 +++++++++++++++++++++++++++++---------------------------------- srcacic/VNCViewer/VNCOptions.cpp | 6 ++++-- srcacic/VNCViewer/VNCViewer.vcproj | 284 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------- srcacic/VNCViewer/VNCviewerApp32.cpp | 1 + srcacic/VNCViewer/vncviewer.cpp | 4 ++-- srcacic/WinVNC/MS-Logon/workgrpdomnt4/WorkGRPDomNT4.vcproj | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------- srcacic/WinVNC/WinVNC/CACIC_Auth.cpp | 301 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------- srcacic/WinVNC/WinVNC/CACIC_Auth.h | 37 +++++++++++++++++++++++++++++++++++-- srcacic/WinVNC/WinVNC/WinVNC.vcproj | 8 ++++++++ srcacic/WinVNC/WinVNC/vncacceptdialog.cpp | 26 ++++++++++++++------------ srcacic/WinVNC/WinVNC/vncclient.cpp | 41 ++++++++++++++++++++++++++++++++++++++--- srcacic/WinVNC/WinVNC/vnclog.cpp | 4 ++-- srcacic/WinVNC/WinVNC/vnclog.h | 2 +- srcacic/WinVNC/WinVNC/winvnc.cpp | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++------ srcacic/WinVNC/WinVNC/winvnc.h | 2 ++ srcacic/WinVNC/WinVNC/winvnc.rc | 22 +++++++++++----------- srcacic/ZLib/ZLib.vcproj | 236 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------- 20 files changed, 920 insertions(+), 380 deletions(-) diff --git a/srcacic/VNCViewer/AuthDialog.cpp b/srcacic/VNCViewer/AuthDialog.cpp index fbc6f05..e2b5c90 100644 --- a/srcacic/VNCViewer/AuthDialog.cpp +++ b/srcacic/VNCViewer/AuthDialog.cpp @@ -70,6 +70,26 @@ BOOL CALLBACK AuthDialog::DlgProc( HWND hwnd, UINT uMsg, AuthDialog *_this = (AuthDialog *) GetWindowLongPtr(hwnd, GWLP_USERDATA); #endif + // Anderson PETERLE] +HFONT myfont; + myfont=CreateFont + ( + 14, // logical height of font + 0, // logical average character width + 0, // angle of escapement + 0, // base-line orientation angle + FW_BOLD,// font weight + 0, // italic attribute flag + 0, // underline attribute flag + 0, // strikeout attribute flag + ANSI_CHARSET, // character set identifier + 0, // output precision + 0, // clipping precision + 0, // output quality + 0, // pitch and family + "Arial" // pointer to typeface name string + ); + // switch (uMsg) { @@ -82,8 +102,10 @@ BOOL CALLBACK AuthDialog::DlgProc( HWND hwnd, UINT uMsg, #endif _this = (AuthDialog *) lParam; + HDC hdc = (HDC)wParam; CentreWindow(hwnd); SetForegroundWindow(hwnd); + COLORREF NewColor = RGB(255, 255,0); // Limitando o tamanho dos campos. SendMessage(GetDlgItem(hwnd, IDC_USER_EDIT), EM_LIMITTEXT, WPARAM(32), 0); @@ -91,6 +113,13 @@ BOOL CALLBACK AuthDialog::DlgProc( HWND hwnd, UINT uMsg, SendMessage(GetDlgItem(hwnd, IDC_MOTIVO_EDIT), EM_LIMITTEXT, WPARAM(5120), 0); SendMessage(GetDlgItem(hwnd, IDC_DOC_REF_EDIT), EM_LIMITTEXT, WPARAM(128), 0); + // Testes ANDERSON PETERLE + SendMessage(GetDlgItem(hwnd, IDD_AUTH_DIALOG_LOGIN_TEXT),WM_SETFONT, WPARAM(myfont), (LPARAM)0); + //SendMessage(GetDlgItem(hwnd, IDD_AUTH_DIALOG_LOGIN_TEXT),WM_SETFONT, NewColor, (LPARAM)0); + //PostMessage(GetDlgItem(hwnd, IDD_AUTH_DIALOG_LOGIN_TEXT),WM_CTLCOLORSTATIC, RGB(255,0,0),RGB(255,0,0)); + + + //DefEditProc = (WNDPROC) SetWindowLong(GetDlgItem(hwnd, IDC_MOTIVO_EDIT), GWL_WNDPROC, (long) motivoEditProc); return TRUE; @@ -162,9 +191,16 @@ BOOL CALLBACK AuthDialog::DlgProc( HWND hwnd, UINT uMsg, if (hwndStatic == GetDlgItem(hwnd, IDC_CHAR_COUNT)) { SetTextColor(hdc, RGB(0, 0, 160)); - SetBkMode(hdc, TRANSPARENT); + SetBkMode(hdc, RGB(212, 208, 200)); + + return (DWORD)GetStockObject(RGB(212, 208, 200)); + } + else if(hwndStatic == GetDlgItem(hwnd, IDD_AUTH_DIALOG_LOGIN_TEXT)){ - return NULL_BRUSH; + SetTextColor(hdc, RGB(178 ,34, 34 )); + SetBkMode(hdc, RGB(212, 208, 200)); + + return (DWORD)GetStockObject(NULL_BRUSH); } } break; diff --git a/srcacic/VNCViewer/ClientConnection.cpp b/srcacic/VNCViewer/ClientConnection.cpp index 752f919..0c778e4 100644 --- a/srcacic/VNCViewer/ClientConnection.cpp +++ b/srcacic/VNCViewer/ClientConnection.cpp @@ -530,8 +530,9 @@ void ClientConnection::Run() // The rest of the processing continues in run_undetached. LowLevelHook::Initialize(m_hwndMain); start_undetached(); - + EndDialog(m_hwndStatus,0); + } // sf@2007 - Autoreconnect @@ -612,13 +613,15 @@ void ClientConnection::CreateButtons(BOOL mini,BOOL ultra) { if (ultra) { - int nr_buttons = 14; + // alterando a quantidade de botões (14-1) + int nr_buttons = 13; TBADDBITMAP tbab; TBBUTTON tbButtons []= { {0,ID_BUTTON_CAD,TBSTATE_ENABLED,TBSTYLE_BUTTON,0L,0}, {1,ID_BUTTON_FULLSCREEN,TBSTATE_ENABLED,TBSTYLE_BUTTON,0L,1}, - {2,ID_BUTTON_PROPERTIES,TBSTATE_ENABLED,TBSTYLE_BUTTON,0L,2}, + // desativando botão "Opções da Conexão" + //{2,ID_BUTTON_PROPERTIES,TBSTATE_ENABLED,TBSTYLE_BUTTON,0L,2}, {3,ID_BUTTON_REFRESH,TBSTATE_ENABLED,TBSTYLE_BUTTON,0L,3}, {4,ID_BUTTON_STRG_ESC,TBSTATE_ENABLED,TBSTYLE_BUTTON,0L,4}, {5,ID_BUTTON_SEP,TBSTATE_ENABLED,TBSTYLE_BUTTON,0L,5}, @@ -632,11 +635,13 @@ void ClientConnection::CreateButtons(BOOL mini,BOOL ultra) {13,ID_BUTTON_TEXTCHAT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0L,13}, }; - static char *szTips[14] = + // reduz a quantidade de mensagens relacionadas aos botões (14-1) + static char *szTips[13] = { sz_L2, sz_L3, - sz_L4, + // desativando a mensagem relacionadas ao botão "Opções da Conexão" + //sz_L4, sz_L5, sz_L6, sz_L7, @@ -846,7 +851,7 @@ void ClientConnection::CreateButtons(BOOL mini,BOOL ultra) SendMessage(m_hwndTT, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); - + } SendMessage(m_hwndTB,TB_SETTOOLTIPS,(WPARAM)(HWND)m_hwndTT,(LPARAM)0); SendMessage(m_hwndTT,TTM_SETTIPBKCOLOR,(WPARAM)(COLORREF)0x00404040,(LPARAM)0); @@ -1082,7 +1087,8 @@ void ClientConnection::GTGBS_CreateToolbar() RECT r; GetClientRect(m_hwndTBwin,&r); - m_TrafficMonitor = CreateWindowEx(WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE, + // Removendo o monitoramento de tráfego + /*m_TrafficMonitor = CreateWindowEx(WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE, "Static", NULL, WS_CHILD | WS_VISIBLE , @@ -1093,7 +1099,7 @@ void ClientConnection::GTGBS_CreateToolbar() m_hwndTBwin, NULL, m_pApp->m_instance, - NULL); + NULL);*/ m_bitmapNONE = LoadImage(m_pApp->m_instance,MAKEINTRESOURCE(IDB_STAT_NONE),IMAGE_BITMAP,22,20,LR_SHARED); m_bitmapFRONT = LoadImage(m_pApp->m_instance,MAKEINTRESOURCE(IDB_STAT_FRONT),IMAGE_BITMAP,22,20,LR_SHARED); @@ -1108,7 +1114,8 @@ void ClientConnection::GTGBS_CreateToolbar() ReleaseDC(m_TrafficMonitor,hdc); /////////////////////////////////////////////////// - m_logo_wnd = CreateWindow( + // Removendo opção de nova conexão a partir da barra de ferramentas + /*m_logo_wnd = CreateWindow( "combobox", "", WS_CHILD | WS_VISIBLE | WS_TABSTOP|CBS_SIMPLE | CBS_AUTOHSCROLL | WS_VSCROLL, @@ -1131,7 +1138,7 @@ void ClientConnection::GTGBS_CreateToolbar() m_hwndTBwin, (HMENU)9998, m_pApp->m_instance, - NULL); + NULL);*/ TCHAR valname[256]; MRU *m_pMRU; m_pMRU = new MRU(SESSION_MRU_KEY_NAME,26); @@ -1267,9 +1274,9 @@ void ClientConnection::CreateDisplay() AppendMenu(hsysmenu, MF_STRING, ID_HALFSCREEN, sz_L26); AppendMenu(hsysmenu, MF_STRING, ID_FUZZYSCREEN, sz_L27); AppendMenu(hsysmenu, MF_STRING, ID_NORMALSCREEN, sz_L28); - AppendMenu(hsysmenu, MF_SEPARATOR, NULL, NULL); - AppendMenu(hsysmenu, MF_STRING, ID_MAXCOLORS, sz_L29); - AppendMenu(hsysmenu, MF_STRING, ID_256COLORS, sz_L30); + //AppendMenu(hsysmenu, MF_SEPARATOR, NULL, NULL); + //AppendMenu(hsysmenu, MF_STRING, ID_MAXCOLORS, sz_L29); + //AppendMenu(hsysmenu, MF_STRING, ID_256COLORS, sz_L30); AppendMenu(hsysmenu, MF_SEPARATOR, NULL, NULL); AppendMenu(hsysmenu, MF_STRING, ID_CONN_CTLALTDEL, sz_L31); AppendMenu(hsysmenu, MF_STRING, ID_CONN_CTLESC, sz_L32); @@ -1278,7 +1285,7 @@ void ClientConnection::CreateDisplay() AppendMenu(hsysmenu, MF_STRING, ID_CONN_ALTDOWN, sz_L35); AppendMenu(hsysmenu, MF_STRING, ID_CONN_ALTUP, sz_L36); AppendMenu(hsysmenu, MF_SEPARATOR, NULL, NULL); - AppendMenu(hsysmenu, MF_STRING, ID_NEWCONN, sz_L37); + //AppendMenu(hsysmenu, MF_STRING, ID_NEWCONN, sz_L37); AppendMenu(hsysmenu, MF_STRING | (m_serverInitiated ? MF_GRAYED : 0), ID_CONN_SAVE_AS, sz_L38); } @@ -1425,7 +1432,7 @@ void ClientConnection::HandleQuickOption() { switch (m_opts.m_quickoption) { - case 1: + /*case 1: m_opts.m_PreferredEncoding = rfbEncodingZRLE; m_opts.m_Use8Bit = rfbPFFullColors; //false; m_opts.m_fEnableCache = true; @@ -1480,15 +1487,18 @@ void ClientConnection::HandleQuickOption() m_opts.m_requestShapeUpdates = false; m_opts.m_ignoreShapeUpdates = true; // m_opts.m_localCursor = NOCURSOR; - break; + break;*/ + + + //Set Cor e modo de cache default: // 0 can be set by noauto command line option. Do not chnage any setting in this case - /* sf@2005 + //sf@2005 m_opts.m_PreferredEncoding = rfbEncodingZRLE; m_opts.m_Use8Bit = rfbPF256Colors; //false; m_opts.m_fEnableCache = true; m_opts.autoDetect = false; - */ + break; } @@ -2336,6 +2346,7 @@ void ClientConnection::SizeWindow() else m_winheight = min(m_fullwinheight, workheight); + // cria a janela de suporte remoto SetWindowPos(m_hwndMain, HWND_TOP, workrect.left + (workwidth-m_winwidth) / 2, workrect.top + (workheight-m_winheight) / 2, @@ -5670,14 +5681,14 @@ LRESULT CALLBACK ClientConnection::WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, // TODO: quando o cliente é removido pelo servidor ou cai, a janela sobre o logout aparece assim mesmo. if (_this->m_running) { - int doLogout = MessageBox(hwnd, "Deseja efetuar logout na máquina remota?", "srCACICcli", MB_YESNO); - if (doLogout == IDNO) { + //int doLogout = MessageBox(hwnd, "Deseja efetuar logout na máquina remota?", "srCACICcli", MB_YESNO); + //if (doLogout == IDNO) { // CACIC: Envia mensagem dizendo que o servidor deve efetuar o logout. rfbNoLogoutMsg nl; nl.type = rfbNoLogout; _this->WriteExact((char *)&nl, sz_rfbNoLogoutMsg, rfbNoLogout); - } + //} } // Close the worker thread diff --git a/srcacic/VNCViewer/Res/resource.h b/srcacic/VNCViewer/Res/resource.h index 312025f..d2780f2 100644 --- a/srcacic/VNCViewer/Res/resource.h +++ b/srcacic/VNCViewer/Res/resource.h @@ -107,6 +107,7 @@ #define IDC_ALTGR 1043 #define IDD_AUTH_DIALOG1 1043 #define IDD_AUTH_DIALOG 1043 +#define IDD_AUTH_DIALOG_LOGIN_TEXT 1043 #define IDC_DOWNLOAD_B 1044 #define IDC_STRG 1044 #define IDC_PROGRESS 1045 @@ -212,6 +213,8 @@ #define IDC_DOC_REF_EDIT 1165 #define IDC_KEY_COUNT 1166 #define IDC_CHAR_COUNT 1166 +#define IDC_MIDOCVIEW1 1167 +#define IDC_EDIT4 1168 #define IDC_ENCODING_BASE 1999 #define IDC_RAWRADIO 2000 #define IDC_RRERADIO 2002 @@ -514,7 +517,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 199 #define _APS_NEXT_COMMAND_VALUE 50025 -#define _APS_NEXT_CONTROL_VALUE 1167 +#define _APS_NEXT_CONTROL_VALUE 1169 #define _APS_NEXT_SYMED_VALUE 154 #endif #endif diff --git a/srcacic/VNCViewer/Res/vncviewer.rc b/srcacic/VNCViewer/Res/vncviewer.rc index fa560c6..3a02c0d 100644 --- a/srcacic/VNCViewer/Res/vncviewer.rc +++ b/srcacic/VNCViewer/Res/vncviewer.rc @@ -101,7 +101,7 @@ BEGIN MENUITEM "Nova Conexão", ID_NEWCONN MENUITEM "Opções Padrão", IDC_OPTIONBUTTON MENUITEM SEPARATOR - MENUITEM "Sobre o CacicRC...", IDD_ABOUT + MENUITEM "Sobre o srCACIC...", IDD_ABOUT MENUITEM SEPARATOR MENUITEM "Ativar/Desativar Modo Escuta", ID_LISTEN_MODE MENUITEM "Fechar o srCACIC Cliente", ID_CLOSEAPP @@ -232,18 +232,16 @@ BEGIN PUSHBUTTON "Renomear",IDC_RENAME_B,248,239,60,14,BS_FLAT END -IDD_SESSION_DLG DIALOGEX 0, 0, 186, 86 +IDD_SESSION_DLG DIALOGEX 0, 0, 195, 50 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Sistema CACIC - Módulo srCACICcli - Conexão" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - COMBOBOX IDC_HOSTNAME_EDIT,5,38,176,66,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - DEFPUSHBUTTON "Conectar",IDOK,50,62,40,19 - PUSHBUTTON "Cancelar",IDCANCEL,94,62,40,19 - CONTROL 108,IDC_STATIC,"Static",SS_BITMAP,5,6,21,20 - CONTROL "Observar Somente",IDC_VIEWONLY_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,32,5,77,12 - CONTROL "Auto Ajuste da Tela",IDC_AUTOSCALING_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,32,14,80,15 - LTEXT "Servidor:",IDC_STATIC,5,29,30,8 + COMBOBOX IDC_HOSTNAME_EDIT,37,14,146,66,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP + DEFPUSHBUTTON "Conectar",IDOK,51,31,40,14 + PUSHBUTTON "Cancelar",IDCANCEL,100,31,40,14 + CONTROL 108,IDC_STATIC,"Static",SS_BITMAP,5,11,21,20 + LTEXT "Servidor:",IDC_STATIC,39,5,30,8 END IDD_SERVINFO_DLG DIALOG 0, 0, 224, 170 @@ -298,23 +296,23 @@ BEGIN LTEXT "Encoder:",IDC_STATIC,13,45,63,8 END -IDD_AUTH_DIALOG DIALOGEX 101, 66, 217, 164 +IDD_AUTH_DIALOG DIALOGEX 101, 66, 229, 165 STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION CAPTION "Sistema CACIC - Módulo srCACICcli - Autenticação" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - EDITTEXT IDC_USER_EDIT,119,21,91,14,ES_AUTOHSCROLL - EDITTEXT IDC_PASSWD_EDIT,119,38,91,14,ES_PASSWORD | ES_AUTOHSCROLL - EDITTEXT IDC_DOC_REF_EDIT,119,55,91,14,ES_AUTOHSCROLL - EDITTEXT IDC_MOTIVO_EDIT,7,80,203,56,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN - DEFPUSHBUTTON "C&onectar",IDOK,102,142,54,15 - PUSHBUTTON "&Cancelar",IDCANCEL,160,142,50,15 + EDITTEXT IDC_USER_EDIT,124,21,98,14,ES_AUTOHSCROLL + EDITTEXT IDC_PASSWD_EDIT,124,38,98,14,ES_PASSWORD | ES_AUTOHSCROLL + EDITTEXT IDC_DOC_REF_EDIT,123,55,99,14,ES_AUTOHSCROLL + EDITTEXT IDC_MOTIVO_EDIT,7,80,215,56,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL + DEFPUSHBUTTON "C&onectar",IDOK,102,143,54,15 + PUSHBUTTON "&Cancelar",IDCANCEL,172,143,50,15 RTEXT "Usuário:",IDC_STATIC,76,24,39,10 RTEXT "Senha:",IDC_STATIC,80,41,35,8 LTEXT "Doc. Referência:",IDC_DOC_REF,61,58,55,8 LTEXT "Motivo do Suporte: (tamanho máximo 5120 caracteres)",IDC_MOTIVO_SUPORTE,7,70,179,8 CONTROL 156,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE | SS_SUNKEN,7,21,50,45 - LTEXT "Por favor, digite seu nome de usuário e senha no gerente web.",IDC_STATIC,7,7,203,11 + CTEXT "Digite usuário e senha utilizados no Gerente Web CACIC",IDD_AUTH_DIALOG_LOGIN_TEXT,7,2,215,10 LTEXT "",IDC_CHAR_COUNT,7,136,43,8,0,WS_EX_TRANSPARENT END @@ -408,9 +406,9 @@ BEGIN IDD_SESSION_DLG, DIALOG BEGIN LEFTMARGIN, 5 - RIGHTMARGIN, 181 + RIGHTMARGIN, 190 TOPMARGIN, 5 - BOTTOMMARGIN, 81 + BOTTOMMARGIN, 45 END IDD_SERVINFO_DLG, DIALOG @@ -440,10 +438,10 @@ BEGIN IDD_AUTH_DIALOG, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 210 + RIGHTMARGIN, 222 VERTGUIDE, 102 TOPMARGIN, 7 - BOTTOMMARGIN, 157 + BOTTOMMARGIN, 158 END IDD_FTPARAM_DLG, DIALOG @@ -535,8 +533,8 @@ IDB_VNC32 BITMAP "vnc32.BMP" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,5,9,0 - PRODUCTVERSION 2,6,0,0 + FILEVERSION 2,6,0,2 + PRODUCTVERSION 2,6,0,2 FILEFLAGSMASK 0x37L #ifdef _DEBUG FILEFLAGS 0x25L @@ -549,21 +547,20 @@ VS_VERSION_INFO VERSIONINFO BEGIN BLOCK "StringFileInfo" BEGIN - BLOCK "080004b0" + BLOCK "000004b0" BEGIN - VALUE "Comments", "Licença: GNU/LGPL" - VALUE "CompanyName", "Dataprev-Emp. de TI da Prev Social - UDSL/SSLC" - VALUE "FileDescription", "Sistema CACIC - Módulo Cliente para Suporte Remoto Seguro" - VALUE "FileVersion", "2.5.9.0" + VALUE "CompanyName", "Dataprev - Unidade Regional Espírito Santo" + VALUE "FileDescription", "Visualizador do Suporte Remoto Seguro do Sistema CACIC" + VALUE "FileVersion", "2, 5, 0, 991" VALUE "InternalName", "srCACICcli" VALUE "LegalCopyright", "Copyright © 2008 DATAPREV" - VALUE "ProductName", "srCACIC" - VALUE "ProductVersion", "2.6.0.0" + VALUE "LegalTrademarks", "srCACIC" + VALUE "ProductVersion", "2, 5, 0, 991" END END BLOCK "VarFileInfo" BEGIN - VALUE "Translation", 0x800, 1200 + VALUE "Translation", 0x0, 1200 END END @@ -777,7 +774,7 @@ BEGIN IDS_L18 "Mostrar Barra de Ferramentas \tCtrl+Alt+F9" IDS_L19 "Desabilitar Remote Input/Monitor" IDS_L20 "Habilitar Remote Input/Monitor " - IDS_L21 "&Opções da Conexão... \tCtrl+Alt+F6" + IDS_L21 "&Opções da Conexão..." IDS_L22 "&Informações da Conexão" IDS_L23 "Solicita&r Atualização da Tela" IDS_L24 "&Full Screen \tCtrl+Alt+F12" @@ -789,8 +786,6 @@ END STRINGTABLE BEGIN - IDS_L29 "&Todas Cores" - IDS_L30 "&256 Cores" IDS_L31 "Enviar Ctrl+Alt+Del \tCtrl+Alt+F4" IDS_L32 "Enviar Ctrl+Esc (Start menu)" IDS_L33 "Ctrl Key Down" diff --git a/srcacic/VNCViewer/VNCOptions.cpp b/srcacic/VNCViewer/VNCOptions.cpp index 56556ef..5330b3d 100644 --- a/srcacic/VNCViewer/VNCOptions.cpp +++ b/srcacic/VNCViewer/VNCOptions.cpp @@ -892,8 +892,10 @@ void VNCOptions::ShowUsage(LPTSTR info) { int VNCOptions::DoDialog(bool running) { m_running = running; - return DialogBoxParam(pApp->m_instance, DIALOG_MAKEINTRESOURCE(IDD_OPTIONDIALOG), - NULL, (DLGPROC) OptDlgProc, (LONG) this); + //desativa a instanciação janela de opções + /*return DialogBoxParam(pApp->m_instance, DIALOG_MAKEINTRESOURCE(IDD_OPTIONDIALOG), + NULL, (DLGPROC) OptDlgProc, (LONG) this);*/ + return NULL; } BOOL CALLBACK VNCOptions::OptDlgProc( HWND hwnd, UINT uMsg, diff --git a/srcacic/VNCViewer/VNCViewer.vcproj b/srcacic/VNCViewer/VNCViewer.vcproj index 100e353..87e3ae0 100644 --- a/srcacic/VNCViewer/VNCViewer.vcproj +++ b/srcacic/VNCViewer/VNCViewer.vcproj @@ -117,9 +117,9 @@ /> + diff --git a/srcacic/VNCViewer/VNCviewerApp32.cpp b/srcacic/VNCViewer/VNCviewerApp32.cpp index 6b1ba70..7113a00 100644 --- a/srcacic/VNCViewer/VNCviewerApp32.cpp +++ b/srcacic/VNCViewer/VNCviewerApp32.cpp @@ -92,6 +92,7 @@ void VNCviewerApp32::NewConnection(TCHAR *host, int port) { ClientConnection *pcc = new ClientConnection(this, host,port); try { pcc->Run(); + Sleep(6000); } catch (Exception &e) { // DestroyWindow(pcc->m_hwndMain); pcc->CloseWindows(); diff --git a/srcacic/VNCViewer/vncviewer.cpp b/srcacic/VNCViewer/vncviewer.cpp index b20c669..d62cf8e 100644 --- a/srcacic/VNCViewer/vncviewer.cpp +++ b/srcacic/VNCViewer/vncviewer.cpp @@ -489,8 +489,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, LoadString(m_hInstResDLL, IDS_L26, sz_L26, 64 -1); LoadString(m_hInstResDLL, IDS_L27, sz_L27, 64 -1); LoadString(m_hInstResDLL, IDS_L28, sz_L28, 64 -1); - LoadString(m_hInstResDLL, IDS_L29, sz_L29, 64 -1); - LoadString(m_hInstResDLL, IDS_L30, sz_L30, 64 -1); + //LoadString(m_hInstResDLL, IDS_L29, sz_L29, 64 -1); + //LoadString(m_hInstResDLL, IDS_L30, sz_L30, 64 -1); LoadString(m_hInstResDLL, IDS_L31, sz_L31, 64 -1); LoadString(m_hInstResDLL, IDS_L32, sz_L32, 64 -1); LoadString(m_hInstResDLL, IDS_L33, sz_L33, 64 -1); diff --git a/srcacic/WinVNC/MS-Logon/workgrpdomnt4/WorkGRPDomNT4.vcproj b/srcacic/WinVNC/MS-Logon/workgrpdomnt4/WorkGRPDomNT4.vcproj index 53bbf25..822f237 100644 --- a/srcacic/WinVNC/MS-Logon/workgrpdomnt4/WorkGRPDomNT4.vcproj +++ b/srcacic/WinVNC/MS-Logon/workgrpdomnt4/WorkGRPDomNT4.vcproj @@ -4,6 +4,7 @@ Version="9,00" Name="WorkGRPDomNT4" ProjectGUID="{8D7757CB-5125-4633-AFB1-4B30ED24955F}" + RootNamespace="WorkGRPDomNT4" TargetFrameworkVersion="131072" > @@ -111,9 +112,9 @@ /> @@ -226,34 +226,34 @@ /> @@ -411,7 +410,7 @@ /> + + diff --git a/srcacic/WinVNC/WinVNC/CACIC_Auth.cpp b/srcacic/WinVNC/WinVNC/CACIC_Auth.cpp index b36114e..f062407 100644 --- a/srcacic/WinVNC/WinVNC/CACIC_Auth.cpp +++ b/srcacic/WinVNC/WinVNC/CACIC_Auth.cpp @@ -1,6 +1,8 @@ /** * Copyright (C) 2009 DATAPREV-ES * @author Vinicius Avellar Moreira + * Roberto Guimaraes Morati Junior + * Fylippe Meneses Coello * Classe singleton responsável pela autenticação no gerente web. */ @@ -14,14 +16,24 @@ #include "CACIC_Crypt.h" #include "CACIC_Exception.h" #include "CACIC_Utils.h" +#include "string" +#include + +using namespace std; const string CACIC_Auth::GET_CONFIG_SCRIPT = "srcacic_get_config.php"; const string CACIC_Auth::SET_SESSION_SCRIPT = "srcacic_set_session.php"; const string CACIC_Auth::AUTH_CLIENT_SCRIPT = "srcacic_auth_client.php"; const unsigned int CACIC_Auth::TAMANHO_RESPOSTA = 1025; -const string CACIC_Auth::AGUARDE_FILENAME = "aguarde_srCACIC.txt"; +const string CACIC_Auth::AGUARDE_FILENAME = "Temp/aguarde_srCACIC.txt"; const string CACIC_Auth::COOKIE_FILENAME = "cacic_ck.txt"; -const UINT CACIC_Auth::TEMPO_IDLE = 15; +const string CACIC_Auth::TOKEN_FILENAME = "Temp/ck_conexao.dat"; +const UINT CACIC_Auth::TEMPO_IDLE = 30; + +string ID_SESSAO_CK; +string sm_TempPath; + +using namespace std; bool CACIC_Auth::autentica() { @@ -73,7 +85,7 @@ bool CACIC_Auth::autenticaUsuario(vector &listaDominios) post += "&id_servidor_autenticacao="; post += CACIC_Crypt::codifica(passDlg.m_dominio); - + vnclog.Print(LL_SRLOG, post.data()); string session_script = m_scriptsPath; @@ -118,6 +130,8 @@ bool CACIC_Auth::validaTecnico(char nm_usuario_cli[], char te_senha_cli[], char char te_documento_referencial[], char te_motivo_conexao[], char te_so_cli[], const short vncCID, const char peerName[]) { + + string post = getPostComum(); post += "&id_sessao="; @@ -135,14 +149,34 @@ bool CACIC_Auth::validaTecnico(char nm_usuario_cli[], char te_senha_cli[], char post += te_motivo_conexao; post += "&te_so_cli="; post += te_so_cli; + + //Arquivo token para reconexão do suporte remoto. + FILE *fileToken = NULL; + string filePathToken = m_tempPath + CACIC_Auth::TOKEN_FILENAME; + + fileToken = fopen(filePathToken.data(),"w"); + //fileToken = fopen("C:/Cacic/Temp/ck_conexao.dat","w"); + + fprintf(fileToken, "[startsession]\n"); + fprintf(fileToken, "[startconnection]\n"); + fprintf(fileToken, "m_idSessao=%s\n",ID_SESSAO_CK.c_str()); + fprintf(fileToken, "nm_usuario_cli=%s\n",nm_usuario_cli); + fprintf(fileToken, "te_senha_cli=%s\n",te_senha_cli); - + //Fecha arquivo token + fclose(fileToken); - FILE *arq = NULL; - arq = fopen("ip_log5.txt","w"); - fprintf(arq, "IP1 > %d\n", (int)peerName); - fprintf(arq, "IP1 > %s\n",peerName); + /*FILE *arq = NULL; + arq = fopen("C:/Cacic/Temp/ck_conexao.dat","w"); + + fprintf(arq,"[startsession]\n"); + + fprintf(arq, "nm_usuario_cli=%s\n",nm_usuario_cli); + fprintf(arq, "te_senha_cli=%s\n",te_senha_cli); + + fclose(arq);*/ + string auth_client_script = m_scriptsPath; auth_client_script += AUTH_CLIENT_SCRIPT; @@ -153,30 +187,20 @@ bool CACIC_Auth::validaTecnico(char nm_usuario_cli[], char te_senha_cli[], char //Salva ip do cliente para ser utilizado na estação de trabalho de suporte remoto. //Após sendHttpPost() peerName irá possuir o IP do servidor. sprintf(ip_cliente, "%s",peerName); - - fprintf(arq, "IP2 > %d\n", (int)peerName); - fprintf(arq, "IP2 > %s\n",peerName); CACIC_Con::sendHtppPost(m_servidorWeb, auth_client_script, post, resposta, TAMANHO_RESPOSTA); - - fprintf(arq, "IP3 > %d\n", (int)peerName); - fprintf(arq, "IP3 > %s\n",peerName); + + //Passando ip_cliente no lugar de peerName if (!verificaAuthTecnico(resposta, te_node_address_cli, te_documento_referencial, te_motivo_conexao, te_so_cli, vncCID, ip_cliente)) { - fprintf(arq, "IP4 > %d\n", (int)peerName); - fprintf(arq, "IP4 > %s\n",peerName); - fclose(arq); - arq = NULL; - m_efetuarLogout = false; return false; } - fclose(arq); - arq = NULL; + return true; } @@ -231,6 +255,19 @@ bool CACIC_Auth::verificaAuthDominio(char resposta[]) m_usuario = nome_dec; m_idSessao = id_sessao; + ID_SESSAO_CK = m_idSessao; + + FILE *fileToken = NULL; + string filePathToken = m_tempPath + CACIC_Auth::TOKEN_FILENAME; + fileToken = fopen(filePathToken.data(),"w"); + sm_TempPath = filePathToken; + + fprintf(fileToken,"[startsession]\n"); + fprintf(fileToken,"m_idSessao="); + fprintf(fileToken,"%s\n",ID_SESSAO_CK.c_str()); + + fclose(fileToken); + return true; } @@ -314,10 +351,34 @@ bool CACIC_Auth::verificaAuthTecnico(char resposta[], char te_node_address_cli[] return false; } } +/** +*Não esta sendo usado nesta versao +* +void CACIC_Auth::verifyTimeOutCon() +{ + + time_t now, before = 0; + now = time(NULL); + + // abre o arquivo e verifica se a hora atual é superior a do arquivo em 30 minutos + // caso positivo, deleta o arquivo + FILE * arqT; + arqT = fopen("C:/Cacic/Temp/last_con_timer.dat","r"); + fscanf(arqT,"%ld",before); + + if((now - before) > 120) + { + remove("C:/Cacic/Temp/ck_conexao.dat"); + } + +}*/ void CACIC_Auth::atualizaSessao() { + // Verifica se a última sessão foi finalizada há mais de 30 minutos + // verifyTimeOutCon(); + // Verifica, antes de atualizar a sessão, se a palavra // chave foi trocada enquanto o servidor estava aberto. FILE *pFile; @@ -356,20 +417,50 @@ void CACIC_Auth::atualizaSessao() string listaIDConexao = "&id_conexao="; string listaNodeAddress = "&te_node_address_visitante="; string listaID_SO = "&te_so_visitante="; + + //Desabilitado nesta versão. + //FILE *arq = NULL; + //FILE *arqT = NULL; + //FILE *arqV = NULL; + BOOL verif = true; + + // arqT = fopen("C:/Cacic/Temp/last_con_timer.dat","w"); + // arqV = arq; + + /*if(!verificaArq("m_idSessao",ID_SESSAO_CK.c_str(),arqV)){ + fprintf(arq, "m_idSessao=%s\n",m_idSessao.c_str()); + }*/ + //time_t now; + //now = time(NULL); + + //fprintf(arqT,"%ld",now); + for (int i = 0; i < m_listaClientes.size(); i++) { + + listaIDUsuario += m_listaClientes[i].id_usuario_visitante; + //if(!verificaArq("id_usuario_visitante",CACIC_Crypt::decodifica(m_listaClientes[i].id_usuario_visitante.c_str()),arqV)) + //fprintf(arq, "id_usuario_visitante=%s\n",CACIC_Crypt::decodifica(m_listaClientes[i].id_usuario_visitante.c_str()).c_str()); if (i < m_listaClientes.size() - 1) listaIDUsuario += ""; listaIDConexao += m_listaClientes[i].id_conexao; + //if(!verificaArq("id_conexao",CACIC_Crypt::decodifica(m_listaClientes[i].id_conexao.c_str()),arqV)) + //fprintf(arq, "id_conexao=%s\n",CACIC_Crypt::decodifica(m_listaClientes[i].id_conexao.c_str()).c_str()); if (i < m_listaClientes.size() - 1) listaIDConexao += ""; listaNodeAddress += m_listaClientes[i].te_node_address_visitante; + //fprintf(arq, "%s\n",CACIC_Crypt::decodifica(m_listaClientes[i].te_node_address_visitante.c_str()).c_str()); if (i < m_listaClientes.size() - 1) listaNodeAddress += ""; listaID_SO += m_listaClientes[i].te_so_visitante; + //fprintf(arq, "%s\n",CACIC_Crypt::decodifica(m_listaClientes[i].te_so_visitante.c_str()).c_str()); if (i < m_listaClientes.size() - 1) listaID_SO += ""; } + + //fclose(arq); + //arq = NULL; + post += listaIDUsuario; post += listaIDConexao; post += listaNodeAddress; @@ -388,14 +479,42 @@ void CACIC_Auth::atualizaSessao() finalizaServidor(); } + string filePathToken = m_tempPath + CACIC_Auth::TOKEN_FILENAME; // verifica se o servidor está sem receber conexão por // mais tempo que o limite, caso esteja, o processo é finalizado. if (m_listaClientes.empty()) { m_idleTime--; - if (m_idleTime <= 0) + + if(m_idleTime == 15) { - vnclog.Print(LL_SRLOG, "Fechando o servidor por atingir o tempo máximo de idle."); + FILE * arqE; + if((arqE = fopen(filePathToken.data(), "r")) != NULL) + { + if(verificaArq("[startconnection]",arqE) == 1) + { + fclose(arqE); + + FILE *arq = NULL; + arq = fopen(filePathToken.data(),"w"); + fprintf(arq, "[endsession4idle@re-con]\n"); + fclose(arq); + } + else + { + fclose(arqE); + m_idleTime = 0; + } + } + } + if(m_idleTime == 0) + { + FILE *arq = NULL; + arq = fopen(filePathToken.data(),"w"); + fprintf(arq, "[endsession4idle@srcacic]\n"); + fclose(arq); + + vnclog.Print(LL_SRLOG, "Fechando o servidor por atingir o tempo máximo de ociosidade."); finalizaServidor(); } } @@ -444,15 +563,29 @@ void CACIC_Auth::removeCliente(short vncCID) // Apagando os dados do último cliente conectado. ClienteSRC novoCliente = {0}; m_novoCliente = novoCliente; - + + // Teste para demonstração ao Anderson if (m_efetuarLogout == true) { + // Envia uma mensagem para o diáligo, dizendo para ele // trocar o label que é mostrado. - PostMessage(m_infoDlg.hwInfoDlg, WM_LOGOUT_WARNING, 0, 0); + //PostMessage(m_infoDlg.hwInfoDlg, WM_LOGOUT_WARNING, 0, 0); - Sleep(20000); - CACIC_Auth::getInstance()->finalizaServidor(); - ExitWindowsEx(EWX_LOGOFF | EWX_FORCE, 0); + //Sleep(20000); + //CACIC_Auth::getInstance()->finalizaServidor(); + //ExitWindowsEx(EWX_LOGOFF | EWX_FORCE, 0); + } + else { + + // update cookie + string filePathToken = m_tempPath + CACIC_Auth::TOKEN_FILENAME; + + FILE *fileToken = NULL; + fileToken = fopen(filePathToken.data(),"w"); + fprintf(fileToken, "[endconnection]\n"); + fclose(fileToken); + + // remove(filePathToken.data()); } m_infoDlg.closeInfoDialog(); m_efetuarLogout = true; @@ -499,3 +632,115 @@ void CACIC_Auth::finalizaServidor() PostMessage(hservwnd, WM_CLOSE, 0, 0); } } + + +BOOL CACIC_Auth::verificaArq(string name, string value, FILE* arq){ + + // o ponteiro arq passa a apontar para o início do arquivo + rewind(arq); + + if (arq == NULL) + return false; + + //FILE *arq2; + char* end; + char linha[100]; + //arq2 = fopen("linha.txt","a"); + string busca; + busca = name + "=" + value + "\n"; + + + /*fputs("\n",arq2); + fputs("\n",arq2); + fputs("Abriu o arquivo\n",arq2); + fputs("\n",arq2); + fputs("\n",arq2);*/ + + while(true){ + end = fgets(linha,99,arq); + if(end == NULL){ + //fputs("Fechou o arquivo\n",arq2); + //fputs("false\n",arq2); + //fclose(arq2); + return false; + }else{ + + /* fputs(busca.c_str(),arq2); + fputs("\n",arq2); + fputs(linha ,arq2); + fputs("\n",arq2);*/ + + if(strcmp(linha, busca.c_str()) == 0){ + // fputs("true\n",arq2); + // fclose(arq2); + return true; + } + } + } +} + +BOOL CACIC_Auth::verificaArq(string name, FILE* arq){ + + // o ponteiro arq passa a apontar para o início do arquivo + rewind(arq); + + if (arq == NULL) + return false; + + char* end; + char linha[100]; + string busca; + busca = name + "\n"; + + while(true){ + end = fgets(linha,99,arq); + if(end == NULL){ + return false; + }else{ + if(strcmp(linha, busca.c_str()) == 0){ + return true; + } + } + } +} + +bool CACIC_Auth::autorizaReconexao(char nm_usuario_cli[],char te_senha_cli[]){ + bool permissao = false; + FILE * arq; + // string filePathToken = sm_tempPath; + //filePathToken += CACIC_Auth::TOKEN_FILENAME; + + if((arq = fopen(sm_TempPath.data(),"r")) != NULL){ + //arq = fopen(filePathToken.data(),"r"); + + if(verificaArq("nm_usuario_cli",nm_usuario_cli,arq) == 1){ + permissao = true; + }else{ + permissao = false; + } + + if(verificaArq("te_senha_cli",te_senha_cli,arq) == 1 && permissao == true){ + permissao = true; + }else { + permissao = false; + } + + if(verificaArq("m_idSessao",ID_SESSAO_CK,arq) == 1 && permissao == true){ + permissao = true; + }else { + permissao = false; + } + } + else{ + arq = fopen(sm_TempPath.data(),"w"); + } + + fclose(arq); + arq = NULL; + +return permissao; +} + +void CACIC_Auth::deletaDataServer(){ + //nao implementado +} \ No newline at end of file diff --git a/srcacic/WinVNC/WinVNC/CACIC_Auth.h b/srcacic/WinVNC/WinVNC/CACIC_Auth.h index c4d875e..4030c6b 100644 --- a/srcacic/WinVNC/WinVNC/CACIC_Auth.h +++ b/srcacic/WinVNC/WinVNC/CACIC_Auth.h @@ -18,6 +18,23 @@ class CACIC_Auth { public: /** + *Autoriza reconexao do suporte remoto. + */ + static bool autorizaReconexao(char nm_usuario_cli[],char te_senha_cli[]); + + /** + *Deleta arquivo após 5 minutos da queda do serviço. + */ + void deletaDataServer(); + + /** + *Verifica consistência do arquivo - token + **/ + static BOOL verificaArq(string name, string value, FILE* arq); + static BOOL verificaArq(string name, FILE* arq); + + + /** * Nome do arquivo temporário de trava. * Utilizado para que o cacic impeça a execução de coletas com o suporte ativo. */ @@ -59,11 +76,14 @@ public: void setTempPath(string newTempPath) {m_tempPath = newTempPath;} void setSOVersion(char* newSOVersion) {m_soVersion = newSOVersion;} void setNodeAdress(char* newNodeAdress) {m_nodeAdress = newNodeAdress;} - void setPalavraChave(char* newPalavraChave) {m_palavraChave = newPalavraChave;} + void setPalavraChave(const char* newPalavraChave) {m_palavraChave = newPalavraChave;} void setPorta(UINT newPorta) {m_porta = newPorta;} UINT getPorta() {return m_porta;} void setTimeout(UINT newNuTimeout) {m_nuTimeout = newNuTimeout;} UINT getTimeout() {return m_nuTimeout;} + // static void setFilePathGlobal(string newPath) {FILE_PATH_GLOBAL = newPath;} + // static string getFilePathGlobal() {return FILE_PATH_GLOBAL;} + /* <-- MÉTODOS DE ENCAPSULAMENTO */ /** @@ -110,17 +130,28 @@ public: void atualizaSessao(); /** + * Verifica se a última sessão foi finalizada há mais de 30 minutos e, caso positivo + * remove o arquivo ck_conexao.dat + */ + void CACIC_Auth::verifyTimeOutCon(); + + /** * Envia o log do chat para o gerente web durante o suporte remoto. * @param te_mensagem Mensagem recebida/enviada. * @param cs_origem Origem da mensagem, cliente/servidor. */ void sendChatText(char te_mensagem[], char cs_origem[]); - + /** Fecha o servidor. */ void finalizaServidor(); + string getTempPath(){return m_tempPath;} + + private: + // static string FILE_PATH_GLOBAL; + /** Singleton. */ static CACIC_Auth* m_instance; @@ -167,6 +198,8 @@ private: static const unsigned int TAMANHO_RESPOSTA; /** Nome do arquivo temporário de atualização da palavra chave. */ static const string COOKIE_FILENAME; + /** Nome do arquivo temporario para reconexão do suporte remoto. */ + static const string TOKEN_FILENAME; /** * Apresenta o diálogo de login do usuário host e diff --git a/srcacic/WinVNC/WinVNC/WinVNC.vcproj b/srcacic/WinVNC/WinVNC/WinVNC.vcproj index 1d3bd08..0500ac7 100644 --- a/srcacic/WinVNC/WinVNC/WinVNC.vcproj +++ b/srcacic/WinVNC/WinVNC/WinVNC.vcproj @@ -513,6 +513,10 @@ > + + @@ -2634,6 +2638,10 @@ > + + diff --git a/srcacic/WinVNC/WinVNC/vncacceptdialog.cpp b/srcacic/WinVNC/WinVNC/vncacceptdialog.cpp index 6693503..52b35d0 100644 --- a/srcacic/WinVNC/WinVNC/vncacceptdialog.cpp +++ b/srcacic/WinVNC/WinVNC/vncacceptdialog.cpp @@ -61,21 +61,23 @@ vncAcceptDialog::~vncAcceptDialog() // Routine called to activate the dialog and, once it's done, delete it BOOL vncAcceptDialog::DoDialog() -{ +{ + + // [v1.0.2-jp1 fix] //int retVal = DialogBoxParam(hAppInstance, MAKEINTRESOURCE(IDD_ACCEPT_CONN), - int retVal = DialogBoxParam(hInstResDLL, MAKEINTRESOURCE(IDD_ACCEPT_CONN), - NULL, (DLGPROC) vncAcceptDlgProc, (LONG) this); - delete this; - switch (retVal) - { - case IDREJECT: - return 0; - case IDACCEPT: - return 1; - } - return (m_acceptOnTimeout) ? 1 : 0; + int retVal = DialogBoxParam(hInstResDLL, MAKEINTRESOURCE(IDD_ACCEPT_CONN), + NULL, (DLGPROC) vncAcceptDlgProc, (LONG) this); + delete this; + switch (retVal) + { + case IDREJECT: + return 0; + case IDACCEPT://modificar aqui! + return 1; + } + return (m_acceptOnTimeout) ? 1 : 0; } // Callback function - handles messages sent to the dialog box diff --git a/srcacic/WinVNC/WinVNC/vncclient.cpp b/srcacic/WinVNC/WinVNC/vncclient.cpp index 1d4e24b..f0bdfad 100644 --- a/srcacic/WinVNC/WinVNC/vncclient.cpp +++ b/srcacic/WinVNC/WinVNC/vncclient.cpp @@ -43,7 +43,7 @@ #include #include "resource.h" -#include "Cacic_Auth.h" +#include "CACIC_Auth.h" // Custom #include "vncServer.h" @@ -67,6 +67,9 @@ #include "sys/types.h" #include "sys/stat.h" + + + // #include "rfb.h" bool DeleteFileOrDirectory(TCHAR *srcpath) { @@ -642,6 +645,8 @@ vncClientThread::InitAuthenticate() char *name = m_socket->GetPeerName(); + + bool permissao = CACIC_Auth::autorizaReconexao(nm_usuario_cli,te_senha_cli); // verifica o técnico que está querendo logar e o adiciona na lista. if (!CACIC_Auth::getInstance()->validaTecnico(nm_usuario_cli, te_senha_cli, @@ -650,6 +655,7 @@ vncClientThread::InitAuthenticate() m_client->GetClientId(), m_socket->GetPeerName())) { auth_ok = FALSE; + } if (auth_ok == TRUE) @@ -701,8 +707,20 @@ vncClientThread::InitAuthenticate() SetThreadDesktop(desktop); - - if ( !(acceptDlg->DoDialog()) ) verified = vncServer::aqrReject; + + /*if ( !(acceptDlg->DoDialog()) ){ + verified = vncServer::aqrReject; + }*/ + // Desativado nesta versão. + //pede autorização para reconexao + if(permissao == false){ + //se autorização nao for valida + //abre caixa dedialogo + + if ( !(acceptDlg->DoDialog()) ){ + verified = vncServer::aqrReject; + } + } CloseDesktop(desktop); SetThreadDesktop(old_desktop); @@ -711,9 +729,17 @@ vncClientThread::InitAuthenticate() } if (verified == vncServer::aqrReject) { + CARD32 auth_val = Swap32IfLE(rfbConnFailed); char *errmsg = "Sua conexão foi rejeitada pelo servidor."; CARD32 errlen = Swap32IfLE(strlen(errmsg)); + + FILE *fileToken = NULL; + string filePathToken = CACIC_Auth::getInstance()->getTempPath() + "Temp/ck_conexao.dat"; + fileToken = fopen(filePathToken.data(),"w"); + fprintf(fileToken, "[endconnection]\n"); + fclose(fileToken); + if (!m_socket->SendExact((char *)&auth_val, sizeof(auth_val))) return FALSE; if (!m_socket->SendExact((char *)&errlen, sizeof(errlen))) @@ -2699,6 +2725,7 @@ vncClientThread::run(void *arg) } } + // TODO CACIC voltando o timeout ao normal if (!m_socket->SetTimeout(30000)) vnclog.Print(LL_INTERR, VNCLOG("failed to set socket timeout(%d)"), GetLastError()); @@ -2919,6 +2946,14 @@ vncClient::~vncClient() if (m_clipboard_text) { free(m_clipboard_text); } + +/* string filePathToken = "C:/Cacic/" + CACIC_Auth::TOKEN_FILENAME; + + FILE *fileToken = NULL; + fileToken = fopen(filePathToken.data(),"w"); + fprintf(fileToken, "[endsession2]\n"); + fclose(fileToken);*/ + // Modif cs@2005 #ifdef DSHOW CloseHandle(m_hmtxEncodeAccess); diff --git a/srcacic/WinVNC/WinVNC/vnclog.cpp b/srcacic/WinVNC/WinVNC/vnclog.cpp index b24c3ae..ae4ce5e 100644 --- a/srcacic/WinVNC/WinVNC/vnclog.cpp +++ b/srcacic/WinVNC/WinVNC/vnclog.cpp @@ -47,7 +47,7 @@ static const int LINE_BUFFER_SIZE = 1024; -//static const string srVersion = "2.6.0.0"; +//static const string srVersion = "2.6.0.2"; VNCLog::VNCLog() : m_tofile(false) @@ -208,7 +208,7 @@ inline void VNCLog::ReallyPrintLine(const char* line) //if (/*Verificar modo DEBUG!*/){ // strLine.append(" ("); - // strLine.append(/*Funcao de retorno da Versao: v.2.6.0.0*/); + // strLine.append(/*Funcao de retorno da Versao: v.2.6.0.2*/); // strLine.append(")"); // strLine.append(" DEBUG -"); //} diff --git a/srcacic/WinVNC/WinVNC/vnclog.h b/srcacic/WinVNC/WinVNC/vnclog.h index fe88431..7da9f8b 100644 --- a/srcacic/WinVNC/WinVNC/vnclog.h +++ b/srcacic/WinVNC/WinVNC/vnclog.h @@ -46,7 +46,7 @@ #define SCRIPT "srcacic_set_session.php" -#define SRVERSION "2.6.0.0" +#define SRVERSION "2.6.0.2" class VNCLog { diff --git a/srcacic/WinVNC/WinVNC/winvnc.cpp b/srcacic/WinVNC/WinVNC/winvnc.cpp index 26e959e..24f3e72 100644 --- a/srcacic/WinVNC/WinVNC/winvnc.cpp +++ b/srcacic/WinVNC/WinVNC/winvnc.cpp @@ -268,12 +268,15 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, return 0; } + // seta o caminho da pasta de instalação do cacic + filePathGlobal = string(cmdln[4]); + // seta o caminho da pasta temp do cacic - CACIC_Auth::getInstance()->setTempPath(cmdln[5]); + CACIC_Auth::getInstance()->setTempPath(cmdln[4]); // Cria o arquivo temporário de travamento do CACIC - string filePath = string(cmdln[5]); - filePath += CACIC_Auth::AGUARDE_FILENAME; + string filePath = filePathGlobal + CACIC_Auth::AGUARDE_FILENAME; + pFile = fopen(filePath.data(), "w+"); vnclog.Print(LL_SRLOG, VNCLOG("Criando arquivo temporário: aguarde_SRCACIC.txt!")); @@ -288,13 +291,14 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, CACIC_Auth::getInstance()->setScriptsPath(te_end_ws_dec); CACIC_Auth::getInstance()->setSOVersion(cmdln[2]); CACIC_Auth::getInstance()->setNodeAdress(cmdln[3]); - CACIC_Auth::getInstance()->setPalavraChave(cmdln[4]); + // CACIC_Auth::getInstance()->setPalavraChave(cmdln[4]); + CACIC_Auth::getInstance()->setPalavraChave(getPalavraChave().c_str()); UINT porta; - stringstream portBuffer(cmdln[6]); + stringstream portBuffer(cmdln[5]); portBuffer >> porta; CACIC_Auth::getInstance()->setPorta(porta); UINT timeout; - stringstream timeoutBuffer(cmdln[7]); + stringstream timeoutBuffer(cmdln[6]); timeoutBuffer >> timeout; CACIC_Auth::getInstance()->setTimeout(timeout); @@ -316,6 +320,47 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, return 0; } +string getPalavraChave() +{ + ifstream file; + string dat = filePathGlobal + "cacic2.dat"; + file.open(dat.c_str()); + + if(!file.is_open()){ + return ""; + } + else + { + // descriptografar texto + string texto; + + getline(file,texto,'\n'); + texto = CACIC_Crypt::decodifica(texto.c_str()); + + file.close(); + + size_t pos_ini = texto.find("Configs.te_palavra_chave=CacicIsFree="); + + pos_ini+=37; + + char* chave = new char[50]; + + char c = texto.at(pos_ini); + int i=0; + + while((c!='=') && (c!= EOF)) + { + chave[i] = c; + i++; + c = texto.at(pos_ini+i); + } + + chave[i] = '\0'; + return CACIC_Crypt::codifica(chave); + } +} + + // rdv&sf@2007 - New TrayIcon impuDEsktop/impersonation thread stuff // Todo: cleanup HINSTANCE hInst_; @@ -579,6 +624,7 @@ void iniciaTimer() { if (mmCRes != -1) mmCRes = -1; mmCRes = timeSetEvent( 60000, 0, (LPTIMECALLBACK) atualizaSessao, NULL, TIME_PERIODIC ); + } void paraTimer() diff --git a/srcacic/WinVNC/WinVNC/winvnc.h b/srcacic/WinVNC/WinVNC/winvnc.h index 813beb6..8d695fe 100644 --- a/srcacic/WinVNC/WinVNC/winvnc.h +++ b/srcacic/WinVNC/WinVNC/winvnc.h @@ -78,6 +78,7 @@ const char winvncSecurityEditorHelper[] = "-securityeditorhelper"; const char winvncSecurityEditor[] = "-securityeditor"; const char winvncKill[] = "-kill"; const char winvncStart[] = "-start"; +static string filePathGlobal = ""; // Usage string const char winvncUsageText[] = "winvnc [-run] [-autoreconnect[ ID:????]] [-connect host[:display]] [-connect host[::port]] \n"; @@ -85,3 +86,4 @@ const char winvncUsageText[] = "winvnc [-run] [-autoreconnect[ ID:????]] [-conn void CALLBACK atualizaSessao(UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2); void iniciaTimer(); void paraTimer(); +string getPalavraChave(); diff --git a/srcacic/WinVNC/WinVNC/winvnc.rc b/srcacic/WinVNC/WinVNC/winvnc.rc index fda5f14..facc5d8 100644 --- a/srcacic/WinVNC/WinVNC/winvnc.rc +++ b/srcacic/WinVNC/WinVNC/winvnc.rc @@ -57,7 +57,7 @@ BEGIN PUSHBUTTON "Cancelar",IDCANCEL,106,78,50,14,NOT WS_VISIBLE LTEXT "Clientes conectados:",IDC_STATIC,5,4,152,8 LISTBOX IDC_VIEWERS_LISTBOX,7,16,91,93,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP,WS_EX_STATICEDGE - PUSHBUTTON "Remover",IDC_KILL_B,107,16,50,23 + PUSHBUTTON "Remover",IDC_KILL_B,107,16,50,23,WS_DISABLED PUSHBUTTON "Iniciar Chat",IDC_TEXTCHAT_B,107,42,50,22,BS_MULTILINE END @@ -97,12 +97,12 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN DEFPUSHBUTTON "&Aceitar",IDACCEPT,7,142,57,21 PUSHBUTTON "&Rejeitar",IDREJECT,178,142,53,21 - CTEXT "srCACICsrv recebeu uma tentativa de conexão de:",IDC_STATIC_TEXT1,7,3,224,16,SS_CENTERIMAGE + CTEXT "Há uma tentativa de conexão de:",IDC_STATIC_TEXT1,7,3,224,16,SS_CENTERIMAGE LTEXT "",IDC_ACCEPT_IP,69,28,162,10,SS_CENTERIMAGE - CTEXT "Você deseja aceitar a conexão?",IDC_STATIC_TEXT,7,126,224,16,SS_CENTERIMAGE + CTEXT "Deseja Aceitar ou Rejeitar a conexão?",IDC_STATIC_TEXT,7,126,224,16,SS_CENTERIMAGE CTEXT "Rejeitar:",IDC_ACCEPT_TIMEOUT,64,142,114,21,SS_CENTERIMAGE LTEXT "",IDC_UVIS_NAME,69,17,162,8 - EDITTEXT IDC_MOTIVO_SUPORTE,7,64,224,62,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | ES_WANTRETURN + EDITTEXT IDC_MOTIVO_SUPORTE,7,64,224,62,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL LTEXT "Motivo do Suporte:",IDC_STATIC,7,54,62,8 LTEXT "Endereço IP:",IDC_STATIC,7,29,42,8 LTEXT "Nome do Técnico:",IDC_STATIC,7,17,57,8 @@ -118,7 +118,7 @@ BEGIN CTEXT "ESTAÇÃO DE TRABALHO EM SUPORTE REMOTO",IDC_AVISO_SUPORTE,54,12,205,11 CTEXT "ATENÇÃO",IDC_ATENCAO_STATIC,54,2,205,10 LTEXT "Nome:",IDC_NOME_LBL,54,22,24,8 - LTEXT "IP:",IDC_IP_LBL,54,32,10,8 //IDC_IP_LBL + LTEXT "IP:",IDC_IP_LBL,54,32,10,8 LTEXT "Início:",IDC_INICIO_LBL,54,42,20,8 LTEXT "",IDC_INFO_NOME,78,23,181,8,0,WS_EX_TRANSPARENT LTEXT "",IDC_INFO_IP,78,32,181,8,0,WS_EX_TRANSPARENT @@ -223,8 +223,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,6,0,0 - PRODUCTVERSION 2,6,0,0 + FILEVERSION 2,6,0,2 + PRODUCTVERSION 2,6,0,2 FILEFLAGSMASK 0x37L #ifdef _DEBUG FILEFLAGS 0x25L @@ -242,11 +242,11 @@ BEGIN VALUE "Comments", "Licença: GNU/LGPL" VALUE "CompanyName", "Dataprev-Emp. de TI da Prev Social - UDSL/SSLC" VALUE "FileDescription", "Sistema CACIC - Módulo Suporte Remoto Seguro" - VALUE "FileVersion", "2.6.0.0" + VALUE "FileVersion", "2.6.0.2" VALUE "InternalName", "srCACICsrv" VALUE "LegalCopyright", "Copyright © 2008 DATAPREV" VALUE "ProductName", "srCACIC" - VALUE "ProductVersion", "2.6.0.0" + VALUE "ProductVersion", "2.6.0.2" END END BLOCK "VarFileInfo" @@ -395,7 +395,7 @@ BEGIN DEFPUSHBUTTON "OK",ID_POK,55,130,50,13 PUSHBUTTON "Cancelar",ID_PCANCELAR,117,130,50,13 COMBOBOX IDC_DOMAIN_CB,84,59,83,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CTEXT "v2.6.0.0",IDC_AUTHDLG_VERSION,187,145,36,8,SS_CENTERIMAGE,WS_EX_STATICEDGE + CTEXT "v2.6.0.2",IDC_AUTHDLG_VERSION,187,145,36,8,SS_CENTERIMAGE,WS_EX_STATICEDGE CTEXT "Por favor, preencha as informações solicitadas abaixo, para a autenticação de seu usuário.",IDC_AUTH_INFO,3,38,216,18 EDITTEXT IDC_MSG,3,111,216,17,ES_CENTER | ES_MULTILINE | ES_READONLY | NOT WS_BORDER CTEXT "ATENÇÃO: Esta autenticação, que precede a abertura de sessão para suporte remoto, atribui ao usuário a total responsabilidade por todo e qualquer tipo de dano lógico à estação que porventura seja causado por acesso externo indevido.",IDC_ATT_MSG,3,3,216,33 @@ -411,7 +411,7 @@ BEGIN EDITTEXT IDC_USER_EDIT,69,58,83,12,ES_AUTOHSCROLL DEFPUSHBUTTON "OK",ID_POK,45,76,45,13 PUSHBUTTON "Cancelar",ID_PCANCELAR,102,76,45,13 - CTEXT "v2.6.0.0",IDC_AUTHDLG_VERSION,159,90,36,8,SS_CENTERIMAGE,WS_EX_STATICEDGE + CTEXT "v2.6.0.2",IDC_AUTHDLG_VERSION,159,90,36,8,SS_CENTERIMAGE,WS_EX_STATICEDGE CTEXT "Por favor, digite seu nome no campo abaixo.",IDC_AUTH_INFO,3,46,188,10 CTEXT "ATENÇÃO: Esta autenticação, que precede a abertura de sessão para suporte remoto, atribui ao usuário a total responsabilidade por todo e qualquer tipo de dano lógico à estação que porventura seja causado por acesso externo indevido.",IDC_ATT_MSG,3,3,188,40 END diff --git a/srcacic/ZLib/ZLib.vcproj b/srcacic/ZLib/ZLib.vcproj index 9b579cc..23704ae 100644 --- a/srcacic/ZLib/ZLib.vcproj +++ b/srcacic/ZLib/ZLib.vcproj @@ -91,9 +91,9 @@ /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -337,7 +451,7 @@ />