/[rdesktop]/sourceforge.net/trunk/rdesktop/rdesktop.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/rdesktop.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 975 by astrand, Thu Aug 4 12:51:44 2005 UTC revision 980 by stargo, Mon Aug 15 12:06:59 2005 UTC
# Line 27  Line 27 
27  #include <sys/time.h>           /* gettimeofday */  #include <sys/time.h>           /* gettimeofday */
28  #include <sys/times.h>          /* times */  #include <sys/times.h>          /* times */
29  #include <ctype.h>              /* toupper */  #include <ctype.h>              /* toupper */
 #include <limits.h>             /* PATH_MAX */  
30  #include <errno.h>  #include <errno.h>
31  #include "rdesktop.h"  #include "rdesktop.h"
32    
# Line 92  BOOL g_ownbackstore = True;    /* We can't Line 91  BOOL g_ownbackstore = True;    /* We can't
91  uint32 g_embed_wnd;  uint32 g_embed_wnd;
92  uint32 g_rdp5_performanceflags =  uint32 g_rdp5_performanceflags =
93          RDP5_NO_WALLPAPER | RDP5_NO_FULLWINDOWDRAG | RDP5_NO_MENUANIMATIONS;          RDP5_NO_WALLPAPER | RDP5_NO_FULLWINDOWDRAG | RDP5_NO_MENUANIMATIONS;
94    /* Session Directory redirection */
95    BOOL g_redirect = False;
96    char g_redirect_server[64];
97    char g_redirect_domain[16];
98    char g_redirect_password[64];
99    char g_redirect_username[64];
100    char g_redirect_cookie[128];
101    uint32 g_redirect_flags = 0;
102    
103  #ifdef WITH_RDPSND  #ifdef WITH_RDPSND
104  BOOL g_rdpsnd = False;  BOOL g_rdpsnd = False;
# Line 275  print_disconnect_reason(uint16 reason) Line 282  print_disconnect_reason(uint16 reason)
282          fprintf(stderr, "disconnect: %s.\n", text);          fprintf(stderr, "disconnect: %s.\n", text);
283  }  }
284    
285    static void
286    rdesktop_reset_state(void)
287    {
288            rdp_reset_state();
289    }
290    
291  static BOOL  static BOOL
292  read_password(char *password, int size)  read_password(char *password, int size)
293  {  {
# Line 376  main(int argc, char *argv[]) Line 389  main(int argc, char *argv[])
389          int c;          int c;
390          char *locale = NULL;          char *locale = NULL;
391          int username_option = 0;          int username_option = 0;
392            int run_count = 0;      /* Session Directory support */
393            BOOL continue_connect = True;   /* Session Directory support */
394    
395  #ifdef HAVE_LOCALE_H  #ifdef HAVE_LOCALE_H
396          /* Set locale according to environment */          /* Set locale according to environment */
# Line 790  main(int argc, char *argv[]) Line 805  main(int argc, char *argv[])
805  #endif  #endif
806          rdpdr_init();          rdpdr_init();
807    
808          if (!rdp_connect(server, flags, domain, password, shell, directory))          while (run_count < 2 && continue_connect)       /* add support for Session Directory; only reconnect once */
809                  return 1;          {
810                    if (run_count == 0)
811                    {
812                            if (!rdp_connect(server, flags, domain, password, shell, directory))
813                                    return 1;
814                    }
815                    else if (!rdp_reconnect
816                             (server, flags, domain, password, shell, directory, g_redirect_cookie))
817                            return 1;
818    
819          /* By setting encryption to False here, we have an encrypted login                  /* By setting encryption to False here, we have an encrypted login
820             packet but unencrypted transfer of other packets */                     packet but unencrypted transfer of other packets */
821          if (!packet_encryption)                  if (!packet_encryption)
822                  g_encryption = False;                          g_encryption = False;
823    
824    
825          DEBUG(("Connection successful.\n"));                  DEBUG(("Connection successful.\n"));
826          memset(password, 0, sizeof(password));                  memset(password, 0, sizeof(password));
827    
828          if (ui_create_window())                  if (run_count == 0)
829          {                          if (!ui_create_window())
830                  rdp_main_loop(&deactivated, &ext_disc_reason);                                  continue_connect = False;
831                  ui_destroy_window();  
832                    if (continue_connect)
833                            rdp_main_loop(&deactivated, &ext_disc_reason);
834    
835                    DEBUG(("Disconnecting...\n"));
836                    rdp_disconnect();
837    
838                    if ((g_redirect == True) && (run_count == 0))   /* Support for Session Directory */
839                    {
840                            /* reset state of major globals */
841                            rdesktop_reset_state();
842    
843                            STRNCPY(domain, g_redirect_domain, sizeof(domain));
844                            STRNCPY(g_username, g_redirect_username, sizeof(g_username));
845                            STRNCPY(password, g_redirect_password, sizeof(password));
846                            STRNCPY(server, g_redirect_server, sizeof(server));
847                            flags |= RDP_LOGON_AUTO;
848    
849                            g_redirect = False;
850                    }
851                    else
852                    {
853                            continue_connect = False;
854                            ui_destroy_window();
855                            break;
856                    }
857    
858                    run_count++;
859          }          }
860    
         DEBUG(("Disconnecting...\n"));  
         rdp_disconnect();  
861          cache_save_state();          cache_save_state();
862          ui_deinit();          ui_deinit();
863    

Legend:
Removed from v.975  
changed lines
  Added in v.980

  ViewVC Help
Powered by ViewVC 1.1.26