--- sourceforge.net/trunk/rdesktop/rdesktop.c 2003/05/19 21:36:33 376 +++ sourceforge.net/trunk/rdesktop/rdesktop.c 2003/07/09 09:18:20 435 @@ -55,6 +55,7 @@ BOOL sendmotion = True; BOOL orders = True; BOOL encryption = True; +BOOL packet_encryption = True; BOOL desktop_save = True; BOOL fullscreen = False; BOOL grab_keyboard = True; @@ -94,6 +95,7 @@ fprintf(stderr, " -f: full-screen mode\n"); fprintf(stderr, " -b: force bitmap updates\n"); fprintf(stderr, " -e: disable encryption (French TS)\n"); + fprintf(stderr, " -E: disable encryption of everything but the logon packet\n"); fprintf(stderr, " -m: do not send motion events\n"); fprintf(stderr, " -C: use private colour map\n"); fprintf(stderr, " -K: keep window manager key bindings\n"); @@ -149,7 +151,7 @@ char password[16]; char shell[128]; char directory[32]; - BOOL prompt_password; + BOOL prompt_password, rdp_retval = False; struct passwd *pw; uint32 flags; char *p; @@ -167,7 +169,7 @@ #define VNCOPT #endif - while ((c = getopt(argc, argv, VNCOPT "u:d:s:S:c:p:n:k:g:a:fbemCKT:Dh?54")) != -1) + while ((c = getopt(argc, argv, VNCOPT "u:d:s:S:c:p:n:k:g:a:fbeEmCKT:Dh?54")) != -1) { switch (c) { @@ -272,7 +274,9 @@ case 'e': encryption = False; break; - + case 'E': + packet_encryption = False; + break; case 'm': sendmotion = False; break; @@ -366,20 +370,30 @@ #ifdef RDP2VNC rdp2vnc_connect(server, flags, domain, password, shell, directory); + return 0; #else if (!ui_init()) return 1; + /* rdpsnd_init(); */ + /* rdpdr_init(); */ + if (!rdp_connect(server, flags, domain, password, shell, directory)) return 1; + /* By setting encryption to False here, we have an encrypted login + packet but unencrypted transfer of other packets */ + if (!packet_encryption) + encryption = False; + + DEBUG(("Connection successful.\n")); memset(password, 0, sizeof(password)); if (ui_create_window()) { - rdp_main_loop(); + rdp_retval = rdp_main_loop(); ui_destroy_window(); } @@ -387,9 +401,13 @@ rdp_disconnect(); ui_deinit(); + if (True == rdp_retval) + return 0; + else + return 2; + #endif - return 0; } #ifdef EGD_SOCKET @@ -588,7 +606,7 @@ if (home == NULL) return -1; - path = (char*)xmalloc(strlen(home) + strlen(hostname) + sizeof("/.rdesktop/licence.")); + path = (char *) xmalloc(strlen(home) + strlen(hostname) + sizeof("/.rdesktop/licence.")); sprintf(path, "%s/.rdesktop/licence.%s", home, hostname); fd = open(path, O_RDONLY); @@ -598,7 +616,7 @@ if (fstat(fd, &st)) return -1; - *data = (uint8*)xmalloc(st.st_size); + *data = (uint8 *) xmalloc(st.st_size); length = read(fd, *data, st.st_size); close(fd); xfree(path); @@ -615,7 +633,7 @@ if (home == NULL) return; - path = (char*)xmalloc(strlen(home) + strlen(hostname) + sizeof("/.rdesktop/licence.")); + path = (char *) xmalloc(strlen(home) + strlen(hostname) + sizeof("/.rdesktop/licence.")); sprintf(path, "%s/.rdesktop", home); if ((mkdir(path, 0700) == -1) && errno != EEXIST) @@ -627,11 +645,11 @@ /* write licence to licence.hostname.new, then atomically rename to licence.hostname */ sprintf(path, "%s/.rdesktop/licence.%s", home, hostname); - tmppath = (char*)xmalloc(strlen(path) + sizeof(".new")); + tmppath = (char *) xmalloc(strlen(path) + sizeof(".new")); strcpy(tmppath, path); strcat(tmppath, ".new"); - fd = open(tmppath, O_WRONLY|O_CREAT|O_TRUNC, 0600); + fd = open(tmppath, O_WRONLY | O_CREAT | O_TRUNC, 0600); if (fd == -1) { perror(tmppath);